Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_registerStoreInGutenberg() {
return registerStore( "yoast-seo/editor", {
reducer: combineReducers( reducers ),
selectors,
actions: pickBy( actions, x => typeof x === "function" ),
} );
}
* Internal dependencies
*/
import { ActionType, Vertical } from './types';
import * as Actions from './actions';
const verticals: Reducer< Vertical[], ReturnType< typeof Actions[ 'receiveVerticals' ] > > = (
state = [],
action
) => {
if ( action.type === ActionType.RECEIVE_VERTICALS ) {
return action.verticals;
}
return state;
};
const reducer = combineReducers( { verticals } );
export type State = ReturnType< typeof reducer >;
export default reducer;
entitiesDataReducer = combineReducers( Object.entries( entitiesByKind ).reduce( ( memo, [ kind, subEntities ] ) => {
const kindReducer = combineReducers( subEntities.reduce(
( kindMemo, entityConfig ) => ( {
...kindMemo,
[ entityConfig.name ]: entity( entityConfig ),
} ),
{}
) );
memo[ kind ] = kindReducer;
return memo;
}, {} ) );
}
/**
* WordPress dependencies
*/
import { combineReducers } from '@wordpress/data';
/**
* Internal dependencies
*/
import { UPDATE_JOB_LISTINGS, UPDATE_JOB_TYPES } from './action-types';
const jobListings = combineReducers( {
items: ( state = [], action ) => action.type === UPDATE_JOB_LISTINGS ? action.listings : state,
} );
const jobTypes = combineReducers( {
items: ( state = [], action ) => action.type === UPDATE_JOB_TYPES ? action.types : state,
} );
export default combineReducers( {
jobListings,
jobTypes,
} );
export function dismissedTips( state = {}, action ) {
switch ( action.type ) {
case 'DISMISS_TIP':
return {
...state,
[ action.id ]: true,
};
case 'ENABLE_TIPS':
return {};
}
return state;
}
const preferences = combineReducers( { areTipsEnabled, dismissedTips } );
export default combineReducers( { guides, preferences } );
import { stringifyDomainQueryObject } from './utils';
const domainSuggestions: Reducer<
Record< string, DomainSuggestion[] | undefined >,
ReturnType< typeof Actions[ 'receiveDomainSuggestions' ] >
> = ( state = {}, action ) => {
if ( action.type === ActionType.RECEIVE_DOMAIN_SUGGESTIONS ) {
return {
...state,
[ stringifyDomainQueryObject( action.queryObject ) ]: action.suggestions,
};
}
return state;
};
const reducer = combineReducers( { domainSuggestions } );
export type State = ReturnType< typeof reducer >;
export default reducer;
import * as Actions from './actions';
const templates: Reducer<
Record< string, Template[] | undefined >,
ReturnType< typeof Actions[ 'receiveTemplates' ] >
> = ( state = {}, action ) => {
if ( action.type === ActionType.RECEIVE_TEMPLATES ) {
return {
...state,
[ action.verticalId ]: action.templates,
};
}
return state;
};
const reducer = combineReducers( { templates } );
export type State = ReturnType< typeof reducer >;
export default reducer;
return action.verticals;
}
return state;
};
const siteVertical: Reducer<
FormValue< SiteVertical >,
ReturnType< typeof Actions[ 'setSiteVertical' ] >
> = ( state = EMPTY_FORM_VALUE, action ) => {
if ( action.type === ActionType.SET_SITE_VERTICAL ) {
return action.siteVertical;
}
return state;
};
const reducer = combineReducers( { siteType, siteTitle, verticals, siteVertical } );
export type State = ReturnType< typeof reducer >;
export default reducer;
export function dismissedTips( state = {}, action ) {
switch ( action.type ) {
case 'DISMISS_TIP':
return {
...state,
[ action.id ]: true,
};
case 'ENABLE_TIPS':
return {};
}
return state;
}
const preferences = combineReducers( { areTipsEnabled, dismissedTips } );
export default combineReducers( { guides, tipInstanceIds, preferences } );
*
* @return {Object} Updated state.
*/
export function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {
switch ( action.type ) {
case 'UPDATE_EDITOR_SETTINGS':
return {
...state,
...action.settings,
};
}
return state;
}
export default optimist( combineReducers( {
postId,
postType,
preferences,
saving,
postLock,
reusableBlocks,
template,
postSavingLock,
isReady,
editorSettings,
postAutosavingLock,
} ) );