@afosto/checkout-ui 0.0.1-alpha.5 → 0.0.1-alpha.7

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 (75) hide show
  1. package/dist/CheckoutAddressBlock/CheckoutAddressBlock.d.ts +1 -1
  2. package/dist/CheckoutAddressBlock/CheckoutAddressBlock.d.ts.map +1 -1
  3. package/dist/CheckoutAddressCard/CheckoutAddressCard.d.ts +2 -2
  4. package/dist/CheckoutAddressCard/CheckoutAddressCard.d.ts.map +1 -1
  5. package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts +2 -2
  6. package/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts.map +1 -1
  7. package/dist/CheckoutAddressFields/CheckoutAddressFields.js +8 -8
  8. package/dist/CheckoutAgreementSummaryCard/CheckoutAgreementSummaryCard.d.ts +2 -2
  9. package/dist/CheckoutAgreementSummaryCard/CheckoutAgreementSummaryCard.d.ts.map +1 -1
  10. package/dist/CheckoutCartProvider/CheckoutCartProvider.d.ts.map +1 -1
  11. package/dist/CheckoutCartProvider/CheckoutCartProvider.js +45 -42
  12. package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.d.ts +1 -0
  13. package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.d.ts.map +1 -1
  14. package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.js +50 -40
  15. package/dist/CheckoutForm/CheckoutForm.d.ts +6 -6
  16. package/dist/CheckoutForm/CheckoutForm.d.ts.map +1 -1
  17. package/dist/CheckoutForm/CheckoutForm.js +142 -120
  18. package/dist/CheckoutOrderProvider/CheckoutOrderProvider.d.ts.map +1 -1
  19. package/dist/CheckoutOrderProvider/CheckoutOrderProvider.js +41 -38
  20. package/dist/CheckoutProvider/components/CheckoutThemeProvider/CheckoutThemeProvider.d.ts.map +1 -1
  21. package/dist/CheckoutProvider/components/CheckoutThemeProvider/CheckoutThemeProvider.js +35 -36
  22. package/dist/CheckoutSummary/components/CheckoutSummaryFees/CheckoutSummaryFees.d.ts.map +1 -1
  23. package/dist/CheckoutSummary/components/CheckoutSummaryFees/CheckoutSummaryFees.js +24 -24
  24. package/dist/CheckoutSummary/components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees.d.ts.map +1 -1
  25. package/dist/CheckoutSummary/components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees.js +28 -20
  26. package/dist/CheckoutSummary/components/CheckoutSummaryShippingFees/CheckoutSummaryShippingFees.d.ts.map +1 -1
  27. package/dist/CheckoutSummary/components/CheckoutSummaryShippingFees/CheckoutSummaryShippingFees.js +34 -24
  28. package/dist/CheckoutSummary/components/CheckoutSummaryTotalBreakdown/CheckoutSummaryTotalBreakdown.d.ts.map +1 -1
  29. package/dist/CheckoutSummary/components/CheckoutSummaryTotalBreakdown/CheckoutSummaryTotalBreakdown.js +54 -53
  30. package/dist/constants/analyticsEvents.d.ts +65 -21
  31. package/dist/constants/analyticsEvents.d.ts.map +1 -1
  32. package/dist/constants/analyticsEvents.js +153 -3
  33. package/dist/fragments/CoreCartProjectionFields.d.ts +1 -1
  34. package/dist/fragments/CoreCartProjectionFields.d.ts.map +1 -1
  35. package/dist/hooks/useCheckoutAddressOptions.d.ts.map +1 -1
  36. package/dist/hooks/useCheckoutAnalytics.d.ts.map +1 -1
  37. package/dist/hooks/useCheckoutAnalytics.js +23 -18
  38. package/dist/hooks/useCheckoutAuth.d.ts +2 -0
  39. package/dist/hooks/useCheckoutAuth.d.ts.map +1 -1
  40. package/dist/hooks/useCheckoutAuth.js +40 -39
  41. package/dist/hooks/useCheckoutCart.d.ts +12 -0
  42. package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
  43. package/dist/hooks/useCheckoutCart.js +128 -123
  44. package/dist/hooks/useCheckoutForm.d.ts +2 -0
  45. package/dist/hooks/useCheckoutForm.d.ts.map +1 -1
  46. package/dist/hooks/useCheckoutForm.js +55 -44
  47. package/dist/hooks/useCheckoutOrder.d.ts +12 -0
  48. package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
  49. package/dist/hooks/useCheckoutOrder.js +81 -72
  50. package/dist/mutations/addShippingMethodToCart.d.ts +10 -0
  51. package/dist/mutations/addShippingMethodToCart.d.ts.map +1 -1
  52. package/dist/mutations/addShippingMethodToCart.js +12 -2
  53. package/dist/mutations/addShippingMethodToOrder.d.ts +10 -0
  54. package/dist/mutations/addShippingMethodToOrder.d.ts.map +1 -1
  55. package/dist/mutations/addShippingMethodToOrder.js +15 -5
  56. package/dist/operations/authOperations.d.ts.map +1 -1
  57. package/dist/operations/authOperations.js +10 -2
  58. package/dist/operations/cartOperations.d.ts.map +1 -1
  59. package/dist/operations/cartOperations.js +130 -117
  60. package/dist/steps/informationStep.d.ts +1 -0
  61. package/dist/steps/informationStep.d.ts.map +1 -1
  62. package/dist/steps/informationStep.js +96 -94
  63. package/dist/steps/paymentStep.js +1 -1
  64. package/dist/steps/shippingStep.js +1 -1
  65. package/dist/types.d.ts +26 -2
  66. package/dist/types.d.ts.map +1 -1
  67. package/dist/utils/colorManipulator.d.ts +15 -15
  68. package/dist/utils/colorManipulator.d.ts.map +1 -1
  69. package/dist/utils/colorManipulator.js +86 -75
  70. package/dist/utils/formatEcommerceDataLayerItems.d.ts +11 -0
  71. package/dist/utils/formatEcommerceDataLayerItems.d.ts.map +1 -0
  72. package/dist/utils/formatEcommerceDataLayerItems.js +26 -0
  73. package/dist/utils/getAutocompletedAddress.d.ts +1 -1
  74. package/dist/utils/getAutocompletedAddress.d.ts.map +1 -1
  75. package/package.json +1 -1
