@afosto/checkout-ui 0.0.17 → 0.0.19

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 (100) hide show
  1. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts.map +1 -1
  2. package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +26 -22
  3. package/dist/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.d.ts.map +1 -1
  4. package/dist/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.js +18 -17
  5. package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.d.ts.map +1 -1
  6. package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.js +0 -1
  7. package/dist/CheckoutCurrency/CheckoutCurrency.d.ts.map +1 -1
  8. package/dist/CheckoutCurrency/CheckoutCurrency.js +11 -11
  9. package/dist/CheckoutIssuersField/CheckoutIssuersField.js +15 -14
  10. package/dist/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.d.ts +1 -1
  11. package/dist/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.d.ts.map +1 -1
  12. package/dist/CheckoutPaymentMethodsField/CheckoutPaymentMethodsField.js +6 -6
  13. package/dist/CheckoutPickupPointsField/CheckoutPickupPointsField.d.ts.map +1 -1
  14. package/dist/CheckoutPickupPointsField/CheckoutPickupPointsField.js +13 -12
  15. package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.js +12 -12
  16. package/dist/CheckoutShippingStep/CheckoutShippingStep.d.ts.map +1 -1
  17. package/dist/CheckoutShippingStep/CheckoutShippingStep.js +11 -11
  18. package/dist/CheckoutSubmitButton/CheckoutSubmitButton.d.ts.map +1 -1
  19. package/dist/CheckoutSubmitButton/CheckoutSubmitButton.js +11 -10
  20. package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
  21. package/dist/CheckoutSummary/CheckoutSummary.js +6 -7
  22. package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js +12 -12
  23. package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.d.ts +0 -2
  24. package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.d.ts.map +1 -1
  25. package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.js +16 -18
  26. package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.d.ts +1 -1
  27. package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.d.ts.map +1 -1
  28. package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.js +49 -35
  29. package/dist/CheckoutTerminalsField/CheckoutTerminalsField.js +15 -14
  30. package/dist/constants/analyticsEvents.d.ts +79 -11
  31. package/dist/constants/analyticsEvents.d.ts.map +1 -1
  32. package/dist/constants/analyticsEvents.js +30 -30
  33. package/dist/constants/paymentMethodIconMapping.d.ts +4 -0
  34. package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
  35. package/dist/constants/paymentMethodIconMapping.js +55 -47
  36. package/dist/fragments/CoreCartInitialCheckoutFields.d.ts +4 -0
  37. package/dist/fragments/CoreCartInitialCheckoutFields.d.ts.map +1 -1
  38. package/dist/hooks/useCheckoutAnalytics.d.ts.map +1 -1
  39. package/dist/hooks/useCheckoutAnalytics.js +13 -17
  40. package/dist/hooks/useCheckoutCart.d.ts +2 -2
  41. package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
  42. package/dist/hooks/useCheckoutForm.d.ts +3 -3
  43. package/dist/hooks/useCheckoutForm.d.ts.map +1 -1
  44. package/dist/hooks/useCheckoutFormContext.d.ts +3 -0
  45. package/dist/hooks/useCheckoutFormContext.d.ts.map +1 -0
  46. package/dist/hooks/useCheckoutFormContext.js +5 -0
  47. package/dist/hooks/useCheckoutOrder.d.ts +2 -2
  48. package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
  49. package/dist/hooks/useCheckoutPaymentMethods.js +8 -8
  50. package/dist/hooks/useCheckoutPaymentStep.js +6 -6
  51. package/dist/hooks/useCheckoutShippingMethods.js +14 -14
  52. package/dist/icons/index.js +160 -152
  53. package/dist/icons/paymentMethods/Dankort.d.ts +3 -0
  54. package/dist/icons/paymentMethods/Dankort.d.ts.map +1 -0
  55. package/dist/icons/paymentMethods/Dankort.js +18 -0
  56. package/dist/icons/paymentMethods/Nexi.d.ts +3 -0
  57. package/dist/icons/paymentMethods/Nexi.d.ts.map +1 -0
  58. package/dist/icons/paymentMethods/Nexi.js +17 -0
  59. package/dist/icons/paymentMethods/Swish.d.ts +3 -0
  60. package/dist/icons/paymentMethods/Swish.d.ts.map +1 -0
  61. package/dist/icons/paymentMethods/Swish.js +127 -0
  62. package/dist/icons/paymentMethods/Wero.d.ts +3 -0
  63. package/dist/icons/paymentMethods/Wero.d.ts.map +1 -0
  64. package/dist/icons/paymentMethods/Wero.js +15 -0
  65. package/dist/icons/paymentMethods/index.d.ts +4 -0
  66. package/dist/icons/paymentMethods/index.d.ts.map +1 -1
  67. package/dist/icons/paymentMethods/index.js +112 -104
  68. package/dist/index.js +412 -404
  69. package/dist/mutations/addInformationToCart.d.ts +2 -5
  70. package/dist/mutations/addInformationToCart.d.ts.map +1 -1
  71. package/dist/mutations/addInformationToOrder.d.ts +2 -5
  72. package/dist/mutations/addInformationToOrder.d.ts.map +1 -1
  73. package/dist/steps/informationStep.d.ts +1 -0
  74. package/dist/steps/informationStep.d.ts.map +1 -1
  75. package/dist/steps/informationStep.js +271 -245
  76. package/dist/steps/paymentStep.d.ts.map +1 -1
  77. package/dist/steps/paymentStep.js +23 -23
  78. package/dist/steps/reviewStep.d.ts.map +1 -1
  79. package/dist/steps/reviewStep.js +13 -12
  80. package/dist/steps/shippingStep.d.ts.map +1 -1
  81. package/dist/steps/shippingStep.js +19 -19
  82. package/dist/types.d.ts +39 -11
  83. package/dist/types.d.ts.map +1 -1
  84. package/dist/utils/formatAddressPayload.d.ts +5 -2
  85. package/dist/utils/formatAddressPayload.d.ts.map +1 -1
  86. package/dist/utils/formatAddressPayload.js +24 -24
  87. package/dist/utils/formatAddressResponse.d.ts +1 -0
  88. package/dist/utils/formatAddressResponse.d.ts.map +1 -1
  89. package/dist/utils/formatInformationStepPayload.d.ts +2 -2
  90. package/dist/utils/formatInformationStepPayload.d.ts.map +1 -1
  91. package/dist/utils/formatUpdateAccountInformationPayload.d.ts +7 -2
  92. package/dist/utils/formatUpdateAccountInformationPayload.d.ts.map +1 -1
  93. package/dist/utils/formatUpdateAccountInformationPayload.js +3 -1
  94. package/dist/utils/formatUpdateOrganisationOnAccountPayload.d.ts +16 -3
  95. package/dist/utils/formatUpdateOrganisationOnAccountPayload.d.ts.map +1 -1
  96. package/dist/utils/formatUpdateOrganisationOnAccountPayload.js +7 -5
  97. package/dist/utils/setupCustomValidationRules.d.ts.map +1 -1
  98. package/dist/utils/setupCustomValidationRules.js +15 -15
  99. package/package.json +2 -2
  100. package/dist/modules.d.js +0 -1
