2025-01-13 17:06:05 +01:00
|
|
|
import { createReduxStore, register } from '@wordpress/data';
|
|
|
|
|
|
|
|
import { STORE_NAME } from './constants';
|
|
|
|
import reducer from './reducer';
|
|
|
|
import * as selectors from './selectors';
|
|
|
|
import * as actions from './actions';
|
|
|
|
import * as hooks from './hooks';
|
2025-02-05 18:51:41 +01:00
|
|
|
import * as resolvers from './resolvers';
|
2025-01-13 17:06:05 +01:00
|
|
|
|
2025-01-21 13:32:03 +01:00
|
|
|
/**
|
|
|
|
* Initializes and registers the settings store with WordPress data layer.
|
|
|
|
* Combines custom controls with WordPress data controls.
|
|
|
|
*
|
|
|
|
* @return {boolean} True if initialization succeeded, false otherwise.
|
|
|
|
*/
|
2025-01-13 17:06:05 +01:00
|
|
|
export const initStore = () => {
|
|
|
|
const store = createReduxStore( STORE_NAME, {
|
|
|
|
reducer,
|
|
|
|
actions,
|
|
|
|
selectors,
|
|
|
|
resolvers,
|
|
|
|
} );
|
|
|
|
|
|
|
|
register( store );
|
2025-01-21 13:32:03 +01:00
|
|
|
|
|
|
|
return Boolean( wp.data.select( STORE_NAME ) );
|
2025-01-13 17:06:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export { hooks, selectors, STORE_NAME };
|