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