@afosto/checkout-ui 0.0.12 → 0.0.14
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/CheckoutAddressFields/CheckoutAddressFields.d.ts +2 -0
- package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts.map +1 -1
- package/dist/CheckoutAddressFields/CheckoutAddressFields.js +155 -130
- package/dist/CheckoutAddressSection/CheckoutAddressSection.d.ts +6 -2
- package/dist/CheckoutAddressSection/CheckoutAddressSection.d.ts.map +1 -1
- package/dist/CheckoutAddressSection/CheckoutAddressSection.js +82 -71
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts.map +1 -1
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +32 -29
- package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.d.ts.map +1 -1
- package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.js +21 -21
- package/dist/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.d.ts.map +1 -1
- package/dist/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.js +38 -35
- package/dist/CheckoutInformationStep/CheckoutInformationStep.d.ts +0 -2
- package/dist/CheckoutInformationStep/CheckoutInformationStep.d.ts.map +1 -1
- package/dist/CheckoutInformationStep/CheckoutInformationStep.js +30 -37
- package/dist/CheckoutPaymentStep/CheckoutPaymentStep.d.ts.map +1 -1
- package/dist/CheckoutPaymentStep/CheckoutPaymentStep.js +15 -15
- package/dist/CheckoutReviewPaymentSection/CheckoutReviewPaymentSection.d.ts.map +1 -1
- package/dist/CheckoutReviewPaymentSection/CheckoutReviewPaymentSection.js +19 -19
- package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
- package/dist/CheckoutSummary/CheckoutSummary.js +23 -23
- package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.d.ts.map +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js +35 -28
- package/dist/constants/addressDefaultValues.d.ts +1 -0
- package/dist/constants/addressDefaultValues.d.ts.map +1 -1
- package/dist/constants/addressDefaultValues.js +1 -0
- package/dist/constants/addressFields.d.ts.map +1 -1
- package/dist/constants/addressFields.js +6 -5
- package/dist/constants/addressValidationSchema.d.ts +10 -2
- package/dist/constants/addressValidationSchema.d.ts.map +1 -1
- package/dist/constants/addressValidationSchema.js +58 -46
- package/dist/constants/index.js +8 -8
- package/dist/fragments/CoreCartProjectionFields.d.ts +8 -1
- package/dist/fragments/CoreCartProjectionFields.d.ts.map +1 -1
- package/dist/fragments/CoreCartProjectionFields.js +8 -1
- package/dist/fragments/CoreOrderProjectionFields.d.ts +8 -1
- package/dist/fragments/CoreOrderProjectionFields.d.ts.map +1 -1
- package/dist/fragments/CoreOrderProjectionFields.js +8 -1
- package/dist/hooks/useCheckoutAddressOptions.d.ts +3 -1
- package/dist/hooks/useCheckoutAddressOptions.d.ts.map +1 -1
- package/dist/hooks/useCheckoutAddressOptions.js +64 -57
- package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
- package/dist/hooks/useCheckoutForm.d.ts.map +1 -1
- package/dist/hooks/useCheckoutForm.js +45 -41
- package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -428
- package/dist/operations/cartOperations.d.ts.map +1 -1
- package/dist/operations/cartOperations.js +120 -108
- package/dist/operations/orderOperations.d.ts.map +1 -1
- package/dist/operations/orderOperations.js +123 -111
- package/dist/queries/getCartInitialPaymentStepQuery.d.ts +4 -0
- package/dist/queries/getCartInitialPaymentStepQuery.d.ts.map +1 -1
- package/dist/queries/getCartInitialPaymentStepQuery.js +10 -2
- package/dist/queries/getOrderInitialPaymentStepQuery.d.ts +4 -0
- package/dist/queries/getOrderInitialPaymentStepQuery.d.ts.map +1 -1
- package/dist/queries/getOrderInitialPaymentStepQuery.js +11 -3
- package/dist/steps/informationStep.d.ts +0 -1
- package/dist/steps/informationStep.d.ts.map +1 -1
- package/dist/steps/informationStep.js +234 -238
- package/dist/types.d.ts +13 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/createAddressValidationSchema.d.ts +4 -1
- package/dist/utils/createAddressValidationSchema.d.ts.map +1 -1
- package/dist/utils/createAddressValidationSchema.js +8 -8
- package/dist/utils/formatCurrency.d.ts +2 -0
- package/dist/utils/formatCurrency.d.ts.map +1 -0
- package/dist/utils/formatCurrency.js +14 -0
- package/package.json +1 -1
- package/dist/CheckoutSalutationSection/CheckoutSalutationSection.d.ts +0 -13
- package/dist/CheckoutSalutationSection/CheckoutSalutationSection.d.ts.map +0 -1
- package/dist/CheckoutSalutationSection/CheckoutSalutationSection.js +0 -26
- package/dist/CheckoutSalutationSection/index.d.ts +0 -3
- package/dist/CheckoutSalutationSection/index.d.ts.map +0 -1
- package/dist/CheckoutSalutationSection/index.js +0 -4
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFormContext as
|
|
3
|
-
import { CheckoutAddressCard as
|
|
4
|
-
import { CheckoutSection as
|
|
5
|
-
import { CheckoutSectionHeader as
|
|
6
|
-
import { CheckoutAddressFields as
|
|
7
|
-
import { string as e, object as
|
|
8
|
-
import { useState as
|
|
9
|
-
import { isDefined as
|
|
10
|
-
import { useCheckout as
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as B, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext as H, Collapse as b } from "@afosto/components";
|
|
3
|
+
import { CheckoutAddressCard as O } from "../CheckoutAddressCard/CheckoutAddressCard.js";
|
|
4
|
+
import { CheckoutSection as R } from "../CheckoutSection/CheckoutSection.js";
|
|
5
|
+
import { CheckoutSectionHeader as $ } from "../CheckoutSectionHeader/CheckoutSectionHeader.js";
|
|
6
|
+
import { CheckoutAddressFields as z } from "../CheckoutAddressFields/CheckoutAddressFields.js";
|
|
7
|
+
import { string as e, object as y } from "yup";
|
|
8
|
+
import { useState as I, useEffect as Z } from "react";
|
|
9
|
+
import { isDefined as G } from "@afosto/utils";
|
|
10
|
+
import { useCheckout as J } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
11
|
+
const K = (r) => {
|
|
12
|
+
const { isSalutationRequired: o = !1, salutation: i = !1 } = r || {};
|
|
13
|
+
return {
|
|
14
|
+
...i ? {
|
|
15
|
+
salutation: o ? e().required() : e().nullable()
|
|
16
|
+
} : {},
|
|
17
|
+
givenName: e().required(),
|
|
18
|
+
additionalName: e().nullable(),
|
|
19
|
+
familyName: e().required(),
|
|
20
|
+
country: y().nullable().required(),
|
|
21
|
+
postalCode: e(),
|
|
22
|
+
premiseNumber: e().numbersOnly(),
|
|
23
|
+
premiseNumberSuffix: e().maxLength(15),
|
|
24
|
+
addressLine1: e(),
|
|
25
|
+
addressLine2: e(),
|
|
26
|
+
administrativeArea: y().nullable(),
|
|
27
|
+
thoroughfare: e(),
|
|
28
|
+
locality: e()
|
|
29
|
+
};
|
|
30
|
+
}, Q = {
|
|
25
31
|
addressFields: {
|
|
26
32
|
additionalName: "Prefix",
|
|
27
33
|
addressLine2: "Address line 2",
|
|
@@ -36,83 +42,88 @@ const Z = {
|
|
|
36
42
|
premiseNumber: "House number",
|
|
37
43
|
premiseNumberSuffix: "Suffix",
|
|
38
44
|
province: "Province",
|
|
45
|
+
salutation: "Salutation",
|
|
46
|
+
salutationMr: "Mr.",
|
|
47
|
+
salutationMrs: "Ms.",
|
|
39
48
|
state: "State",
|
|
40
49
|
suburb: "Suburb",
|
|
41
50
|
thoroughfare: "Street",
|
|
42
51
|
zip: "ZIP code"
|
|
43
52
|
}
|
|
44
|
-
},
|
|
53
|
+
}, de = (r) => {
|
|
45
54
|
const {
|
|
46
|
-
address:
|
|
47
|
-
addressCardProps:
|
|
48
|
-
availableCountryCodes:
|
|
49
|
-
canEdit:
|
|
50
|
-
checkFieldsState:
|
|
51
|
-
children:
|
|
55
|
+
address: o,
|
|
56
|
+
addressCardProps: i = {},
|
|
57
|
+
availableCountryCodes: F = [],
|
|
58
|
+
canEdit: g = !0,
|
|
59
|
+
checkFieldsState: k = !1,
|
|
60
|
+
children: v,
|
|
52
61
|
name: s,
|
|
53
62
|
onChangeCountry: A,
|
|
54
|
-
onChangeValidationSchema:
|
|
55
|
-
showAddressCard:
|
|
63
|
+
onChangeValidationSchema: w,
|
|
64
|
+
showAddressCard: n,
|
|
56
65
|
showOrganisationField: N = !1,
|
|
57
|
-
title:
|
|
58
|
-
translations:
|
|
59
|
-
validationSchema:
|
|
60
|
-
...
|
|
61
|
-
} =
|
|
62
|
-
|
|
63
|
-
), { translations:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
title: l,
|
|
67
|
+
translations: c = {},
|
|
68
|
+
validationSchema: x,
|
|
69
|
+
...P
|
|
70
|
+
} = r, [u, a] = I(
|
|
71
|
+
n ?? !1
|
|
72
|
+
), { settings: m, translations: h } = J(), { isSalutationRequired: q = !1, salutation: E = !1 } = m || {}, { clearErrors: f, setValue: d, trigger: p, watch: L } = H(), [T] = L([s]), V = o ?? T, C = k && !G(n), M = !!E, j = x ?? K(m);
|
|
73
|
+
Z(() => {
|
|
74
|
+
C ? (async () => {
|
|
66
75
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
76
|
+
const S = await p(s);
|
|
77
|
+
f(s), S || d(`${s}.isDirty`, !0), a(S);
|
|
69
78
|
} catch {
|
|
70
|
-
|
|
79
|
+
a(!1);
|
|
71
80
|
}
|
|
72
|
-
})() :
|
|
73
|
-
}, [
|
|
74
|
-
const
|
|
75
|
-
...
|
|
76
|
-
...
|
|
81
|
+
})() : a(!1);
|
|
82
|
+
}, [f, s, d, C, p]);
|
|
83
|
+
const D = {
|
|
84
|
+
...h?.addressSection || {},
|
|
85
|
+
...c || {},
|
|
77
86
|
addressFields: {
|
|
78
|
-
...
|
|
79
|
-
...
|
|
80
|
-
...
|
|
87
|
+
...Q.addressFields || {},
|
|
88
|
+
...h?.addressFields || {},
|
|
89
|
+
...c?.addressFields || {}
|
|
81
90
|
}
|
|
82
91
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
92
|
+
return /* @__PURE__ */ B(R, { ...P, children: [
|
|
93
|
+
/* @__PURE__ */ t($, { title: l }),
|
|
94
|
+
/* @__PURE__ */ t(b, { in: u, children: /* @__PURE__ */ t(
|
|
95
|
+
O,
|
|
87
96
|
{
|
|
88
|
-
address:
|
|
89
|
-
canEdit:
|
|
97
|
+
address: V,
|
|
98
|
+
canEdit: g,
|
|
90
99
|
onEdit: () => {
|
|
91
|
-
|
|
100
|
+
a(!1), d(`${s}.isDirty`, !0);
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
103
|
) }),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
104
|
+
/* @__PURE__ */ t(b, { in: !u, children: /* @__PURE__ */ t(
|
|
105
|
+
z,
|
|
97
106
|
{
|
|
98
107
|
addressCardProps: {
|
|
99
108
|
editComponentType: "link",
|
|
100
|
-
...
|
|
109
|
+
...i
|
|
101
110
|
},
|
|
102
111
|
name: s,
|
|
103
|
-
title:
|
|
104
|
-
availableCountryCodes:
|
|
105
|
-
fieldLabels:
|
|
112
|
+
title: l,
|
|
113
|
+
availableCountryCodes: F,
|
|
114
|
+
fieldLabels: D.addressFields,
|
|
115
|
+
isSalutationRequired: q,
|
|
106
116
|
onChangeCountry: A,
|
|
107
|
-
onChangeValidationSchema:
|
|
117
|
+
onChangeValidationSchema: w,
|
|
108
118
|
showOrganisationField: N,
|
|
109
|
-
|
|
119
|
+
showSalutationField: M,
|
|
120
|
+
validationSchema: j
|
|
110
121
|
}
|
|
111
122
|
) }),
|
|
112
|
-
|
|
123
|
+
v
|
|
113
124
|
] });
|
|
114
125
|
};
|
|
115
126
|
export {
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
de as CheckoutAddressSection,
|
|
128
|
+
K as getBaseAddressValidationSchema
|
|
118
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutAgreementOptionCondition.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oCAAoC,EACpC,WAAW,EACZ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckoutAgreementOptionCondition.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oCAAoC,EACpC,WAAW,EACZ,MAAM,UAAU,CAAC;AAOlB,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAEF,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oCAAoC,CAAC;IAChD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,gCAAgC,GAC3C,OAAO,qCAAqC,qDA2E7C,CAAC"}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Box as
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Box as c, Typography as m } from "@afosto/components";
|
|
3
3
|
import { TurnDownRightSolid as g } from "../icons/TurnDownRightSolid.js";
|
|
4
|
-
import { CheckoutCurrency as
|
|
5
|
-
import { camelize as
|
|
6
|
-
import { useCheckout as
|
|
7
|
-
|
|
4
|
+
import { CheckoutCurrency as C } from "../CheckoutCurrency/CheckoutCurrency.js";
|
|
5
|
+
import { camelize as x } from "@afosto/utils";
|
|
6
|
+
import { useCheckout as v } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
7
|
+
import { formatCurrency as D } from "../utils/formatCurrency.js";
|
|
8
|
+
const w = {
|
|
8
9
|
payImmediately: "Pay immediately",
|
|
9
10
|
paymentOnDelivery: "Payment on delivery",
|
|
10
11
|
withinDaysOfTheInvoiceDate: "Within {days} days of the invoice date"
|
|
11
|
-
},
|
|
12
|
+
}, S = (y) => {
|
|
12
13
|
const {
|
|
13
|
-
condition:
|
|
14
|
-
currency:
|
|
15
|
-
locale:
|
|
16
|
-
translations:
|
|
17
|
-
} =
|
|
18
|
-
...
|
|
14
|
+
condition: e,
|
|
15
|
+
currency: i,
|
|
16
|
+
locale: r,
|
|
17
|
+
translations: l = {}
|
|
18
|
+
} = y, { settings: p, translations: d } = v(), { currency: u } = p || {}, n = {
|
|
19
|
+
...w,
|
|
19
20
|
...d.agreementOptionConditions || {},
|
|
20
|
-
...
|
|
21
|
-
},
|
|
22
|
-
let
|
|
23
|
-
return
|
|
21
|
+
...l || {}
|
|
22
|
+
}, o = x(e.type?.toLowerCase() || ""), f = e.outcome?.amount || 0;
|
|
23
|
+
let t = e.type;
|
|
24
|
+
return o === "downPayment" && e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 && e.amount < 100 ? ` (${e.amount}%)` : ""}`), o === "downPayment" && !e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 ? ` (${D(e.amount / 100, r, {
|
|
25
|
+
currency: i || u
|
|
26
|
+
})})` : ""}`), o === "postPaid" && (t = n.withinDaysOfTheInvoiceDate.replace(
|
|
24
27
|
"{days}",
|
|
25
|
-
|
|
26
|
-
)),
|
|
27
|
-
|
|
28
|
+
e.pastDueAfter.toString()
|
|
29
|
+
)), o === "cod" && (t = n.paymentOnDelivery), /* @__PURE__ */ s(
|
|
30
|
+
c,
|
|
28
31
|
{
|
|
29
32
|
sx: {
|
|
30
33
|
display: "flex",
|
|
@@ -33,21 +36,21 @@ const D = {
|
|
|
33
36
|
justifyContent: "space-between"
|
|
34
37
|
},
|
|
35
38
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ s(c, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
|
|
40
|
+
/* @__PURE__ */ a(
|
|
38
41
|
g,
|
|
39
42
|
{
|
|
40
43
|
sx: { color: (h) => h.palette.gray[400], fontSize: 16 }
|
|
41
44
|
}
|
|
42
45
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ a(m, { children: t })
|
|
44
47
|
] }),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
48
|
+
/* @__PURE__ */ a(m, { fontWeight: 500, children: /* @__PURE__ */ a(
|
|
49
|
+
C,
|
|
47
50
|
{
|
|
48
|
-
currency:
|
|
49
|
-
locale:
|
|
50
|
-
value:
|
|
51
|
+
currency: i,
|
|
52
|
+
locale: r,
|
|
53
|
+
value: f / 100
|
|
51
54
|
}
|
|
52
55
|
) })
|
|
53
56
|
]
|
|
@@ -55,5 +58,5 @@ const D = {
|
|
|
55
58
|
);
|
|
56
59
|
};
|
|
57
60
|
export {
|
|
58
|
-
|
|
61
|
+
S as CheckoutAgreementOptionCondition
|
|
59
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutAgreementsTimeline.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMtE,QAAA,MAAM,mBAAmB;;;;;;;CAOxB,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,wBAAwB,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,0BAA0B,GACrC,OAAO,+BAA+B,
|
|
1
|
+
{"version":3,"file":"CheckoutAgreementsTimeline.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMtE,QAAA,MAAM,mBAAmB;;;;;;;CAOxB,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,wBAAwB,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,0BAA0B,GACrC,OAAO,+BAA+B,qDAiQvC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { Card as j, Timeline as A, TimelineItem as p, TimelineSeparator as
|
|
2
|
+
import { Card as j, Timeline as A, TimelineItem as p, TimelineSeparator as m, TimelineDot as h, TimelineConnector as P, TimelineContent as u, Box as y, Typography as i } from "@afosto/components";
|
|
3
3
|
import { camelize as g } from "@afosto/utils";
|
|
4
4
|
import { CheckoutCurrency as f } from "../CheckoutCurrency/CheckoutCurrency.js";
|
|
5
5
|
import { useCheckout as L } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
@@ -27,14 +27,14 @@ const S = {
|
|
|
27
27
|
), b = (C || []).filter(
|
|
28
28
|
(e) => g(e.type?.toLowerCase() || "") !== "downPayment"
|
|
29
29
|
), l = w.reduce(
|
|
30
|
-
(e, o) => e + o.amount,
|
|
30
|
+
(e, o) => e + (o.outcome?.amount || 0),
|
|
31
31
|
0
|
|
32
32
|
);
|
|
33
33
|
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ n(A, { sx: { m: 0, p: 2.5 }, children: [
|
|
34
34
|
r > 0 && r < l && /* @__PURE__ */ n(p, { sx: { minHeight: 40 }, children: [
|
|
35
|
-
/* @__PURE__ */ n(
|
|
35
|
+
/* @__PURE__ */ n(m, { children: [
|
|
36
36
|
/* @__PURE__ */ t(
|
|
37
|
-
|
|
37
|
+
h,
|
|
38
38
|
{
|
|
39
39
|
sx: {
|
|
40
40
|
width: 16,
|
|
@@ -59,8 +59,8 @@ const S = {
|
|
|
59
59
|
}
|
|
60
60
|
)
|
|
61
61
|
] }),
|
|
62
|
-
/* @__PURE__ */ t(
|
|
63
|
-
|
|
62
|
+
/* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
|
|
63
|
+
y,
|
|
64
64
|
{
|
|
65
65
|
sx: {
|
|
66
66
|
display: "flex",
|
|
@@ -87,15 +87,15 @@ const S = {
|
|
|
87
87
|
{
|
|
88
88
|
sx: { minHeight: 64 },
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */ n(
|
|
90
|
+
/* @__PURE__ */ n(m, { children: [
|
|
91
91
|
/* @__PURE__ */ t(
|
|
92
|
-
|
|
92
|
+
h,
|
|
93
93
|
{
|
|
94
94
|
sx: {
|
|
95
95
|
width: 16,
|
|
96
96
|
height: 16,
|
|
97
97
|
my: 0.5,
|
|
98
|
-
...r < e.amount ? {
|
|
98
|
+
...r < (e.outcome?.amount || 0) ? {
|
|
99
99
|
backgroundColor: "transparent",
|
|
100
100
|
borderColor: (o) => o.palette.success[500],
|
|
101
101
|
position: "relative",
|
|
@@ -117,7 +117,7 @@ const S = {
|
|
|
117
117
|
backgroundColor: (o) => o.palette.success[500]
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
-
children: r >= e.amount && /* @__PURE__ */ t(x, {})
|
|
120
|
+
children: r >= (e.outcome?.amount || 0) && /* @__PURE__ */ t(x, {})
|
|
121
121
|
}
|
|
122
122
|
),
|
|
123
123
|
/* @__PURE__ */ t(
|
|
@@ -130,8 +130,8 @@ const S = {
|
|
|
130
130
|
}
|
|
131
131
|
)
|
|
132
132
|
] }),
|
|
133
|
-
/* @__PURE__ */ t(
|
|
134
|
-
|
|
133
|
+
/* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
|
|
134
|
+
y,
|
|
135
135
|
{
|
|
136
136
|
sx: {
|
|
137
137
|
display: "flex",
|
|
@@ -149,7 +149,7 @@ const S = {
|
|
|
149
149
|
{
|
|
150
150
|
currency: c,
|
|
151
151
|
locale: d,
|
|
152
|
-
value: e.amount / 100
|
|
152
|
+
value: (e.outcome?.amount || 0) / 100
|
|
153
153
|
}
|
|
154
154
|
) })
|
|
155
155
|
]
|
|
@@ -168,11 +168,11 @@ const S = {
|
|
|
168
168
|
{
|
|
169
169
|
sx: { minHeight: b.length - 1 === o ? 48 : 64 },
|
|
170
170
|
children: [
|
|
171
|
-
/* @__PURE__ */ t(
|
|
172
|
-
|
|
171
|
+
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(
|
|
172
|
+
h,
|
|
173
173
|
{
|
|
174
174
|
sx: {
|
|
175
|
-
...r >= l && r < l + e.amount ? {
|
|
175
|
+
...r >= l && r < l + (e.outcome?.amount || 0) ? {
|
|
176
176
|
backgroundColor: "transparent",
|
|
177
177
|
borderColor: (s) => s.palette.success[500],
|
|
178
178
|
position: "relative",
|
|
@@ -190,7 +190,7 @@ const S = {
|
|
|
190
190
|
borderRadius: "50%"
|
|
191
191
|
}
|
|
192
192
|
} : {},
|
|
193
|
-
...r >= l + e.amount ? {
|
|
193
|
+
...r >= l + (e.outcome?.amount || 0) ? {
|
|
194
194
|
display: "flex",
|
|
195
195
|
alignItems: "center",
|
|
196
196
|
justifyContent: "center",
|
|
@@ -208,11 +208,11 @@ const S = {
|
|
|
208
208
|
my: 1
|
|
209
209
|
} : {}
|
|
210
210
|
},
|
|
211
|
-
children: r >= l + e.amount && /* @__PURE__ */ t(x, {})
|
|
211
|
+
children: r >= l + (e.outcome?.amount || 0) && /* @__PURE__ */ t(x, {})
|
|
212
212
|
}
|
|
213
213
|
) }),
|
|
214
|
-
/* @__PURE__ */ t(
|
|
215
|
-
|
|
214
|
+
/* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
|
|
215
|
+
y,
|
|
216
216
|
{
|
|
217
217
|
sx: {
|
|
218
218
|
display: "flex",
|
|
@@ -230,7 +230,7 @@ const S = {
|
|
|
230
230
|
{
|
|
231
231
|
currency: c,
|
|
232
232
|
locale: d,
|
|
233
|
-
value: e.amount / 100
|
|
233
|
+
value: (e.outcome?.amount || 0) / 100
|
|
234
234
|
}
|
|
235
235
|
) })
|
|
236
236
|
]
|
package/dist/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutDownPaymentAgreementsSummary.d.ts","sourceRoot":"","sources":["../../src/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckoutDownPaymentAgreementsSummary.d.ts","sourceRoot":"","sources":["../../src/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKtE,QAAA,MAAM,mBAAmB;;CAExB,CAAC;AAEF,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,oCAAoC,GAC/C,OAAO,yCAAyC,4DA0DjD,CAAC"}
|
|
@@ -1,57 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { useCheckout as
|
|
4
|
-
import { TurnDownRightSolid as
|
|
5
|
-
import { CheckoutCurrency as
|
|
6
|
-
|
|
1
|
+
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { Box as e, Typography as s } from "@afosto/components";
|
|
3
|
+
import { useCheckout as f } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
4
|
+
import { TurnDownRightSolid as h } from "../icons/TurnDownRightSolid.js";
|
|
5
|
+
import { CheckoutCurrency as x } from "../CheckoutCurrency/CheckoutCurrency.js";
|
|
6
|
+
import { formatCurrency as g } from "../utils/formatCurrency.js";
|
|
7
|
+
const C = {
|
|
7
8
|
payImmediately: "Pay immediately"
|
|
8
|
-
},
|
|
9
|
+
}, b = (c) => {
|
|
9
10
|
const {
|
|
10
|
-
currency:
|
|
11
|
-
locale:
|
|
12
|
-
downPaymentAgreements:
|
|
13
|
-
translations:
|
|
14
|
-
} =
|
|
15
|
-
...
|
|
16
|
-
...
|
|
17
|
-
...
|
|
11
|
+
currency: n,
|
|
12
|
+
locale: a,
|
|
13
|
+
downPaymentAgreements: i = [],
|
|
14
|
+
translations: l = {}
|
|
15
|
+
} = c || {}, { settings: m, translations: y } = f(), { currency: p } = m || {}, u = {
|
|
16
|
+
...C,
|
|
17
|
+
...y?.downPaymentsSummary || {},
|
|
18
|
+
...l || {}
|
|
18
19
|
};
|
|
19
|
-
return
|
|
20
|
-
|
|
20
|
+
return i.length ? /* @__PURE__ */ o(
|
|
21
|
+
e,
|
|
21
22
|
{
|
|
22
23
|
sx: {
|
|
23
|
-
borderBottom: (
|
|
24
|
-
borderTop: (
|
|
24
|
+
borderBottom: (t) => `1px solid ${t.palette.divider}`,
|
|
25
|
+
borderTop: (t) => `1px solid ${t.palette.divider}`,
|
|
25
26
|
my: 2.5,
|
|
26
27
|
py: 2.5
|
|
27
28
|
},
|
|
28
|
-
children:
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
29
|
+
children: i.map((t) => /* @__PURE__ */ r(e, { display: "flex", justifyContent: "space-between", children: [
|
|
30
|
+
/* @__PURE__ */ r(e, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
|
|
31
|
+
/* @__PURE__ */ o(
|
|
32
|
+
h,
|
|
32
33
|
{
|
|
33
|
-
sx: { color: (
|
|
34
|
+
sx: { color: (d) => d.palette.gray[400], fontSize: 16 }
|
|
34
35
|
}
|
|
35
36
|
),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
37
|
+
/* @__PURE__ */ r(s, { color: "gray.800", children: [
|
|
38
|
+
u.payImmediately,
|
|
38
39
|
" (",
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
t.isPercentage ? `${t.amount}%` : g(t.amount / 100, a, {
|
|
41
|
+
currency: n || p
|
|
42
|
+
}),
|
|
43
|
+
")"
|
|
41
44
|
] })
|
|
42
45
|
] }),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
46
|
+
/* @__PURE__ */ o(s, { color: "gray.800", fontWeight: 500, children: /* @__PURE__ */ o(
|
|
47
|
+
x,
|
|
45
48
|
{
|
|
46
|
-
currency:
|
|
47
|
-
locale:
|
|
48
|
-
value:
|
|
49
|
+
currency: n,
|
|
50
|
+
locale: a,
|
|
51
|
+
value: (t.outcome?.amount || 0) / 100
|
|
49
52
|
}
|
|
50
53
|
) })
|
|
51
|
-
] },
|
|
54
|
+
] }, t.type))
|
|
52
55
|
}
|
|
53
56
|
) : null;
|
|
54
57
|
};
|
|
55
58
|
export {
|
|
56
|
-
|
|
59
|
+
b as CheckoutDownPaymentAgreementsSummary
|
|
57
60
|
};
|
|
@@ -4,14 +4,12 @@ import { CheckoutBusinessInformationSectionProps } from '../CheckoutBusinessInfo
|
|
|
4
4
|
import { CheckoutShippingAddressSectionProps } from '../CheckoutShippingAddressSection/CheckoutShippingAddressSection';
|
|
5
5
|
import { CheckoutBillingAddressSectionProps } from '../CheckoutBillingAddressSection/CheckoutBillingAddressSection';
|
|
6
6
|
import { CheckoutExpressCheckoutSectionProps } from '../CheckoutExpressCheckoutSection/CheckoutExpressCheckoutSection';
|
|
7
|
-
import { CheckoutSalutationSectionProps } from '../CheckoutSalutationSection/CheckoutSalutationSection';
|
|
8
7
|
export interface CheckoutInformationStepProps {
|
|
9
8
|
translations?: {
|
|
10
9
|
billingAddressSection?: CheckoutBillingAddressSectionProps['translations'];
|
|
11
10
|
businessInformationSection?: CheckoutBusinessInformationSectionProps['translations'];
|
|
12
11
|
contactInformationSection?: CheckoutContactInformationSectionProps['translations'];
|
|
13
12
|
expressCheckoutSection?: CheckoutExpressCheckoutSectionProps['translations'];
|
|
14
|
-
salutationSection?: CheckoutSalutationSectionProps['translations'];
|
|
15
13
|
shippingAddressSection?: CheckoutShippingAddressSectionProps['translations'];
|
|
16
14
|
typeSection?: CheckoutTypeSectionProps['translations'];
|
|
17
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutInformationStep.d.ts","sourceRoot":"","sources":["../../src/CheckoutInformationStep/CheckoutInformationStep.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sCAAsC,EAC5C,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckoutInformationStep.d.ts","sourceRoot":"","sources":["../../src/CheckoutInformationStep/CheckoutInformationStep.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sCAAsC,EAC5C,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,kEAAkE,CAAC;AAE1E,MAAM,WAAW,4BAA4B;IAC3C,YAAY,CAAC,EAAE;QACb,qBAAqB,CAAC,EAAE,kCAAkC,CAAC,cAAc,CAAC,CAAC;QAC3E,0BAA0B,CAAC,EAAE,uCAAuC,CAAC,cAAc,CAAC,CAAC;QACrF,yBAAyB,CAAC,EAAE,sCAAsC,CAAC,cAAc,CAAC,CAAC;QACnF,sBAAsB,CAAC,EAAE,mCAAmC,CAAC,cAAc,CAAC,CAAC;QAC7E,sBAAsB,CAAC,EAAE,mCAAmC,CAAC,cAAc,CAAC,CAAC;QAC7E,WAAW,CAAC,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;KACxD,CAAC;CACH;AAED,eAAO,MAAM,uBAAuB,GAClC,OAAO,4BAA4B,qDAmDpC,CAAC"}
|