woocommerce/plugins/woocommerce-admin/client/wc-api/wc-api-spec.js

71 lines
1.8 KiB
JavaScript
Raw Normal View History

/**
* Internal dependencies
*/
import reportExport from './export';
import items from './items';
import imports from './imports';
import notes from './notes';
import options from './options';
2018-12-05 17:10:54 +00:00
import reportItems from './reports/items';
2018-12-04 03:01:49 +00:00
import reportStats from './reports/stats';
import reviews from './reviews';
import user from './user';
function createWcApiSpec() {
return {
name: 'wcApi',
mutations: {
...reportExport.mutations,
...items.mutations,
...notes.mutations,
...options.mutations,
...user.mutations,
},
selectors: {
...imports.selectors,
...items.selectors,
...notes.selectors,
...options.selectors,
2018-12-05 17:10:54 +00:00
...reportItems.selectors,
2018-12-04 03:01:49 +00:00
...reportStats.selectors,
...reviews.selectors,
...user.selectors,
},
operations: {
read( resourceNames ) {
if ( document.hidden ) {
// Don't do any read updates while the tab isn't active.
return [];
}
return [
...imports.operations.read( resourceNames ),
...items.operations.read( resourceNames ),
...notes.operations.read( resourceNames ),
...options.operations.read( resourceNames ),
2018-12-05 17:10:54 +00:00
...reportItems.operations.read( resourceNames ),
2018-12-04 03:01:49 +00:00
...reportStats.operations.read( resourceNames ),
...reviews.operations.read( resourceNames ),
...user.operations.read( resourceNames ),
];
},
update( resourceNames, data ) {
Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) * Add settings page routes * Add control options for excluded statuses * Add control options for excluded statuses * Add excluded order statuses to rest api * Add wc settings to wc-api * Add wc settings to wc-api * Split and validate multiselect values in settings controller * Add wcAdminSettings to wcSettings global * Set initial excluded statuses from serverside wcSettings data * Add extensible filter for wcSettings global * Split arrays into comma separated strings in wc-api * Extract setting as separate component * Extra settings to config file * Add checkboxGroup option as input type * Separate status types into default and custom groups * Add setting option styling * Add responsive styling for settings * Fix wpClosedMenu and wpOpenMenu for settings page * Add support for resetting to default values * Only show checkbox group if options are available * Add proptypes to Setting component * Add extensible filter to analytics settings * Add readme for settings config and extensibility * Hook up excluded status settings to reports * Pass object to settings API instead of comma delimited string * Fix inpuType -> inputType typo * Remove hasError from constructor * Bump settings API to v4 * Use interpolateComponents instead of dangerously setting html * Use empty array in initial excldued statuses setting value if none is retrieved * Remove double check for refunded status in default order statuses * Update settings wc-api to use namespace * Add aria=labelledby to checkbox group
2019-01-31 01:04:11 +00:00
return [
...reportExport.operations.update( resourceNames, data ),
...items.operations.update( resourceNames, data ),
...notes.operations.update( resourceNames, data ),
...options.operations.update( resourceNames, data ),
Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) * Add settings page routes * Add control options for excluded statuses * Add control options for excluded statuses * Add excluded order statuses to rest api * Add wc settings to wc-api * Add wc settings to wc-api * Split and validate multiselect values in settings controller * Add wcAdminSettings to wcSettings global * Set initial excluded statuses from serverside wcSettings data * Add extensible filter for wcSettings global * Split arrays into comma separated strings in wc-api * Extract setting as separate component * Extra settings to config file * Add checkboxGroup option as input type * Separate status types into default and custom groups * Add setting option styling * Add responsive styling for settings * Fix wpClosedMenu and wpOpenMenu for settings page * Add support for resetting to default values * Only show checkbox group if options are available * Add proptypes to Setting component * Add extensible filter to analytics settings * Add readme for settings config and extensibility * Hook up excluded status settings to reports * Pass object to settings API instead of comma delimited string * Fix inpuType -> inputType typo * Remove hasError from constructor * Bump settings API to v4 * Use interpolateComponents instead of dangerously setting html * Use empty array in initial excldued statuses setting value if none is retrieved * Remove double check for refunded status in default order statuses * Update settings wc-api to use namespace * Add aria=labelledby to checkbox group
2019-01-31 01:04:11 +00:00
...user.operations.update( resourceNames, data ),
];
},
updateLocally( resourceNames, data ) {
return [
...items.operations.updateLocally( resourceNames, data ),
];
},
},
};
}
export default createWcApiSpec();