@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.
Files changed (76) hide show
  1. package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts +2 -0
  2. package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts.map +1 -1
  3. package/dist/CheckoutAddressFields/CheckoutAddressFields.js +155 -130
  4. package/dist/CheckoutAddressSection/CheckoutAddressSection.d.ts +6 -2
  5. package/dist/CheckoutAddressSection/CheckoutAddressSection.d.ts.map +1 -1
  6. package/dist/CheckoutAddressSection/CheckoutAddressSection.js +82 -71
  7. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts.map +1 -1
  8. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +32 -29
  9. package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.d.ts.map +1 -1
  10. package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.js +21 -21
  11. package/dist/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.d.ts.map +1 -1
  12. package/dist/CheckoutDownPaymentAgreementsSummary/CheckoutDownPaymentAgreementsSummary.js +38 -35
  13. package/dist/CheckoutInformationStep/CheckoutInformationStep.d.ts +0 -2
  14. package/dist/CheckoutInformationStep/CheckoutInformationStep.d.ts.map +1 -1
  15. package/dist/CheckoutInformationStep/CheckoutInformationStep.js +30 -37
  16. package/dist/CheckoutPaymentStep/CheckoutPaymentStep.d.ts.map +1 -1
  17. package/dist/CheckoutPaymentStep/CheckoutPaymentStep.js +15 -15
  18. package/dist/CheckoutReviewPaymentSection/CheckoutReviewPaymentSection.d.ts.map +1 -1
  19. package/dist/CheckoutReviewPaymentSection/CheckoutReviewPaymentSection.js +19 -19
  20. package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
  21. package/dist/CheckoutSummary/CheckoutSummary.js +23 -23
  22. package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.d.ts.map +1 -1
  23. package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js +35 -28
  24. package/dist/constants/addressDefaultValues.d.ts +1 -0
  25. package/dist/constants/addressDefaultValues.d.ts.map +1 -1
  26. package/dist/constants/addressDefaultValues.js +1 -0
  27. package/dist/constants/addressFields.d.ts.map +1 -1
  28. package/dist/constants/addressFields.js +6 -5
  29. package/dist/constants/addressValidationSchema.d.ts +10 -2
  30. package/dist/constants/addressValidationSchema.d.ts.map +1 -1
  31. package/dist/constants/addressValidationSchema.js +58 -46
  32. package/dist/constants/index.js +8 -8
  33. package/dist/fragments/CoreCartProjectionFields.d.ts +8 -1
  34. package/dist/fragments/CoreCartProjectionFields.d.ts.map +1 -1
  35. package/dist/fragments/CoreCartProjectionFields.js +8 -1
  36. package/dist/fragments/CoreOrderProjectionFields.d.ts +8 -1
  37. package/dist/fragments/CoreOrderProjectionFields.d.ts.map +1 -1
  38. package/dist/fragments/CoreOrderProjectionFields.js +8 -1
  39. package/dist/hooks/useCheckoutAddressOptions.d.ts +3 -1
  40. package/dist/hooks/useCheckoutAddressOptions.d.ts.map +1 -1
  41. package/dist/hooks/useCheckoutAddressOptions.js +64 -57
  42. package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
  43. package/dist/hooks/useCheckoutForm.d.ts.map +1 -1
  44. package/dist/hooks/useCheckoutForm.js +45 -41
  45. package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
  46. package/dist/index.d.ts +0 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +426 -428
  49. package/dist/operations/cartOperations.d.ts.map +1 -1
  50. package/dist/operations/cartOperations.js +120 -108
  51. package/dist/operations/orderOperations.d.ts.map +1 -1
  52. package/dist/operations/orderOperations.js +123 -111
  53. package/dist/queries/getCartInitialPaymentStepQuery.d.ts +4 -0
  54. package/dist/queries/getCartInitialPaymentStepQuery.d.ts.map +1 -1
  55. package/dist/queries/getCartInitialPaymentStepQuery.js +10 -2
  56. package/dist/queries/getOrderInitialPaymentStepQuery.d.ts +4 -0
  57. package/dist/queries/getOrderInitialPaymentStepQuery.d.ts.map +1 -1
  58. package/dist/queries/getOrderInitialPaymentStepQuery.js +11 -3
  59. package/dist/steps/informationStep.d.ts +0 -1
  60. package/dist/steps/informationStep.d.ts.map +1 -1
  61. package/dist/steps/informationStep.js +234 -238
  62. package/dist/types.d.ts +13 -3
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/utils/createAddressValidationSchema.d.ts +4 -1
  65. package/dist/utils/createAddressValidationSchema.d.ts.map +1 -1
  66. package/dist/utils/createAddressValidationSchema.js +8 -8
  67. package/dist/utils/formatCurrency.d.ts +2 -0
  68. package/dist/utils/formatCurrency.d.ts.map +1 -0
  69. package/dist/utils/formatCurrency.js +14 -0
  70. package/package.json +1 -1
  71. package/dist/CheckoutSalutationSection/CheckoutSalutationSection.d.ts +0 -13
  72. package/dist/CheckoutSalutationSection/CheckoutSalutationSection.d.ts.map +0 -1
  73. package/dist/CheckoutSalutationSection/CheckoutSalutationSection.js +0 -26
  74. package/dist/CheckoutSalutationSection/index.d.ts +0 -3
  75. package/dist/CheckoutSalutationSection/index.d.ts.map +0 -1
  76. 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,EAOL,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,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,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDAkdtE,CAAC"}
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 $, Fragment as P, jsx as i } from "react/jsx-runtime";
2
- import { useRef as A, useEffect as k, useCallback as fe } from "react";
3
- import { useFormContext as he, Fields as s, Grid as d, Collapse as B, Box as Ce } from "@afosto/components";
4
- import { isDefined as T, capitalize as I, decamelize as M, camelize as G } from "@afosto/utils";
5
- import { CheckoutAddressCard as Ae } from "../CheckoutAddressCard/CheckoutAddressCard.js";
6
- import { calculateBreakpointsForAddressFields as Fe } from "../utils/calculateBreakpointsForAddressFields.js";
7
- import { useCheckoutAddressOptions as ge } from "../hooks/useCheckoutAddressOptions.js";
8
- import { useCheckoutAutocompleteAddress as Se } from "../hooks/useCheckoutAutocompleteAddress.js";
9
- import { useCheckoutAddressFieldFormats as ye } from "../hooks/useCheckoutAddressFieldFormats.js";
10
- import { ADDRESS_FIELD_TYPE_MAPPING as xe, ADDRESS_FIELDS_DEFAULT_FORMAT as be, ADDRESS_FIELDS_FORMAT_NETHERLANDS as Ne, ADDRESS_FIELDS_FORMAT_SINGAPORE as $e, ADDRESS_FIELDS_FORMAT_MACAO as Te } from "../constants/addressFields.js";
11
- const We = (j) => {
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: U = {},
14
- alwaysShowAddressLineFields: L = !1,
15
- availableCountryCodes: F,
13
+ addressCardProps: q = {},
14
+ alwaysShowAddressLineFields: T = !1,
15
+ availableCountryCodes: g,
16
16
  fieldLabels: v = {},
17
+ isSalutationRequired: H = !1,
17
18
  name: e,
18
- onChangeCountry: g,
19
- onChangeValidationSchema: q,
20
- showOrganisationField: H,
21
- title: Y,
22
- validationSchema: J
23
- } = j, R = A(null), D = A(null), E = A(null), z = A(null), { getValues: S, reset: Q, setValue: p, watch: c } = he(), y = c(e, {}), m = c(`${e}.country`), X = m?.alpha2Code, Z = c(`${e}.postalCode`), K = c(`${e}.premiseNumber`), {
24
- autocompletedAddress: ee,
25
- handleAutocompleteAddress: _,
26
- handleBlurAutocompleteAddressField: f,
27
- handleShowAddressLines: te,
28
- showAddressLineFields: w
29
- } = Se({ alwaysShowAddressLineFields: L, name: e }), {
30
- administrativeAreas: x,
31
- areFieldsAllowed: h,
32
- fieldFormats: C,
33
- fieldTypes: oe,
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
- } = ge({
37
+ } = xe({
36
38
  enabled: !0,
37
39
  countryCode: m?.alpha2Code,
38
- onChangeValidationSchema: q,
39
- validationSchema: J
40
- }), b = T(X) && T(Z) && T(K);
41
- ye({ fieldFormats: C, name: e }), k(() => {
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
- ].every((r) => r !== t) && b && _(!0).catch(() => {
50
+ z.current,
51
+ _.current
52
+ ].every((n) => n !== t) && $ && w(!0).catch(() => {
49
53
  });
50
- }, [_, b]), k(() => {
51
- const t = S(`${e}.administrativeArea`);
54
+ }, [w, $]), k(() => {
55
+ const t = y(`${e}.administrativeArea`);
52
56
  if (t && typeof t == "string") {
53
- const o = x.find(
54
- (r) => r.code === t
57
+ const o = b.find(
58
+ (n) => n.code === t
55
59
  );
56
- o && p(`${e}.administrativeArea`, o);
57
- } else !t && typeof t == "string" && p(`${e}.administrativeArea`, null);
58
- }, [x, e, S, p]);
59
- const ie = w && h(["thoroughfare", "locality"]) && !O, re = fe(
60
- (t) => F.includes("*") || F.includes(t?.alpha2Code),
61
- [F]
62
- ), n = (t) => {
63
- const o = oe[t];
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(M(t)?.replace(/_/g, " "));
66
- const r = G(
69
+ return v?.[t] || I(G(t)?.replace(/_/g, " "));
70
+ const n = j(
67
71
  o
68
- ), N = `${xe[r] || r}`;
69
- return v?.[N] || I(M(o));
70
- }, ne = (t, o) => {
71
- const r = S();
72
- g && typeof g == "function" && g(t, o), Q({
73
- ...r,
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
- ...r[e] || {},
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
- }, se = (t) => {
91
+ }, le = (t) => {
88
92
  let o = t?.target?.value || "";
89
- C?.isPostalCodeUppercase === !0 && (o = o?.toUpperCase()), p(`${e}.postalCode`, o);
93
+ A?.isPostalCodeUppercase === !0 && (o = o?.toUpperCase()), c(`${e}.postalCode`, o);
90
94
  }, l = {
91
- ...H ? {
95
+ ...J ? {
92
96
  organisation: {
93
97
  minSizes: {
94
98
  xs: 12,
95
99
  md: 12
96
100
  },
97
- component: s.TextField,
101
+ component: r.TextField,
98
102
  props: {
99
- label: n("organisation"),
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: s.TextField,
116
+ component: r.TextField,
113
117
  props: {
114
- label: n("givenName"),
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: s.TextField,
131
+ component: r.TextField,
128
132
  props: {
129
- label: n("additionalName"),
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: s.TextField,
145
+ component: r.TextField,
142
146
  props: {
143
- label: n("familyName"),
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: s.TextField,
159
+ component: r.TextField,
156
160
  props: {
157
- label: n("addressLine2"),
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: s.TextField,
173
+ component: r.TextField,
170
174
  props: {
171
- label: n("postalCode"),
175
+ label: a("postalCode"),
172
176
  name: `${e}.postalCode`,
173
177
  id: `${e}PostalCode`,
174
- inputRef: D,
175
- onBlur: f,
176
- onChange: se,
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: s.TextField,
191
+ component: r.TextField,
188
192
  props: {
189
- label: n("premiseNumber"),
193
+ label: a("premiseNumber"),
190
194
  name: `${e}.premiseNumber`,
191
195
  id: `${e}PremiseNumber`,
192
- inputRef: E,
193
- onBlur: f,
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: s.TextField,
207
+ component: r.TextField,
204
208
  props: {
205
- label: n("premiseNumberSuffix"),
209
+ label: a("premiseNumberSuffix"),
206
210
  name: `${e}.premiseNumberSuffix`,
207
211
  id: `${e}PremiseNumberSuffix`,
208
- inputRef: z,
209
- onBlur: f,
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: s.TextField,
222
+ component: r.TextField,
219
223
  props: {
220
- label: n("thoroughfare"),
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: s.TextField,
236
+ component: r.TextField,
233
237
  props: {
234
- label: n("locality"),
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: s.Autocomplete,
250
+ component: r.Autocomplete,
247
251
  props: {
248
- label: n("administrativeArea"),
252
+ label: a("administrativeArea"),
249
253
  name: `${e}.administrativeArea`,
250
254
  id: `${e}AdministrativeArea`,
251
- options: x,
255
+ options: b,
252
256
  fullWidth: !0
253
257
  }
254
258
  }
255
- }, ae = l.locality.component, le = l.thoroughfare.component, de = () => {
259
+ }, de = l.locality.component, me = l.thoroughfare.component, ue = () => {
256
260
  const t = ["xs", "md"];
257
- let o = C.fields || be;
258
- return m?.alpha2Code === "NL" && (o = Ne), m?.alpha2Code === "SG" && (o = $e), m?.alpha2Code === "MO" && (o = Te), o.reduce((r, N) => {
259
- const u = N.map((a) => G(a)).filter(
260
- (a) => !!l[a] && h([a])
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 r;
264
- const me = Fe(
267
+ return n;
268
+ const pe = ye(
265
269
  u,
266
270
  t,
267
271
  l
268
- ), V = u.map((a) => {
269
- const ue = l[a].component, pe = t.reduce(
270
- (ce, W) => ({
271
- ...ce,
272
- [W]: me[W][a]
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, ...pe, children: /* @__PURE__ */ i(ue, { ...l[a].props }) }, a);
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
- ...r,
283
+ ...n,
280
284
  /* @__PURE__ */ i(d, { item: !0, container: !0, spacing: 2, children: V }, u.join("."))
281
- ] : [...r, ...V];
285
+ ] : [...n, ...V];
282
286
  }, []);
283
287
  };
284
- return /* @__PURE__ */ $(P, { children: [
285
- /* @__PURE__ */ $(d, { container: !0, spacing: 2, children: [
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
- s.CountrySelect,
291
+ r.CountrySelect,
288
292
  {
289
- label: n("country"),
293
+ label: a("country"),
290
294
  name: `${e}.country`,
291
295
  id: `${e}Country`,
292
- inputRef: R,
293
- onBlur: f,
294
- onChange: ne,
295
- filterCountryOptions: re,
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
- !O && /* @__PURE__ */ i(P, { children: de() })
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: ie, children: /* @__PURE__ */ $(d, { container: !0, spacing: 2, sx: { pt: 2 }, children: [
303
- h(["thoroughfare"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(le, { ...l.thoroughfare.props }) }),
304
- h(["locality"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(ae, { ...l.locality.props }) })
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: !w && b && !!ee,
334
+ in: !W && $ && !!oe,
310
335
  sx: { width: "100%" },
311
- children: /* @__PURE__ */ i(Ce, { mt: 4, children: /* @__PURE__ */ i(
312
- Ae,
336
+ children: /* @__PURE__ */ i(ge, { mt: 4, children: /* @__PURE__ */ i(
337
+ Se,
313
338
  {
314
- ...U,
339
+ ...q,
315
340
  address: {
316
- ...y,
317
- countryCode: y?.country?.alpha2Code,
341
+ ...x,
342
+ countryCode: x?.country?.alpha2Code,
318
343
  options: {
319
- ...y?.options || {},
320
- format: C.address
344
+ ...x?.options || {},
345
+ format: A.address
321
346
  }
322
347
  },
323
- ...L ? {} : { onEdit: te },
324
- title: Y
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
- We as CheckoutAddressFields
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 baseAddressValidationSchema: {
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;AAE5C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;CAavC,CAAC;A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