Download wp-calypso/client/state/active-promotions/test/fixture/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/active-promotions/test/fixture/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/active-promotions/test/fixture/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/active-promotions/test/fixture/index.js
1.87 kB
| import { | |
| ACTIVE_PROMOTIONS_RECEIVE, | |
| ACTIVE_PROMOTIONS_REQUEST, | |
| ACTIVE_PROMOTIONS_REQUEST_SUCCESS, | |
| ACTIVE_PROMOTIONS_REQUEST_FAILURE, | |
| } from 'calypso/state/action-types'; | |
| // WP REST-API error response | |
| export const ERROR_MESSAGE_RESPONSE = | |
| 'There was a problem fetching activePromotions. Please try again later or contact support.'; | |
| export const ACTIVE_PROMOTION_1 = 'spring_sale'; | |
| export const ACTIVE_PROMOTION_1003 = 'valentine_promotion'; | |
| export const ACTIVE_PROMOTION_1008 = 'spring_sale_2'; | |
| export const ACTIVE_PROMOTION_1009 = 'spring_sale_3'; | |
| export const ACTIVE_PROMOTION_1029 = 'spring_sale_4'; | |
| export const ACTIVE_PROMOTION_2000 = 'spring_sale_5'; | |
| export const ACTIVE_PROMOTION_2001 = 'spring_sale_6'; | |
| export const ACTIVE_PROMOTION_2002 = 'spring_sale_7'; | |
| export const ACTIVE_PROMOTION_2003 = 'spring_sale_8'; | |
| export const WPCOM_RESPONSE = [ | |
| ACTIVE_PROMOTION_1, | |
| ACTIVE_PROMOTION_1003, | |
| ACTIVE_PROMOTION_1008, | |
| ACTIVE_PROMOTION_1009, | |
| ACTIVE_PROMOTION_1029, | |
| ACTIVE_PROMOTION_2000, | |
| ACTIVE_PROMOTION_2001, | |
| ACTIVE_PROMOTION_2002, | |
| ACTIVE_PROMOTION_2003, | |
| ]; | |
| export const ACTIVE_PROMOTIONS = WPCOM_RESPONSE; | |
| // actions | |
| export const ACTION_ACTIVE_PROMOTIONS_RECEIVE = { | |
| type: ACTIVE_PROMOTIONS_RECEIVE, | |
| activePromotions: ACTIVE_PROMOTIONS, | |
| }; | |
| export const ACTION_ACTIVE_PROMOTIONS_REQUEST = { | |
| type: ACTIVE_PROMOTIONS_REQUEST, | |
| }; | |
| export const ACTION_ACTIVE_PROMOTIONS_REQUEST_SUCCESS = { | |
| type: ACTIVE_PROMOTIONS_REQUEST_SUCCESS, | |
| }; | |
| export const ACTION_ACTIVE_PROMOTIONS_REQUEST_FAILURE = { | |
| type: ACTIVE_PROMOTIONS_REQUEST_FAILURE, | |
| error: ERROR_MESSAGE_RESPONSE, | |
| }; | |
| /** | |
| * Return a whole state instance | |
| * | |
| * - requesting: false | |
| * - error: false | |
| * @returns {Object} an state instance | |
| */ | |
| export const getStateInstance = () => { | |
| return { | |
| activePromotions: { | |
| items: [ ...ACTIVE_PROMOTIONS ], | |
| requesting: false, | |
| error: false, | |
| }, | |
| }; | |
| }; | |