@afosto/checkout-ui 0.0.11 → 0.0.13
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/CheckoutForm/CheckoutForm.d.ts.map +1 -1
- package/dist/CheckoutForm/CheckoutForm.js +146 -132
- 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/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/analyticsEvents.d.ts +7 -0
- package/dist/constants/analyticsEvents.d.ts.map +1 -1
- package/dist/constants/index.js +8 -8
- 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/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 +1 -2
- 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/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":"CheckoutForm.d.ts","sourceRoot":"","sources":["../../src/CheckoutForm/CheckoutForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,KAAK,EACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,OAAO,CAAC;AAYzD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcxB,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EACtC,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,CAAC;IAC9D,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;CACrD;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,
|
|
1
|
+
{"version":3,"file":"CheckoutForm.d.ts","sourceRoot":"","sources":["../../src/CheckoutForm/CheckoutForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,KAAK,EACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,OAAO,CAAC;AAYzD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcxB,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EACtC,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,CAAC;IAC9D,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;CACrD;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,qDAyTpD,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { useCheckout as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { isDefined as
|
|
7
|
-
import { CheckoutFormSkeleton as
|
|
8
|
-
import { CheckoutSubmitButton as
|
|
9
|
-
import { CheckoutTermsAndPrivacyMessage as
|
|
10
|
-
import { getErrorMessage as
|
|
11
|
-
import { getValidationErrorMessage as
|
|
12
|
-
import { validationTranslations as
|
|
13
|
-
import { CheckoutErrorMessageAlert as
|
|
14
|
-
import { useGetLatest as
|
|
15
|
-
const
|
|
1
|
+
import { jsxs as p, jsx as u, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { Box as fe, MultiStepForm as he } from "@afosto/components";
|
|
3
|
+
import { useCheckout as ke } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
4
|
+
import { useEffect as ve } from "react";
|
|
5
|
+
import { createPortal as Le } from "react-dom";
|
|
6
|
+
import { isDefined as ge, camelize as xe, wait as ye } from "@afosto/utils";
|
|
7
|
+
import { CheckoutFormSkeleton as Pe } from "../CheckoutFormSkeleton/CheckoutFormSkeleton.js";
|
|
8
|
+
import { CheckoutSubmitButton as Ce } from "../CheckoutSubmitButton/CheckoutSubmitButton.js";
|
|
9
|
+
import { CheckoutTermsAndPrivacyMessage as E } from "../CheckoutTermsAndPrivacyMessage/CheckoutTermsAndPrivacyMessage.js";
|
|
10
|
+
import { getErrorMessage as we } from "../utils/getErrorMessage.js";
|
|
11
|
+
import { getValidationErrorMessage as Fe } from "../utils/getValidationErrorMessage.js";
|
|
12
|
+
import { validationTranslations as Me } from "../constants/validationTranslations.js";
|
|
13
|
+
import { CheckoutErrorMessageAlert as Te } from "../CheckoutErrorMessageAlert/CheckoutErrorMessageAlert.js";
|
|
14
|
+
import { useGetLatest as Be } from "@afosto/hooks";
|
|
15
|
+
const v = {
|
|
16
16
|
cancelLabel: "Back to webshop",
|
|
17
17
|
downPaymentSubmitLabel: "Pay deposit & order",
|
|
18
18
|
nextStepLabel: "To {stepLabel}",
|
|
@@ -24,74 +24,74 @@ const h = {
|
|
|
24
24
|
checkoutFailedTitle: "Could not proceed to payment",
|
|
25
25
|
checkoutFailedDescription: "Something went wrong while proceeding to the payment. Please try again."
|
|
26
26
|
},
|
|
27
|
-
validation:
|
|
28
|
-
},
|
|
27
|
+
validation: Me
|
|
28
|
+
}, Qe = (I) => {
|
|
29
29
|
const {
|
|
30
|
-
activeStep:
|
|
31
|
-
autoComplete:
|
|
32
|
-
defaultValues:
|
|
33
|
-
errorMessage:
|
|
34
|
-
formRef:
|
|
35
|
-
hideErrorMessage:
|
|
36
|
-
hideForm:
|
|
37
|
-
isLoading:
|
|
38
|
-
onNextStep:
|
|
39
|
-
onPreviousStep:
|
|
40
|
-
onCancel:
|
|
41
|
-
onSubmit:
|
|
42
|
-
steps:
|
|
43
|
-
submitLabel:
|
|
44
|
-
validationSchema:
|
|
45
|
-
translations:
|
|
46
|
-
sx:
|
|
47
|
-
...
|
|
48
|
-
} =
|
|
49
|
-
activeStep:
|
|
50
|
-
defaultValues:
|
|
51
|
-
checkout:
|
|
52
|
-
errorMessage:
|
|
53
|
-
formRef:
|
|
54
|
-
getNextStepLabel:
|
|
55
|
-
getPreviousStepLabel:
|
|
56
|
-
isLoading:
|
|
57
|
-
isProcessing:
|
|
58
|
-
nextStep:
|
|
59
|
-
previousStep:
|
|
60
|
-
setErrorMessage:
|
|
61
|
-
settings:
|
|
62
|
-
steps:
|
|
63
|
-
subStep:
|
|
64
|
-
submitButtonDisabled:
|
|
65
|
-
submitButtonPortalRef:
|
|
66
|
-
summary:
|
|
67
|
-
validationSchema:
|
|
30
|
+
activeStep: N,
|
|
31
|
+
autoComplete: A = "on",
|
|
32
|
+
defaultValues: R,
|
|
33
|
+
errorMessage: D,
|
|
34
|
+
formRef: L,
|
|
35
|
+
hideErrorMessage: V = !1,
|
|
36
|
+
hideForm: g = !1,
|
|
37
|
+
isLoading: O,
|
|
38
|
+
onNextStep: j,
|
|
39
|
+
onPreviousStep: z,
|
|
40
|
+
onCancel: m,
|
|
41
|
+
onSubmit: d,
|
|
42
|
+
steps: G,
|
|
43
|
+
submitLabel: b,
|
|
44
|
+
validationSchema: q,
|
|
45
|
+
translations: S = {},
|
|
46
|
+
sx: H = {},
|
|
47
|
+
...J
|
|
48
|
+
} = I, s = ke(), {
|
|
49
|
+
activeStep: K = 0,
|
|
50
|
+
defaultValues: Q = [],
|
|
51
|
+
checkout: U,
|
|
52
|
+
errorMessage: W,
|
|
53
|
+
formRef: X,
|
|
54
|
+
getNextStepLabel: Y,
|
|
55
|
+
getPreviousStepLabel: Z,
|
|
56
|
+
isLoading: _,
|
|
57
|
+
isProcessing: x,
|
|
58
|
+
nextStep: $,
|
|
59
|
+
previousStep: ee,
|
|
60
|
+
setErrorMessage: y,
|
|
61
|
+
settings: te,
|
|
62
|
+
steps: oe = [],
|
|
63
|
+
subStep: ne,
|
|
64
|
+
submitButtonDisabled: ae,
|
|
65
|
+
submitButtonPortalRef: P,
|
|
66
|
+
summary: re,
|
|
67
|
+
validationSchema: se,
|
|
68
68
|
translations: f = {},
|
|
69
|
-
track:
|
|
70
|
-
} =
|
|
71
|
-
...
|
|
69
|
+
track: h
|
|
70
|
+
} = s, { vendor: C } = te?.links ?? {}, t = {
|
|
71
|
+
...v,
|
|
72
72
|
...f?.checkoutForm || {},
|
|
73
|
-
...
|
|
73
|
+
...S || {},
|
|
74
74
|
feedback: {
|
|
75
|
-
...
|
|
75
|
+
...v.feedback,
|
|
76
76
|
...f?.checkoutForm?.feedback || {},
|
|
77
|
-
...
|
|
77
|
+
...S?.feedback || {}
|
|
78
78
|
},
|
|
79
79
|
validation: {
|
|
80
|
-
...
|
|
80
|
+
...v.validation,
|
|
81
81
|
...f?.validation || {},
|
|
82
|
-
...
|
|
82
|
+
...S?.validation || {}
|
|
83
83
|
}
|
|
84
|
-
},
|
|
85
|
-
let o = typeof e.nextLabel == "function" ? e.nextLabel({ ...
|
|
84
|
+
}, i = O ?? _, r = N ?? K, ie = R ?? Q, w = D ?? W, ce = j ?? $, ue = z ?? ee, le = q ?? se, c = (G ?? oe ?? []).map((e) => {
|
|
85
|
+
let o = typeof e.nextLabel == "function" ? e.nextLabel({ ...s, translations: t }) : e.nextLabel, a = typeof e.previousLabel == "function" ? e.previousLabel({ ...s, translations: t }) : e.previousLabel;
|
|
86
86
|
if (!o) {
|
|
87
|
-
const n =
|
|
87
|
+
const n = Y();
|
|
88
88
|
n && (o = t.nextStepLabel.replace(
|
|
89
89
|
"{stepLabel}",
|
|
90
90
|
n
|
|
91
91
|
));
|
|
92
92
|
}
|
|
93
93
|
if (!a) {
|
|
94
|
-
const n =
|
|
94
|
+
const n = Z();
|
|
95
95
|
n && (a = t.previousStepLabel.replace(
|
|
96
96
|
"{stepLabel}",
|
|
97
97
|
n
|
|
@@ -102,57 +102,71 @@ const h = {
|
|
|
102
102
|
nextLabel: o,
|
|
103
103
|
previousLabel: a
|
|
104
104
|
};
|
|
105
|
-
}),
|
|
106
|
-
summary:
|
|
107
|
-
steps:
|
|
108
|
-
track:
|
|
105
|
+
}), F = r === c.length - 1, M = c[r]?.component, T = Be({
|
|
106
|
+
summary: re,
|
|
107
|
+
steps: c,
|
|
108
|
+
track: h
|
|
109
109
|
});
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
ve(() => {
|
|
111
|
+
i || (() => {
|
|
112
112
|
const {
|
|
113
113
|
steps: o,
|
|
114
114
|
summary: a,
|
|
115
115
|
track: n
|
|
116
|
-
} =
|
|
116
|
+
} = T();
|
|
117
117
|
!n && typeof n != "function" || n("checkoutStep", {
|
|
118
|
-
step: o[
|
|
119
|
-
stepIndex:
|
|
118
|
+
step: o[r],
|
|
119
|
+
stepIndex: r + 1,
|
|
120
120
|
summary: a
|
|
121
121
|
});
|
|
122
122
|
})();
|
|
123
|
-
}, [
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
}, [r, i, T]);
|
|
124
|
+
const pe = async (e, o) => {
|
|
125
|
+
const a = c[r], n = r + 1, l = await ce(e, o, {
|
|
126
|
+
...s,
|
|
127
|
+
translations: t
|
|
128
|
+
});
|
|
129
|
+
return h("stepSubmitted", {
|
|
130
|
+
step: a,
|
|
131
|
+
stepIndex: n,
|
|
132
|
+
stepValues: e,
|
|
133
|
+
formData: o
|
|
134
|
+
}), l;
|
|
135
|
+
}, me = async (e) => ue(e, { ...s, translations: t }), de = () => {
|
|
131
136
|
if (m && typeof m == "function")
|
|
132
|
-
return m(
|
|
133
|
-
|
|
137
|
+
return m();
|
|
138
|
+
}, be = async (e, o) => {
|
|
139
|
+
const a = c[r], n = r + 1;
|
|
140
|
+
if (h("stepSubmitted", {
|
|
141
|
+
step: a,
|
|
142
|
+
stepIndex: n,
|
|
143
|
+
stepValues: e,
|
|
144
|
+
formData: o
|
|
145
|
+
}), d && typeof d == "function")
|
|
146
|
+
return d(e, o, {
|
|
147
|
+
...s,
|
|
134
148
|
translations: t
|
|
135
149
|
});
|
|
136
150
|
try {
|
|
137
|
-
await
|
|
138
|
-
} catch (
|
|
139
|
-
const
|
|
140
|
-
return
|
|
151
|
+
await U(), y(null), await ye(5e3);
|
|
152
|
+
} catch (l) {
|
|
153
|
+
const Se = we(l);
|
|
154
|
+
return y({
|
|
141
155
|
title: t.feedback?.checkoutFailedTitle,
|
|
142
|
-
description:
|
|
143
|
-
}), Promise.reject(
|
|
156
|
+
description: Se || t.feedback?.checkoutFailedDescription
|
|
157
|
+
}), Promise.reject(l);
|
|
144
158
|
}
|
|
145
|
-
},
|
|
146
|
-
const { summary: e } =
|
|
159
|
+
}, k = typeof b == "function" ? b({ ...s, translations: t }) : b ?? (() => {
|
|
160
|
+
const { summary: e } = s, { agreementTemplate: o } = e || {}, a = xe(
|
|
147
161
|
o?.type?.toLowerCase() || ""
|
|
148
162
|
);
|
|
149
163
|
return a === "downPayment" ? t.downPaymentSubmitLabel : ["cod", "postPaid"].includes(a) ? t.postPaidSubmitLabel : t.submitLabel;
|
|
150
164
|
})();
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
165
|
+
return /* @__PURE__ */ p(fe, { sx: g ? { display: "none" } : H, children: [
|
|
166
|
+
/* @__PURE__ */ p(
|
|
167
|
+
he,
|
|
154
168
|
{
|
|
155
|
-
...
|
|
169
|
+
...J,
|
|
156
170
|
actionsAlignment: "space-between",
|
|
157
171
|
actionsContainerProps: {
|
|
158
172
|
sx: {
|
|
@@ -161,71 +175,71 @@ const h = {
|
|
|
161
175
|
mt: 1
|
|
162
176
|
}
|
|
163
177
|
},
|
|
164
|
-
activeStep:
|
|
165
|
-
autoComplete:
|
|
178
|
+
activeStep: r,
|
|
179
|
+
autoComplete: A,
|
|
166
180
|
cancelLabel: t.cancelLabel,
|
|
167
181
|
defaultValues: ie,
|
|
168
182
|
formRef: [
|
|
169
|
-
|
|
170
|
-
...
|
|
183
|
+
X,
|
|
184
|
+
...L ? [L] : []
|
|
171
185
|
],
|
|
172
|
-
getErrorMessage:
|
|
173
|
-
hideActions:
|
|
174
|
-
onNextStep:
|
|
175
|
-
onPreviousStep:
|
|
176
|
-
onCancel:
|
|
177
|
-
onSubmit:
|
|
178
|
-
subStep:
|
|
179
|
-
steps:
|
|
186
|
+
getErrorMessage: Fe(t.validation),
|
|
187
|
+
hideActions: i,
|
|
188
|
+
onNextStep: pe,
|
|
189
|
+
onPreviousStep: me,
|
|
190
|
+
onCancel: de,
|
|
191
|
+
onSubmit: be,
|
|
192
|
+
subStep: ne,
|
|
193
|
+
steps: c,
|
|
180
194
|
cancelButtonProps: {
|
|
181
|
-
...
|
|
182
|
-
disabled:
|
|
195
|
+
...r === 0 && ge(C) ? { href: C } : {},
|
|
196
|
+
disabled: x,
|
|
183
197
|
size: "large"
|
|
184
198
|
},
|
|
185
199
|
submitButtonProps: {
|
|
186
|
-
disabled:
|
|
187
|
-
loading:
|
|
200
|
+
disabled: ae,
|
|
201
|
+
loading: x,
|
|
188
202
|
size: "large"
|
|
189
203
|
},
|
|
190
|
-
submitLabel:
|
|
204
|
+
submitLabel: k,
|
|
191
205
|
validationSchema: le,
|
|
192
206
|
children: [
|
|
193
|
-
!
|
|
194
|
-
|
|
207
|
+
!i && w && !V && /* @__PURE__ */ u(
|
|
208
|
+
Te,
|
|
195
209
|
{
|
|
196
|
-
errorMessage:
|
|
210
|
+
errorMessage: w,
|
|
197
211
|
sx: { mt: 1.5, mb: 3 }
|
|
198
212
|
}
|
|
199
213
|
),
|
|
200
|
-
!
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
!
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
!i && M && /* @__PURE__ */ p(B, { children: [
|
|
215
|
+
/* @__PURE__ */ u(M, {}),
|
|
216
|
+
!g && P.current && Le(
|
|
217
|
+
/* @__PURE__ */ p(B, { children: [
|
|
218
|
+
/* @__PURE__ */ u(Ce, { sx: { mt: 0.5 } }),
|
|
219
|
+
F && /* @__PURE__ */ u(
|
|
220
|
+
E,
|
|
207
221
|
{
|
|
208
|
-
submitLabel:
|
|
222
|
+
submitLabel: k,
|
|
209
223
|
sx: { mt: 3 }
|
|
210
224
|
}
|
|
211
225
|
)
|
|
212
226
|
] }),
|
|
213
|
-
|
|
227
|
+
P.current
|
|
214
228
|
)
|
|
215
229
|
] }),
|
|
216
|
-
|
|
230
|
+
i && /* @__PURE__ */ u(Pe, {})
|
|
217
231
|
]
|
|
218
232
|
}
|
|
219
233
|
),
|
|
220
|
-
|
|
221
|
-
|
|
234
|
+
F && /* @__PURE__ */ u(
|
|
235
|
+
E,
|
|
222
236
|
{
|
|
223
|
-
submitLabel:
|
|
237
|
+
submitLabel: k,
|
|
224
238
|
sx: { display: { md: "none" }, mt: 3, textAlign: "center" }
|
|
225
239
|
}
|
|
226
240
|
)
|
|
227
241
|
] });
|
|
228
242
|
};
|
|
229
243
|
export {
|
|
230
|
-
|
|
244
|
+
Qe as CheckoutForm
|
|
231
245
|
};
|
|
@@ -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"}
|