Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function mapStateToProps(state, ownProps = {}) {
let props = {};
const context = {
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
};
if (ownProps.actionId) {
// deprecated
props = cmf.action.getActionInfo(context, ownProps.actionId);
}
const actionIds = ownProps.actionIds || props.actionIds;
if (actionIds) {
// deprecated
props.items = actionIds.map(itemId => cmf.action.getActionInfo(context, itemId));
}
return props;
}
export default function initialize(additionalConfiguration = {}) {
// FIXME remove before release
// for debug purpose
window.registry = api.registry.getRegistry();
// register all saga api
api.registry.addToRegistry(
'SEARCH_CATEGORIES_BY_PROVIDER',
constants.search.SEARCH_CATEGORIES_BY_PROVIDER,
);
api.registry.addToRegistry('preparations:sort', preparationService.sort);
const routerSagas = {
...dataset.datasetSagas.datasetRoutesSagas,
};
const additionalRouterSagas = additionalConfiguration.routerSagas;
if (additionalRouterSagas) {
Object.assign(routerSagas, additionalRouterSagas);
}
const rootSagas = [
fork(sagaRouter, browserHistory, routerSagas),
fork(api.sagas.component.handle),
fork(dataset.datasetSagas.datasetMainSaga),
fork(cmfSagas.changeDocumentTitle),
];
const rootSagasToStart = {
export default function initialize(additionalConfiguration = {}) {
// FIXME remove before release
// for debug purpose
window.registry = api.registry.getRegistry();
// register all saga api
api.registry.addToRegistry(
'SEARCH_CATEGORIES_BY_PROVIDER',
constants.search.SEARCH_CATEGORIES_BY_PROVIDER,
);
const routerSagas = {
...dataset.datasetSagas.datasetRoutesSagas,
};
const additionalRouterSagas = additionalConfiguration.routerSagas;
if (additionalRouterSagas) {
Object.assign(routerSagas, additionalRouterSagas);
}
const rootSagas = [
export function* search(payload) {
yield put(Typeahead.setStateAction({ searching: true }, 'headerbar:search'));
const categories = api.registry.getFromRegistry('SEARCH_CATEGORIES_BY_PROVIDER');
const providers = Object.keys(categories);
const service = new SearchService(categories);
const batches = providers.map(
provider => service.build(
provider,
payload,
)
);
const results = (
yield all(batches.map(request => call(...request)))
).map(
(result, index) => service.transform(providers[index], result)
);
yield put(Typeahead.setStateAction({ searching: false }, 'headerbar:search'));
yield put(actions.collections.addOrReplace(
},
});
}
function* sagaPhotoGet3() {
const answer = yield call(sagas.http.get, 'https://jsonplaceholder.typicode.com/photos/');
yield put(actions.collections.addOrReplace('photos3', answer.data));
}
function sortByLength(sortBy) {
return function sort(a, b) {
return a.get(sortBy).length - b.get(sortBy).length;
};
}
api.registry.addToRegistry('_list_sort:sortByLength', sortByLength);
api.sagas.register('saga:get:photos3', sagaPhotoGet3);
api.actionCreator.register('http:get:photos1', httpPhotosGet1);
api.actionCreator.register('http:get:photos2', httpPhotosGet2);
api.actionCreator.register('object:view', objectView);
api.actionCreator.register('cancel:hide:dialog', hideDialog);
api.actionCreator.register('confirm:dialog', confirmDialog);
api.actionCreator.register('item1:action', chooseItem1);
api.actionCreator.register('item2:action', chooseItem2);
api.actionCreator.register(
'subheaderbar:display-sharing',
actionsCreatorsSubHeader.sharingSubHeader,
);
api.actionCreator.register(
'subheaderbar:display-bubbles',
export function mapStateToProps(state, ownProps) {
if (ownProps.actionId) {
return cmf.action.getActionInfo(
{
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
},
ownProps.actionId,
);
}
return {};
}
export function mapStateToProps(state, ownProps) {
let props = {};
if (ownProps.actionId) {
props = cmf.action.getActionInfo(
{
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
},
ownProps.actionId,
);
}
return props;
}
export function mapStateToProps(state, ownProps) {
let props = {};
if (ownProps.actionId) {
props = cmf.action.getActionInfo(
{
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
},
ownProps.actionId,
);
}
return props;
}
function getAction(id, currentRoute, state) {
const action = { actionId: id };
const info = cmf.action.getActionInfo(
{
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
},
id,
);
action.label = info.label;
action.id = info.id;
const route = get(
info,
'payload.cmf.routerReplace',
get(info, 'payload.cmf.routerPush', get(info, 'href')),
);
if (route && isBasePathOf(route, currentRoute)) {
export function mapStateToProps(state, { actionId, actionIds } = {}) {
let props = {};
const context = {
registry: cmf.registry.getRegistry(),
store: {
getState: () => state,
},
};
if (actionId) {
props = cmf.action.getActionInfo(context, actionId);
}
if (actionIds) {
props.actionIds = actionIds;
}
if (props.actionIds) {
props.items = props.actionIds.map(itemId => cmf.action.getActionInfo(context, itemId));
}
return props;
}