Skip to content

Commit 4566683

Browse files
committed
Add JSDoc for more functions that also relate to the ProductStatistics type.
Address #1638 (comment)
1 parent 603438a commit 4566683

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

js/src/data/actions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,13 @@ export function* receiveMCSetup( mcSetup ) {
889889
};
890890
}
891891

892+
/**
893+
* Creates a wp-data action with data payload to be dispatched the received
894+
* MC product statistics to wp-data store.
895+
*
896+
* @param {ProductStatistics} mcProductStatistics The received MC product statistics data.
897+
* @yield {Object} The wp-data action with data payload.
898+
*/
892899
export function* receiveMCProductStatistics( mcProductStatistics ) {
893900
return {
894901
type: TYPES.RECEIVE_MC_PRODUCT_STATISTICS,

js/src/data/selectors.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,17 @@ export const getMCSetup = ( state ) => {
129129
return state.mc_setup;
130130
};
131131

132+
/**
133+
* @typedef {import('.~/data/actions').ProductStatistics } ProductStatistics
134+
*/
135+
136+
/**
137+
* Get the MC product statistics data.
138+
*
139+
* @param {Object} state The current store state will be injected by `wp.data`.
140+
*
141+
* @return {ProductStatistics|null} The MC product statistics data. Returns `null` if data have not yet loaded.
142+
*/
132143
export const getMCProductStatistics = ( state ) => {
133144
return state.mc_product_statistics;
134145
};

0 commit comments

Comments
 (0)