2020-12-14 08:15:50 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import {
|
|
|
|
previewCart,
|
|
|
|
previewShippingRates,
|
|
|
|
} from '@woocommerce/resource-previews';
|
|
|
|
|
|
|
|
export * from '../../assets/js/base/hooks/index.js';
|
|
|
|
export const useStoreCart = () => ( {
|
|
|
|
cartCoupons: previewCart.coupons,
|
|
|
|
cartItems: previewCart.items,
|
|
|
|
cartItemsCount: previewCart.items_count,
|
|
|
|
cartItemsWeight: previewCart.items_weight,
|
|
|
|
cartNeedsPayment: previewCart.needs_payment,
|
|
|
|
cartNeedsShipping: previewCart.needs_shipping,
|
|
|
|
cartItemErrors: [],
|
|
|
|
cartTotals: previewCart.totals,
|
|
|
|
cartIsLoading: false,
|
|
|
|
cartErrors: [],
|
2021-01-13 16:57:42 +00:00
|
|
|
cartFees: [],
|
2022-09-21 06:04:15 +00:00
|
|
|
crossSellsProducts: previewCart.cross_sells,
|
2020-12-14 08:15:50 +00:00
|
|
|
billingAddress: {},
|
|
|
|
shippingAddress: {},
|
|
|
|
shippingRates: previewShippingRates,
|
2022-03-14 11:29:25 +00:00
|
|
|
isLoadingRates: false,
|
2020-12-14 08:15:50 +00:00
|
|
|
cartHasCalculatedShipping: previewCart.has_calculated_shipping,
|
|
|
|
receiveCart: () => void null,
|
|
|
|
} );
|
2022-12-15 23:52:03 +00:00
|
|
|
export const useShippingData = () => ( {
|
2020-12-14 08:15:50 +00:00
|
|
|
selectShippingRate: () => void null,
|
2022-12-15 23:52:03 +00:00
|
|
|
selectedRates: [],
|
|
|
|
shippingRates: previewShippingRates,
|
2020-12-14 08:15:50 +00:00
|
|
|
isSelectingRate: false,
|
2022-12-15 23:52:03 +00:00
|
|
|
needsShipping: previewCart.needs_shipping,
|
|
|
|
hasCalculatedShipping: previewCart.has_calculated_shipping,
|
|
|
|
isLoadingRates: false,
|
|
|
|
isCollectable: false,
|
|
|
|
hasSelectedLocalPickup: false,
|
2020-12-14 08:15:50 +00:00
|
|
|
} );
|