@afosto/checkout-ui 0.0.12 → 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/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/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
|
@@ -7,10 +7,12 @@ export interface CheckoutAddressFieldsProps {
|
|
|
7
7
|
alwaysShowAddressLineFields?: boolean;
|
|
8
8
|
availableCountryCodes: string[];
|
|
9
9
|
fieldLabels?: Record<string, string>;
|
|
10
|
+
isSalutationRequired?: boolean;
|
|
10
11
|
name: string;
|
|
11
12
|
onChangeCountry?: (event: SyntheticEvent<Element, Event>, country: CountryOption | null) => void;
|
|
12
13
|
onChangeValidationSchema?: OnChangeValidationSchema;
|
|
13
14
|
showOrganisationField?: boolean;
|
|
15
|
+
showSalutationField?: boolean;
|
|
14
16
|
title: string;
|
|
15
17
|
validationSchema: object;
|
|
16
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutAddressFields.d.ts","sourceRoot":"","sources":["../../src/CheckoutAddressFields/CheckoutAddressFields.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckoutAddressFields.d.ts","sourceRoot":"","sources":["../../src/CheckoutAddressFields/CheckoutAddressFields.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AACf,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4CAA4C,CAAC;AAYpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;IAC5C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,CAChB,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EACrC,OAAO,EAAE,aAAa,GAAG,IAAI,KAC1B,IAAI,CAAC;IACV,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDAwetE,CAAC"}
|
|
@@ -1,78 +1,82 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useFormContext as
|
|
4
|
-
import { isDefined as
|
|
5
|
-
import { CheckoutAddressCard as
|
|
6
|
-
import { calculateBreakpointsForAddressFields as
|
|
7
|
-
import { useCheckoutAddressOptions as
|
|
8
|
-
import { useCheckoutAutocompleteAddress as
|
|
9
|
-
import { useCheckoutAddressFieldFormats as
|
|
10
|
-
import { ADDRESS_FIELD_TYPE_MAPPING as
|
|
11
|
-
const
|
|
1
|
+
import { jsxs as p, Fragment as M, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as F, useEffect as k, useCallback as Ce } from "react";
|
|
3
|
+
import { useFormContext as Ae, Fields as r, Grid as d, Typography as Fe, Collapse as B, Box as ge } from "@afosto/components";
|
|
4
|
+
import { isDefined as R, capitalize as I, decamelize as G, camelize as j } from "@afosto/utils";
|
|
5
|
+
import { CheckoutAddressCard as Se } from "../CheckoutAddressCard/CheckoutAddressCard.js";
|
|
6
|
+
import { calculateBreakpointsForAddressFields as ye } from "../utils/calculateBreakpointsForAddressFields.js";
|
|
7
|
+
import { useCheckoutAddressOptions as xe } from "../hooks/useCheckoutAddressOptions.js";
|
|
8
|
+
import { useCheckoutAutocompleteAddress as be } from "../hooks/useCheckoutAutocompleteAddress.js";
|
|
9
|
+
import { useCheckoutAddressFieldFormats as $e } from "../hooks/useCheckoutAddressFieldFormats.js";
|
|
10
|
+
import { ADDRESS_FIELD_TYPE_MAPPING as Ne, ADDRESS_FIELDS_DEFAULT_FORMAT as Re, ADDRESS_FIELDS_FORMAT_NETHERLANDS as Te, ADDRESS_FIELDS_FORMAT_SINGAPORE as ve, ADDRESS_FIELDS_FORMAT_MACAO as Le } from "../constants/addressFields.js";
|
|
11
|
+
const ke = (U) => {
|
|
12
12
|
const {
|
|
13
|
-
addressCardProps:
|
|
14
|
-
alwaysShowAddressLineFields:
|
|
15
|
-
availableCountryCodes:
|
|
13
|
+
addressCardProps: q = {},
|
|
14
|
+
alwaysShowAddressLineFields: T = !1,
|
|
15
|
+
availableCountryCodes: g,
|
|
16
16
|
fieldLabels: v = {},
|
|
17
|
+
isSalutationRequired: H = !1,
|
|
17
18
|
name: e,
|
|
18
|
-
onChangeCountry:
|
|
19
|
-
onChangeValidationSchema:
|
|
20
|
-
showOrganisationField:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
onChangeCountry: S,
|
|
20
|
+
onChangeValidationSchema: Y,
|
|
21
|
+
showOrganisationField: J,
|
|
22
|
+
showSalutationField: L,
|
|
23
|
+
title: Q,
|
|
24
|
+
validationSchema: X
|
|
25
|
+
} = U, D = F(null), E = F(null), z = F(null), _ = F(null), { getValues: y, reset: Z, setValue: c, watch: f } = Ae(), x = f(e, {}), m = f(`${e}.country`), K = m?.alpha2Code, ee = f(`${e}.postalCode`), te = f(`${e}.premiseNumber`), {
|
|
26
|
+
autocompletedAddress: oe,
|
|
27
|
+
handleAutocompleteAddress: w,
|
|
28
|
+
handleBlurAutocompleteAddressField: h,
|
|
29
|
+
handleShowAddressLines: ie,
|
|
30
|
+
showAddressLineFields: W
|
|
31
|
+
} = be({ alwaysShowAddressLineFields: T, name: e }), {
|
|
32
|
+
administrativeAreas: b,
|
|
33
|
+
areFieldsAllowed: C,
|
|
34
|
+
fieldFormats: A,
|
|
35
|
+
fieldTypes: ae,
|
|
34
36
|
isFetchingAddressOptions: O
|
|
35
|
-
} =
|
|
37
|
+
} = xe({
|
|
36
38
|
enabled: !0,
|
|
37
39
|
countryCode: m?.alpha2Code,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
isSalutationRequired: H,
|
|
41
|
+
onChangeValidationSchema: Y,
|
|
42
|
+
salutation: L,
|
|
43
|
+
validationSchema: X
|
|
44
|
+
}), $ = R(K) && R(ee) && R(te);
|
|
45
|
+
$e({ fieldFormats: A, name: e }), k(() => {
|
|
42
46
|
const t = document.activeElement;
|
|
43
47
|
[
|
|
44
|
-
R.current,
|
|
45
48
|
D.current,
|
|
46
49
|
E.current,
|
|
47
|
-
z.current
|
|
48
|
-
|
|
50
|
+
z.current,
|
|
51
|
+
_.current
|
|
52
|
+
].every((n) => n !== t) && $ && w(!0).catch(() => {
|
|
49
53
|
});
|
|
50
|
-
}, [
|
|
51
|
-
const t =
|
|
54
|
+
}, [w, $]), k(() => {
|
|
55
|
+
const t = y(`${e}.administrativeArea`);
|
|
52
56
|
if (t && typeof t == "string") {
|
|
53
|
-
const o =
|
|
54
|
-
(
|
|
57
|
+
const o = b.find(
|
|
58
|
+
(n) => n.code === t
|
|
55
59
|
);
|
|
56
|
-
o &&
|
|
57
|
-
} else !t && typeof t == "string" &&
|
|
58
|
-
}, [
|
|
59
|
-
const
|
|
60
|
-
(t) =>
|
|
61
|
-
[
|
|
62
|
-
),
|
|
63
|
-
const o =
|
|
60
|
+
o && c(`${e}.administrativeArea`, o);
|
|
61
|
+
} else !t && typeof t == "string" && c(`${e}.administrativeArea`, null);
|
|
62
|
+
}, [b, e, y, c]);
|
|
63
|
+
const re = W && C(["thoroughfare", "locality"]) && !O, ne = Ce(
|
|
64
|
+
(t) => g.includes("*") || g.includes(t?.alpha2Code),
|
|
65
|
+
[g]
|
|
66
|
+
), a = (t) => {
|
|
67
|
+
const o = ae[t];
|
|
64
68
|
if (!o)
|
|
65
|
-
return v?.[t] || I(
|
|
66
|
-
const
|
|
69
|
+
return v?.[t] || I(G(t)?.replace(/_/g, " "));
|
|
70
|
+
const n = j(
|
|
67
71
|
o
|
|
68
|
-
), N = `${
|
|
69
|
-
return v?.[N] || I(
|
|
70
|
-
},
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
...
|
|
72
|
+
), N = `${Ne[n] || n}`;
|
|
73
|
+
return v?.[N] || I(G(o));
|
|
74
|
+
}, se = (t, o) => {
|
|
75
|
+
const n = y();
|
|
76
|
+
S && typeof S == "function" && S(t, o), Z({
|
|
77
|
+
...n,
|
|
74
78
|
[e]: {
|
|
75
|
-
...
|
|
79
|
+
...n[e] || {},
|
|
76
80
|
country: o,
|
|
77
81
|
postalCode: "",
|
|
78
82
|
premiseNumber: "",
|
|
@@ -84,19 +88,19 @@ const We = (j) => {
|
|
|
84
88
|
locality: ""
|
|
85
89
|
}
|
|
86
90
|
});
|
|
87
|
-
},
|
|
91
|
+
}, le = (t) => {
|
|
88
92
|
let o = t?.target?.value || "";
|
|
89
|
-
|
|
93
|
+
A?.isPostalCodeUppercase === !0 && (o = o?.toUpperCase()), c(`${e}.postalCode`, o);
|
|
90
94
|
}, l = {
|
|
91
|
-
...
|
|
95
|
+
...J ? {
|
|
92
96
|
organisation: {
|
|
93
97
|
minSizes: {
|
|
94
98
|
xs: 12,
|
|
95
99
|
md: 12
|
|
96
100
|
},
|
|
97
|
-
component:
|
|
101
|
+
component: r.TextField,
|
|
98
102
|
props: {
|
|
99
|
-
label:
|
|
103
|
+
label: a("organisation"),
|
|
100
104
|
name: `${e}.organisation`,
|
|
101
105
|
id: `${e}Organisation`,
|
|
102
106
|
fullWidth: !0,
|
|
@@ -109,9 +113,9 @@ const We = (j) => {
|
|
|
109
113
|
xs: 12,
|
|
110
114
|
md: 4
|
|
111
115
|
},
|
|
112
|
-
component:
|
|
116
|
+
component: r.TextField,
|
|
113
117
|
props: {
|
|
114
|
-
label:
|
|
118
|
+
label: a("givenName"),
|
|
115
119
|
name: `${e}.givenName`,
|
|
116
120
|
id: `${e}GivenName`,
|
|
117
121
|
fullWidth: !0,
|
|
@@ -124,9 +128,9 @@ const We = (j) => {
|
|
|
124
128
|
md: 4
|
|
125
129
|
},
|
|
126
130
|
grow: !1,
|
|
127
|
-
component:
|
|
131
|
+
component: r.TextField,
|
|
128
132
|
props: {
|
|
129
|
-
label:
|
|
133
|
+
label: a("additionalName"),
|
|
130
134
|
name: `${e}.additionalName`,
|
|
131
135
|
id: `${e}AdditionalName`,
|
|
132
136
|
fullWidth: !0,
|
|
@@ -138,9 +142,9 @@ const We = (j) => {
|
|
|
138
142
|
xs: 12,
|
|
139
143
|
md: 4
|
|
140
144
|
},
|
|
141
|
-
component:
|
|
145
|
+
component: r.TextField,
|
|
142
146
|
props: {
|
|
143
|
-
label:
|
|
147
|
+
label: a("familyName"),
|
|
144
148
|
name: `${e}.familyName`,
|
|
145
149
|
id: `${e}FamilyName`,
|
|
146
150
|
fullWidth: !0,
|
|
@@ -152,9 +156,9 @@ const We = (j) => {
|
|
|
152
156
|
xs: 12,
|
|
153
157
|
md: 6
|
|
154
158
|
},
|
|
155
|
-
component:
|
|
159
|
+
component: r.TextField,
|
|
156
160
|
props: {
|
|
157
|
-
label:
|
|
161
|
+
label: a("addressLine2"),
|
|
158
162
|
name: `${e}.addressLine2`,
|
|
159
163
|
id: `${e}AddressLine2`,
|
|
160
164
|
fullWidth: !0,
|
|
@@ -166,14 +170,14 @@ const We = (j) => {
|
|
|
166
170
|
xs: 12,
|
|
167
171
|
md: 4
|
|
168
172
|
},
|
|
169
|
-
component:
|
|
173
|
+
component: r.TextField,
|
|
170
174
|
props: {
|
|
171
|
-
label:
|
|
175
|
+
label: a("postalCode"),
|
|
172
176
|
name: `${e}.postalCode`,
|
|
173
177
|
id: `${e}PostalCode`,
|
|
174
|
-
inputRef:
|
|
175
|
-
onBlur:
|
|
176
|
-
onChange:
|
|
178
|
+
inputRef: E,
|
|
179
|
+
onBlur: h,
|
|
180
|
+
onChange: le,
|
|
177
181
|
fullWidth: !0,
|
|
178
182
|
autoComplete: "postal-code"
|
|
179
183
|
}
|
|
@@ -184,13 +188,13 @@ const We = (j) => {
|
|
|
184
188
|
md: 3
|
|
185
189
|
},
|
|
186
190
|
grow: !1,
|
|
187
|
-
component:
|
|
191
|
+
component: r.TextField,
|
|
188
192
|
props: {
|
|
189
|
-
label:
|
|
193
|
+
label: a("premiseNumber"),
|
|
190
194
|
name: `${e}.premiseNumber`,
|
|
191
195
|
id: `${e}PremiseNumber`,
|
|
192
|
-
inputRef:
|
|
193
|
-
onBlur:
|
|
196
|
+
inputRef: z,
|
|
197
|
+
onBlur: h,
|
|
194
198
|
fullWidth: !0
|
|
195
199
|
}
|
|
196
200
|
},
|
|
@@ -200,13 +204,13 @@ const We = (j) => {
|
|
|
200
204
|
md: 3
|
|
201
205
|
},
|
|
202
206
|
grow: !1,
|
|
203
|
-
component:
|
|
207
|
+
component: r.TextField,
|
|
204
208
|
props: {
|
|
205
|
-
label:
|
|
209
|
+
label: a("premiseNumberSuffix"),
|
|
206
210
|
name: `${e}.premiseNumberSuffix`,
|
|
207
211
|
id: `${e}PremiseNumberSuffix`,
|
|
208
|
-
inputRef:
|
|
209
|
-
onBlur:
|
|
212
|
+
inputRef: _,
|
|
213
|
+
onBlur: h,
|
|
210
214
|
fullWidth: !0
|
|
211
215
|
}
|
|
212
216
|
},
|
|
@@ -215,9 +219,9 @@ const We = (j) => {
|
|
|
215
219
|
xs: 12,
|
|
216
220
|
md: 6
|
|
217
221
|
},
|
|
218
|
-
component:
|
|
222
|
+
component: r.TextField,
|
|
219
223
|
props: {
|
|
220
|
-
label:
|
|
224
|
+
label: a("thoroughfare"),
|
|
221
225
|
name: `${e}.thoroughfare`,
|
|
222
226
|
id: `${e}Thoroughfare`,
|
|
223
227
|
fullWidth: !0,
|
|
@@ -229,9 +233,9 @@ const We = (j) => {
|
|
|
229
233
|
xs: 12,
|
|
230
234
|
md: 6
|
|
231
235
|
},
|
|
232
|
-
component:
|
|
236
|
+
component: r.TextField,
|
|
233
237
|
props: {
|
|
234
|
-
label:
|
|
238
|
+
label: a("locality"),
|
|
235
239
|
name: `${e}.locality`,
|
|
236
240
|
id: `${e}Locality`,
|
|
237
241
|
fullWidth: !0,
|
|
@@ -243,85 +247,106 @@ const We = (j) => {
|
|
|
243
247
|
xs: 12,
|
|
244
248
|
md: 6
|
|
245
249
|
},
|
|
246
|
-
component:
|
|
250
|
+
component: r.Autocomplete,
|
|
247
251
|
props: {
|
|
248
|
-
label:
|
|
252
|
+
label: a("administrativeArea"),
|
|
249
253
|
name: `${e}.administrativeArea`,
|
|
250
254
|
id: `${e}AdministrativeArea`,
|
|
251
|
-
options:
|
|
255
|
+
options: b,
|
|
252
256
|
fullWidth: !0
|
|
253
257
|
}
|
|
254
258
|
}
|
|
255
|
-
},
|
|
259
|
+
}, de = l.locality.component, me = l.thoroughfare.component, ue = () => {
|
|
256
260
|
const t = ["xs", "md"];
|
|
257
|
-
let o =
|
|
258
|
-
return m?.alpha2Code === "NL" && (o =
|
|
259
|
-
const u = N.map((
|
|
260
|
-
(
|
|
261
|
+
let o = A.fields || Re;
|
|
262
|
+
return m?.alpha2Code === "NL" && (o = Te), m?.alpha2Code === "SG" && (o = ve), m?.alpha2Code === "MO" && (o = Le), o.reduce((n, N) => {
|
|
263
|
+
const u = N.map((s) => j(s)).filter(
|
|
264
|
+
(s) => !!l[s] && C([s])
|
|
261
265
|
);
|
|
262
266
|
if (!u.length)
|
|
263
|
-
return
|
|
264
|
-
const
|
|
267
|
+
return n;
|
|
268
|
+
const pe = ye(
|
|
265
269
|
u,
|
|
266
270
|
t,
|
|
267
271
|
l
|
|
268
|
-
), V = u.map((
|
|
269
|
-
const
|
|
270
|
-
(
|
|
271
|
-
...
|
|
272
|
-
[
|
|
272
|
+
), V = u.map((s) => {
|
|
273
|
+
const ce = l[s].component, fe = t.reduce(
|
|
274
|
+
(he, P) => ({
|
|
275
|
+
...he,
|
|
276
|
+
[P]: pe[P][s]
|
|
273
277
|
}),
|
|
274
278
|
{}
|
|
275
279
|
);
|
|
276
|
-
return /* @__PURE__ */ i(d, { item: !0, ...
|
|
280
|
+
return /* @__PURE__ */ i(d, { item: !0, ...fe, children: /* @__PURE__ */ i(ce, { ...l[s].props }) }, s);
|
|
277
281
|
});
|
|
278
282
|
return u.length > 1 ? [
|
|
279
|
-
...
|
|
283
|
+
...n,
|
|
280
284
|
/* @__PURE__ */ i(d, { item: !0, container: !0, spacing: 2, children: V }, u.join("."))
|
|
281
|
-
] : [...
|
|
285
|
+
] : [...n, ...V];
|
|
282
286
|
}, []);
|
|
283
287
|
};
|
|
284
|
-
return /* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ p(M, { children: [
|
|
289
|
+
/* @__PURE__ */ p(d, { container: !0, spacing: 2, children: [
|
|
286
290
|
/* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(
|
|
287
|
-
|
|
291
|
+
r.CountrySelect,
|
|
288
292
|
{
|
|
289
|
-
label:
|
|
293
|
+
label: a("country"),
|
|
290
294
|
name: `${e}.country`,
|
|
291
295
|
id: `${e}Country`,
|
|
292
|
-
inputRef:
|
|
293
|
-
onBlur:
|
|
294
|
-
onChange:
|
|
295
|
-
filterCountryOptions:
|
|
296
|
+
inputRef: D,
|
|
297
|
+
onBlur: h,
|
|
298
|
+
onChange: se,
|
|
299
|
+
filterCountryOptions: ne,
|
|
296
300
|
sortBy: "name",
|
|
297
301
|
fullWidth: !0
|
|
298
302
|
}
|
|
299
303
|
) }),
|
|
300
|
-
|
|
304
|
+
L && /* @__PURE__ */ p(d, { item: !0, xs: 12, children: [
|
|
305
|
+
/* @__PURE__ */ i(Fe, { sx: { fontWeight: 500, mb: 0.5 }, children: a("salutation") }),
|
|
306
|
+
/* @__PURE__ */ p(
|
|
307
|
+
r.RadioGroup,
|
|
308
|
+
{
|
|
309
|
+
id: `${e}Salutation`,
|
|
310
|
+
name: `${e}.salutation`,
|
|
311
|
+
row: !0,
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ i(r.Radio, { label: a("salutationMr"), value: "mr" }),
|
|
314
|
+
/* @__PURE__ */ i(
|
|
315
|
+
r.Radio,
|
|
316
|
+
{
|
|
317
|
+
label: a("salutationMrs"),
|
|
318
|
+
value: "mrs"
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }),
|
|
325
|
+
!O && /* @__PURE__ */ i(M, { children: ue() })
|
|
301
326
|
] }),
|
|
302
|
-
m?.alpha2Code === "NL" && /* @__PURE__ */ i(B, { in:
|
|
303
|
-
|
|
304
|
-
|
|
327
|
+
m?.alpha2Code === "NL" && /* @__PURE__ */ i(B, { in: re, children: /* @__PURE__ */ p(d, { container: !0, spacing: 2, sx: { pt: 2 }, children: [
|
|
328
|
+
C(["thoroughfare"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(me, { ...l.thoroughfare.props }) }),
|
|
329
|
+
C(["locality"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(de, { ...l.locality.props }) })
|
|
305
330
|
] }) }),
|
|
306
331
|
/* @__PURE__ */ i(
|
|
307
332
|
B,
|
|
308
333
|
{
|
|
309
|
-
in: !
|
|
334
|
+
in: !W && $ && !!oe,
|
|
310
335
|
sx: { width: "100%" },
|
|
311
|
-
children: /* @__PURE__ */ i(
|
|
312
|
-
|
|
336
|
+
children: /* @__PURE__ */ i(ge, { mt: 4, children: /* @__PURE__ */ i(
|
|
337
|
+
Se,
|
|
313
338
|
{
|
|
314
|
-
...
|
|
339
|
+
...q,
|
|
315
340
|
address: {
|
|
316
|
-
...
|
|
317
|
-
countryCode:
|
|
341
|
+
...x,
|
|
342
|
+
countryCode: x?.country?.alpha2Code,
|
|
318
343
|
options: {
|
|
319
|
-
...
|
|
320
|
-
format:
|
|
344
|
+
...x?.options || {},
|
|
345
|
+
format: A.address
|
|
321
346
|
}
|
|
322
347
|
},
|
|
323
|
-
...
|
|
324
|
-
title:
|
|
348
|
+
...T ? {} : { onEdit: ie },
|
|
349
|
+
title: Q
|
|
325
350
|
}
|
|
326
351
|
) })
|
|
327
352
|
}
|
|
@@ -329,5 +354,5 @@ const We = (j) => {
|
|
|
329
354
|
] });
|
|
330
355
|
};
|
|
331
356
|
export {
|
|
332
|
-
|
|
357
|
+
ke as CheckoutAddressFields
|
|
333
358
|
};
|
|
@@ -4,8 +4,8 @@ import { Maybe, AnyObject, ObjectSchema } from 'yup';
|
|
|
4
4
|
import { Address } from '@afosto/storefront';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
import { CheckoutAddressCardProps } from '../CheckoutAddressCard/CheckoutAddressCard';
|
|
7
|
-
import { DeepPartial } from '../types';
|
|
8
|
-
export declare const
|
|
7
|
+
import { CheckoutSettings, DeepPartial } from '../types';
|
|
8
|
+
export declare const getBaseAddressValidationSchema: (settings: CheckoutSettings) => {
|
|
9
9
|
givenName: import('yup').StringSchema<string, AnyObject, undefined, "">;
|
|
10
10
|
additionalName: import('yup').StringSchema<string | null | undefined, AnyObject, undefined, "">;
|
|
11
11
|
familyName: import('yup').StringSchema<string, AnyObject, undefined, "">;
|
|
@@ -18,6 +18,7 @@ export declare const baseAddressValidationSchema: {
|
|
|
18
18
|
administrativeArea: ObjectSchema<{} | null, AnyObject, {}, "">;
|
|
19
19
|
thoroughfare: import('yup').StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
20
20
|
locality: import('yup').StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
21
|
+
salutation?: import('yup').StringSchema<string | null | undefined, AnyObject, undefined, ""> | undefined;
|
|
21
22
|
};
|
|
22
23
|
declare const defaultTranslations: {
|
|
23
24
|
addressFields: {
|
|
@@ -34,6 +35,9 @@ declare const defaultTranslations: {
|
|
|
34
35
|
premiseNumber: string;
|
|
35
36
|
premiseNumberSuffix: string;
|
|
36
37
|
province: string;
|
|
38
|
+
salutation: string;
|
|
39
|
+
salutationMr: string;
|
|
40
|
+
salutationMrs: string;
|
|
37
41
|
state: string;
|
|
38
42
|
suburb: string;
|
|
39
43
|
thoroughfare: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutAddressSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutAddressSection/CheckoutAddressSection.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGlB,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAY,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAG5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckoutAddressSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutAddressSection/CheckoutAddressSection.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,YAAY,EAGlB,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAY,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAG5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,8BAA8B,GAAI,UAAU,gBAAgB;;;;;;;;;;;;;;CAwBxE,CAAC;AAEF,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;CAuBxB,CAAC;AAEF,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;IAC5C,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,CAAC;IAChE,wBAAwB,CAAC,EAAE,0BAA0B,CAAC,0BAA0B,CAAC,CAAC;IAClF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,qDA2GxE,CAAC"}
|