2020-03-30 14:32:23 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { getSetting } from '@woocommerce/settings';
|
|
|
|
|
2020-03-10 13:39:21 +00:00
|
|
|
/**
|
|
|
|
* @type {import("@woocommerce/type-defs/checkout").CheckoutStatusConstants}
|
|
|
|
*/
|
|
|
|
export const STATUS = {
|
|
|
|
PRISTINE: 'pristine',
|
|
|
|
IDLE: 'idle',
|
|
|
|
PROCESSING: 'processing',
|
|
|
|
COMPLETE: 'complete',
|
2020-04-14 16:52:23 +00:00
|
|
|
BEFORE_PROCESSING: 'before_processing',
|
|
|
|
AFTER_PROCESSING: 'after_processing',
|
2020-03-10 13:39:21 +00:00
|
|
|
};
|
|
|
|
|
2020-04-07 14:29:59 +00:00
|
|
|
const checkoutData = getSetting( 'checkoutData', {
|
|
|
|
order_id: 0,
|
|
|
|
customer_id: 0,
|
|
|
|
} );
|
2020-03-30 14:32:23 +00:00
|
|
|
|
2020-03-10 13:39:21 +00:00
|
|
|
export const DEFAULT_STATE = {
|
|
|
|
redirectUrl: '',
|
|
|
|
status: STATUS.PRISTINE,
|
|
|
|
hasError: false,
|
|
|
|
calculatingCount: 0,
|
2020-03-30 14:32:23 +00:00
|
|
|
orderId: checkoutData.order_id,
|
2020-04-07 14:29:59 +00:00
|
|
|
customerId: checkoutData.customer_id,
|
2020-04-14 16:52:23 +00:00
|
|
|
processingResponse: null,
|
2020-03-10 13:39:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const TYPES = {
|
2020-04-14 16:52:23 +00:00
|
|
|
SET_IDLE: 'set_idle',
|
2020-03-10 13:39:21 +00:00
|
|
|
SET_PRISTINE: 'set_pristine',
|
|
|
|
SET_REDIRECT_URL: 'set_redirect_url',
|
|
|
|
SET_COMPLETE: 'set_checkout_complete',
|
2020-04-14 16:52:23 +00:00
|
|
|
SET_BEFORE_PROCESSING: 'set_before_processing',
|
|
|
|
SET_AFTER_PROCESSING: 'set_after_processing',
|
|
|
|
SET_PROCESSING_RESPONSE: 'set_processing_response',
|
2020-03-10 13:39:21 +00:00
|
|
|
SET_PROCESSING: 'set_checkout_is_processing',
|
|
|
|
SET_HAS_ERROR: 'set_checkout_has_error',
|
|
|
|
SET_NO_ERROR: 'set_checkout_no_error',
|
2020-03-30 14:32:23 +00:00
|
|
|
SET_ORDER_ID: 'set_checkout_order_id',
|
2020-03-10 13:39:21 +00:00
|
|
|
INCREMENT_CALCULATING: 'increment_calculating',
|
|
|
|
DECREMENT_CALCULATING: 'decrement_calculating',
|
|
|
|
};
|