2018-11-29 15:57:49 +00:00
|
|
|
/** @format */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2019-10-08 22:02:26 +00:00
|
|
|
import reportExport from './export';
|
2019-02-01 09:55:19 +00:00
|
|
|
import items from './items';
|
2019-05-20 20:50:25 +00:00
|
|
|
import imports from './imports';
|
2018-12-06 22:08:40 +00:00
|
|
|
import notes from './notes';
|
2019-05-28 14:45:52 +00:00
|
|
|
import onboarding from './onboarding';
|
2019-09-02 03:45:56 +00:00
|
|
|
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';
|
2018-12-12 13:35:56 +00:00
|
|
|
import reviews from './reviews';
|
2019-01-31 01:04:11 +00:00
|
|
|
import settings from './settings';
|
2018-12-13 19:24:54 +00:00
|
|
|
import user from './user';
|
2018-11-29 15:57:49 +00:00
|
|
|
|
|
|
|
function createWcApiSpec() {
|
|
|
|
return {
|
2019-04-09 14:55:01 +00:00
|
|
|
name: 'wcApi',
|
2018-12-13 19:24:54 +00:00
|
|
|
mutations: {
|
2019-10-08 22:02:26 +00:00
|
|
|
...reportExport.mutations,
|
2019-03-28 17:38:44 +00:00
|
|
|
...items.mutations,
|
|
|
|
...notes.mutations,
|
2019-05-28 14:45:52 +00:00
|
|
|
...onboarding.mutations,
|
2019-09-02 03:45:56 +00:00
|
|
|
...options.mutations,
|
2019-01-31 01:04:11 +00:00
|
|
|
...settings.mutations,
|
2018-12-13 19:24:54 +00:00
|
|
|
...user.mutations,
|
|
|
|
},
|
2018-11-29 15:57:49 +00:00
|
|
|
selectors: {
|
2019-05-20 20:50:25 +00:00
|
|
|
...imports.selectors,
|
2019-02-01 09:55:19 +00:00
|
|
|
...items.selectors,
|
2018-12-06 22:08:40 +00:00
|
|
|
...notes.selectors,
|
2019-05-28 14:45:52 +00:00
|
|
|
...onboarding.selectors,
|
2019-09-02 03:45:56 +00:00
|
|
|
...options.selectors,
|
2018-12-05 17:10:54 +00:00
|
|
|
...reportItems.selectors,
|
2018-12-04 03:01:49 +00:00
|
|
|
...reportStats.selectors,
|
2018-12-12 13:35:56 +00:00
|
|
|
...reviews.selectors,
|
2019-01-31 01:04:11 +00:00
|
|
|
...settings.selectors,
|
2018-12-13 19:24:54 +00:00
|
|
|
...user.selectors,
|
2018-11-29 15:57:49 +00:00
|
|
|
},
|
|
|
|
operations: {
|
|
|
|
read( resourceNames ) {
|
2019-06-10 22:03:08 +00:00
|
|
|
if ( document.hidden ) {
|
|
|
|
// Don't do any read updates while the tab isn't active.
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2018-12-06 22:08:40 +00:00
|
|
|
return [
|
2019-05-20 20:50:25 +00:00
|
|
|
...imports.operations.read( resourceNames ),
|
2019-02-01 09:55:19 +00:00
|
|
|
...items.operations.read( resourceNames ),
|
2018-12-06 22:08:40 +00:00
|
|
|
...notes.operations.read( resourceNames ),
|
2019-05-28 14:45:52 +00:00
|
|
|
...onboarding.operations.read( resourceNames ),
|
2019-09-02 03:45:56 +00:00
|
|
|
...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 ),
|
2018-12-12 13:35:56 +00:00
|
|
|
...reviews.operations.read( resourceNames ),
|
2019-01-31 01:04:11 +00:00
|
|
|
...settings.operations.read( resourceNames ),
|
2018-12-13 19:24:54 +00:00
|
|
|
...user.operations.read( resourceNames ),
|
2018-12-06 22:08:40 +00:00
|
|
|
];
|
2018-11-29 15:57:49 +00:00
|
|
|
},
|
2018-12-13 19:24:54 +00:00
|
|
|
update( resourceNames, data ) {
|
2019-01-31 01:04:11 +00:00
|
|
|
return [
|
2019-10-08 22:02:26 +00:00
|
|
|
...reportExport.operations.update( resourceNames, data ),
|
2019-03-28 17:38:44 +00:00
|
|
|
...items.operations.update( resourceNames, data ),
|
|
|
|
...notes.operations.update( resourceNames, data ),
|
2019-05-28 14:45:52 +00:00
|
|
|
...onboarding.operations.update( resourceNames, data ),
|
2019-09-02 03:45:56 +00:00
|
|
|
...options.operations.update( resourceNames, data ),
|
2019-01-31 01:04:11 +00:00
|
|
|
...settings.operations.update( resourceNames, data ),
|
|
|
|
...user.operations.update( resourceNames, data ),
|
|
|
|
];
|
2018-12-13 19:24:54 +00:00
|
|
|
},
|
2019-06-27 09:21:43 +00:00
|
|
|
updateLocally( resourceNames, data ) {
|
|
|
|
return [ ...items.operations.updateLocally( resourceNames, data ) ];
|
|
|
|
},
|
2018-11-29 15:57:49 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default createWcApiSpec();
|