2021-02-24 01:36:24 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import type { Cart, CartMeta } from '@woocommerce/types';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import type { ResponseError } from './types';
|
|
|
|
|
|
|
|
export interface CartState {
|
|
|
|
cartItemsPendingQuantity: Array< string >;
|
|
|
|
cartItemsPendingDelete: Array< string >;
|
|
|
|
cartData: Cart;
|
|
|
|
metaData: CartMeta;
|
|
|
|
errors: Array< ResponseError >;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const defaultCartState: CartState = {
|
2020-06-10 18:21:34 +00:00
|
|
|
cartItemsPendingQuantity: [],
|
|
|
|
cartItemsPendingDelete: [],
|
|
|
|
cartData: {
|
|
|
|
coupons: [],
|
|
|
|
shippingRates: [],
|
|
|
|
shippingAddress: {
|
|
|
|
first_name: '',
|
|
|
|
last_name: '',
|
|
|
|
company: '',
|
|
|
|
address_1: '',
|
|
|
|
address_2: '',
|
|
|
|
city: '',
|
|
|
|
state: '',
|
|
|
|
postcode: '',
|
|
|
|
country: '',
|
2021-07-22 11:03:00 +00:00
|
|
|
phone: '',
|
2020-06-10 18:21:34 +00:00
|
|
|
},
|
2021-02-24 01:36:24 +00:00
|
|
|
billingAddress: {
|
|
|
|
first_name: '',
|
|
|
|
last_name: '',
|
|
|
|
company: '',
|
|
|
|
address_1: '',
|
|
|
|
address_2: '',
|
|
|
|
city: '',
|
|
|
|
state: '',
|
|
|
|
postcode: '',
|
|
|
|
country: '',
|
|
|
|
phone: '',
|
|
|
|
email: '',
|
|
|
|
},
|
2020-06-10 18:21:34 +00:00
|
|
|
items: [],
|
|
|
|
itemsCount: 0,
|
|
|
|
itemsWeight: 0,
|
|
|
|
needsShipping: true,
|
2021-02-24 01:36:24 +00:00
|
|
|
needsPayment: false,
|
|
|
|
hasCalculatedShipping: true,
|
|
|
|
fees: [],
|
2020-06-10 18:21:34 +00:00
|
|
|
totals: {
|
|
|
|
currency_code: '',
|
|
|
|
currency_symbol: '',
|
|
|
|
currency_minor_unit: 2,
|
|
|
|
currency_decimal_separator: '.',
|
|
|
|
currency_thousand_separator: ',',
|
|
|
|
currency_prefix: '',
|
|
|
|
currency_suffix: '',
|
|
|
|
total_items: '0',
|
|
|
|
total_items_tax: '0',
|
|
|
|
total_fees: '0',
|
|
|
|
total_fees_tax: '0',
|
|
|
|
total_discount: '0',
|
|
|
|
total_discount_tax: '0',
|
|
|
|
total_shipping: '0',
|
|
|
|
total_shipping_tax: '0',
|
|
|
|
total_price: '0',
|
|
|
|
total_tax: '0',
|
|
|
|
tax_lines: [],
|
|
|
|
},
|
2021-02-24 01:36:24 +00:00
|
|
|
errors: [],
|
|
|
|
paymentRequirements: [],
|
2021-03-16 09:16:56 +00:00
|
|
|
extensions: {},
|
2021-02-24 01:36:24 +00:00
|
|
|
},
|
|
|
|
metaData: {
|
|
|
|
updatingCustomerData: false,
|
|
|
|
updatingSelectedRate: false,
|
|
|
|
applyingCoupon: '',
|
|
|
|
removingCoupon: '',
|
2021-03-24 13:28:11 +00:00
|
|
|
isCartDataStale: false,
|
2020-06-10 18:21:34 +00:00
|
|
|
},
|
|
|
|
errors: [],
|
|
|
|
};
|