@afosto/checkout-ui 0.0.8 → 0.0.10
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.
- package/dist/CheckoutProvider/CheckoutProvider.d.ts.map +1 -1
- package/dist/CheckoutProvider/CheckoutProvider.js +53 -50
- package/dist/CheckoutSummary/CheckoutSummary.d.ts +5 -1
- package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
- package/dist/CheckoutSummary/CheckoutSummary.js +90 -68
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts +11 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts.map +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.js +71 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts +3 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts.map +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.js +4 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts.map +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.js +33 -7
- package/dist/CheckoutSummary/index.d.ts +2 -0
- package/dist/CheckoutSummary/index.d.ts.map +1 -1
- package/dist/CheckoutSummary/index.js +26 -24
- package/dist/constants/paymentMethodIconMapping.d.ts +1 -0
- package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
- package/dist/constants/paymentMethodIconMapping.js +54 -52
- package/dist/hooks/useCheckoutCart.d.ts +48 -10
- package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
- package/dist/hooks/useCheckoutCart.js +117 -63
- package/dist/hooks/useCheckoutOrder.d.ts +48 -10
- package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
- package/dist/hooks/useCheckoutOrder.js +208 -154
- package/dist/icons/AngleRightSolid.d.ts +3 -0
- package/dist/icons/AngleRightSolid.d.ts.map +1 -0
- package/dist/icons/AngleRightSolid.js +6 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +130 -126
- package/dist/icons/paymentMethods/Giftcard.d.ts +3 -0
- package/dist/icons/paymentMethods/Giftcard.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Giftcard.js +54 -0
- package/dist/icons/paymentMethods/Ideal.d.ts.map +1 -1
- package/dist/icons/paymentMethods/Ideal.js +104 -23
- package/dist/icons/paymentMethods/index.d.ts +1 -0
- package/dist/icons/paymentMethods/index.d.ts.map +1 -1
- package/dist/icons/paymentMethods/index.js +80 -78
- package/dist/index.js +301 -289
- package/dist/mutations/addCouponToCart.d.ts +12 -0
- package/dist/mutations/addCouponToCart.d.ts.map +1 -0
- package/dist/mutations/addCouponToCart.js +15 -0
- package/dist/mutations/addCouponToOrder.d.ts +12 -0
- package/dist/mutations/addCouponToOrder.d.ts.map +1 -0
- package/dist/mutations/addCouponToOrder.js +15 -0
- package/dist/mutations/index.d.ts +26 -18
- package/dist/mutations/index.d.ts.map +1 -1
- package/dist/mutations/index.js +44 -36
- package/dist/mutations/removeCouponFromCart.d.ts +12 -0
- package/dist/mutations/removeCouponFromCart.d.ts.map +1 -0
- package/dist/mutations/removeCouponFromCart.js +15 -0
- package/dist/mutations/removeCouponFromOrder.d.ts +12 -0
- package/dist/mutations/removeCouponFromOrder.d.ts.map +1 -0
- package/dist/mutations/removeCouponFromOrder.js +15 -0
- package/dist/operations/cartOperations.d.ts +10 -0
- package/dist/operations/cartOperations.d.ts.map +1 -1
- package/dist/operations/cartOperations.js +218 -168
- package/dist/operations/orderOperations.d.ts +10 -0
- package/dist/operations/orderOperations.d.ts.map +1 -1
- package/dist/operations/orderOperations.js +245 -195
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutProvider.d.ts","sourceRoot":"","sources":["../../src/CheckoutProvider/CheckoutProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpE,OAAO,EAAE,sBAAsB,EAAgB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EACV,gBAAgB,EAChB,6CAA6C,EAC7C,aAAa,EACb,oBAAoB,EAEpB,WAAW,EACX,4BAA4B,EAC5B,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EACP,WAAW,CAAC,sBAAsB,CAAC,GACnC,CAAC,WAAW,CAAC,sBAAsB,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,UAAU,CAAC,EACP,WAAW,CAAC,uBAAuB,CAAC,GACpC,CAAC,WAAW,CAAC,uBAAuB,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACx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B,UAAU,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,MAAM,MAAM,qBAAqB,GAC7B,CAAC,6BAA6B,GAC5B,yBAAyB,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC,GACJ,CAAC,8BAA8B,GAC7B,yBAAyB,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC,CAAC;AAET,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,qDA4K5D,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useState as v, useEffect as w } from "react";
|
|
3
3
|
import { CheckoutOrderProvider as O } from "../CheckoutOrderProvider/CheckoutOrderProvider.js";
|
|
4
4
|
import { CheckoutCartProvider as A } from "../CheckoutCartProvider/CheckoutCartProvider.js";
|
|
5
5
|
import { useGetLatest as V } from "@afosto/hooks";
|
|
6
6
|
import "@afosto/storefront";
|
|
7
|
-
import { camelize as j, isDefined as
|
|
7
|
+
import { camelize as j, isDefined as o } from "@afosto/utils";
|
|
8
8
|
import { CheckoutPayPalExpressButton as z } from "../CheckoutPayPalExpressButton/CheckoutPayPalExpressButton.js";
|
|
9
9
|
import { CheckoutExpressButton as D } from "../CheckoutExpressButton/CheckoutExpressButton.js";
|
|
10
10
|
import { deepMerge as F } from "../utils/deepMerge.js";
|
|
@@ -14,90 +14,93 @@ import { shippingStep as _ } from "../steps/shippingStep.js";
|
|
|
14
14
|
import { paymentStep as $ } from "../steps/paymentStep.js";
|
|
15
15
|
import { reviewStep as H } from "../steps/reviewStep.js";
|
|
16
16
|
import { createSummary as J } from "../utils/createSummary.js";
|
|
17
|
-
const
|
|
18
|
-
if ("cartId" in
|
|
17
|
+
const de = (t) => {
|
|
18
|
+
if ("cartId" in t && "orderId" in t)
|
|
19
19
|
throw new Error("Cannot provide both cartId and orderId");
|
|
20
20
|
const {
|
|
21
21
|
createSummary: h = J,
|
|
22
|
-
expressPaymentMethodsComponentMapping:
|
|
22
|
+
expressPaymentMethodsComponentMapping: M,
|
|
23
23
|
isLoading: s = !1,
|
|
24
|
-
locale:
|
|
25
|
-
operations:
|
|
26
|
-
queryClient:
|
|
24
|
+
locale: k,
|
|
25
|
+
operations: b,
|
|
26
|
+
queryClient: C,
|
|
27
27
|
settings: e,
|
|
28
|
-
steps:
|
|
28
|
+
steps: c,
|
|
29
29
|
storefront: u,
|
|
30
|
-
theme:
|
|
30
|
+
theme: g,
|
|
31
31
|
translations: y = {},
|
|
32
32
|
...R
|
|
33
|
-
} =
|
|
34
|
-
...
|
|
33
|
+
} = t, S = L(!1), [r, l] = v(null), [q, E] = v(!0), x = V(u), N = k || r?.locale?.replace("_", "-") || "en", P = {
|
|
34
|
+
...M || {},
|
|
35
35
|
default: D,
|
|
36
36
|
paypalExpress: z
|
|
37
|
-
},
|
|
38
|
-
const f = j(
|
|
39
|
-
return { ...
|
|
37
|
+
}, m = (r?.links || []).reduce((n, i) => {
|
|
38
|
+
const f = j(i.type?.toLowerCase());
|
|
39
|
+
return { ...n, [f]: i?.value || "#" };
|
|
40
40
|
}, {}), a = {
|
|
41
41
|
...e || {},
|
|
42
42
|
branding: F(
|
|
43
43
|
r?.branding || {},
|
|
44
44
|
e?.branding || {}
|
|
45
45
|
),
|
|
46
|
-
channelLinks:
|
|
46
|
+
channelLinks: m,
|
|
47
47
|
currency: e?.currency || r?.pricing?.currency,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
disableCouponModifications: o(
|
|
49
|
+
e?.disableCouponModifications
|
|
50
|
+
) ? e?.disableCouponModifications : !1,
|
|
51
|
+
isAccountEnabled: o(e?.isAccountEnabled) ? e?.isAccountEnabled : o(m?.myAccount),
|
|
52
|
+
isB2bExcluded: o(e?.isB2bExcluded) ? e?.isB2bExcluded : r?.options?.isB2bExcluded ?? !1,
|
|
53
|
+
isB2cExcluded: o(e?.isB2cExcluded) ? e?.isB2cExcluded : r?.options?.isB2cExcluded ?? !1,
|
|
54
|
+
isPhoneNumberRequired: o(e?.isPhoneNumberRequired) ? e?.isPhoneNumberRequired : r?.options?.isPhoneNumberRequired ?? !1,
|
|
55
|
+
isCocNumberRequired: o(e?.isCocNumberRequired) ? e?.isCocNumberRequired : r?.options?.isCocNumberRequired ?? !1,
|
|
56
|
+
isSharedOrganisationRequired: o(
|
|
54
57
|
e?.isSharedOrganisationRequired
|
|
55
58
|
) ? e?.isSharedOrganisationRequired : r?.options?.isSharedOrganisationRequired ?? !1,
|
|
56
|
-
isVatNumberRequired:
|
|
59
|
+
isVatNumberRequired: o(e?.isVatNumberRequired) ? e?.isVatNumberRequired : r?.options?.isVatNumberRequired ?? !1,
|
|
57
60
|
links: {
|
|
58
|
-
...
|
|
61
|
+
...m,
|
|
59
62
|
...e?.links || {}
|
|
60
63
|
},
|
|
61
64
|
logo: e?.logo || r?.logo,
|
|
62
65
|
storeName: e?.storeName || r?.name
|
|
63
66
|
};
|
|
64
67
|
let p = [G, _, $, H];
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
68
|
+
if (c && c.length > 0 && (p = c), w(() => {
|
|
69
|
+
const n = async () => {
|
|
67
70
|
try {
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
70
|
-
|
|
71
|
+
const i = x();
|
|
72
|
+
if (!i) {
|
|
73
|
+
l(null), E(!1);
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
const f = await
|
|
74
|
-
|
|
76
|
+
const f = await i.getChannel();
|
|
77
|
+
l(f);
|
|
75
78
|
} catch {
|
|
76
|
-
|
|
79
|
+
l(null);
|
|
77
80
|
} finally {
|
|
78
81
|
E(!1);
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
|
-
!s && !S.current && (S.current = !0,
|
|
82
|
-
}, [x, s]), "orderId" in
|
|
83
|
-
const { orderId:
|
|
84
|
-
return /* @__PURE__ */
|
|
84
|
+
!s && !S.current && (S.current = !0, n());
|
|
85
|
+
}, [x, s]), "orderId" in t) {
|
|
86
|
+
const { orderId: n = "" } = t;
|
|
87
|
+
return /* @__PURE__ */ d(
|
|
85
88
|
B,
|
|
86
89
|
{
|
|
87
|
-
queryClient:
|
|
90
|
+
queryClient: C,
|
|
88
91
|
settings: a,
|
|
89
|
-
theme:
|
|
90
|
-
children: /* @__PURE__ */
|
|
92
|
+
theme: g,
|
|
93
|
+
children: /* @__PURE__ */ d(
|
|
91
94
|
O,
|
|
92
95
|
{
|
|
93
|
-
orderId:
|
|
96
|
+
orderId: n,
|
|
94
97
|
channel: r,
|
|
95
98
|
createSummary: h,
|
|
96
99
|
expressPaymentMethodsComponentMapping: P,
|
|
97
100
|
isLoading: s,
|
|
98
101
|
isLoadingChannel: q,
|
|
99
102
|
locale: N,
|
|
100
|
-
operations:
|
|
103
|
+
operations: b,
|
|
101
104
|
settings: a,
|
|
102
105
|
steps: p,
|
|
103
106
|
storefront: u,
|
|
@@ -108,24 +111,24 @@ const ce = (o) => {
|
|
|
108
111
|
}
|
|
109
112
|
);
|
|
110
113
|
}
|
|
111
|
-
const { cartId:
|
|
112
|
-
return /* @__PURE__ */
|
|
114
|
+
const { cartId: I } = t;
|
|
115
|
+
return /* @__PURE__ */ d(
|
|
113
116
|
B,
|
|
114
117
|
{
|
|
115
|
-
queryClient:
|
|
118
|
+
queryClient: C,
|
|
116
119
|
settings: a,
|
|
117
|
-
theme:
|
|
118
|
-
children: /* @__PURE__ */
|
|
120
|
+
theme: g,
|
|
121
|
+
children: /* @__PURE__ */ d(
|
|
119
122
|
A,
|
|
120
123
|
{
|
|
121
|
-
cartId:
|
|
124
|
+
cartId: I,
|
|
122
125
|
channel: r,
|
|
123
126
|
createSummary: h,
|
|
124
127
|
expressPaymentMethodsComponentMapping: P,
|
|
125
128
|
isLoading: s,
|
|
126
129
|
isLoadingChannel: q,
|
|
127
130
|
locale: N,
|
|
128
|
-
operations:
|
|
131
|
+
operations: b,
|
|
129
132
|
settings: a,
|
|
130
133
|
steps: p,
|
|
131
134
|
storefront: u,
|
|
@@ -137,5 +140,5 @@ const ce = (o) => {
|
|
|
137
140
|
);
|
|
138
141
|
};
|
|
139
142
|
export {
|
|
140
|
-
|
|
143
|
+
de as CheckoutProvider
|
|
141
144
|
};
|
|
@@ -5,24 +5,28 @@ import { CheckoutItemProps } from '../CheckoutItem/CheckoutItem';
|
|
|
5
5
|
import { CheckoutSummarySubtotalProps } from './components/CheckoutSummarySubtotal/CheckoutSummarySubtotal';
|
|
6
6
|
import { CheckoutSummaryShippingFeesProps } from './components/CheckoutSummaryShippingFees/CheckoutSummaryShippingFees';
|
|
7
7
|
import { CheckoutSummaryPaymentFeesProps } from './components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees';
|
|
8
|
+
import { CheckoutSummaryCouponFieldProps } from './components/CheckoutSummaryCouponField/CheckoutSummaryCouponField';
|
|
8
9
|
import { CheckoutSummaryTotalBreakdownProps } from './components/CheckoutSummaryTotalBreakdown/CheckoutSummaryTotalBreakdown';
|
|
9
10
|
import { CheckoutSummaryAgreementsProps } from './components/CheckoutSummaryAgreements/CheckoutSummaryAgreements';
|
|
10
11
|
declare const defaultTranslations: {
|
|
11
12
|
title: string;
|
|
12
13
|
};
|
|
13
14
|
export interface CheckoutSummaryProps extends Omit<BoxProps, 'ref'> {
|
|
15
|
+
disableCouponModifications?: boolean;
|
|
14
16
|
hideDefaultAgreementOption?: boolean;
|
|
15
17
|
hideTitle?: boolean;
|
|
16
18
|
locale?: string;
|
|
17
19
|
slots?: {
|
|
20
|
+
couponField?: ElementType<CheckoutSummaryCouponFieldProps>;
|
|
18
21
|
item?: ElementType<CheckoutItemProps>;
|
|
19
22
|
};
|
|
20
23
|
slotProps?: {
|
|
24
|
+
couponField?: SlotProps<HTMLAttributes<HTMLDivElement> & Partial<CheckoutSummaryCouponFieldProps>>;
|
|
21
25
|
item?: SlotProps<HTMLAttributes<HTMLDivElement> & Partial<Omit<CheckoutItemProps, 'item'>>>;
|
|
22
26
|
};
|
|
23
27
|
summary?: CheckoutSummaryType;
|
|
24
28
|
titleTypographyProps?: TypographyProps;
|
|
25
|
-
translations?: DeepPartial<typeof defaultTranslations> & CheckoutSummarySubtotalProps['translations'] & CheckoutSummaryShippingFeesProps['translations'] & CheckoutSummaryPaymentFeesProps['translations'] & CheckoutSummaryTotalBreakdownProps['translations'] & CheckoutSummaryAgreementsProps['translations'];
|
|
29
|
+
translations?: DeepPartial<typeof defaultTranslations> & CheckoutSummarySubtotalProps['translations'] & CheckoutSummaryShippingFeesProps['translations'] & CheckoutSummaryPaymentFeesProps['translations'] & CheckoutSummaryTotalBreakdownProps['translations'] & CheckoutSummaryAgreementsProps['translations'] & CheckoutSummaryCouponFieldProps['translations'];
|
|
26
30
|
}
|
|
27
31
|
export declare const CheckoutSummary: (props: CheckoutSummaryProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
28
32
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutSummary.d.ts","sourceRoot":"","sources":["../../src/CheckoutSummary/CheckoutSummary.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,8DAA8D,CAAC;AAEtE,OAAO,EAEL,KAAK,gCAAgC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,EAAE;QACN,WAAW,CAAC,EAAE,WAAW,CAAC,+BAA+B,CAAC,CAAC;QAC3D,IAAI,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;KACvC,CAAC;IACF,SAAS,CAAC,EAAE;QACV,WAAW,CAAC,EAAE,SAAS,CACrB,cAAc,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAC1E,CAAC;QACF,IAAI,CAAC,EAAE,SAAS,CACd,cAAc,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAC1E,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,GACpD,4BAA4B,CAAC,cAAc,CAAC,GAC5C,gCAAgC,CAAC,cAAc,CAAC,GAChD,+BAA+B,CAAC,cAAc,CAAC,GAC/C,kCAAkC,CAAC,cAAc,CAAC,GAClD,8BAA8B,CAAC,cAAc,CAAC,GAC9C,+BAA+B,CAAC,cAAc,CAAC,CAAC;CACnD;AAMD,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,qDA8I1D,CAAC"}
|
|
@@ -1,125 +1,147 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { useCheckout as
|
|
4
|
-
import { resolveSlotProps as
|
|
5
|
-
import { CheckoutSummaryItems as
|
|
6
|
-
import { CheckoutSummarySubtotal as
|
|
7
|
-
import { CheckoutSummaryTitle as
|
|
8
|
-
import { CheckoutSummaryShippingFees as
|
|
9
|
-
import { CheckoutSummaryPaymentFees as
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Box as M } from "@afosto/components";
|
|
3
|
+
import { useCheckout as D } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
4
|
+
import { resolveSlotProps as y } from "../utils/resolveSlotProps.js";
|
|
5
|
+
import { CheckoutSummaryItems as B } from "./components/CheckoutSummaryItems/CheckoutSummaryItems.js";
|
|
6
|
+
import { CheckoutSummarySubtotal as E } from "./components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.js";
|
|
7
|
+
import { CheckoutSummaryTitle as G } from "./components/CheckoutSummaryTitle/CheckoutSummaryTitle.js";
|
|
8
|
+
import { CheckoutSummaryShippingFees as L } from "./components/CheckoutSummaryShippingFees/CheckoutSummaryShippingFees.js";
|
|
9
|
+
import { CheckoutSummaryPaymentFees as O } from "./components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees.js";
|
|
10
10
|
import { CheckoutSummaryGroup as s } from "./components/CheckoutSummaryGroup/CheckoutSummaryGroup.js";
|
|
11
|
-
import { CheckoutSummaryAdjustments as
|
|
12
|
-
import { CheckoutSummaryCoupons as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
11
|
+
import { CheckoutSummaryAdjustments as _ } from "./components/CheckoutSummaryAdjustments/CheckoutSummaryAdjustments.js";
|
|
12
|
+
import { CheckoutSummaryCoupons as q } from "./components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.js";
|
|
13
|
+
import { CheckoutSummaryCouponField as z } from "./components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.js";
|
|
14
|
+
import { CheckoutSummaryTotalBreakdown as H } from "./components/CheckoutSummaryTotalBreakdown/CheckoutSummaryTotalBreakdown.js";
|
|
15
|
+
import { CheckoutSummaryAgreements as J } from "./components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js";
|
|
16
|
+
import { isDefined as K } from "@afosto/utils";
|
|
17
|
+
const N = {
|
|
16
18
|
title: "Summary"
|
|
17
|
-
},
|
|
19
|
+
}, Q = {
|
|
20
|
+
couponField: z
|
|
21
|
+
}, ut = (h) => {
|
|
18
22
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
disableCouponModifications: m,
|
|
24
|
+
hideDefaultAgreementOption: f = !0,
|
|
25
|
+
hideTitle: g = !1,
|
|
26
|
+
locale: o,
|
|
27
|
+
slots: S = {},
|
|
28
|
+
slotProps: c = {},
|
|
29
|
+
summary: C,
|
|
30
|
+
titleTypographyProps: k = {},
|
|
31
|
+
translations: P,
|
|
32
|
+
...v
|
|
33
|
+
} = h, {
|
|
34
|
+
summary: T,
|
|
35
|
+
translations: b,
|
|
36
|
+
settings: F
|
|
37
|
+
} = D(), a = K(
|
|
38
|
+
m
|
|
39
|
+
) ? m : F?.disableCouponModifications, t = C || T, u = (t?.agreements || [] || []).filter(
|
|
29
40
|
(n) => n.type?.toLowerCase() === "down_payment" && n.originalPercentage > 0 && n.originalPercentage < 100
|
|
30
|
-
),
|
|
31
|
-
...
|
|
32
|
-
...
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
}.item,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
), l = u.length > 0, V = (t?.adjustments || []).length > 0, j = (t?.coupons || []).length > 0, x = (t?.items || []).length > 0, r = {
|
|
42
|
+
...N,
|
|
43
|
+
...b?.summary || {},
|
|
44
|
+
...P || {}
|
|
45
|
+
}, d = {
|
|
46
|
+
...Q,
|
|
47
|
+
...S
|
|
48
|
+
}, p = d.item, w = y({}, c.item, {}), A = d.couponField, I = y(
|
|
49
|
+
{},
|
|
50
|
+
c.couponField,
|
|
51
|
+
{}
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ i(M, { ...v, children: [
|
|
54
|
+
!g && /* @__PURE__ */ e(
|
|
55
|
+
G,
|
|
41
56
|
{
|
|
42
|
-
titleTypographyProps:
|
|
43
|
-
translations: { title:
|
|
57
|
+
titleTypographyProps: k,
|
|
58
|
+
translations: { title: r.title }
|
|
44
59
|
}
|
|
45
60
|
),
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
x && /* @__PURE__ */ e(s, { disablePadding: !0, sx: { overflow: "auto" }, children: /* @__PURE__ */ e(
|
|
62
|
+
B,
|
|
48
63
|
{
|
|
49
64
|
currency: t?.currency,
|
|
50
|
-
locale:
|
|
65
|
+
locale: o,
|
|
51
66
|
items: t?.items,
|
|
52
|
-
slots:
|
|
53
|
-
slotProps: { item: { ...
|
|
67
|
+
slots: p ? { item: p } : {},
|
|
68
|
+
slotProps: { item: { ...w, currency: t?.currency } }
|
|
54
69
|
}
|
|
55
70
|
) }),
|
|
56
|
-
/* @__PURE__ */
|
|
71
|
+
!a && /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(A, { ...I, translations: r }) }),
|
|
72
|
+
/* @__PURE__ */ i(s, { children: [
|
|
57
73
|
/* @__PURE__ */ e(
|
|
58
|
-
|
|
74
|
+
E,
|
|
59
75
|
{
|
|
60
76
|
currency: t?.currency,
|
|
61
77
|
isVatShifted: t?.isVatShifted,
|
|
62
|
-
locale:
|
|
78
|
+
locale: o,
|
|
63
79
|
value: t?.subtotal,
|
|
64
|
-
translations:
|
|
80
|
+
translations: r
|
|
65
81
|
}
|
|
66
82
|
),
|
|
67
83
|
/* @__PURE__ */ e(
|
|
68
|
-
|
|
84
|
+
L,
|
|
69
85
|
{
|
|
70
86
|
currency: t?.currency,
|
|
71
87
|
fees: t?.fees?.shipping,
|
|
72
|
-
locale:
|
|
73
|
-
translations:
|
|
88
|
+
locale: o,
|
|
89
|
+
translations: r
|
|
74
90
|
}
|
|
75
91
|
),
|
|
76
92
|
/* @__PURE__ */ e(
|
|
77
|
-
|
|
93
|
+
O,
|
|
78
94
|
{
|
|
79
95
|
currency: t?.currency,
|
|
80
96
|
fees: t?.fees?.payment,
|
|
81
|
-
locale:
|
|
82
|
-
translations:
|
|
97
|
+
locale: o,
|
|
98
|
+
translations: r
|
|
83
99
|
}
|
|
84
100
|
)
|
|
85
101
|
] }),
|
|
86
|
-
(
|
|
102
|
+
(V || j) && /* @__PURE__ */ i(s, { children: [
|
|
87
103
|
/* @__PURE__ */ e(
|
|
88
|
-
|
|
104
|
+
_,
|
|
89
105
|
{
|
|
90
106
|
adjustments: t?.adjustments,
|
|
91
107
|
currency: t?.currency,
|
|
92
|
-
locale:
|
|
108
|
+
locale: o
|
|
93
109
|
}
|
|
94
110
|
),
|
|
95
|
-
/* @__PURE__ */ e(
|
|
111
|
+
/* @__PURE__ */ e(
|
|
112
|
+
q,
|
|
113
|
+
{
|
|
114
|
+
coupons: t?.coupons,
|
|
115
|
+
disableModifications: a
|
|
116
|
+
}
|
|
117
|
+
)
|
|
96
118
|
] }),
|
|
97
|
-
/* @__PURE__ */ e(s, { divider:
|
|
98
|
-
|
|
119
|
+
/* @__PURE__ */ e(s, { divider: l, children: /* @__PURE__ */ e(
|
|
120
|
+
H,
|
|
99
121
|
{
|
|
100
122
|
currency: t?.currency,
|
|
101
123
|
isIncludingVat: t?.isIncludingVat,
|
|
102
124
|
isVatShifted: t?.isVatShifted,
|
|
103
|
-
locale:
|
|
125
|
+
locale: o,
|
|
104
126
|
total: t?.total,
|
|
105
127
|
totalExcludingVat: t?.totalExcludingVat,
|
|
106
|
-
translations:
|
|
128
|
+
translations: r,
|
|
107
129
|
vat: t?.vat
|
|
108
130
|
}
|
|
109
131
|
) }),
|
|
110
|
-
|
|
111
|
-
|
|
132
|
+
l && /* @__PURE__ */ e(s, { divider: !1, children: /* @__PURE__ */ e(
|
|
133
|
+
J,
|
|
112
134
|
{
|
|
113
135
|
agreementTemplate: t?.agreementTemplate,
|
|
114
|
-
agreements:
|
|
136
|
+
agreements: u,
|
|
115
137
|
currency: t?.currency,
|
|
116
|
-
locale:
|
|
117
|
-
hideDefaultAgreementOption:
|
|
118
|
-
translations:
|
|
138
|
+
locale: o,
|
|
139
|
+
hideDefaultAgreementOption: f,
|
|
140
|
+
translations: r
|
|
119
141
|
}
|
|
120
142
|
) })
|
|
121
143
|
] });
|
|
122
144
|
};
|
|
123
145
|
export {
|
|
124
|
-
|
|
146
|
+
ut as CheckoutSummary
|
|
125
147
|
};
|
package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DeepPartial } from '../../../types';
|
|
2
|
+
declare const defaultTranslations: {
|
|
3
|
+
couponFieldPlaceholder: string;
|
|
4
|
+
invalidCouponCodeMessage: string;
|
|
5
|
+
};
|
|
6
|
+
export interface CheckoutSummaryCouponFieldProps {
|
|
7
|
+
translations?: DeepPartial<typeof defaultTranslations>;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckoutSummaryCouponField: (props: CheckoutSummaryCouponFieldProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=CheckoutSummaryCouponField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutSummaryCouponField.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,QAAA,MAAM,mBAAmB;;;CAGxB,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,0BAA0B,GACrC,OAAO,+BAA+B,qDAwGvC,CAAC"}
|
package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs as h, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useCallback as u } from "react";
|
|
3
|
+
import { Box as g, TextField as S, InputAdornment as k, CircularProgress as I, IconButton as M, Typography as P } from "@afosto/components";
|
|
4
|
+
import { useCheckout as T } from "../../../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
5
|
+
import { AngleRightSolid as F } from "../../../icons/AngleRightSolid.js";
|
|
6
|
+
const w = {
|
|
7
|
+
couponFieldPlaceholder: "Coupon code",
|
|
8
|
+
invalidCouponCodeMessage: "Invalid coupon code"
|
|
9
|
+
}, E = (f) => {
|
|
10
|
+
const { translations: y = {} } = f || {}, { addCoupon: d, translations: x } = T(), [p, m] = c(""), [e, t] = c(null), [C, r] = c(!1), s = {
|
|
11
|
+
...w,
|
|
12
|
+
...x?.summary || {},
|
|
13
|
+
...y || {}
|
|
14
|
+
}, a = p.trim(), l = a.length > 0 && !C, i = u(async () => {
|
|
15
|
+
if (l)
|
|
16
|
+
try {
|
|
17
|
+
t(null), r(!0), await d({ coupon: a }), m(""), r(!1);
|
|
18
|
+
} catch {
|
|
19
|
+
t(s.invalidCouponCodeMessage), r(!1);
|
|
20
|
+
}
|
|
21
|
+
}, [
|
|
22
|
+
d,
|
|
23
|
+
l,
|
|
24
|
+
a,
|
|
25
|
+
s.invalidCouponCodeMessage
|
|
26
|
+
]), b = u(
|
|
27
|
+
(o) => {
|
|
28
|
+
m(o.target.value), e && t(null);
|
|
29
|
+
},
|
|
30
|
+
[e]
|
|
31
|
+
), v = u(
|
|
32
|
+
(o) => {
|
|
33
|
+
o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), i().catch(() => {
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
[i]
|
|
37
|
+
);
|
|
38
|
+
return /* @__PURE__ */ h(g, { children: [
|
|
39
|
+
/* @__PURE__ */ h(g, { sx: { display: "flex", gap: 1.5 }, children: [
|
|
40
|
+
/* @__PURE__ */ n(
|
|
41
|
+
S,
|
|
42
|
+
{
|
|
43
|
+
size: "small",
|
|
44
|
+
fullWidth: !0,
|
|
45
|
+
placeholder: s.couponFieldPlaceholder,
|
|
46
|
+
value: p,
|
|
47
|
+
onChange: b,
|
|
48
|
+
onKeyDown: v,
|
|
49
|
+
error: !!e,
|
|
50
|
+
InputProps: {
|
|
51
|
+
endAdornment: /* @__PURE__ */ n(k, { position: "end", sx: { ml: 0 }, children: C && /* @__PURE__ */ n(I, { size: 16, color: "inherit" }) })
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ n(
|
|
56
|
+
M,
|
|
57
|
+
{
|
|
58
|
+
variant: "contained",
|
|
59
|
+
type: "button",
|
|
60
|
+
disabled: !l,
|
|
61
|
+
onClick: i,
|
|
62
|
+
children: /* @__PURE__ */ n(F, {})
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }),
|
|
66
|
+
e && /* @__PURE__ */ n(P, { color: "error", sx: { mt: 0.5 }, children: e })
|
|
67
|
+
] });
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
E as CheckoutSummaryCouponField
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryCouponField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,YAAY,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { BoxProps } from '@afosto/components';
|
|
|
2
2
|
import { CheckoutSummaryCoupon } from '../../../types';
|
|
3
3
|
export interface CheckoutSummaryCouponsProps extends Omit<BoxProps, 'ref'> {
|
|
4
4
|
coupons?: CheckoutSummaryCoupon[];
|
|
5
|
+
disableModifications?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const CheckoutSummaryCoupons: (props: CheckoutSummaryCouponsProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
7
8
|
//# sourceMappingURL=CheckoutSummaryCoupons.d.ts.map
|
package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutSummaryCoupons.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckoutSummaryCoupons.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAG5D,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;IACxE,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,4DAgDxE,CAAC"}
|
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as m } from "react";
|
|
3
|
+
import { Box as f, Chip as h } from "@afosto/components";
|
|
4
|
+
import { isDefined as C } from "@afosto/utils";
|
|
5
|
+
import { useCheckout as b } from "../../../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
6
|
+
const M = (n) => {
|
|
7
|
+
const {
|
|
8
|
+
coupons: r,
|
|
9
|
+
disableModifications: e,
|
|
10
|
+
...c
|
|
11
|
+
} = n, {
|
|
12
|
+
removeCoupon: s,
|
|
13
|
+
summary: a,
|
|
14
|
+
settings: p
|
|
15
|
+
} = b(), d = C(e) ? e : p?.disableCouponModifications, i = r || a?.coupons || [], u = i.length > 0, l = m(
|
|
16
|
+
(o) => () => {
|
|
17
|
+
s({ coupon: o.code }).catch(() => {
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
[s]
|
|
21
|
+
);
|
|
22
|
+
return u ? /* @__PURE__ */ t(f, { sx: { display: "flex", flexWrap: "wrap", gap: 1 }, ...c, children: i.map((o) => /* @__PURE__ */ t(
|
|
23
|
+
h,
|
|
24
|
+
{
|
|
25
|
+
label: o.code,
|
|
26
|
+
onDelete: d ? void 0 : l(o),
|
|
27
|
+
size: "small",
|
|
28
|
+
shape: "rounded",
|
|
29
|
+
sx: { bgcolor: "gray.25" }
|
|
30
|
+
},
|
|
31
|
+
o.code
|
|
32
|
+
)) }) : null;
|
|
7
33
|
};
|
|
8
34
|
export {
|
|
9
|
-
|
|
35
|
+
M as CheckoutSummaryCoupons
|
|
10
36
|
};
|
|
@@ -4,6 +4,8 @@ export { CheckoutSummaryAdjustments as Adjustments } from './components/Checkout
|
|
|
4
4
|
export type { CheckoutSummaryAdjustmentsProps } from './components/CheckoutSummaryAdjustments/CheckoutSummaryAdjustments';
|
|
5
5
|
export { CheckoutSummaryAgreements as Agreements } from './components/CheckoutSummaryAgreements/CheckoutSummaryAgreements';
|
|
6
6
|
export type { CheckoutSummaryAgreementsProps } from './components/CheckoutSummaryAgreements/CheckoutSummaryAgreements';
|
|
7
|
+
export { CheckoutSummaryCouponField as CouponField } from './components/CheckoutSummaryCouponField/CheckoutSummaryCouponField';
|
|
8
|
+
export type { CheckoutSummaryCouponFieldProps } from './components/CheckoutSummaryCouponField/CheckoutSummaryCouponField';
|
|
7
9
|
export { CheckoutSummaryCoupons as Coupons } from './components/CheckoutSummaryCoupons/CheckoutSummaryCoupons';
|
|
8
10
|
export type { CheckoutSummaryCouponsProps } from './components/CheckoutSummaryCoupons/CheckoutSummaryCoupons';
|
|
9
11
|
export { CheckoutSummaryFees as Fees } from './components/CheckoutSummaryFees/CheckoutSummaryFees';
|
|
@@ -1 +1 @@
|
|
|
1
|
-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