@weareconceptstudio/account 0.4.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,10 +15,10 @@ const PromoCodeComp = ({ isPromoCode = true, promotionHandler, usePromotion, get
|
|
|
15
15
|
promotionHandler(values.promo_code);
|
|
16
16
|
};
|
|
17
17
|
const promotions = useMemo(() => {
|
|
18
|
-
return appliedPromotions
|
|
18
|
+
return appliedPromotions?.map((promotion) => React.createElement(AppliedPromotion, { ...promotion }));
|
|
19
19
|
}, [appliedPromotions]);
|
|
20
20
|
return isPromoCode ? (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${getItemCount ? '' : 'disable'}` },
|
|
21
|
-
React.createElement(CollapseItem, { status: appliedPromotions
|
|
21
|
+
React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : 'closed', disable: disable, title: React.createElement(React.Fragment, null,
|
|
22
22
|
React.createElement("div", { className: 'inner-wrapper-icon' },
|
|
23
23
|
React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none' },
|
|
24
24
|
React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
|
|
@@ -15,10 +15,11 @@ import SequenceSkeleton from '../../../components/Sequence/Skeleton';
|
|
|
15
15
|
import SkeletonAddressSelect from '../../address/SelectAddress/Skeleton';
|
|
16
16
|
const CheckoutTemplate = () => {
|
|
17
17
|
const firstStepFormRef = useRef(null);
|
|
18
|
+
const { useCart, useUser } = useAccountContext();
|
|
18
19
|
const { hasCheckoutAddress, addressLoading } = useAddressContext();
|
|
19
20
|
const { handleCheckout } = useCheckoutContext();
|
|
20
|
-
const { useCart } = useAccountContext();
|
|
21
21
|
const { items, itemsCount, loading } = useCart();
|
|
22
|
+
const { user } = useUser();
|
|
22
23
|
const checkStep = {
|
|
23
24
|
isShipping: !hasCheckoutAddress,
|
|
24
25
|
isReview: hasCheckoutAddress,
|
|
@@ -46,19 +47,18 @@ const CheckoutTemplate = () => {
|
|
|
46
47
|
}
|
|
47
48
|
}, [itemsCount, loading]);
|
|
48
49
|
return (React.createElement(Page, { className: 'checkout use-account' },
|
|
49
|
-
React.createElement(AccountContainer, { className: `second-version` },
|
|
50
|
-
React.createElement(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
React.createElement(SkeletonCartTemplate, null))))))));
|
|
50
|
+
React.createElement(AccountContainer, { className: `second-version` }, itemsCount && user ? (React.createElement(CheckoutTemplateStyle, null,
|
|
51
|
+
React.createElement(TotalCheckout, { isShipping: checkStep.isShipping, buttonProps: {
|
|
52
|
+
url: false,
|
|
53
|
+
handleClick: handleCheckoutBtn,
|
|
54
|
+
type: checkStep.isShipping ? 'submit' : 'button',
|
|
55
|
+
text: checkStep.isShipping ? 'account.cart_checkout.proceedToCheckout' : 'account.cart_checkout.proceedToPayment',
|
|
56
|
+
loadingButton: loadingProcessToPayment,
|
|
57
|
+
} }, !addressLoading && itemsCount ? (React.createElement(React.Fragment, null,
|
|
58
|
+
React.createElement(Sequence, { step: checkStep.isShipping ? 'shipping' : 'review' }),
|
|
59
|
+
checkStep.isShipping ? React.createElement(StepShipping, { firstStepFormRef: firstStepFormRef }) : React.createElement(StepReview, { items: items }))) : (React.createElement(React.Fragment, null,
|
|
60
|
+
React.createElement(SequenceSkeleton, { className: 'sequence-checkout-template' }),
|
|
61
|
+
React.createElement(SkeletonAddressSelect, { className: 'address-checkout-template' }),
|
|
62
|
+
React.createElement(SkeletonCartTemplate, null)))))) : null)));
|
|
63
63
|
};
|
|
64
64
|
export default CheckoutTemplate;
|