@@ -1,16 +1,17 @@
1
- import { jsxs as l, jsx as r, Fragment as F } from "react/jsx-runtime";
2
- import { Box as pe, MultiStepForm as de } from "@afosto/components";
3
- import { useCheckout as me } from "../CheckoutStateProvider/CheckoutStateProvider.js";
4
- import "react";
5
- import { createPortal as be } from "react-dom";
6
- import { isDefined as Se, camelize as fe, wait as he } from "@afosto/utils";
7
- import { CheckoutFormSkeleton as ve } from "../CheckoutFormSkeleton/CheckoutFormSkeleton.js";
8
- import { CheckoutSubmitButton as Le } from "../CheckoutSubmitButton/CheckoutSubmitButton.js";
9
- import { CheckoutTermsAndPrivacyMessage as M } from "../CheckoutTermsAndPrivacyMessage/CheckoutTermsAndPrivacyMessage.js";
10
- import { getErrorMessage as ge } from "../utils/getErrorMessage.js";
11
- import { getValidationErrorMessage as ke } from "../utils/getValidationErrorMessage.js";
12
- import { validationTranslations as xe } from "../constants/validationTranslations.js";
13
- import { CheckoutErrorMessageAlert as Pe } from "../CheckoutErrorMessageAlert/CheckoutErrorMessageAlert.js";
1
+ import { jsxs as u, jsx as c, Fragment as M } from "react/jsx-runtime";
2
+ import { Box as be, MultiStepForm as fe } from "@afosto/components";
3
+ import { useCheckout as Se } from "../CheckoutStateProvider/CheckoutStateProvider.js";
4
+ import { useEffect as he } from "react";
5
+ import { createPortal as ke } from "react-dom";
6
+ import { isDefined as ve, camelize as Le, wait as ge } from "@afosto/utils";
7
+ import { CheckoutFormSkeleton as xe } from "../CheckoutFormSkeleton/CheckoutFormSkeleton.js";
8
+ import { CheckoutSubmitButton as ye } from "../CheckoutSubmitButton/CheckoutSubmitButton.js";
9
+ import { CheckoutTermsAndPrivacyMessage as T } from "../CheckoutTermsAndPrivacyMessage/CheckoutTermsAndPrivacyMessage.js";
10
+ import { getErrorMessage as Pe } from "../utils/getErrorMessage.js";
11
+ import { getValidationErrorMessage as Ce } from "../utils/getValidationErrorMessage.js";
12
+ import { validationTranslations as we } from "../constants/validationTranslations.js";
13
+ import { CheckoutErrorMessageAlert as Fe } from "../CheckoutErrorMessageAlert/CheckoutErrorMessageAlert.js";
14
+ import { useGetLatest as Me } from "@afosto/hooks";
14
15
  const h = {
15
16
  cancelLabel: "Back to webshop",
16
17
  downPaymentSubmitLabel: "Pay deposit & order",
@@ -23,114 +24,135 @@ const h = {
23
24
  checkoutFailedTitle: "Could not proceed to payment",
24
25
  checkoutFailedDescription: "Something went wrong while proceeding to the payment. Please try again."
25
26
  },
26
- validation: xe
27
- }, je = (B) => {
27
+ validation: we
28
+ }, Je = (B) => {
28
29
  const {
29
- activeStep: T,
30
+ activeStep: E,
30
31
  autoComplete: D = "on",
31
- defaultValues: E,
32
- errorMessage: N,
33
- formRef: v,
34
- hideErrorMessage: V = !1,
35
- hideForm: L = !1,
36
- isLoading: A,
37
- onNextStep: R,
38
- onPreviousStep: O,
39
- onCancel: u,
40
- onSubmit: p,
32
+ defaultValues: N,
33
+ errorMessage: V,
34
+ formRef: k,
35
+ hideErrorMessage: A = !1,
36
+ hideForm: v = !1,
37
+ isLoading: R,
38
+ onNextStep: O,
39
+ onPreviousStep: I,
40
+ onCancel: p,
41
+ onSubmit: m,
41
42
  steps: j,
42
43
  submitLabel: d,
43
44
  validationSchema: z,
44
- translations: m = {},
45
- sx: I = {},
46
- ...G
47
- } = B, n = me(), {
48
- activeStep: q = 0,
49
- defaultValues: H = [],
50
- checkout: J,
51
- errorMessage: K,
52
- formRef: Q,
53
- getNextStepLabel: U,
54
- getPreviousStepLabel: W,
55
- isLoading: X,
56
- isProcessing: g,
57
- nextStep: Y,
58
- previousStep: Z,
59
- setErrorMessage: k,
60
- settings: _,
61
- steps: $ = [],
62
- subStep: ee,
63
- submitButtonDisabled: te,
45
+ translations: b = {},
46
+ sx: G = {},
47
+ ...q
48
+ } = B, r = Se(), {
49
+ activeStep: H = 0,
50
+ defaultValues: J = [],
51
+ checkout: K,
52
+ errorMessage: Q,
53
+ formRef: U,
54
+ getNextStepLabel: W,
55
+ getPreviousStepLabel: X,
56
+ isLoading: Y,
57
+ isProcessing: L,
58
+ nextStep: Z,
59
+ previousStep: _,
60
+ setErrorMessage: g,
61
+ settings: $,
62
+ steps: ee = [],
63
+ subStep: te,
64
+ submitButtonDisabled: oe,
64
65
  submitButtonPortalRef: x,
65
- validationSchema: oe,
66
- translations: b = {}
67
- } = n, { vendor: P } = _?.links ?? {}, e = {
66
+ summary: ae,
67
+ validationSchema: ne,
68
+ translations: f = {},
69
+ track: re
70
+ } = r, { vendor: y } = $?.links ?? {}, t = {
68
71
  ...h,
69
- ...b?.checkoutForm || {},
70
- ...m || {},
72
+ ...f?.checkoutForm || {},
73
+ ...b || {},
71
74
  feedback: {
72
75
  ...h.feedback,
73
- ...b?.checkoutForm?.feedback || {},
74
- ...m?.feedback || {}
76
+ ...f?.checkoutForm?.feedback || {},
77
+ ...b?.feedback || {}
75
78
  },
76
79
  validation: {
77
80
  ...h.validation,
78
- ...b?.validation || {},
79
- ...m?.validation || {}
81
+ ...f?.validation || {},
82
+ ...b?.validation || {}
80
83
  }
81
- }, s = A ?? X, c = T ?? q, ae = E ?? H, y = N ?? K, ne = R ?? Y, ie = O ?? Z, re = z ?? oe, S = (j ?? $ ?? []).map((t) => {
82
- let o = typeof t.nextLabel == "function" ? t.nextLabel({ ...n, translations: e }) : t.nextLabel, a = typeof t.previousLabel == "function" ? t.previousLabel({ ...n, translations: e }) : t.previousLabel;
84
+ }, s = R ?? Y, i = E ?? H, ie = N ?? J, P = V ?? Q, se = O ?? Z, ce = I ?? _, le = z ?? ne, l = (j ?? ee ?? []).map((e) => {
85
+ let o = typeof e.nextLabel == "function" ? e.nextLabel({ ...r, translations: t }) : e.nextLabel, a = typeof e.previousLabel == "function" ? e.previousLabel({ ...r, translations: t }) : e.previousLabel;
83
86
  if (!o) {
84
- const i = U();
85
- i && (o = e.nextStepLabel.replace(
87
+ const n = W();
88
+ n && (o = t.nextStepLabel.replace(
86
89
  "{stepLabel}",
87
- i
90
+ n
88
91
  ));
89
92
  }
90
93
  if (!a) {
91
- const i = W();
92
- i && (a = e.previousStepLabel.replace(
94
+ const n = X();
95
+ n && (a = t.previousStepLabel.replace(
93
96
  "{stepLabel}",
94
- i
97
+ n
95
98
  ));
96
99
  }
97
100
  return {
98
- ...t,
101
+ ...e,
99
102
  nextLabel: o,
100
103
  previousLabel: a
101
104
  };
102
- }), C = c === S.length - 1, w = S[c]?.component, se = async (t, o) => ne(t, o, {
103
- ...n,
104
- translations: e
105
- }), ce = (t) => ie(t, { ...n, translations: e }), le = () => {
106
- if (u && typeof u == "function")
107
- return u();
108
- }, ue = async (t, o) => {
105
+ }), C = i === l.length - 1, w = l[i]?.component, F = Me({
106
+ summary: ae,
107
+ steps: l,
108
+ track: re
109
+ });
110
+ he(() => {
111
+ s || (() => {
112
+ const {
113
+ steps: o,
114
+ summary: a,
115
+ track: n
116
+ } = F();
117
+ !n && typeof n != "function" || n("checkoutStep", {
118
+ step: o[i],
119
+ stepIndex: i + 1,
120
+ summary: a
121
+ });
122
+ })();
123
+ }, [i, s, F]);
124
+ const ue = async (e, o) => se(e, o, {
125
+ ...r,
126
+ translations: t
127
+ }), pe = async (e) => ce(e, { ...r, translations: t }), me = () => {
109
128
  if (p && typeof p == "function")
110
- return p(t, o, {
111
- ...n,
112
- translations: e
129
+ return p();
130
+ }, de = async (e, o) => {
131
+ if (m && typeof m == "function")
132
+ return m(e, o, {
133
+ ...r,
134
+ translations: t
113
135
  });
114
136
  try {
115
- await J(), k(null), await he(5e3);
137
+ await K(), g(null), await ge(5e3);
116
138
  } catch (a) {
117
- const i = ge(a);
118
- return k({
119
- title: e.feedback?.checkoutFailedTitle,
120
- description: i || e.feedback?.checkoutFailedDescription
139
+ const n = Pe(a);
140
+ return g({
141
+ title: t.feedback?.checkoutFailedTitle,
142
+ description: n || t.feedback?.checkoutFailedDescription
121
143
  }), Promise.reject(a);
122
144
  }
123
- }, f = typeof d == "function" ? d({ ...n, translations: e }) : d ?? (() => {
124
- const { summary: t } = n, { agreementTemplate: o } = t || {}, a = fe(
145
+ }, S = typeof d == "function" ? d({ ...r, translations: t }) : d ?? (() => {
146
+ const { summary: e } = r, { agreementTemplate: o } = e || {}, a = Le(
125
147
  o?.type?.toLowerCase() || ""
126
148
  );
127
- return a === "downPayment" ? e.downPaymentSubmitLabel : ["cod", "postPaid"].includes(a) ? e.postPaidSubmitLabel : e.submitLabel;
149
+ return a === "downPayment" ? t.downPaymentSubmitLabel : ["cod", "postPaid"].includes(a) ? t.postPaidSubmitLabel : t.submitLabel;
128
150
  })();
129
- return /* @__PURE__ */ l(pe, { sx: L ? { display: "none" } : I, children: [
130
- /* @__PURE__ */ l(
131
- de,
151
+ return /* @__PURE__ */ u(be, { sx: v ? { display: "none" } : G, children: [
152
+ /* @__PURE__ */ u(
153
+ fe,
132
154
  {
133
- ...G,
155
+ ...q,
134
156
  actionsAlignment: "space-between",
135
157
  actionsContainerProps: {
136
158
  sx: {
@@ -139,51 +161,51 @@ const h = {
139
161
  mt: 1
140
162
  }
141
163
  },
142
- activeStep: c,
164
+ activeStep: i,
143
165
  autoComplete: D,
144
- cancelLabel: e.cancelLabel,
145
- defaultValues: ae,
166
+ cancelLabel: t.cancelLabel,
167
+ defaultValues: ie,
146
168
  formRef: [
147
- Q,
148
- ...v ? [v] : []
169
+ U,
170
+ ...k ? [k] : []
149
171
  ],
150
- getErrorMessage: ke(e.validation),
172
+ getErrorMessage: Ce(t.validation),
151
173
  hideActions: s,
152
- onNextStep: se,
153
- onPreviousStep: ce,
154
- onCancel: le,
155
- onSubmit: ue,
156
- subStep: ee,
157
- steps: S,
174
+ onNextStep: ue,
175
+ onPreviousStep: pe,
176
+ onCancel: me,
177
+ onSubmit: de,
178
+ subStep: te,
179
+ steps: l,
158
180
  cancelButtonProps: {
159
- ...c === 0 && Se(P) ? { href: P } : {},
160
- disabled: g,
181
+ ...i === 0 && ve(y) ? { href: y } : {},
182
+ disabled: L,
161
183
  size: "large"
162
184
  },
163
185
  submitButtonProps: {
164
- disabled: te,
165
- loading: g,
186
+ disabled: oe,
187
+ loading: L,
166
188
  size: "large"
167
189
  },
168
- submitLabel: f,
169
- validationSchema: re,
190
+ submitLabel: S,
191
+ validationSchema: le,
170
192
  children: [
171
- !s && y && !V && /* @__PURE__ */ r(
172
- Pe,
193
+ !s && P && !A && /* @__PURE__ */ c(
194
+ Fe,
173
195
  {
174
- errorMessage: y,
196
+ errorMessage: P,
175
197
  sx: { mt: 1.5, mb: 3 }
176
198
  }
177
199
  ),
178
- !s && w && /* @__PURE__ */ l(F, { children: [
179
- /* @__PURE__ */ r(w, {}),
180
- !L && x.current && be(
181
- /* @__PURE__ */ l(F, { children: [
182
- /* @__PURE__ */ r(Le, { sx: { mt: 0.5 } }),
183
- C && /* @__PURE__ */ r(
184
- M,
200
+ !s && w && /* @__PURE__ */ u(M, { children: [
201
+ /* @__PURE__ */ c(w, {}),
202
+ !v && x.current && ke(
203
+ /* @__PURE__ */ u(M, { children: [
204
+ /* @__PURE__ */ c(ye, { sx: { mt: 0.5 } }),
205
+ C && /* @__PURE__ */ c(
206
+ T,
185
207
  {
186
- submitLabel: f,
208
+ submitLabel: S,
187
209
  sx: { mt: 3 }
188
210
  }
189
211
  )
@@ -191,19 +213,19 @@ const h = {
191
213
  x.current
192
214
  )
193
215
  ] }),
194
- s && /* @__PURE__ */ r(ve, {})
216
+ s && /* @__PURE__ */ c(xe, {})
195
217
  ]
196
218
  }
197
219
  ),
198
- C && /* @__PURE__ */ r(
199
- M,
220
+ C && /* @__PURE__ */ c(
221
+ T,
200
222
  {
201
- submitLabel: f,
223
+ submitLabel: S,
202
224
  sx: { display: { md: "none" }, mt: 3, textAlign: "center" }
203
225
  }
204
226
  )
205
227
  ] });
206
228
  };
207
229
  export {
208
- je as CheckoutForm
230
+ Je as CheckoutForm
209
231
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutOrderProvider.d.ts","sourceRoot":"","sources":["../../src/CheckoutOrderProvider/CheckoutOrderProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAOtF,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,uBAAuB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EACP,WAAW,CAAC,uBAAuB,CAAC,GACpC,CAAC,WAAW,CAAC,uBAAuB,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDA+DtE,CAAC"}
1
+ {"version":3,"file":"CheckoutOrderProvider.d.ts","sourceRoot":"","sources":["../../src/CheckoutOrderProvider/CheckoutOrderProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAOtF,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,uBAAuB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EACP,WAAW,CAAC,uBAAuB,CAAC,GACpC,CAAC,WAAW,CAAC,uBAAuB,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC;IACpD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDAkEtE,CAAC"}
@@ -1,61 +1,64 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { CheckoutStateProvider as k } from "../CheckoutStateProvider/CheckoutStateProvider.js";
3
- import { orderOperations as C } from "../operations/orderOperations.js";
4
- import { authOperations as v } from "../operations/authOperations.js";
5
- import { useCheckoutOrder as P } from "../hooks/useCheckoutOrder.js";
6
- const w = (m) => {
1
+ import { jsx as k } from "react/jsx-runtime";
2
+ import { CheckoutStateProvider as C } from "../CheckoutStateProvider/CheckoutStateProvider.js";
3
+ import { orderOperations as v } from "../operations/orderOperations.js";
4
+ import { authOperations as P } from "../operations/authOperations.js";
5
+ import { useCheckoutOrder as S } from "../hooks/useCheckoutOrder.js";
6
+ const y = (u) => {
7
7
  const {
8
8
  orderId: t,
9
- analytics: u,
10
- createSummary: e,
11
- isLoadingChannel: f,
12
- locale: s,
13
- storefront: n,
14
- operations: i = {},
15
- settings: a,
9
+ analytics: f,
10
+ channel: e,
11
+ createSummary: s,
12
+ isLoadingChannel: h,
13
+ locale: n,
14
+ storefront: i,
15
+ operations: a = {},
16
+ settings: c,
16
17
  steps: d,
17
18
  ...O
18
- } = m, r = {
19
- ...v,
20
- ...C
21
- }, c = Object.keys(i || {}).reduce(
22
- (p, o) => ({
23
- ...p,
19
+ } = u, r = {
20
+ ...P,
21
+ ...v
22
+ }, p = Object.keys(a || {}).reduce(
23
+ (m, o) => ({
24
+ ...m,
24
25
  [o]: {
25
- ...p[o] || {},
26
- ...i[o] || {}
26
+ ...m[o] || {},
27
+ ...a[o] || {}
27
28
  }
28
29
  }),
29
30
  r
30
- ), h = P({
31
+ ), l = S({
31
32
  orderId: t,
32
- analytics: u,
33
- createSummary: e,
33
+ analytics: f,
34
+ channel: e,
35
+ createSummary: s,
34
36
  defaultOperations: r,
35
- isLoadingChannel: f,
36
- locale: s,
37
- operations: c,
38
- settings: a,
39
- storefront: n,
37
+ isLoadingChannel: h,
38
+ locale: n,
39
+ operations: p,
40
+ settings: c,
41
+ storefront: i,
40
42
  steps: d
41
43
  });
42
- return /* @__PURE__ */ l(
43
- k,
44
+ return /* @__PURE__ */ k(
45
+ C,
44
46
  {
45
47
  ...O,
46
- ...h,
47
- createSummary: e,
48
+ ...l,
49
+ channel: e,
50
+ createSummary: s,
48
51
  defaultOperations: r,
49
52
  flow: "order",
50
53
  orderId: t,
51
- locale: s,
52
- operations: c,
53
- settings: a,
54
+ locale: n,
55
+ operations: p,
56
+ settings: c,
54
57
  steps: d,
55
- storefront: n
58
+ storefront: i
56
59
  }
57
60
  );
58
61
  };
59
62
  export {
60
- w as CheckoutOrderProvider
63
+ y as CheckoutOrderProvider
61
64
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutProvider/components/CheckoutThemeProvider/CheckoutThemeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAIL,KAAK,KAAK,EACX,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDAuEtE,CAAC"}
1
+ {"version":3,"file":"CheckoutThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutProvider/components/CheckoutThemeProvider/CheckoutThemeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAIL,KAAK,KAAK,EACX,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,qDAkEtE,CAAC"}
@@ -1,25 +1,25 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { theme as l, createTheme as u, ThemeProvider as h } from "@afosto/components";
3
- import { darken as r, lighten as t } from "../../../utils/colorManipulator.js";
4
- import { deepMerge as m } from "../../../utils/deepMerge.js";
5
- const x = (a) => {
6
- const { branding: d, children: c, theme: n } = a, { primary: e } = d?.colors || {}, o = e ? {
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { theme as a, createTheme as f, ThemeProvider as b } from "@afosto/components";
3
+ import { darken as o, lighten as t } from "../../../utils/colorManipulator.js";
4
+ import { deepMerge as i } from "../../../utils/deepMerge.js";
5
+ const C = (m) => {
6
+ const { branding: c, children: p, theme: n } = m, { primary: e } = c?.colors || {}, s = e ? {
7
7
  main: e,
8
8
  100: t(e, 0.9),
9
9
  200: t(e, 0.6),
10
10
  300: t(e, 0.3),
11
11
  400: t(e, 0.1),
12
12
  500: e,
13
- 600: r(e, 0.1),
14
- 700: r(e, 0.2),
15
- 800: r(e, 0.3),
16
- 900: r(e, 0.4)
17
- } : null;
18
- let i = m(l, {
13
+ 600: o(e, 0.1),
14
+ 700: o(e, 0.2),
15
+ 800: o(e, 0.3),
16
+ 900: o(e, 0.4)
17
+ } : {}, r = i(
18
+ a.palette.primary,
19
+ i(s, n?.palette?.primary || {})
20
+ ), d = {
19
21
  palette: {
20
- ...o ? {
21
- primary: o
22
- } : {}
22
+ primary: r
23
23
  },
24
24
  components: {
25
25
  MuiInputBase: {
@@ -32,32 +32,31 @@ const x = (a) => {
32
32
  }
33
33
  },
34
34
  MuiButton: {
35
- ...o ? {
36
- styleOverrides: {
37
- root: {
38
- "&.Mui-focusVisible, &:focus-visible": {
39
- boxShadow: `0 0 0 3px ${o.main}88`
40
- }
35
+ styleOverrides: {
36
+ root: {
37
+ "&.Mui-focusVisible, &:focus-visible": {
38
+ boxShadow: `0 0 0 3px ${r.main}88`
39
+ }
40
+ },
41
+ containedPrimary: {
42
+ backgroundColor: r.main,
43
+ color: "#fff",
44
+ "&:hover:not(.Mui-disabled):not(:active)": {
45
+ backgroundColor: r[600]
41
46
  },
42
- containedPrimary: {
43
- backgroundColor: o.main,
44
- color: "#fff",
45
- "&:hover:not(.Mui-disabled):not(:active)": {
46
- backgroundColor: o[600]
47
- },
48
- '&:active, &[aria-expanded="true"]': {
49
- backgroundColor: o[700]
50
- }
47
+ '&:active, &[aria-expanded="true"]': {
48
+ backgroundColor: r[700]
51
49
  }
52
50
  }
53
- } : {}
51
+ }
54
52
  }
55
53
  }
56
- });
57
- n && (i = m(i, n));
58
- const s = u(i);
59
- return /* @__PURE__ */ p(h, { theme: s, children: c });
54
+ }, l = i(
55
+ a,
56
+ i(d, n || {})
57
+ ), u = f(l);
58
+ return /* @__PURE__ */ h(b, { theme: u, children: p });
60
59
  };
61
60
  export {
62
- x as CheckoutThemeProvider
61
+ C as CheckoutThemeProvider
63
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSummaryFees.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryFees/CheckoutSummaryFees.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,8CAA8C,CAAC;AAEtD,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAEF,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4DAsElE,CAAC"}
1
+ {"version":3,"file":"CheckoutSummaryFees.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryFees/CheckoutSummaryFees.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,8CAA8C,CAAC;AAEtD,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAEF,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4DA0ElE,CAAC"}
@@ -1,57 +1,57 @@
1
- import { jsxs as v, jsx as o } from "react/jsx-runtime";
2
- import { useCheckout as w } from "../../../CheckoutStateProvider/CheckoutStateProvider.js";
3
- import { isDefined as D } from "@afosto/utils";
4
- import { CheckoutSummaryRow as r } from "../CheckoutSummaryRow/CheckoutSummaryRow.js";
5
- import { CheckoutSummaryGroup as I } from "../CheckoutSummaryGroup/CheckoutSummaryGroup.js";
6
- const x = {
1
+ import { jsxs as w, jsx as a } from "react/jsx-runtime";
2
+ import { useCheckout as D } from "../../../CheckoutStateProvider/CheckoutStateProvider.js";
3
+ import { isDefined as I } from "@afosto/utils";
4
+ import { CheckoutSummaryRow as l } from "../CheckoutSummaryRow/CheckoutSummaryRow.js";
5
+ import { CheckoutSummaryGroup as x } from "../CheckoutSummaryGroup/CheckoutSummaryGroup.js";
6
+ const T = {
7
7
  calculatedInStep: "Calculated in step {step}",
8
8
  free: "Free",
9
9
  defaultFeesDescription: "Fees"
10
- }, Z = (c) => {
10
+ }, b = (c) => {
11
11
  const {
12
- calculatedStep: a,
12
+ calculatedStep: r,
13
13
  currency: u,
14
14
  disablePadding: p = !0,
15
15
  divider: d = !1,
16
- showFreeWhenEmpty: l = !1,
16
+ showFreeWhenEmpty: n = !1,
17
17
  showFreeWhenZero: m = !1,
18
18
  showFeeWhenZero: f = !1,
19
19
  locale: h,
20
20
  fees: F = [],
21
21
  hideCalculatedInStep: S = !1,
22
22
  translations: C = {},
23
- ...y
24
- } = c, { translations: k } = w(), t = {
25
- ...x,
23
+ ...v
24
+ } = c, { activeStep: y, translations: k } = D(), t = {
25
+ ...T,
26
26
  ...k?.summary || {},
27
27
  ...C || {}
28
- }, n = F.filter((e) => f || e.total !== 0), s = n.length > 0, i = !S && D(a);
29
- return !s && !i && !l ? null : /* @__PURE__ */ v(
30
- I,
28
+ }, i = F.filter((e) => f || e.total !== 0), s = i.length > 0, o = !s && !S && I(r) && (r || 0) > y + 1;
29
+ return !s && !o && !n ? null : /* @__PURE__ */ w(
30
+ x,
31
31
  {
32
- ...y,
32
+ ...v,
33
33
  disablePadding: p,
34
34
  divider: d,
35
35
  children: [
36
- !s && i && /* @__PURE__ */ o(
37
- r,
36
+ !s && o && /* @__PURE__ */ a(
37
+ l,
38
38
  {
39
39
  description: t.defaultFeesDescription,
40
40
  value: t.calculatedInStep.replace(
41
41
  "{step}",
42
- `${a}`
42
+ `${r}`
43
43
  )
44
44
  }
45
45
  ),
46
- !s && l && /* @__PURE__ */ o(
47
- r,
46
+ !s && !o && n && /* @__PURE__ */ a(
47
+ l,
48
48
  {
49
49
  description: t.defaultFeesDescription,
50
50
  value: t.free
51
51
  }
52
52
  ),
53
- s && n.map((e) => /* @__PURE__ */ o(
54
- r,
53
+ s && !o && i.map((e) => /* @__PURE__ */ a(
54
+ l,
55
55
  {
56
56
  description: e.description,
57
57
  value: !m || e.total !== 0 ? e.total : t.free,
@@ -65,5 +65,5 @@ const x = {
65
65
  );
66
66
  };
67
67
  export {
68
- Z as CheckoutSummaryFees
68
+ b as CheckoutSummaryFees
69
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSummaryPaymentFees.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4CAA4C,CAAC;AAGpD,QAAA,MAAM,mBAAmB;;CAExB,CAAC;AAEF,MAAM,WAAW,+BACf,SAAQ,IAAI,CAAC,wBAAwB,EAAE,cAAc,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,0BAA0B,GACrC,OAAO,+BAA+B,qDA6BvC,CAAC"}
1
+ {"version":3,"file":"CheckoutSummaryPaymentFees.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutSummary/components/CheckoutSummaryPaymentFees/CheckoutSummaryPaymentFees.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4CAA4C,CAAC;AAIpD,QAAA,MAAM,mBAAmB;;CAExB,CAAC;AAEF,MAAM,WAAW,+BACf,SAAQ,IAAI,CAAC,wBAAwB,EAAE,cAAc,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,0BAA0B,GACrC,OAAO,+BAA+B,qDAwCvC,CAAC"}