@afosto/checkout-ui 0.0.14 → 0.0.15

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 (61) hide show
  1. package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts.map +1 -1
  2. package/dist/CheckoutAddressFields/CheckoutAddressFields.js +59 -57
  3. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts +1 -1
  4. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +23 -23
  5. package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.js +10 -10
  6. package/dist/CheckoutShippingMethodSection/CheckoutShippingMethodSection.d.ts +1 -1
  7. package/dist/CheckoutShippingMethodSection/CheckoutShippingMethodSection.d.ts.map +1 -1
  8. package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.d.ts +1 -1
  9. package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.d.ts.map +1 -1
  10. package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.js +78 -77
  11. package/dist/constants/paymentMethodIconMapping.d.ts +9 -0
  12. package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
  13. package/dist/constants/paymentMethodIconMapping.js +76 -58
  14. package/dist/hooks/useCheckoutShippingMethods.d.ts +2 -1
  15. package/dist/hooks/useCheckoutShippingMethods.d.ts.map +1 -1
  16. package/dist/hooks/useCheckoutShippingMethods.js +110 -67
  17. package/dist/icons/index.js +178 -160
  18. package/dist/icons/paymentMethods/Alma.d.ts +3 -0
  19. package/dist/icons/paymentMethods/Alma.d.ts.map +1 -0
  20. package/dist/icons/paymentMethods/Alma.js +15 -0
  21. package/dist/icons/paymentMethods/Bancomat.d.ts +3 -0
  22. package/dist/icons/paymentMethods/Bancomat.d.ts.map +1 -0
  23. package/dist/icons/paymentMethods/Bancomat.js +15 -0
  24. package/dist/icons/paymentMethods/Bizum.d.ts +3 -0
  25. package/dist/icons/paymentMethods/Bizum.d.ts.map +1 -0
  26. package/dist/icons/paymentMethods/Bizum.js +28 -0
  27. package/dist/icons/paymentMethods/Blik.d.ts +3 -0
  28. package/dist/icons/paymentMethods/Blik.d.ts.map +1 -0
  29. package/dist/icons/paymentMethods/Blik.js +59 -0
  30. package/dist/icons/paymentMethods/ClickToPay.d.ts +3 -0
  31. package/dist/icons/paymentMethods/ClickToPay.d.ts.map +1 -0
  32. package/dist/icons/paymentMethods/ClickToPay.js +35 -0
  33. package/dist/icons/paymentMethods/MBWay.d.ts +3 -0
  34. package/dist/icons/paymentMethods/MBWay.d.ts.map +1 -0
  35. package/dist/icons/paymentMethods/MBWay.js +65 -0
  36. package/dist/icons/paymentMethods/MobilePay.d.ts +3 -0
  37. package/dist/icons/paymentMethods/MobilePay.d.ts.map +1 -0
  38. package/dist/icons/paymentMethods/MobilePay.js +103 -0
  39. package/dist/icons/paymentMethods/Satispay.d.ts +3 -0
  40. package/dist/icons/paymentMethods/Satispay.d.ts.map +1 -0
  41. package/dist/icons/paymentMethods/Satispay.js +15 -0
  42. package/dist/icons/paymentMethods/Vipps.d.ts +3 -0
  43. package/dist/icons/paymentMethods/Vipps.d.ts.map +1 -0
  44. package/dist/icons/paymentMethods/Vipps.js +15 -0
  45. package/dist/icons/paymentMethods/index.d.ts +9 -0
  46. package/dist/icons/paymentMethods/index.d.ts.map +1 -1
  47. package/dist/icons/paymentMethods/index.js +124 -106
  48. package/dist/index.js +356 -338
  49. package/dist/operations/cartOperations.d.ts.map +1 -1
  50. package/dist/operations/cartOperations.js +4 -6
  51. package/dist/operations/orderOperations.d.ts.map +1 -1
  52. package/dist/operations/orderOperations.js +4 -6
  53. package/dist/queries/getCartShippingMethodsQuery.d.ts +0 -1
  54. package/dist/queries/getCartShippingMethodsQuery.d.ts.map +1 -1
  55. package/dist/queries/getCartShippingMethodsQuery.js +6 -29
  56. package/dist/queries/getOrderShippingMethodsQuery.d.ts +0 -1
  57. package/dist/queries/getOrderShippingMethodsQuery.d.ts.map +1 -1
  58. package/dist/queries/getOrderShippingMethodsQuery.js +4 -27
  59. package/dist/types.d.ts +1 -1
  60. package/dist/types.d.ts.map +1 -1
  61. package/package.json +2 -2
