woocommerce/plugins/woocommerce-blocks/assets/js/base/context/cart-checkout/billing/constants.js

45 lines
830 B
JavaScript
Raw Normal View History

/**
* @typedef {import('@woocommerce/type-defs/billing').BillingData} BillingData
* @typedef {import('@woocommerce/type-defs/contexts').BillingDataContext} BillingDataContext
*/
/**
* External dependencies
*/
import { getSetting } from '@woocommerce/settings';
const checkoutData = getSetting( 'checkoutData', {} );
/**
* @type {BillingData}
*/
export const DEFAULT_BILLING_DATA = {
first_name: '',
last_name: '',
company: '',
address_1: '',
address_2: '',
city: '',
state: '',
postcode: '',
country: '',
email: '',
phone: '',
};
/**
* @type {BillingData}
*/
export const DEFAULT_STATE = {
...DEFAULT_BILLING_DATA,
...checkoutData.billing_address,
};
/**
* @type {BillingDataContext}
*/
export const DEFAULT_BILLING_CONTEXT_DATA = {
billingData: DEFAULT_BILLING_DATA,
setBillingData: () => null,
};