mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
.. | ||
action-types.js | ||
actions.js | ||
constants.js | ||
hooks.js | ||
index.js | ||
README.md | ||
reducer.js | ||
resolvers.js | ||
selectors.js |
Store template
This template contains all files for a Redux store.
New Store: Redux integration
- Copy this folder, give it a correct name.
- Check each file for
<UNKNOWN>
placeholders andTODO
remarks. - Edit the main store-index file and add the relevant store integration there.
- Check the debug-module, and add relevant debug code.
- Register the store in the
reset()
method.
- Register the store in the
Main store-index:
modules/ppcp-settings/resources/js/data/index.js
Sample store integration:
import * as YourStore from './yourStore';
// ...
YourStore.initStore();
// ...
export const YourStoreHooks = YourStore.hooks;
// ...
export const YourStoreName = YourStore.STORE_NAME;
// ...
addDebugTools( window.ppcpSettings, [ ..., YourStoreName ] );
New Store: PHP integration
- Create the REST endpoint for hydrating and persisting data.
modules/ppcp-settings/src/Endpoint/YourStoreRestEndpoint.php
- Extend from base class
RestEndpoint
- Create the data model class to manage the DB interaction.
modules/ppcp-settings/src/Data/YourStoreSettings.php
- Extend from base class
AbstractDataModel
- Create relevant DI services for both files.
modules/ppcp-settings/services.php
- Register the REST endpoint in the service module.
modules/ppcp-settings/src/SettingsModule.php
- Find the action
rest_api_init