@afosto/checkout-ui 0.0.8 → 0.0.10

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 (65) hide show
  1. package/dist/CheckoutProvider/CheckoutProvider.d.ts.map +1 -1
  2. package/dist/CheckoutProvider/CheckoutProvider.js +53 -50
  3. package/dist/CheckoutSummary/CheckoutSummary.d.ts +5 -1
  4. package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
  5. package/dist/CheckoutSummary/CheckoutSummary.js +90 -68
  6. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts +11 -0
  7. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts.map +1 -0
  8. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.js +71 -0
  9. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts +3 -0
  10. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts.map +1 -0
  11. package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.js +4 -0
  12. package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts +1 -0
  13. package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts.map +1 -1
  14. package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.js +33 -7
  15. package/dist/CheckoutSummary/index.d.ts +2 -0
  16. package/dist/CheckoutSummary/index.d.ts.map +1 -1
  17. package/dist/CheckoutSummary/index.js +26 -24
  18. package/dist/constants/paymentMethodIconMapping.d.ts +1 -0
  19. package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
  20. package/dist/constants/paymentMethodIconMapping.js +54 -52
  21. package/dist/hooks/useCheckoutCart.d.ts +48 -10
  22. package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
  23. package/dist/hooks/useCheckoutCart.js +117 -63
  24. package/dist/hooks/useCheckoutOrder.d.ts +48 -10
  25. package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
  26. package/dist/hooks/useCheckoutOrder.js +208 -154
  27. package/dist/icons/AngleRightSolid.d.ts +3 -0
  28. package/dist/icons/AngleRightSolid.d.ts.map +1 -0
  29. package/dist/icons/AngleRightSolid.js +6 -0
  30. package/dist/icons/index.d.ts +1 -0
  31. package/dist/icons/index.d.ts.map +1 -1
  32. package/dist/icons/index.js +130 -126
  33. package/dist/icons/paymentMethods/Giftcard.d.ts +3 -0
  34. package/dist/icons/paymentMethods/Giftcard.d.ts.map +1 -0
  35. package/dist/icons/paymentMethods/Giftcard.js +54 -0
  36. package/dist/icons/paymentMethods/Ideal.d.ts.map +1 -1
  37. package/dist/icons/paymentMethods/Ideal.js +104 -23
  38. package/dist/icons/paymentMethods/index.d.ts +1 -0
  39. package/dist/icons/paymentMethods/index.d.ts.map +1 -1
  40. package/dist/icons/paymentMethods/index.js +80 -78
  41. package/dist/index.js +301 -289
  42. package/dist/mutations/addCouponToCart.d.ts +12 -0
  43. package/dist/mutations/addCouponToCart.d.ts.map +1 -0
  44. package/dist/mutations/addCouponToCart.js +15 -0
  45. package/dist/mutations/addCouponToOrder.d.ts +12 -0
  46. package/dist/mutations/addCouponToOrder.d.ts.map +1 -0
  47. package/dist/mutations/addCouponToOrder.js +15 -0
  48. package/dist/mutations/index.d.ts +26 -18
  49. package/dist/mutations/index.d.ts.map +1 -1
  50. package/dist/mutations/index.js +44 -36
  51. package/dist/mutations/removeCouponFromCart.d.ts +12 -0
  52. package/dist/mutations/removeCouponFromCart.d.ts.map +1 -0
  53. package/dist/mutations/removeCouponFromCart.js +15 -0
  54. package/dist/mutations/removeCouponFromOrder.d.ts +12 -0
  55. package/dist/mutations/removeCouponFromOrder.d.ts.map +1 -0
  56. package/dist/mutations/removeCouponFromOrder.js +15 -0
  57. package/dist/operations/cartOperations.d.ts +10 -0
  58. package/dist/operations/cartOperations.d.ts.map +1 -1
  59. package/dist/operations/cartOperations.js +218 -168
  60. package/dist/operations/orderOperations.d.ts +10 -0
  61. package/dist/operations/orderOperations.d.ts.map +1 -1
  62. package/dist/operations/orderOperations.js +245 -195
  63. package/dist/types.d.ts +1 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/package.json +1 -1