@@ -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,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
+ {"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,qDA+etE,CAAC"}
@@ -1,6 +1,6 @@
1
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";
2
+ import { useRef as g, useEffect as k, useCallback as Ce } from "react";
3
+ import { useFormContext as Ae, Fields as n, Grid as d, Typography as Fe, Collapse as B, Box as ge } from "@afosto/components";
4
4
  import { isDefined as R, capitalize as I, decamelize as G, camelize as j } from "@afosto/utils";
5
5
  import { CheckoutAddressCard as Se } from "../CheckoutAddressCard/CheckoutAddressCard.js";
6
6
  import { calculateBreakpointsForAddressFields as ye } from "../utils/calculateBreakpointsForAddressFields.js";
@@ -12,36 +12,36 @@ const ke = (U) => {
12
12
  const {
13
13
  addressCardProps: q = {},
14
14
  alwaysShowAddressLineFields: T = !1,
15
- availableCountryCodes: g,
15
+ availableCountryCodes: S,
16
16
  fieldLabels: v = {},
17
17
  isSalutationRequired: H = !1,
18
18
  name: e,
19
- onChangeCountry: S,
19
+ onChangeCountry: y,
20
20
  onChangeValidationSchema: Y,
21
21
  showOrganisationField: J,
22
22
  showSalutationField: L,
23
23
  title: Q,
24
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`), {
25
+ } = U, D = g(null), E = g(null), z = g(null), _ = g(null), { getValues: x, reset: Z, setValue: c, watch: f } = Ae(), b = f(e, {}), u = f(`${e}.country`), K = u?.alpha2Code, ee = f(`${e}.postalCode`), te = f(`${e}.premiseNumber`), {
26
26
  autocompletedAddress: oe,
27
27
  handleAutocompleteAddress: w,
28
28
  handleBlurAutocompleteAddressField: h,
29
29
  handleShowAddressLines: ie,
30
30
  showAddressLineFields: W
31
31
  } = be({ alwaysShowAddressLineFields: T, name: e }), {
32
- administrativeAreas: b,
32
+ administrativeAreas: $,
33
33
  areFieldsAllowed: C,
34
34
  fieldFormats: A,
35
35
  fieldTypes: ae,
36
36
  isFetchingAddressOptions: O
37
37
  } = xe({
38
38
  enabled: !0,
39
- countryCode: m?.alpha2Code,
39
+ countryCode: u?.alpha2Code,
40
40
  isSalutationRequired: H,
41
41
  onChangeValidationSchema: Y,
42
42
  salutation: L,
43
43
  validationSchema: X
44
- }), $ = R(K) && R(ee) && R(te);
44
+ }), N = R(K) && R(ee) && R(te);
45
45
  $e({ fieldFormats: A, name: e }), k(() => {
46
46
  const t = document.activeElement;
47
47
  [
@@ -49,35 +49,37 @@ const ke = (U) => {
49
49
  E.current,
50
50
  z.current,
51
51
  _.current
52
- ].every((n) => n !== t) && $ && w(!0).catch(() => {
52
+ ].every((r) => r !== t) && N && w(!0).catch(() => {
53
53
  });
54
- }, [w, $]), k(() => {
55
- const t = y(`${e}.administrativeArea`);
54
+ }, [w, N]), k(() => {
55
+ const t = x(`${e}.administrativeArea`);
56
56
  if (t && typeof t == "string") {
57
- const o = b.find(
58
- (n) => n.code === t
57
+ const o = $.find(
58
+ (r) => r.code === t
59
59
  );
60
60
  o && c(`${e}.administrativeArea`, o);
61
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]
62
+ }, [$, e, x, c]);
63
+ const ne = W && C(["thoroughfare", "locality"]) && !O, re = Ce(
64
+ (t) => S.includes("*") || S.includes(t?.alpha2Code),
65
+ [S]
66
66
  ), a = (t) => {
67
67
  const o = ae[t];
68
68
  if (!o)
69
69
  return v?.[t] || I(G(t)?.replace(/_/g, " "));
70
- const n = j(
70
+ const r = j(
71
71
  o
72
- ), N = `${Ne[n] || n}`;
73
- return v?.[N] || I(G(o));
72
+ ), F = `${Ne[r] || r}`;
73
+ return v?.[F] || I(G(o));
74
74
  }, se = (t, o) => {
75
- const n = y();
76
- S && typeof S == "function" && S(t, o), Z({
77
- ...n,
75
+ const r = x();
76
+ y && typeof y == "function" && y(t, o);
77
+ const { avatar: F, ...m } = o || {};
78
+ Z({
79
+ ...r,
78
80
  [e]: {
79
- ...n[e] || {},
80
- country: o,
81
+ ...r[e] || {},
82
+ country: o ? m : null,
81
83
  postalCode: "",
82
84
  premiseNumber: "",
83
85
  premiseNumberSuffix: "",
@@ -98,7 +100,7 @@ const ke = (U) => {
98
100
  xs: 12,
99
101
  md: 12
100
102
  },
101
- component: r.TextField,
103
+ component: n.TextField,
102
104
  props: {
103
105
  label: a("organisation"),
104
106
  name: `${e}.organisation`,
@@ -113,7 +115,7 @@ const ke = (U) => {
113
115
  xs: 12,
114
116
  md: 4
115
117
  },
116
- component: r.TextField,
118
+ component: n.TextField,
117
119
  props: {
118
120
  label: a("givenName"),
119
121
  name: `${e}.givenName`,
@@ -128,7 +130,7 @@ const ke = (U) => {
128
130
  md: 4
129
131
  },
130
132
  grow: !1,
131
- component: r.TextField,
133
+ component: n.TextField,
132
134
  props: {
133
135
  label: a("additionalName"),
134
136
  name: `${e}.additionalName`,
@@ -142,7 +144,7 @@ const ke = (U) => {
142
144
  xs: 12,
143
145
  md: 4
144
146
  },
145
- component: r.TextField,
147
+ component: n.TextField,
146
148
  props: {
147
149
  label: a("familyName"),
148
150
  name: `${e}.familyName`,
@@ -156,7 +158,7 @@ const ke = (U) => {
156
158
  xs: 12,
157
159
  md: 6
158
160
  },
159
- component: r.TextField,
161
+ component: n.TextField,
160
162
  props: {
161
163
  label: a("addressLine2"),
162
164
  name: `${e}.addressLine2`,
@@ -170,7 +172,7 @@ const ke = (U) => {
170
172
  xs: 12,
171
173
  md: 4
172
174
  },
173
- component: r.TextField,
175
+ component: n.TextField,
174
176
  props: {
175
177
  label: a("postalCode"),
176
178
  name: `${e}.postalCode`,
@@ -188,7 +190,7 @@ const ke = (U) => {
188
190
  md: 3
189
191
  },
190
192
  grow: !1,
191
- component: r.TextField,
193
+ component: n.TextField,
192
194
  props: {
193
195
  label: a("premiseNumber"),
194
196
  name: `${e}.premiseNumber`,
@@ -204,7 +206,7 @@ const ke = (U) => {
204
206
  md: 3
205
207
  },
206
208
  grow: !1,
207
- component: r.TextField,
209
+ component: n.TextField,
208
210
  props: {
209
211
  label: a("premiseNumberSuffix"),
210
212
  name: `${e}.premiseNumberSuffix`,
@@ -219,7 +221,7 @@ const ke = (U) => {
219
221
  xs: 12,
220
222
  md: 6
221
223
  },
222
- component: r.TextField,
224
+ component: n.TextField,
223
225
  props: {
224
226
  label: a("thoroughfare"),
225
227
  name: `${e}.thoroughfare`,
@@ -233,7 +235,7 @@ const ke = (U) => {
233
235
  xs: 12,
234
236
  md: 6
235
237
  },
236
- component: r.TextField,
238
+ component: n.TextField,
237
239
  props: {
238
240
  label: a("locality"),
239
241
  name: `${e}.locality`,
@@ -247,29 +249,29 @@ const ke = (U) => {
247
249
  xs: 12,
248
250
  md: 6
249
251
  },
250
- component: r.Autocomplete,
252
+ component: n.Autocomplete,
251
253
  props: {
252
254
  label: a("administrativeArea"),
253
255
  name: `${e}.administrativeArea`,
254
256
  id: `${e}AdministrativeArea`,
255
- options: b,
257
+ options: $,
256
258
  fullWidth: !0
257
259
  }
258
260
  }
259
261
  }, de = l.locality.component, me = l.thoroughfare.component, ue = () => {
260
262
  const t = ["xs", "md"];
261
263
  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
+ return u?.alpha2Code === "NL" && (o = Te), u?.alpha2Code === "SG" && (o = ve), u?.alpha2Code === "MO" && (o = Le), o.reduce((r, F) => {
265
+ const m = F.map((s) => j(s)).filter(
264
266
  (s) => !!l[s] && C([s])
265
267
  );
266
- if (!u.length)
267
- return n;
268
+ if (!m.length)
269
+ return r;
268
270
  const pe = ye(
269
- u,
271
+ m,
270
272
  t,
271
273
  l
272
- ), V = u.map((s) => {
274
+ ), V = m.map((s) => {
273
275
  const ce = l[s].component, fe = t.reduce(
274
276
  (he, P) => ({
275
277
  ...he,
@@ -279,16 +281,16 @@ const ke = (U) => {
279
281
  );
280
282
  return /* @__PURE__ */ i(d, { item: !0, ...fe, children: /* @__PURE__ */ i(ce, { ...l[s].props }) }, s);
281
283
  });
282
- return u.length > 1 ? [
283
- ...n,
284
- /* @__PURE__ */ i(d, { item: !0, container: !0, spacing: 2, children: V }, u.join("."))
285
- ] : [...n, ...V];
284
+ return m.length > 1 ? [
285
+ ...r,
286
+ /* @__PURE__ */ i(d, { item: !0, container: !0, spacing: 2, children: V }, m.join("."))
287
+ ] : [...r, ...V];
286
288
  }, []);
287
289
  };
288
290
  return /* @__PURE__ */ p(M, { children: [
289
291
  /* @__PURE__ */ p(d, { container: !0, spacing: 2, children: [
290
292
  /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(
291
- r.CountrySelect,
293
+ n.CountrySelect,
292
294
  {
293
295
  label: a("country"),
294
296
  name: `${e}.country`,
@@ -296,7 +298,7 @@ const ke = (U) => {
296
298
  inputRef: D,
297
299
  onBlur: h,
298
300
  onChange: se,
299
- filterCountryOptions: ne,
301
+ filterCountryOptions: re,
300
302
  sortBy: "name",
301
303
  fullWidth: !0
302
304
  }
@@ -304,15 +306,15 @@ const ke = (U) => {
304
306
  L && /* @__PURE__ */ p(d, { item: !0, xs: 12, children: [
305
307
  /* @__PURE__ */ i(Fe, { sx: { fontWeight: 500, mb: 0.5 }, children: a("salutation") }),
306
308
  /* @__PURE__ */ p(
307
- r.RadioGroup,
309
+ n.RadioGroup,
308
310
  {
309
311
  id: `${e}Salutation`,
310
312
  name: `${e}.salutation`,
311
313
  row: !0,
312
314
  children: [
313
- /* @__PURE__ */ i(r.Radio, { label: a("salutationMr"), value: "mr" }),
315
+ /* @__PURE__ */ i(n.Radio, { label: a("salutationMr"), value: "mr" }),
314
316
  /* @__PURE__ */ i(
315
- r.Radio,
317
+ n.Radio,
316
318
  {
317
319
  label: a("salutationMrs"),
318
320
  value: "mrs"
@@ -324,24 +326,24 @@ const ke = (U) => {
324
326
  ] }),
325
327
  !O && /* @__PURE__ */ i(M, { children: ue() })
326
328
  ] }),
327
- m?.alpha2Code === "NL" && /* @__PURE__ */ i(B, { in: re, children: /* @__PURE__ */ p(d, { container: !0, spacing: 2, sx: { pt: 2 }, children: [
329
+ u?.alpha2Code === "NL" && /* @__PURE__ */ i(B, { in: ne, children: /* @__PURE__ */ p(d, { container: !0, spacing: 2, sx: { pt: 2 }, children: [
328
330
  C(["thoroughfare"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(me, { ...l.thoroughfare.props }) }),
329
331
  C(["locality"]) && /* @__PURE__ */ i(d, { item: !0, xs: 12, children: /* @__PURE__ */ i(de, { ...l.locality.props }) })
330
332
  ] }) }),
331
333
  /* @__PURE__ */ i(
332
334
  B,
333
335
  {
334
- in: !W && $ && !!oe,
336
+ in: !W && N && !!oe,
335
337
  sx: { width: "100%" },
336
338
  children: /* @__PURE__ */ i(ge, { mt: 4, children: /* @__PURE__ */ i(
337
339
  Se,
338
340
  {
339
341
  ...q,
340
342
  address: {
341
- ...x,
342
- countryCode: x?.country?.alpha2Code,
343
+ ...b,
344
+ countryCode: b?.country?.alpha2Code,
343
345
  options: {
344
- ...x?.options || {},
346
+ ...b?.options || {},
345
347
  format: A.address
346
348
  }
347
349
  },
@@ -1,7 +1,7 @@
1
1
  import { CheckoutAgreementOptionConditionType, DeepPartial } from '../types';
2
2
  declare const defaultTranslations: {
3
3
  payImmediately: string;
4
- paymentOnDelivery: string;
4
+ remainingAmountDueBeforeDelivery: string;
5
5
  withinDaysOfTheInvoiceDate: string;
6
6
  };
7
7
  export interface CheckoutAgreementOptionConditionProps {
@@ -1,33 +1,33 @@
1
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
- import { Box as c, Typography as m } from "@afosto/components";
1
+ import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
+ import { Box as m, Typography as c } from "@afosto/components";
3
3
  import { TurnDownRightSolid as g } from "../icons/TurnDownRightSolid.js";
4
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";
5
+ import { camelize as D } from "@afosto/utils";
6
+ import { useCheckout as x } from "../CheckoutStateProvider/CheckoutStateProvider.js";
7
+ import { formatCurrency as v } from "../utils/formatCurrency.js";
8
8
  const w = {
9
9
  payImmediately: "Pay immediately",
10
- paymentOnDelivery: "Payment on delivery",
10
+ remainingAmountDueBeforeDelivery: "Remaining amount due before delivery",
11
11
  withinDaysOfTheInvoiceDate: "Within {days} days of the invoice date"
12
- }, S = (y) => {
12
+ }, b = (l) => {
13
13
  const {
14
14
  condition: e,
15
- currency: i,
15
+ currency: a,
16
16
  locale: r,
17
- translations: l = {}
18
- } = y, { settings: p, translations: d } = v(), { currency: u } = p || {}, n = {
17
+ translations: y = {}
18
+ } = l, { settings: u, translations: p } = x(), { currency: d } = u || {}, n = {
19
19
  ...w,
20
- ...d.agreementOptionConditions || {},
21
- ...l || {}
22
- }, o = x(e.type?.toLowerCase() || ""), f = e.outcome?.amount || 0;
20
+ ...p.agreementOptionConditions || {},
21
+ ...y || {}
22
+ }, o = D(e.type?.toLowerCase() || ""), f = e.outcome?.amount || 0;
23
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
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 ? ` (${v(e.amount / 100, r, {
25
+ currency: a || d
26
26
  })})` : ""}`), o === "postPaid" && (t = n.withinDaysOfTheInvoiceDate.replace(
27
27
  "{days}",
28
28
  e.pastDueAfter.toString()
29
- )), o === "cod" && (t = n.paymentOnDelivery), /* @__PURE__ */ s(
30
- c,
29
+ )), o === "cod" && (t = n.remainingAmountDueBeforeDelivery), /* @__PURE__ */ s(
30
+ m,
31
31
  {
32
32
  sx: {
33
33
  display: "flex",
@@ -36,19 +36,19 @@ const w = {
36
36
  justifyContent: "space-between"
37
37
  },
38
38
  children: [
39
- /* @__PURE__ */ s(c, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
40
- /* @__PURE__ */ a(
39
+ /* @__PURE__ */ s(m, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
40
+ /* @__PURE__ */ i(
41
41
  g,
42
42
  {
43
43
  sx: { color: (h) => h.palette.gray[400], fontSize: 16 }
44
44
  }
45
45
  ),
46
- /* @__PURE__ */ a(m, { children: t })
46
+ /* @__PURE__ */ i(c, { children: t })
47
47
  ] }),
48
- /* @__PURE__ */ a(m, { fontWeight: 500, children: /* @__PURE__ */ a(
48
+ /* @__PURE__ */ i(c, { fontWeight: 500, children: /* @__PURE__ */ i(
49
49
  C,
50
50
  {
51
- currency: i,
51
+ currency: a,
52
52
  locale: r,
53
53
  value: f / 100
54
54
  }
@@ -58,5 +58,5 @@ const w = {
58
58
  );
59
59
  };
60
60
  export {
61
- S as CheckoutAgreementOptionCondition
61
+ b as CheckoutAgreementOptionCondition
62
62
  };
@@ -1,17 +1,17 @@
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 m, TimelineDot as h, TimelineConnector as P, TimelineContent as u, Box as y, Typography as i } from "@afosto/components";
2
+ import { Card as j, Timeline as A, TimelineItem as p, TimelineSeparator as m, TimelineDot as u, TimelineConnector as P, TimelineContent as h, 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";
6
6
  import { CheckSolid as x } from "../icons/CheckSolid.js";
7
7
  const S = {
8
8
  alreadyPaid: "Already paid",
9
- cod: "Pay on delivery",
9
+ cod: "Remaining amount due before delivery",
10
10
  downPayment: "Down payment",
11
11
  dueLater: "Due later",
12
12
  payImmediately: "Pay immediately",
13
13
  postPaid: "Pay afterwards"
14
- }, R = (T) => {
14
+ }, _ = (T) => {
15
15
  const {
16
16
  agreements: C = [],
17
17
  currency: c,
@@ -34,7 +34,7 @@ const S = {
34
34
  r > 0 && r < l && /* @__PURE__ */ n(p, { sx: { minHeight: 40 }, children: [
35
35
  /* @__PURE__ */ n(m, { children: [
36
36
  /* @__PURE__ */ t(
37
- h,
37
+ u,
38
38
  {
39
39
  sx: {
40
40
  width: 16,
@@ -59,7 +59,7 @@ const S = {
59
59
  }
60
60
  )
61
61
  ] }),
62
- /* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
62
+ /* @__PURE__ */ t(h, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
63
63
  y,
64
64
  {
65
65
  sx: {
@@ -89,7 +89,7 @@ const S = {
89
89
  children: [
90
90
  /* @__PURE__ */ n(m, { children: [
91
91
  /* @__PURE__ */ t(
92
- h,
92
+ u,
93
93
  {
94
94
  sx: {
95
95
  width: 16,
@@ -130,7 +130,7 @@ const S = {
130
130
  }
131
131
  )
132
132
  ] }),
133
- /* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
133
+ /* @__PURE__ */ t(h, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
134
134
  y,
135
135
  {
136
136
  sx: {
@@ -169,7 +169,7 @@ const S = {
169
169
  sx: { minHeight: b.length - 1 === o ? 48 : 64 },
170
170
  children: [
171
171
  /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(
172
- h,
172
+ u,
173
173
  {
174
174
  sx: {
175
175
  ...r >= l && r < l + (e.outcome?.amount || 0) ? {
@@ -211,7 +211,7 @@ const S = {
211
211
  children: r >= l + (e.outcome?.amount || 0) && /* @__PURE__ */ t(x, {})
212
212
  }
213
213
  ) }),
214
- /* @__PURE__ */ t(u, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
214
+ /* @__PURE__ */ t(h, { sx: { pt: 0, pl: 1.5, pr: 0, pb: 0 }, children: /* @__PURE__ */ n(
215
215
  y,
216
216
  {
217
217
  sx: {
@@ -244,5 +244,5 @@ const S = {
244
244
  ] }) });
245
245
  };
246
246
  export {
247
- R as CheckoutAgreementsTimeline
247
+ _ as CheckoutAgreementsTimeline
248
248
  };
@@ -6,7 +6,7 @@ declare const defaultTranslations: {
6
6
  };
7
7
  export interface CheckoutShippingMethodSectionProps extends Omit<CheckoutSectionProps, 'children'> {
8
8
  countryCode: string;
9
- postalCode: string;
9
+ postalCode?: string;
10
10
  translations?: DeepPartial<typeof defaultTranslations>;
11
11
  }
12
12
  export declare const CheckoutShippingMethodSection: (props: CheckoutShippingMethodSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutShippingMethodSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingMethodSection/CheckoutShippingMethodSection.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAI5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;CAGxB,CAAC;AAEF,MAAM,WAAW,kCACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,qDA6B1C,CAAC"}
1
+ {"version":3,"file":"CheckoutShippingMethodSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingMethodSection/CheckoutShippingMethodSection.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAI5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;CAGxB,CAAC;AAEF,MAAM,WAAW,kCACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,qDA6B1C,CAAC"}
@@ -9,7 +9,7 @@ export interface CheckoutShippingMethodsFieldProps {
9
9
  countryCode: string;
10
10
  currency?: string;
11
11
  locale?: string;
12
- postalCode: string;
12
+ postalCode?: string;
13
13
  translations?: DeepPartial<typeof defaultTranslations>;
14
14
  }
15
15
  export declare const CheckoutShippingMethodsField: (props: CheckoutShippingMethodsFieldProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutShippingMethodsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingMethodsField/CheckoutShippingMethodsField.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,UAAU,CAAC;AAE3D,QAAA,MAAM,mBAAmB;;;;CAKxB,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,4BAA4B,GACvC,OAAO,iCAAiC,qDA2IzC,CAAC"}
1
+ {"version":3,"file":"CheckoutShippingMethodsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingMethodsField/CheckoutShippingMethodsField.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,UAAU,CAAC;AAE3D,QAAA,MAAM,mBAAmB;;;;CAKxB,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,4BAA4B,GACvC,OAAO,iCAAiC,qDAwIzC,CAAC"}