@@ -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;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
+ {"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,qDA+E7C,CAAC"}
@@ -1,28 +1,32 @@
1
1
  import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
2
  import { Box as m, Typography as c } from "@afosto/components";
3
- import { TurnDownRightSolid as g } from "../icons/TurnDownRightSolid.js";
4
- import { CheckoutCurrency as C } from "../CheckoutCurrency/CheckoutCurrency.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
- const w = {
3
+ import { TurnDownRightSolid as C } from "../icons/TurnDownRightSolid.js";
4
+ import { CheckoutCurrency as D } 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 w } from "../utils/formatCurrency.js";
8
+ const I = {
9
9
  payImmediately: "Pay immediately",
10
10
  remainingAmountDueBeforeDelivery: "Remaining amount due before delivery",
11
11
  withinDaysOfTheInvoiceDate: "Within {days} days of the invoice date"
12
- }, b = (l) => {
12
+ }, j = (l) => {
13
13
  const {
14
14
  condition: e,
15
- currency: a,
16
- locale: r,
15
+ currency: r,
16
+ locale: a,
17
17
  translations: y = {}
18
- } = l, { settings: u, translations: p } = x(), { currency: d } = u || {}, n = {
19
- ...w,
20
- ...p.agreementOptionConditions || {},
18
+ } = l, {
19
+ settings: u,
20
+ summary: p,
21
+ translations: d
22
+ } = v(), f = p?.currency || u?.currency, n = {
23
+ ...I,
24
+ ...d.agreementOptionConditions || {},
21
25
  ...y || {}
22
- }, o = D(e.type?.toLowerCase() || ""), f = e.outcome?.amount || 0;
26
+ }, o = x(e.type?.toLowerCase() || ""), h = e.outcome?.amount || 0;
23
27
  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 ? ` (${v(e.amount / 100, r, {
25
- currency: a || d
28
+ 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 ? ` (${w(e.amount / 100, a, {
29
+ currency: r || f
26
30
  })})` : ""}`), o === "postPaid" && (t = n.withinDaysOfTheInvoiceDate.replace(
27
31
  "{days}",
28
32
  e.pastDueAfter.toString()
@@ -38,19 +42,19 @@ const w = {
38
42
  children: [
39
43
  /* @__PURE__ */ s(m, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
40
44
  /* @__PURE__ */ i(
41
- g,
45
+ C,
42
46
  {
43
- sx: { color: (h) => h.palette.gray[400], fontSize: 16 }
47
+ sx: { color: (g) => g.palette.gray[400], fontSize: 16 }
44
48
  }
45
49
  ),
46
50
  /* @__PURE__ */ i(c, { children: t })
47
51
  ] }),
48
52
  /* @__PURE__ */ i(c, { fontWeight: 500, children: /* @__PURE__ */ i(
49
- C,
53
+ D,
50
54
  {
51
- currency: a,
52
- locale: r,
53
- value: f / 100
55
+ currency: r,
56
+ locale: a,
57
+ value: h / 100
54
58
  }
55
59
  ) })
56
60
  ]
@@ -58,5 +62,5 @@ const w = {
58
62
  );
59
63
  };