@@ -1,41 +1,43 @@
1
- import { addCustomerToCartMutation as b } from "../mutations/addCustomerToCart.js";
2
- import { addCustomerCountryCodeToCartMutation as E } from "../mutations/addCustomerCountryCodeToCart.js";
3
- import { addInformationToCartMutation as v } from "../mutations/addInformationToCart.js";
4
- import { addNoteToCartMutation as w } from "../mutations/addNoteToCart.js";
5
- import { addPaymentMethodToCartMutation as N } from "../mutations/addPaymentMethodToCart.js";
6
- import { getCartPaymentMethodsQuery as B } from "../queries/getCartPaymentMethodsQuery.js";
7
- import { addPickupPointToCartMutation as Q } from "../mutations/addPickupPointToCart.js";
8
- import { addShippingMethodToCartMutation as U } from "../mutations/addShippingMethodToCart.js";
9
- import { getCartInitialCheckoutDataQuery as _ } from "../queries/getCartInitialCheckoutDataQuery.js";
10
- import { getCartInitialPaymentStepQuery as G } from "../queries/getCartInitialPaymentStepQuery.js";
11
- import { getCartPickupPointsQuery as H } from "../queries/getCartPickupPointsQuery.js";
12
- import { getCartShippingMethodsQuery as x } from "../queries/getCartShippingMethodsQuery.js";
13
- import { setAgreementTemplateForCartMutation as V } from "../mutations/setAgreementTemplateForCart.js";
14
- import { isDefined as T, camelize as K } from "@afosto/utils";
15
- import { CHECKOUT_EXPRESS_PAYMENT_METHOD_CODES as z } from "../constants/expressPaymentMethods.js";
16
- import { getCartReviewCheckoutDataQuery as L } from "../queries/getCartReviewCheckoutDataQuery.js";
17
- import { initialAddCustomerToCartMutation as X } from "../mutations/initialAddCustomerToCart.js";
18
- import { createAddressValidationSchema as O } from "../utils/createAddressValidationSchema.js";
19
- import { formatAddressOptionsRules as k } from "../utils/formatAddressOptionsRules.js";
20
- const yt = {
1
+ import { addCouponToCartMutation as b } from "../mutations/addCouponToCart.js";
2
+ import { addCustomerToCartMutation as E } from "../mutations/addCustomerToCart.js";
3
+ import { addCustomerCountryCodeToCartMutation as v } from "../mutations/addCustomerCountryCodeToCart.js";
4
+ import { addInformationToCartMutation as w } from "../mutations/addInformationToCart.js";
5
+ import { addNoteToCartMutation as N } from "../mutations/addNoteToCart.js";
6
+ import { addPaymentMethodToCartMutation as B } from "../mutations/addPaymentMethodToCart.js";
7
+ import { getCartPaymentMethodsQuery as Q } from "../queries/getCartPaymentMethodsQuery.js";
8
+ import { addPickupPointToCartMutation as U } from "../mutations/addPickupPointToCart.js";
9
+ import { addShippingMethodToCartMutation as _ } from "../mutations/addShippingMethodToCart.js";
10
+ import { getCartInitialCheckoutDataQuery as G } from "../queries/getCartInitialCheckoutDataQuery.js";
11
+ import { getCartInitialPaymentStepQuery as H } from "../queries/getCartInitialPaymentStepQuery.js";
12
+ import { getCartPickupPointsQuery as x } from "../queries/getCartPickupPointsQuery.js";
13
+ import { getCartShippingMethodsQuery as V } from "../queries/getCartShippingMethodsQuery.js";
14
+ import { removeCouponFromCartMutation as K } from "../mutations/removeCouponFromCart.js";
15
+ import { setAgreementTemplateForCartMutation as z } from "../mutations/setAgreementTemplateForCart.js";
16
+ import { isDefined as T, camelize as L } from "@afosto/utils";
17
+ import { CHECKOUT_EXPRESS_PAYMENT_METHOD_CODES as X } from "../constants/expressPaymentMethods.js";
18
+ import { getCartReviewCheckoutDataQuery as Y } from "../queries/getCartReviewCheckoutDataQuery.js";
19
+ import { initialAddCustomerToCartMutation as j } from "../mutations/initialAddCustomerToCart.js";
20
+ import { createAddressValidationSchema as F } from "../utils/createAddressValidationSchema.js";
21
+ import { formatAddressOptionsRules as O } from "../utils/formatAddressOptionsRules.js";
22
+ const gt = {
21
23
  initial: {
22
- queryFn: async ({ id: e, intent: t = "BEGIN_CHECKOUT" }, r) => {
23
- const { storefront: o } = r || {};
24
- return o.query(_, { id: e, intent: t });
24
+ queryFn: async ({ id: r, intent: t = "BEGIN_CHECKOUT" }, e) => {
25
+ const { storefront: o } = e || {};
26
+ return o.query(G, { id: r, intent: t });
25
27
  },
26
- formatter: async (e, t) => {
28
+ formatter: async (r, t) => {
27
29
  const {
28
- getAccountInformation: r,
30
+ getAccountInformation: e,
29
31
  getUser: o,
30
32
  isSignedIn: s,
31
33
  operations: n,
32
34
  settings: a
33
- } = t || {}, { isAccountEnabled: u, isB2bExcluded: g, isSharedOrganisationRequired: l } = a || {}, {
35
+ } = t || {}, { isAccountEnabled: u, isB2bExcluded: g, isSharedOrganisationRequired: f } = a || {}, {
34
36
  cart: C,
35
37
  addressOptions: q,
36
38
  ...P
37
- } = e || {};
38
- let f = null, d = C, m = !1;
39
+ } = r || {};
40
+ let l = null, d = C, m = !1;
39
41
  const { contact: p, organisation: y } = C?.customer || {};
40
42
  if (u) {
41
43
  const i = o();
@@ -57,22 +59,22 @@ const yt = {
57
59
  t
58
60
  ))?.cart, m = !0;
59
61
  }
60
- if (f = await r().catch(() => null), !l && !g && !i.organisation?.id && !y?.id) {
61
- const [S] = f?.organisations || [];
62
+ if (l = await e().catch(() => null), !f && !g && !i.organisation?.id && !y?.id) {
63
+ const [S] = l?.organisations || [];
62
64
  S && (d.customer.organisation = S);
63
65
  }
64
- l && !i?.organisation?.id && (m = !0);
65
- } else !s && (l || p && !p.isGuest) && (m = !0);
66
+ f && !i?.organisation?.id && (m = !0);
67
+ } else !s && (f || p && !p.isGuest) && (m = !0);
66
68
  }
67
69
  const { payment: A, shipping: R } = d?.options || {}, M = R?.countries || [], h = (A?.methods || []).filter(
68
70
  (i) => {
69
- const c = K(i.code?.toLowerCase() || "");
70
- return z.includes(c);
71
+ const c = L(i.code?.toLowerCase() || "");
72
+ return X.includes(c);
71
73
  }
72
74
  );
73
75
  return {
74
76
  ...P,
75
- account: f,
77
+ account: l,
76
78
  addressOptions: q,
77
79
  availableShippingCountryCodes: M,
78
80
  cart: d,
@@ -80,38 +82,38 @@ const yt = {
80
82
  skipCheckCompletedSteps: m
81
83
  };
82
84
  },
83
- success: (e, t) => {
85
+ success: (r, t) => {
84
86
  const {
85
- createSummary: r,
87
+ createSummary: e,
86
88
  getUser: o,
87
89
  isSignedIn: s,
88
90
  setBillingAddressValidationSchema: n,
89
91
  setCurrentOrganisation: a,
90
92
  setHasSharedOrganisations: u,
91
93
  setSessionExpired: g,
92
- setShippingAddressValidationSchema: l,
94
+ setShippingAddressValidationSchema: f,
93
95
  setShowAccountSelection: C,
94
96
  setShowSignIn: q,
95
97
  setSummary: P,
96
- settings: f,
98
+ settings: l,
97
99
  track: d
98
- } = t || {}, { isAccountEnabled: m, isB2bExcluded: p, isSharedOrganisationRequired: y } = f || {}, A = o(), {
100
+ } = t || {}, { isAccountEnabled: m, isB2bExcluded: p, isSharedOrganisationRequired: y } = l || {}, A = o(), {
99
101
  account: R,
100
102
  addressOptions: M,
101
103
  cart: h,
102
104
  ...i
103
- } = e || {}, { contact: c } = h?.customer || {};
104
- P(r(h || {}));
105
+ } = r || {}, { contact: c } = h?.customer || {};
106
+ P(e(h || {}));
105
107
  try {
106
- const { options: S } = h?.billing?.address || {}, { options: D } = h?.delivery?.address || {}, F = k(
108
+ const { options: S } = h?.billing?.address || {}, { options: D } = h?.delivery?.address || {}, k = O(
107
109
  S ?? M
108
- ), I = k(
110
+ ), I = O(
109
111
  D ?? M
110
112
  );
111
113
  n(
112
- O(F)
113
- ), l(
114
- O(I)
114
+ F(k)
115
+ ), f(
116
+ F(I)
115
117
  );
116
118
  } catch {
117
119
  }
@@ -126,19 +128,19 @@ const yt = {
126
128
  }
127
129
  },
128
130
  initialAddCustomer: {
129
- queryFn: async ({ cartId: e, customer: t }, r) => {
130
- const { storefront: o } = r || {};
131
- return o.query(X, {
131
+ queryFn: async ({ cartId: r, customer: t }, e) => {
132
+ const { storefront: o } = e || {};
133
+ return o.query(j, {
132
134
  addCustomerToCartPayload: {
133
- cartId: e,
135
+ cartId: r,
134
136
  customer: t
135
137
  }
136
138
  });
137
139
  },
138
- formatter: (e) => {
139
- const { cart: t, ...r } = e?.addCustomerToCart || {};
140
+ formatter: (r) => {
141
+ const { cart: t, ...e } = r?.addCustomerToCart || {};
140
142
  return {
141
- ...r,
143
+ ...e,
142
144
  cart: t
143
145
  };
144
146
  },
@@ -148,14 +150,14 @@ const yt = {
148
150
  }
149
151
  },
150
152
  initialPaymentStep: {
151
- queryFn: async ({ id: e }, t) => {
152
- const { storefront: r } = t || {};
153
- return r.query(G, { id: e });
153
+ queryFn: async ({ id: r }, t) => {
154
+ const { storefront: e } = t || {};
155
+ return e.query(H, { id: r });
154
156
  },
155
- formatter: (e) => {
156
- const { cart: t, ...r } = e || {}, o = t?.options?.payment?.agreements || [], s = t?.checkout?.agreement || null, n = t?.options?.payment?.methods || [];
157
+ formatter: (r) => {
158
+ const { cart: t, ...e } = r || {}, o = t?.options?.payment?.agreements || [], s = t?.checkout?.agreement || null, n = t?.options?.payment?.methods || [];
157
159
  return {
158
- ...r,
160
+ ...e,
159
161
  cart: t,
160
162
  agreementOptions: o,
161
163
  agreementTemplate: s,
@@ -168,124 +170,148 @@ const yt = {
168
170
  }
169
171
  },
170
172
  checkout: {
171
- queryFn: async ({ cartId: e }, t) => {
172
- const { storefront: r } = t || {};
173
- return r.confirmCart(e);
173
+ queryFn: async ({ cartId: r }, t) => {
174
+ const { storefront: e } = t || {};
175
+ return e.confirmCart(r);
174
176
  },
175
- formatter: (e) => ({
176
- order: e
177
+ formatter: (r) => ({
178
+ order: r
177
179
  }),
178
180
  success: () => {
179
181
  },
180
182
  error: () => {
181
183
  }
182
184
  },
183
- addCustomer: {
184
- queryFn: async ({ cartId: e, customer: t }, r) => {
185
- const { storefront: o } = r || {};
185
+ addCoupon: {
186
+ queryFn: async ({ cartId: r, coupon: t }, e) => {
187
+ const { storefront: o } = e || {};
186
188
  return o.query(b, {
189
+ couponPayload: {
190
+ cartId: r,
191
+ coupon: t
192
+ }
193
+ });
194
+ },
195
+ formatter: (r) => {
196
+ const { cart: t, ...e } = r?.addCouponToCart || {};
197
+ return {
198
+ ...e,
199
+ cart: t
200
+ };
201
+ },
202
+ success: (r, t) => {
203
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
204
+ o(s || {});
205
+ },
206
+ error: () => {
207
+ }
208
+ },
209
+ addCustomer: {
210
+ queryFn: async ({ cartId: r, customer: t }, e) => {
211
+ const { storefront: o } = e || {};
212
+ return o.query(E, {
187
213
  addCustomerToCartPayload: {
188
- cartId: e,
214
+ cartId: r,
189
215
  customer: t
190
216
  }
191
217
  });
192
218
  },
193
- formatter: (e) => {
194
- const { cart: t, ...r } = e?.addCustomerToCart || {};
219
+ formatter: (r) => {
220
+ const { cart: t, ...e } = r?.addCustomerToCart || {};
195
221
  return {
196
- ...r,
222
+ ...e,
197
223
  cart: t
198
224
  };
199
225
  },
200
- success: (e, t) => {
201
- const { createSummary: r, setSummary: o } = t || {}, s = r(e.cart || {});
226
+ success: (r, t) => {
227
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
202
228
  o(s || {});
203
229
  },
204
230
  error: () => {
205
231
  }
206
232
  },
207
233
  addCustomerCountryCode: {
208
- queryFn: async ({ cartId: e, countryCode: t }, r) => {
209
- const { storefront: o } = r || {};
210
- return o.query(E, {
234
+ queryFn: async ({ cartId: r, countryCode: t }, e) => {
235
+ const { storefront: o } = e || {};
236
+ return o.query(v, {
211
237
  countryCodePayload: {
212
- cartId: e,
238
+ cartId: r,
213
239
  countryCode: t
214
240
  }
215
241
  });
216
242
  },
217
- formatter: (e) => {
218
- const { cart: t, ...r } = e?.setCountryCodeForCart || {};
243
+ formatter: (r) => {
244
+ const { cart: t, ...e } = r?.setCountryCodeForCart || {};
219
245
  return {
220
- ...r,
246
+ ...e,
221
247
  cart: t
222
248
  };
223
249
  },
224
- success: (e, t) => {
225
- const { createSummary: r, setSummary: o } = t || {}, s = r(e.cart || {});
250
+ success: (r, t) => {
251
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
226
252
  o(s || {});
227
253
  },
228
254
  error: () => {
229
255
  }
230
256
  },
231
257
  addInformation: {
232
- queryFn: async ({ cartId: e, billingAddress: t, customer: r, phoneNumber: o, shippingAddress: s }, n) => {
258
+ queryFn: async ({ cartId: r, billingAddress: t, customer: e, phoneNumber: o, shippingAddress: s }, n) => {
233
259
  const { storefront: a } = n || {};
234
260
  return a.query(
235
- v({
261
+ w({
236
262
  addPhoneNumber: T(o)
237
263
  }),
238
264
  {
239
265
  customerInput: {
240
- cartId: e,
241
- customer: r
266
+ cartId: r,
267
+ customer: e
242
268
  },
243
269
  ...T(o) ? {
244
270
  phoneNumberInput: {
245
- cartId: e,
271
+ cartId: r,
246
272
  phoneNumber: o
247
273
  }
248
274
  } : {},
249
275
  billingAddressInput: {
250
- cartId: e,
276
+ cartId: r,
251
277
  address: t
252
278
  },
253
279
  shippingAddressInput: {
254
- cartId: e,
280
+ cartId: r,
255
281
  address: s,
256
282
  type: "ADDRESS"
257
283
  }
258
284
  }
259
285
  );
260
286
  },
261
- formatter: (e) => {
262
- const { cart: t, ...r } = e?.addBillingAddressToCart || {};
287
+ formatter: (r) => {
288
+ const { cart: t, ...e } = r?.addBillingAddressToCart || {};
263
289
  return {
264
- ...r,
290
+ ...e,
265
291
  cart: t
266
292
  };
267
293
  },
268
- success: (e, t) => {
269
- const { createSummary: r, setSummary: o } = t || {}, s = r(e.cart || {});
294
+ success: (r, t) => {
295
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
270
296
  o(s || {});
271
297
  },
272
298
  error: () => {
273
299
  }
274
300
  },
275
301
  addNote: {
276
- queryFn: async ({ cartId: e, note: t }, r) => {
277
- const { storefront: o } = r || {};
278
- return o.query(w, {
302
+ queryFn: async ({ cartId: r, note: t }, e) => {
303
+ const { storefront: o } = e || {};
304
+ return o.query(N, {
279
305
  notePayload: {
280
- cartId: e,
306
+ cartId: r,
281
307
  note: t
282
308
  }
283
309
  });
284
310
  },
285
- formatter: (e) => {
286
- const { cart: t, ...r } = e?.setNoteForCart || {};
311
+ formatter: (r) => {
312
+ const { cart: t, ...e } = r?.setNoteForCart || {};
287
313
  return {
288
- ...r,
314
+ ...e,
289
315
  cart: t
290
316
  };
291
317
  },
@@ -295,26 +321,26 @@ const yt = {
295
321
  }
296
322
  },
297
323
  addPaymentMethod: {
298
- queryFn: async ({ cartId: e, methodId: t, issuerId: r, terminalId: o }, s) => {
324
+ queryFn: async ({ cartId: r, methodId: t, issuerId: e, terminalId: o }, s) => {
299
325
  const { storefront: n } = s || {};
300
- return n.query(N, {
326
+ return n.query(B, {
301
327
  paymentMethodPayload: {
302
- cartId: e,
328
+ cartId: r,
303
329
  methodId: t,
304
- issuerId: r || "",
330
+ issuerId: e || "",
305
331
  terminalId: o || ""
306
332
  }
307
333
  });
308
334
  },
309
- formatter: (e) => {
310
- const { cart: t, ...r } = e?.addPaymentMethodToCart || {};
335
+ formatter: (r) => {
336
+ const { cart: t, ...e } = r?.addPaymentMethodToCart || {};
311
337
  return {
312
- ...r,
338
+ ...e,
313
339
  cart: t
314
340
  };
315
341
  },
316
- success: (e, t) => {
317
- const { createSummary: r, setSummary: o, track: s } = t || {}, { cart: n, ...a } = e || {}, u = r(e.cart || {});
342
+ success: (r, t) => {
343
+ const { createSummary: e, setSummary: o, track: s } = t || {}, { cart: n, ...a } = r || {}, u = e(r.cart || {});
318
344
  o(u || {}), s("addPaymentInfo", {
319
345
  ...a,
320
346
  ...n
@@ -324,24 +350,24 @@ const yt = {
324
350
  }
325
351
  },
326
352
  addPickupPoint: {
327
- queryFn: async ({ cartId: e, pickupPointId: t }, r) => {
328
- const { storefront: o } = r || {};
329
- return o.query(Q, {
353
+ queryFn: async ({ cartId: r, pickupPointId: t }, e) => {
354
+ const { storefront: o } = e || {};
355
+ return o.query(U, {
330
356
  pickupPointPayload: {
331
- cartId: e,
357
+ cartId: r,
332
358
  spid: t
333
359
  }
334
360
  });
335
361
  },
336
- formatter: (e) => {
337
- const { cart: t, ...r } = e?.addPickUpPointToCart || {};
362
+ formatter: (r) => {
363
+ const { cart: t, ...e } = r?.addPickUpPointToCart || {};
338
364
  return {
339
- ...r,
365
+ ...e,
340
366
  cart: t
341
367
  };
342
368
  },
343
- success: (e, t) => {
344
- const { createSummary: r, setSummary: o, track: s } = t || {}, { cart: n, ...a } = e || {}, u = r(n || {});
369
+ success: (r, t) => {
370
+ const { createSummary: e, setSummary: o, track: s } = t || {}, { cart: n, ...a } = r || {}, u = e(n || {});
345
371
  o(u || {}), s("addShippingInfo", {
346
372
  ...a,
347
373
  ...n
@@ -351,24 +377,24 @@ const yt = {
351
377
  }
352
378
  },
353
379
  addShippingMethod: {
354
- queryFn: async ({ cartId: e, methodId: t }, r) => {
355
- const { storefront: o } = r || {};
356
- return o.query(U, {
380
+ queryFn: async ({ cartId: r, methodId: t }, e) => {
381
+ const { storefront: o } = e || {};
382
+ return o.query(_, {
357
383
  shippingMethodPayload: {
358
- cartId: e,
384
+ cartId: r,
359
385
  methodId: t
360
386
  }
361
387
  });
362
388
  },
363
- formatter: (e) => {
364
- const { cart: t, ...r } = e?.addShippingMethodToCart || {};
389
+ formatter: (r) => {
390
+ const { cart: t, ...e } = r?.addShippingMethodToCart || {};
365
391
  return {
366
- ...r,
392
+ ...e,
367
393
  cart: t
368
394
  };
369
395
  },
370
- success: (e, t) => {
371
- const { createSummary: r, setSummary: o, track: s } = t || {}, { cart: n, ...a } = e || {}, u = r(n || {});
396
+ success: (r, t) => {
397
+ const { createSummary: e, setSummary: o, track: s } = t || {}, { cart: n, ...a } = r || {}, u = e(n || {});
372
398
  o(u || {}), s("addShippingInfo", {
373
399
  ...a,
374
400
  ...n
@@ -378,16 +404,16 @@ const yt = {
378
404
  }
379
405
  },
380
406
  getPaymentMethods: {
381
- queryFn: async ({ id: e }, t) => {
382
- const { storefront: r } = t || {};
383
- return r.query(B, {
384
- id: e
407
+ queryFn: async ({ id: r }, t) => {
408
+ const { storefront: e } = t || {};
409
+ return e.query(Q, {
410
+ id: r
385
411
  });
386
412
  },
387
- formatter: (e) => {
388
- const { cart: t, ...r } = e || {}, o = t?.billing?.payment?.method || null, s = t?.options?.payment?.methods || [];
413
+ formatter: (r) => {
414
+ const { cart: t, ...e } = r || {}, o = t?.billing?.payment?.method || null, s = t?.options?.payment?.methods || [];
389
415
  return {
390
- ...r,
416
+ ...e,
391
417
  cart: t,
392
418
  currentPaymentMethod: o,
393
419
  paymentMethods: s
@@ -399,18 +425,18 @@ const yt = {
399
425
  }
400
426
  },
401
427
  getPickupPoints: {
402
- queryFn: async ({ id: e, countryCode: t, postalCode: r }, o) => {
428
+ queryFn: async ({ id: r, countryCode: t, postalCode: e }, o) => {
403
429
  const { storefront: s } = o || {};
404
- return s.query(H, {
405
- id: e,
430
+ return s.query(x, {
431
+ id: r,
406
432
  countryCode: t,
407
- postalCode: r
433
+ postalCode: e
408
434
  });
409
435
  },
410
- formatter: (e) => {
411
- const { cart: t, ...r } = e || {}, o = t?.delivery?.method?.pickupPoints || [];
436
+ formatter: (r) => {
437
+ const { cart: t, ...e } = r || {}, o = t?.delivery?.method?.pickupPoints || [];
412
438
  return {
413
- ...r,
439
+ ...e,
414
440
  pickupPoints: o
415
441
  };
416
442
  },
@@ -420,18 +446,18 @@ const yt = {
420
446
  }
421
447
  },
422
448
  getReviewCheckoutData: {
423
- queryFn: async ({ id: e }, t) => {
424
- const { storefront: r } = t || {};
425
- return r.query(L, { id: e });
449
+ queryFn: async ({ id: r }, t) => {
450
+ const { storefront: e } = t || {};
451
+ return e.query(Y, { id: r });
426
452
  },
427
- formatter: (e) => {
428
- const { cart: t, ...r } = e || {}, { agreements: o = [] } = t?.acceptance || {}, s = t?.checkout?.agreement || null, { contact: n, notes: a = "", organisation: u } = t?.customer || {}, { address: g, payment: l } = t?.billing || {}, { issuer: C, method: q } = l || {}, P = t?.phoneNumber || null, {
429
- address: f,
453
+ formatter: (r) => {
454
+ const { cart: t, ...e } = r || {}, { agreements: o = [] } = t?.acceptance || {}, s = t?.checkout?.agreement || null, { contact: n, notes: a = "", organisation: u } = t?.customer || {}, { address: g, payment: f } = t?.billing || {}, { issuer: C, method: q } = f || {}, P = t?.phoneNumber || null, {
455
+ address: l,
430
456
  method: d,
431
457
  pickupPoint: m
432
458
  } = t?.delivery || {}, p = t?.currency, y = t?.items || [];
433
459
  return {
434
- ...r,
460
+ ...e,
435
461
  agreements: o,
436
462
  agreementTemplate: s,
437
463
  amountCovered: 0,
@@ -446,7 +472,7 @@ const yt = {
446
472
  paymentMethod: q,
447
473
  phoneNumber: P,
448
474
  pickupPoint: m,
449
- shippingAddress: f,
475
+ shippingAddress: l,
450
476
  shippingMethod: d
451
477
  };
452
478
  },
@@ -456,18 +482,18 @@ const yt = {
456
482
  }
457
483
  },
458
484
  getShippingMethods: {
459
- queryFn: async ({ id: e, countryCode: t, postalCode: r }, o) => {
485
+ queryFn: async ({ id: r, countryCode: t, postalCode: e }, o) => {
460
486
  const { storefront: s } = o || {};
461
- return s.query(x, {
462
- id: e,
487
+ return s.query(V, {
488
+ id: r,
463
489
  countryCode: t,
464
- postalCode: r
490
+ postalCode: e
465
491
  });
466
492
  },
467
- formatter: (e) => {
468
- const { cart: t, ...r } = e || {}, o = t?.delivery?.method || null, s = t?.options?.shipping?.methods || [];
493
+ formatter: (r) => {
494
+ const { cart: t, ...e } = r || {}, o = t?.delivery?.method || null, s = t?.options?.shipping?.methods || [];
469
495
  return {
470
- ...r,
496
+ ...e,
471
497
  cart: t,
472
498
  currentShippingMethod: o,
473
499
  shippingMethods: s
@@ -478,25 +504,49 @@ const yt = {
478
504
  error: () => {
479
505
  }
480
506
  },
507
+ removeCoupon: {
508
+ queryFn: async ({ cartId: r, coupon: t }, e) => {
509
+ const { storefront: o } = e || {};
510
+ return o.query(K, {
511
+ couponPayload: {
512
+ cartId: r,
513
+ coupon: t
514
+ }
515
+ });
516
+ },
517
+ formatter: (r) => {
518
+ const { cart: t, ...e } = r?.removeCouponFromCart || {};
519
+ return {
520
+ ...e,
521
+ cart: t
522
+ };
523
+ },
524
+ success: (r, t) => {
525
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
526
+ o(s || {});
527
+ },
528
+ error: () => {
529
+ }
530
+ },
481
531
  setAgreementTemplate: {
482
- queryFn: async ({ cartId: e, agreementId: t }, r) => {
483
- const { storefront: o } = r || {};
484
- return o.query(V, {
532
+ queryFn: async ({ cartId: r, agreementId: t }, e) => {
533
+ const { storefront: o } = e || {};
534
+ return o.query(z, {
485
535
  input: {
486
- cartId: e,
536
+ cartId: r,
487
537
  agreementId: t
488
538
  }
489
539
  });
490
540
  },
491
- formatter: (e) => {
492
- const { cart: t, ...r } = e?.setAgreementTemplateForCart || {};
541
+ formatter: (r) => {
542
+ const { cart: t, ...e } = r?.setAgreementTemplateForCart || {};
493
543
  return {
494
- ...r,
544
+ ...e,
495
545
  cart: t
496
546
  };
497
547
  },
498
- success: (e, t) => {
499
- const { createSummary: r, setSummary: o } = t || {}, s = r(e.cart || {});
548
+ success: (r, t) => {
549
+ const { createSummary: e, setSummary: o } = t || {}, s = e(r.cart || {});
500
550
  o(s || {});
501
551
  },
502
552
  error: () => {
@@ -504,5 +554,5 @@ const yt = {
504
554
  }
505
555
  };
506
556
  export {
507
- yt as cartOperations
557
+ gt as cartOperations
508
558
  };