60
64
  export {
61
- b as CheckoutAgreementOptionCondition
65
+ j as CheckoutAgreementOptionCondition
62
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutAgreementOptionsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,2BAA2B,EAC3B,+BAA+B,EAC/B,WAAW,EAEZ,MAAM,UAAU,CAAC;AAMlB,QAAA,MAAM,mBAAmB;;;;;;;;CAUxB,CAAC;AAEF,MAAM,WAAW,kCAAkC;IACjD,gBAAgB,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,+BAA+B,EAAE,CAAC;IACnD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,qDAyI1C,CAAC"}
1
+ {"version":3,"file":"CheckoutAgreementOptionsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,2BAA2B,EAC3B,+BAA+B,EAC/B,WAAW,EAEZ,MAAM,UAAU,CAAC;AAOlB,QAAA,MAAM,mBAAmB;;;;;;;;CAUxB,CAAC;AAEF,MAAM,WAAW,kCAAkC;IACjD,gBAAgB,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,+BAA+B,EAAE,CAAC;IACnD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,qDAyI1C,CAAC"}
@@ -3,7 +3,8 @@ import { CheckoutCardRadioField as M } from "../CheckoutCardRadioField/CheckoutC
3
3
  import { useCheckout as V } from "../CheckoutStateProvider/CheckoutStateProvider.js";
4
4
  import { CheckoutAgreementOption as v } from "../CheckoutAgreementOption/CheckoutAgreementOption.js";
5
5
  import { CheckoutMethodRadioSkeleton as j } from "../CheckoutMethodRadioSkeleton/CheckoutMethodRadioSkeleton.js";
6
- import { useFormContext as z, Divider as E, Typography as R } from "@afosto/components";
6
+ import { Divider as z, Typography as E } from "@afosto/components";
7
+ import { useCheckoutFormContext as R } from "../hooks/useCheckoutFormContext.js";
7
8
  import { camelize as w, capitalize as W } from "@afosto/utils";
8
9
  import { getErrorMessage as q } from "../utils/getErrorMessage.js";
9
10
  const B = {
@@ -14,7 +15,7 @@ const B = {
14
15
  orPayLayer: "Or pay later",
15
16
  payNow: "Pay now",
16
17
  payNowDescription: "Pay the full amount immediately"
17
- }, Z = (k) => {
18
+ }, _ = (k) => {
18
19
  const {
19
20
  agreementOptions: i = [],
20
21
  currency: p,
@@ -26,22 +27,22 @@ const B = {
26
27
  } = k || {}, {
27
28
  activeStep: g,
28
29
  setAgreementTemplate: b,
29
- setErrorMessage: y,
30
+ setErrorMessage: u,
30
31
  setIsProcessing: s,
31
- translations: u
32
- } = V(), { formProps: I, getValues: x, reset: h, watch: D } = z(), { setData: L } = I || {}, [f] = D([d]), t = {
32
+ translations: y
33
+ } = V(), { formProps: I, getValues: x, reset: h, watch: D } = R(), { setData: L } = I || {}, [f] = D([d]), t = {
33
34
  ...B,
34
- ...u?.agreementOptionsField || {},
35
- ...u?.feedback || {},
35
+ ...y?.agreementOptionsField || {},
36
+ ...y?.feedback || {},
36
37
  ...S || {}
37
38
  }, l = i.find(
38
39
  (e) => w(e.type?.toLowerCase() || "") === "default"
39
- ), O = i.filter(
40
+ ), C = i.filter(
40
41
  (e) => w(e.type?.toLowerCase() || "") !== "default"
41
- ), C = async (e) => {
42
+ ), O = async (e) => {
42
43
  const A = x();
43
44
  try {
44
- y(null), s(!0);
45
+ u(null), s(!0);
45
46
  const { value: o } = e.target, r = i.find(
46
47
  (n) => n.id === o
47
48
  );
@@ -55,13 +56,13 @@ const B = {
55
56
  h({
56
57
  ...A,
57
58
  ...T
58
- }), L((n) => (n.splice(g, 1, {
59
+ }), L?.((n) => (n.splice(g, 1, {
59
60
  ...n[g],
60
61
  ...T
61
62
  }), n)), s(!1);
62
63
  } catch (o) {
63
64
  const r = q(o);
64
- y({
65
+ u({
65
66
  title: t.failedToSelectAgreementOptionTitle,
66
67
  description: r ? W(r) : t.failedToSelectAgreementOptionDescription
67
68
  }), h(A), s(!1);
@@ -73,10 +74,10 @@ const B = {
73
74
  id: "field-radio-agreement-option",
74
75
  name: d,
75
76
  isLoading: c,
76
- onChange: C,
77
+ onChange: O,
77
78
  OptionComponent: v,
78
79
  OptionSkeletonComponent: j,
79
- options: O.map((e) => ({
80
+ options: C.map((e) => ({
80
81
  ...e,
81
82
  value: e.id
82
83
  })),
@@ -92,7 +93,7 @@ const B = {
92
93
  active: f === l.id,
93
94
  currency: p,
94
95
  locale: m,
95
- onChange: C,
96
+ onChange: O,
96
97
  option: {
97
98
  ...l,
98
99
  description: t.payNowDescription,
@@ -103,11 +104,11 @@ const B = {
103
104
  hideIcon: !0
104
105
  }
105
106
  ),
106
- O.length > 0 && /* @__PURE__ */ a(E, { sx: { my: 2.5 }, children: /* @__PURE__ */ a(R, { color: "gray.500", children: t.orPayLayer }) })
107
+ C.length > 0 && /* @__PURE__ */ a(z, { sx: { my: 2.5 }, children: /* @__PURE__ */ a(E, { color: "gray.500", children: t.orPayLayer }) })
107
108
  ] })
108
109
  }
109
110
  );
110
111
  };
111
112
  export {
112
- Z as CheckoutAgreementOptionsField
113
+ _ as CheckoutAgreementOptionsField
113
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutContactInformationSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutContactInformationSection/CheckoutContactInformationSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAc5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;;;;;;;;CAWxB,CAAC;AAEF,MAAM,WAAW,sCACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,iCAAiC,GAC5C,OAAO,sCAAsC,qDAyK9C,CAAC"}
1
+ {"version":3,"file":"CheckoutContactInformationSection.d.ts","sourceRoot":"","sources":["../../src/CheckoutContactInformationSection/CheckoutContactInformationSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAc5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;;;;;;;;CAWxB,CAAC;AAEF,MAAM,WAAW,sCACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,iCAAiC,GAC5C,OAAO,sCAAsC,qDAwK9C,CAAC"}
@@ -134,7 +134,6 @@ const J = {
134
134
  /* @__PURE__ */ e(h, { in: !l, children: /* @__PURE__ */ e(
135
135
  s.PhoneNumberField,
136
136
  {
137
- id: "phone-number",
138
137
  numberFieldName: "phoneNumber",
139
138
  label: n.phoneNumber,
140
139
  autoComplete: "tel-national",
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutCurrency.d.ts","sourceRoot":"","sources":["../../src/CheckoutCurrency/CheckoutCurrency.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,WAoB5D,CAAC"}
1
+ {"version":3,"file":"CheckoutCurrency.d.ts","sourceRoot":"","sources":["../../src/CheckoutCurrency/CheckoutCurrency.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,WAqB5D,CAAC"}
@@ -1,18 +1,18 @@
1
- import { useCheckout as y } from "../CheckoutStateProvider/CheckoutStateProvider.js";
2
- const m = (c) => {
1
+ import { useCheckout as m } from "../CheckoutStateProvider/CheckoutStateProvider.js";
2
+ const p = (e) => {
3
3
  const {
4
- currency: e,
5
- value: o,
6
- locale: r,
4
+ currency: c,
5
+ value: r,
6
+ locale: o,
7
7
  options: t
8
- } = c, { locale: n, settings: u } = y(), { currency: l } = u || {}, s = {
8
+ } = e, { locale: n, settings: u, summary: s } = m(), { currency: l } = u || {}, a = {
9
9
  style: "currency",
10
- currency: e || l || "EUR"
11
- }, a = r || n;
12
- return new Intl.NumberFormat(a, t || s).format(
13
- o
10
+ currency: c || s?.currency || l || "EUR"
11
+ }, y = o || n;
12
+ return new Intl.NumberFormat(y, t || a).format(
13
+ r
14
14
  );
15
15
  };
16
16
  export {
17
- m as CheckoutCurrency
17
+ p as CheckoutCurrency
18
18
  };
@@ -1,5 +1,6 @@
1
1
  import { jsx as l, jsxs as f } from "react/jsx-runtime";
2
- import { useFormContext as F, Fields as v, Typography as z, Box as I } from "@afosto/components";
2
+ import { Fields as F, Typography as v, Box as I } from "@afosto/components";
3
+ import { useCheckoutFormContext as z } from "../hooks/useCheckoutFormContext.js";
3
4
  import { useCheckout as M } from "../CheckoutStateProvider/CheckoutStateProvider.js";
4
5
  import { getErrorMessage as V } from "../utils/getErrorMessage.js";
5
6
  import { camelize as g, capitalize as O } from "@afosto/utils";
@@ -8,10 +9,10 @@ const _ = {
8
9
  failedToSelectIssuerTitle: "Issuer not selected",
9
10
  failedToSelectIssuerDescription: "Something went wrong while selecting the issuer. Choose another issuer or try again.",
10
11
  issuerFieldPlaceholder: "Choose a bank"
11
- }, D = (y) => {
12
+ }, G = (y) => {
12
13
  const {
13
14
  disabled: x,
14
- name: n = "issuerId",
15
+ name: i = "issuerId",
15
16
  issuers: c = [],
16
17
  translations: S = {}
17
18
  } = y, {
@@ -20,7 +21,7 @@ const _ = {
20
21
  setErrorMessage: u,
21
22
  setIsProcessing: a,
22
23
  translations: m
23
- } = M(), { formProps: P, getValues: w, setValue: p, watch: b } = F(), { setData: k } = P || {}, [h] = b([n]), i = {
24
+ } = M(), { formProps: P, getValues: w, setValue: p, watch: k } = z(), { setData: b } = P || {}, [h] = k([i]), n = {
24
25
  ..._,
25
26
  ...m?.issuersField || {},
26
27
  ...m?.feedback || {},
@@ -30,33 +31,33 @@ const _ = {
30
31
  try {
31
32
  u(null), a(!0);
32
33
  const { value: s } = e.target, t = w();
33
- p(n, s || ""), await T({
34
+ p(i, s || ""), await T({
34
35
  methodId: t.methodId,
35
36
  issuerId: s
36
- }), k((o) => (o.splice(d, 1, {
37
+ }), b?.((o) => (o.splice(d, 1, {
37
38
  ...o[d],
38
39
  issuerId: s || ""
39
40
  }), o)), a(!1);
40
41
  } catch (s) {
41
42
  const t = V(s);
42
43
  u({
43
- title: i.failedToSelectIssuerTitle,
44
- description: t ? O(t) : i.failedToSelectIssuerDescription
45
- }), p(n, r), a(!1);
44
+ title: n.failedToSelectIssuerTitle,
45
+ description: t ? O(t) : n.failedToSelectIssuerDescription
46
+ }), p(i, r), a(!1);
46
47
  }
47
48
  };
48
49
  return /* @__PURE__ */ l(
49
- v.Select,
50
+ F.Select,
50
51
  {
51
52
  displayEmpty: !0,
52
53
  disabled: x,
53
- name: n,
54
+ name: i,
54
55
  onChange: E,
55
56
  options: c.map((e) => ({
56
57
  ...e,
57
58
  value: e.id
58
59
  })),
59
- placeholder: i.issuerFieldPlaceholder,
60
+ placeholder: n.issuerFieldPlaceholder,
60
61
  renderOption: (e) => {
61
62
  const r = typeof e.value == "string" ? g(e.value?.toLowerCase() || "") : "", s = C[r];
62
63
  return /* @__PURE__ */ f(I, { sx: { display: "flex", alignItems: "center" }, children: [
@@ -66,7 +67,7 @@ const _ = {
66
67
  },
67
68
  renderValue: (e) => {
68
69
  if (!e)
69
- return /* @__PURE__ */ l(z, { color: "gray.600", children: i.issuerFieldPlaceholder });
70
+ return /* @__PURE__ */ l(v, { color: "gray.600", children: n.issuerFieldPlaceholder });
70
71
  const r = c.find((o) => o.id === e), s = typeof e == "string" ? g(e?.toLowerCase() || "") : "", t = C[s];
71
72
  return /* @__PURE__ */ f(I, { sx: { display: "flex", alignItems: "center" }, children: [
72
73
  t && /* @__PURE__ */ l(t, { sx: { fontSize: 20, mr: 1.5 } }),
@@ -79,5 +80,5 @@ const _ = {
79
80
  );
80
81
  };
81
82
  export {
82
- D as CheckoutIssuersField
83
+ G as CheckoutIssuersField
83
84
  };
@@ -10,7 +10,7 @@ declare const defaultTranslations: {
10
10
  export interface CheckoutNotFoundFeedbackProps {
11
11
  description?: string;
12
12
  Icon?: JSXElementConstructor<SvgIconProps>;
13
- severity?: FeedbackMessageSeverity;
13
+ severity?: FeedbackMessageSeverity | 'default';
14
14
  title?: string;
15
15
  translations?: DeepPartial<typeof defaultTranslations>;
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutNotFoundFeedback.d.ts","sourceRoot":"","sources":["../../src/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;;;CAMxB,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,wBAAwB,GACnC,OAAO,6BAA6B,qDAiCrC,CAAC"}
1
+ {"version":3,"file":"CheckoutNotFoundFeedback.d.ts","sourceRoot":"","sources":["../../src/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,mBAAmB;;;;;CAMxB,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,wBAAwB,GACnC,OAAO,6BAA6B,qDAiCrC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as P } from "react/jsx-runtime";
2
- import { useFormContext as F } from "@afosto/components";
2
+ import { useCheckoutFormContext as F } from "../hooks/useCheckoutFormContext.js";
3
3
  import { useCheckoutPaymentMethods as O } from "../hooks/useCheckoutPaymentMethods.js";
4
4
  import { getErrorMessage as V } from "../utils/getErrorMessage.js";
5
5
  import { capitalize as z } from "@afosto/utils";
@@ -13,14 +13,14 @@ const q = {
13
13
  failedToSelectPaymentMethodDescription: "Something went wrong while selecting the payment method. Choose another payment method or try again.",
14
14
  noPaymentMethodsAvailableTitle: "No payment methods available",
15
15
  noPaymentMethodsAvailableDescription: "We are sorry, but there are currently no payment methods available for your order. Please contact us to complete your purchase."
16
- }, _ = (T) => {
16
+ }, _ = (C) => {
17
17
  const {
18
18
  currency: r,
19
- locale: C,
19
+ locale: T,
20
20
  name: l = "methodId",
21
21
  hideEmptyMessage: k = !1,
22
22
  translations: v = {}
23
- } = T || {}, {
23
+ } = C || {}, {
24
24
  activeStep: d,
25
25
  addPaymentMethod: w,
26
26
  setErrorMessage: m,
@@ -48,7 +48,7 @@ const q = {
48
48
  p({
49
49
  ...y,
50
50
  ...g
51
- }), A((t) => (t?.splice(d, 1, {
51
+ }), A?.((t) => (t?.splice(d, 1, {
52
52
  ...t[d],
53
53
  ...g
54
54
  }), t)), a(!1);
@@ -82,7 +82,7 @@ const q = {
82
82
  })),
83
83
  optionProps: {
84
84
  currency: r,
85
- locale: C
85
+ locale: T
86
86
  },
87
87
  value: E
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutPickupPointsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutPickupPointsField/CheckoutPickupPointsField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,QAAQ,EAUd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,iCAAiC,EACjC,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAS5D,QAAA,MAAM,mBAAmB;;;;;;;CAQxB,CAAC;AAEF,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,iCAAiC,EAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,yBAAyB,GACpC,OAAO,8BAA8B,qDAuMtC,CAAC"}
1
+ {"version":3,"file":"CheckoutPickupPointsField.d.ts","sourceRoot":"","sources":["../../src/CheckoutPickupPointsField/CheckoutPickupPointsField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,QAAQ,EASd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,iCAAiC,EACjC,WAAW,EAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAS5D,QAAA,MAAM,mBAAmB;;;;;;;CAQxB,CAAC;AAEF,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,iCAAiC,EAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,yBAAyB,GACpC,OAAO,8BAA8B,qDAuMtC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
- import { useFormContext as Q, Box as U, TextField as X, InputAdornment as Y, CircularProgress as Z, Fields as _, Collapse as v, Grid as d, Typography as $, Button as ee } from "@afosto/components";
2
+ import { Box as Q, TextField as U, InputAdornment as X, CircularProgress as Y, Fields as Z, Collapse as v, Grid as d, Typography as _, Button as $ } from "@afosto/components";
3
+ import { useCheckoutFormContext as ee } from "../hooks/useCheckoutFormContext.js";
3
4
  import { useState as oe, useMemo as te } from "react";
4
5
  import { SearchRegular as ie } from "../icons/SearchRegular.js";
5
6
  import { CheckoutPickupPointOption as T } from "../CheckoutPickupPointOption/CheckoutPickupPointOption.js";
@@ -15,7 +16,7 @@ const ae = {
15
16
  searchForPostalCode: "Search for postal code",
16
17
  showLess: "Show less options",
17
18
  showMore: "Show other {count} options"
18
- }, Se = (b) => {
19
+ }, xe = (b) => {
19
20
  const {
20
21
  defaultSearchValue: M = "",
21
22
  errorMessage: y,
@@ -36,7 +37,7 @@ const ae = {
36
37
  setErrorMessage: w,
37
38
  setIsProcessing: P,
38
39
  translations: S
39
- } = ne(), x = I ?? W, { formProps: z, getValues: B, reset: G, setValue: N, watch: R } = Q(), { setData: D } = z || {}, [s] = R([h]), c = te(() => {
40
+ } = ne(), x = I ?? W, { formProps: z, getValues: B, reset: G, setValue: N, watch: R } = ee(), { setData: D } = z || {}, [s] = R([h]), c = te(() => {
40
41
  const e = r.slice(0, 3).map((t) => t.id), p = r.find(
41
42
  (t) => t.id === s
42
43
  );
@@ -62,7 +63,7 @@ const ae = {
62
63
  try {
63
64
  w(null), P(!0);
64
65
  const { value: t } = e.target;
65
- await E({ pickupPointId: t }), N(h, t || ""), D((i) => (i.splice(k, 1, {
66
+ await E({ pickupPointId: t }), N(h, t || ""), D?.((i) => (i.splice(k, 1, {
66
67
  ...i[k],
67
68
  pickupPointId: t || ""
68
69
  }), i)), P(!1);
@@ -74,15 +75,15 @@ const ae = {
74
75
  }), G(p), P(!1), window && typeof window < "u" && window.scrollTo(0, 0);
75
76
  }
76
77
  };
77
- return /* @__PURE__ */ f(U, { ...V, sx: { pt: 1, px: 2, pb: 2, ...F }, children: [
78
+ return /* @__PURE__ */ f(Q, { ...V, sx: { pt: 1, px: 2, pb: 2, ...F }, children: [
78
79
  g && /* @__PURE__ */ o(
79
- X,
80
+ U,
80
81
  {
81
82
  InputProps: {
82
- startAdornment: /* @__PURE__ */ f(Y, { position: "start", sx: { ml: 1.5 }, children: [
83
+ startAdornment: /* @__PURE__ */ f(X, { position: "start", sx: { ml: 1.5 }, children: [
83
84
  !u && /* @__PURE__ */ o(ie, {}),
84
85
  u && /* @__PURE__ */ o(
85
- Z,
86
+ Y,
86
87
  {
87
88
  size: 16,
88
89
  thickness: 2.5,
@@ -98,7 +99,7 @@ const ae = {
98
99
  fullWidth: !0
99
100
  }
100
101
  ),
101
- /* @__PURE__ */ f(_.RadioGroup, { id: "field-radio-pickup-points", name: h, fullWidth: !0, children: [
102
+ /* @__PURE__ */ f(Z.RadioGroup, { id: "field-radio-pickup-points", name: h, fullWidth: !0, children: [
102
103
  /* @__PURE__ */ o(v, { in: m.length > 0, children: /* @__PURE__ */ o(d, { container: !0, spacing: 2, children: m.map((e) => /* @__PURE__ */ o(d, { item: !0, xs: 12, children: /* @__PURE__ */ o(
103
104
  T,
104
105
  {
@@ -118,9 +119,9 @@ const ae = {
118
119
  }
119
120
  ) }, e.id)) }) })
120
121
  ] }),
121
- q && /* @__PURE__ */ o($, { children: y || n.noAvailablePickupPoints }),
122
+ q && /* @__PURE__ */ o(_, { children: y || n.noAvailablePickupPoints }),
122
123
  H && /* @__PURE__ */ o(
123
- ee,
124
+ $,
124
125
  {
125
126
  startIcon: l ? /* @__PURE__ */ o(ce, {}) : /* @__PURE__ */ o(le, {}),
126
127
  fullWidth: !0,
@@ -137,5 +138,5 @@ const ae = {
137
138
  ] });
138
139
  };
139
140
  export {
140
- Se as CheckoutPickupPointsField
141
+ xe as CheckoutPickupPointsField
141
142
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as j } from "react/jsx-runtime";
2
- import { useFormContext as D } from "@afosto/components";
2
+ import { useCheckoutFormContext as D } from "../hooks/useCheckoutFormContext.js";
3
3
  import { CheckoutCardRadioField as L } from "../CheckoutCardRadioField/CheckoutCardRadioField.js";
4
4
  import { CheckoutShippingMethodOption as q } from "../CheckoutShippingMethodOption/CheckoutShippingMethodOption.js";
5
5
  import { useCheckoutShippingMethods as A } from "../hooks/useCheckoutShippingMethods.js";
@@ -11,15 +11,15 @@ const K = {
11
11
  failedToSearchPickupPoints: "Pickup points search failed. Please try again.",
12
12
  failedToSelectShippingMethodTitle: "Shipping method not selected",
13
13
  failedToSelectShippingMethodDescription: "Something went wrong while selecting the shipping method. Choose another shipping method or try again."
14
- }, oi = (S) => {
14
+ }, oi = (k) => {
15
15
  const {
16
- countryCode: f,
17
- currency: k,
18
- locale: M,
16
+ countryCode: S,
17
+ currency: f,
18
+ locale: C,
19
19
  name: p = "methodId",
20
20
  postalCode: r,
21
- translations: C = {}
22
- } = S || {}, {
21
+ translations: M = {}
22
+ } = k || {}, {
23
23
  activeStep: a,
24
24
  addShippingMethod: T,
25
25
  isProcessing: w,
@@ -36,13 +36,13 @@ const K = {
36
36
  setPickupPoints: V,
37
37
  shippingMethods: l
38
38
  } = A({
39
- countryCode: f,
39
+ countryCode: S,
40
40
  postalCode: r
41
41
  }), { formProps: x, getValues: O, reset: u, watch: z } = D(), { setData: R } = x || {}, [g] = z([p]), s = {
42
42
  ...K,
43
43
  ...d?.shippingMethodsField || {},
44
44
  ...d?.feedback || {},
45
- ...C || {}
45
+ ...M || {}
46
46
  };
47
47
  return /* @__PURE__ */ j(
48
48
  L,
@@ -66,7 +66,7 @@ const K = {
66
66
  u({
67
67
  ...P,
68
68
  ...m
69
- }), R((t) => (t?.splice(a, 1, {
69
+ }), R?.((t) => (t?.splice(a, 1, {
70
70
  ...t[a],
71
71
  ...m
72
72
  }), t)), n(!1);
@@ -88,10 +88,10 @@ const K = {
88
88
  } : {}
89
89
  })),
90
90
  optionProps: {
91
- currency: k,
91
+ currency: f,
92
92
  defaultPickupPointSearchValue: r,
93
93
  isSearchingPickupPoints: w || v,
94
- locale: M,
94
+ locale: C,
95
95
  onSearchPickupPoint: F,
96
96
  searchPickupPointsErrorMessage: y ? s.failedToSearchPickupPoints : void 0
97
97
  },
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutShippingStep.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingStep/CheckoutShippingStep.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,gEAAgE,CAAC;AAGxE,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,YAAY,CAAC,EAAE;QACb,qBAAqB,CAAC,EAAE,kCAAkC,CAAC,cAAc,CAAC,CAAC;KAC5E,CAAC;CACH;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,qDAuBpE,CAAC"}
1
+ {"version":3,"file":"CheckoutShippingStep.d.ts","sourceRoot":"","sources":["../../src/CheckoutShippingStep/CheckoutShippingStep.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,gEAAgE,CAAC;AAIxE,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,YAAY,CAAC,EAAE;QACb,qBAAqB,CAAC,EAAE,kCAAkC,CAAC,cAAc,CAAC,CAAC;KAC5E,CAAC;CACH;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,qDAwBpE,CAAC"}
@@ -1,21 +1,21 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useCheckout as h } from "../CheckoutStateProvider/CheckoutStateProvider.js";
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { useCheckout as m } from "../CheckoutStateProvider/CheckoutStateProvider.js";
3
3
  import { CheckoutShippingMethodSection as u } from "../CheckoutShippingMethodSection/CheckoutShippingMethodSection.js";
4
- import { useFormContext as d } from "@afosto/components";
5
- const g = (t) => {
6
- const { translations: o = {} } = t || {}, { translations: n } = h(), { formProps: s } = d(), { data: i = [] } = s || {}, [r] = i || [], { shipping: a } = r || {}, { countryCode: e, postalCode: p } = a || {}, c = {
4
+ import { useCheckoutFormContext as d } from "../hooks/useCheckoutFormContext.js";
5
+ const k = (o) => {
6
+ const { translations: t = {} } = o || {}, { translations: n } = m(), { formProps: s } = d(), { data: r = [] } = s || {}, [i] = r || [], { shipping: e } = i || {}, { countryCode: a, postalCode: c } = e || {}, p = {
7
7
  ...n,
8
- ...o || {}
8
+ ...t || {}
9
9
  };
10
- return /* @__PURE__ */ m(
10
+ return /* @__PURE__ */ h(
11
11
  u,
12
12
  {
13
- countryCode: e,
14
- postalCode: p,
15
- translations: c.shippingMethodSection
13
+ countryCode: a ?? "",
14
+ postalCode: c,
15
+ translations: p.shippingMethodSection
16
16
  }
17
17
  );
18
18
  };
19
19
  export {
20
- g as CheckoutShippingStep
20
+ k as CheckoutShippingStep
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSubmitButton.d.ts","sourceRoot":"","sources":["../../src/CheckoutSubmitButton/CheckoutSubmitButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG9E,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,qDAiDpE,CAAC"}
1
+ {"version":3,"file":"CheckoutSubmitButton.d.ts","sourceRoot":"","sources":["../../src/CheckoutSubmitButton/CheckoutSubmitButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAI9D,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,qDAiDpE,CAAC"}
@@ -1,30 +1,31 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
- import { useFormContext as f, Button as g } from "@afosto/components";
3
- import { useCheckout as h } from "../CheckoutStateProvider/CheckoutStateProvider.js";
4
- const v = (t) => {
2
+ import { Button as f } from "@afosto/components";
3
+ import { useCheckoutFormContext as h } from "../hooks/useCheckoutFormContext.js";
4
+ import { useCheckout as g } from "../CheckoutStateProvider/CheckoutStateProvider.js";
5
+ const F = (t) => {
5
6
  const {
6
7
  disabled: o,
7
8
  label: i,
8
- loading: n,
9
- ...u
9
+ loading: u,
10
+ ...n
10
11
  } = t, {
11
12
  formRef: s,
12
13
  isProcessing: e,
13
14
  submitButtonDisabled: b
14
- } = h(), m = f(), { isSubmitting: r, submitButtonProps: d } = m?.formProps ?? {}, {
15
+ } = g(), m = h(), { isSubmitting: r, submitButtonProps: d } = m?.formProps ?? {}, {
15
16
  disabled: l,
16
17
  label: a,
17
18
  loading: c,
18
19
  ...B
19
20
  } = d ?? {};
20
21
  return /* @__PURE__ */ p(
21
- g,
22
+ f,
22
23
  {
23
24
  fullWidth: !0,
24
- ...u,
25
+ ...n,
25
26
  ...B,
26
27
  disabled: o ?? (b || l),
27
- loading: n ?? (c || e || r),
28
+ loading: u ?? (c || e || r),
28
29
  onClick: () => {
29
30
  s.current?.submitForm();
30
31
  },
@@ -34,5 +35,5 @@ const v = (t) => {
34
35
  );
35
36
  };
36
37
  export {
37
- v as CheckoutSubmitButton
38
+ F as CheckoutSubmitButton
38
39
  };