@afosto/checkout-ui 0.0.7 → 0.0.9
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.
- package/dist/CheckoutProvider/CheckoutProvider.d.ts.map +1 -1
- package/dist/CheckoutProvider/CheckoutProvider.js +53 -50
- package/dist/CheckoutSummary/CheckoutSummary.d.ts +5 -1
- package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
- package/dist/CheckoutSummary/CheckoutSummary.js +90 -68
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts +11 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.d.ts.map +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/CheckoutSummaryCouponField.js +71 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts +3 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.d.ts.map +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCouponField/index.js +4 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts +1 -0
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.d.ts.map +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummaryCoupons/CheckoutSummaryCoupons.js +33 -7
- package/dist/CheckoutSummary/index.d.ts +2 -0
- package/dist/CheckoutSummary/index.d.ts.map +1 -1
- package/dist/CheckoutSummary/index.js +26 -24
- package/dist/constants/paymentMethodIconMapping.d.ts +3 -0
- package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
- package/dist/constants/paymentMethodIconMapping.js +52 -46
- package/dist/hooks/useCheckoutCart.d.ts +48 -10
- package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
- package/dist/hooks/useCheckoutCart.js +117 -63
- package/dist/hooks/useCheckoutOrder.d.ts +48 -10
- package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
- package/dist/hooks/useCheckoutOrder.js +208 -154
- package/dist/icons/AngleRightSolid.d.ts +3 -0
- package/dist/icons/AngleRightSolid.d.ts.map +1 -0
- package/dist/icons/AngleRightSolid.js +6 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +150 -142
- package/dist/icons/paymentMethods/Belfius.d.ts +3 -0
- package/dist/icons/paymentMethods/Belfius.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Belfius.js +17 -0
- package/dist/icons/paymentMethods/Giftcard.d.ts +3 -0
- package/dist/icons/paymentMethods/Giftcard.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Giftcard.js +54 -0
- package/dist/icons/paymentMethods/Kbc.d.ts +3 -0
- package/dist/icons/paymentMethods/Kbc.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Kbc.js +40 -0
- package/dist/icons/paymentMethods/index.d.ts +3 -0
- package/dist/icons/paymentMethods/index.d.ts.map +1 -1
- package/dist/icons/paymentMethods/index.js +102 -96
- package/dist/index.js +325 -309
- package/dist/mutations/addCouponToCart.d.ts +12 -0
- package/dist/mutations/addCouponToCart.d.ts.map +1 -0
- package/dist/mutations/addCouponToCart.js +15 -0
- package/dist/mutations/addCouponToOrder.d.ts +12 -0
- package/dist/mutations/addCouponToOrder.d.ts.map +1 -0
- package/dist/mutations/addCouponToOrder.js +15 -0
- package/dist/mutations/index.d.ts +26 -18
- package/dist/mutations/index.d.ts.map +1 -1
- package/dist/mutations/index.js +44 -36
- package/dist/mutations/removeCouponFromCart.d.ts +12 -0
- package/dist/mutations/removeCouponFromCart.d.ts.map +1 -0
- package/dist/mutations/removeCouponFromCart.js +15 -0
- package/dist/mutations/removeCouponFromOrder.d.ts +12 -0
- package/dist/mutations/removeCouponFromOrder.d.ts.map +1 -0
- package/dist/mutations/removeCouponFromOrder.js +15 -0
- package/dist/operations/cartOperations.d.ts +10 -0
- package/dist/operations/cartOperations.d.ts.map +1 -1
- package/dist/operations/cartOperations.js +218 -168
- package/dist/operations/orderOperations.d.ts +10 -0
- package/dist/operations/orderOperations.d.ts.map +1 -1
- package/dist/operations/orderOperations.js +245 -195
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/getAutocompletedAddress.d.ts.map +1 -1
- package/dist/utils/getAutocompletedAddress.js +5 -5
- package/package.json +2 -2
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { useCheckoutState as
|
|
2
|
-
import { useCheckoutForm as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { useCheckoutAnalytics as
|
|
5
|
-
import { useCheckoutAuth as
|
|
6
|
-
import { useCheckoutSummary as
|
|
7
|
-
import { isDefined as
|
|
8
|
-
const
|
|
1
|
+
import { useCheckoutState as ot } from "./useCheckoutState.js";
|
|
2
|
+
import { useCheckoutForm as nt } from "./useCheckoutForm.js";
|
|
3
|
+
import { useQueryClient as at, useMutation as i } from "@tanstack/react-query";
|
|
4
|
+
import { useCheckoutAnalytics as rt } from "./useCheckoutAnalytics.js";
|
|
5
|
+
import { useCheckoutAuth as st } from "./useCheckoutAuth.js";
|
|
6
|
+
import { useCheckoutSummary as ct } from "./useCheckoutSummary.js";
|
|
7
|
+
import { isDefined as it } from "@afosto/utils";
|
|
8
|
+
const kt = (F) => {
|
|
9
9
|
const {
|
|
10
10
|
analytics: q,
|
|
11
11
|
cartId: c,
|
|
12
|
-
channel:
|
|
12
|
+
channel: g,
|
|
13
13
|
createSummary: A,
|
|
14
14
|
defaultOperations: D,
|
|
15
15
|
isLoading: y = !1,
|
|
16
|
-
isLoadingChannel:
|
|
16
|
+
isLoadingChannel: w,
|
|
17
17
|
locale: T,
|
|
18
18
|
settings: u,
|
|
19
|
-
storefront:
|
|
19
|
+
storefront: P,
|
|
20
20
|
operations: e,
|
|
21
21
|
steps: E
|
|
22
|
-
} = F || {}, M = "cart", m =
|
|
22
|
+
} = F || {}, M = "cart", m = at(), h = rt({
|
|
23
23
|
analytics: q,
|
|
24
24
|
flow: M,
|
|
25
25
|
settings: u
|
|
26
|
-
}), { track:
|
|
26
|
+
}), { track: v } = h, f = st({
|
|
27
27
|
operations: e,
|
|
28
28
|
settings: u,
|
|
29
|
-
storefront:
|
|
30
|
-
track:
|
|
31
|
-
}), { isInitializingAuth:
|
|
32
|
-
channel:
|
|
29
|
+
storefront: P,
|
|
30
|
+
track: v
|
|
31
|
+
}), { isInitializingAuth: I } = f, l = ct(), C = nt({
|
|
32
|
+
channel: g,
|
|
33
33
|
locale: T,
|
|
34
34
|
settings: u,
|
|
35
35
|
steps: E
|
|
36
|
-
}), { initializeSteps: N } =
|
|
36
|
+
}), { initializeSteps: N } = C, n = {
|
|
37
37
|
...f,
|
|
38
38
|
...l,
|
|
39
|
-
...
|
|
39
|
+
...C,
|
|
40
40
|
...h,
|
|
41
|
-
channel:
|
|
41
|
+
channel: g,
|
|
42
42
|
createSummary: A,
|
|
43
43
|
defaultOperations: D,
|
|
44
44
|
flow: M,
|
|
45
45
|
operations: e,
|
|
46
46
|
settings: u,
|
|
47
|
-
storefront:
|
|
48
|
-
},
|
|
49
|
-
enabled: !!c && !
|
|
47
|
+
storefront: P
|
|
48
|
+
}, S = ot({
|
|
49
|
+
enabled: !!c && !I && !w && !y,
|
|
50
50
|
notFound: !y && !c,
|
|
51
51
|
onError: e.initial.error,
|
|
52
52
|
onFormat: async (t) => {
|
|
@@ -69,7 +69,31 @@ const Mt = (F) => {
|
|
|
69
69
|
{ id: c, intent: "BEGIN_CHECKOUT" },
|
|
70
70
|
n
|
|
71
71
|
)
|
|
72
|
-
}), { setIsAddingExpressPaymentMethod:
|
|
72
|
+
}), { setIsAddingExpressPaymentMethod: R, isInitializing: K } = S, L = K || w || y, x = i({
|
|
73
|
+
mutationFn: async (t) => e.addCoupon.queryFn(t, n),
|
|
74
|
+
onSuccess: async (t) => {
|
|
75
|
+
const o = await e.addCoupon.formatter(
|
|
76
|
+
t,
|
|
77
|
+
n
|
|
78
|
+
);
|
|
79
|
+
e.addCoupon.success(o, n);
|
|
80
|
+
},
|
|
81
|
+
onError: (t) => {
|
|
82
|
+
e.addCoupon.error(t);
|
|
83
|
+
}
|
|
84
|
+
}), Q = i({
|
|
85
|
+
mutationFn: async (t) => e.removeCoupon.queryFn(t, n),
|
|
86
|
+
onSuccess: async (t) => {
|
|
87
|
+
const o = await e.removeCoupon.formatter(
|
|
88
|
+
t,
|
|
89
|
+
n
|
|
90
|
+
);
|
|
91
|
+
e.removeCoupon.success(o, n);
|
|
92
|
+
},
|
|
93
|
+
onError: (t) => {
|
|
94
|
+
e.removeCoupon.error(t);
|
|
95
|
+
}
|
|
96
|
+
}), j = i({
|
|
73
97
|
mutationFn: async (t) => e.addCustomer.queryFn(t, n),
|
|
74
98
|
onSuccess: async (t) => {
|
|
75
99
|
const o = await e.addCustomer.formatter(
|
|
@@ -81,7 +105,7 @@ const Mt = (F) => {
|
|
|
81
105
|
onError: (t) => {
|
|
82
106
|
e.addCustomer.error(t);
|
|
83
107
|
}
|
|
84
|
-
}),
|
|
108
|
+
}), O = i({
|
|
85
109
|
mutationFn: async (t) => e.addCustomerCountryCode.queryFn(t, n),
|
|
86
110
|
onSuccess: async (t) => {
|
|
87
111
|
const o = await e.addCustomerCountryCode.formatter(
|
|
@@ -96,7 +120,7 @@ const Mt = (F) => {
|
|
|
96
120
|
onError: (t) => {
|
|
97
121
|
e.addCustomerCountryCode.error(t);
|
|
98
122
|
}
|
|
99
|
-
}),
|
|
123
|
+
}), z = i({
|
|
100
124
|
mutationFn: async (t) => e.addInformation.queryFn(t, n),
|
|
101
125
|
onSuccess: async (t) => {
|
|
102
126
|
const o = await e.addInformation.formatter(
|
|
@@ -108,7 +132,7 @@ const Mt = (F) => {
|
|
|
108
132
|
onError: (t) => {
|
|
109
133
|
e.addInformation.error(t);
|
|
110
134
|
}
|
|
111
|
-
}),
|
|
135
|
+
}), b = i({
|
|
112
136
|
mutationFn: async (t) => e.addNote.queryFn(t, n),
|
|
113
137
|
onSuccess: async (t) => {
|
|
114
138
|
const o = await e.addNote.formatter(
|
|
@@ -120,7 +144,7 @@ const Mt = (F) => {
|
|
|
120
144
|
onError: (t) => {
|
|
121
145
|
e.addNote.error(t);
|
|
122
146
|
}
|
|
123
|
-
}),
|
|
147
|
+
}), U = i({
|
|
124
148
|
mutationFn: async (t) => e.addPaymentMethod.queryFn(t, n),
|
|
125
149
|
onSuccess: async (t) => {
|
|
126
150
|
const o = await e.addPaymentMethod.formatter(
|
|
@@ -132,7 +156,7 @@ const Mt = (F) => {
|
|
|
132
156
|
onError: (t) => {
|
|
133
157
|
e.addPaymentMethod.error(t);
|
|
134
158
|
}
|
|
135
|
-
}),
|
|
159
|
+
}), _ = i({
|
|
136
160
|
mutationFn: async (t) => e.addPickupPoint.queryFn(t, n),
|
|
137
161
|
onSuccess: async (t) => {
|
|
138
162
|
const o = await e.addPickupPoint.formatter(
|
|
@@ -144,7 +168,7 @@ const Mt = (F) => {
|
|
|
144
168
|
onError: (t) => {
|
|
145
169
|
e.addPickupPoint.error(t);
|
|
146
170
|
}
|
|
147
|
-
}),
|
|
171
|
+
}), $ = i({
|
|
148
172
|
mutationFn: async (t) => e.addShippingMethod.queryFn(t, n),
|
|
149
173
|
onSuccess: async (t) => {
|
|
150
174
|
const o = await e.addShippingMethod.formatter(
|
|
@@ -156,7 +180,7 @@ const Mt = (F) => {
|
|
|
156
180
|
onError: (t) => {
|
|
157
181
|
e.addShippingMethod.error(t);
|
|
158
182
|
}
|
|
159
|
-
}),
|
|
183
|
+
}), B = i({
|
|
160
184
|
mutationFn: async (t) => e.checkout.queryFn(t, n),
|
|
161
185
|
onSuccess: async (t) => {
|
|
162
186
|
const o = await e.checkout.formatter(
|
|
@@ -168,7 +192,7 @@ const Mt = (F) => {
|
|
|
168
192
|
onError: (t) => {
|
|
169
193
|
e.checkout.error(t);
|
|
170
194
|
}
|
|
171
|
-
}),
|
|
195
|
+
}), G = i({
|
|
172
196
|
mutationFn: async (t) => e.setAgreementTemplate.queryFn(t, n),
|
|
173
197
|
onSuccess: async (t) => {
|
|
174
198
|
const o = await e.setAgreementTemplate.formatter(
|
|
@@ -183,10 +207,38 @@ const Mt = (F) => {
|
|
|
183
207
|
onError: (t) => {
|
|
184
208
|
e.setAgreementTemplate.error(t);
|
|
185
209
|
}
|
|
186
|
-
}),
|
|
187
|
-
|
|
210
|
+
}), H = async ({
|
|
211
|
+
coupon: t
|
|
188
212
|
}) => {
|
|
189
213
|
const o = await x.mutateAsync({
|
|
214
|
+
cartId: c,
|
|
215
|
+
coupon: t
|
|
216
|
+
}), a = await e.addCoupon.formatter(
|
|
217
|
+
o,
|
|
218
|
+
n
|
|
219
|
+
), { cart: r, ...s } = a || {};
|
|
220
|
+
return {
|
|
221
|
+
...r,
|
|
222
|
+
...s
|
|
223
|
+
};
|
|
224
|
+
}, J = async ({
|
|
225
|
+
coupon: t
|
|
226
|
+
}) => {
|
|
227
|
+
const o = await Q.mutateAsync({
|
|
228
|
+
cartId: c,
|
|
229
|
+
coupon: t
|
|
230
|
+
}), a = await e.removeCoupon.formatter(
|
|
231
|
+
o,
|
|
232
|
+
n
|
|
233
|
+
), { cart: r, ...s } = a || {};
|
|
234
|
+
return {
|
|
235
|
+
...r,
|
|
236
|
+
...s
|
|
237
|
+
};
|
|
238
|
+
}, V = async ({
|
|
239
|
+
customer: t
|
|
240
|
+
}) => {
|
|
241
|
+
const o = await j.mutateAsync({
|
|
190
242
|
cartId: c,
|
|
191
243
|
customer: t
|
|
192
244
|
}), a = await e.addCustomer.formatter(
|
|
@@ -197,10 +249,10 @@ const Mt = (F) => {
|
|
|
197
249
|
...r,
|
|
198
250
|
...s
|
|
199
251
|
};
|
|
200
|
-
},
|
|
252
|
+
}, W = async ({
|
|
201
253
|
countryCode: t
|
|
202
254
|
}) => {
|
|
203
|
-
const o = await
|
|
255
|
+
const o = await O.mutateAsync({
|
|
204
256
|
cartId: c,
|
|
205
257
|
countryCode: t
|
|
206
258
|
}), a = await e.addCustomerCountryCode.formatter(
|
|
@@ -211,13 +263,13 @@ const Mt = (F) => {
|
|
|
211
263
|
...r,
|
|
212
264
|
...s
|
|
213
265
|
};
|
|
214
|
-
},
|
|
266
|
+
}, X = async ({
|
|
215
267
|
billingAddress: t,
|
|
216
268
|
customer: o,
|
|
217
269
|
phoneNumber: a,
|
|
218
270
|
shippingAddress: r
|
|
219
271
|
}) => {
|
|
220
|
-
const s = await
|
|
272
|
+
const s = await z.mutateAsync({
|
|
221
273
|
cartId: c,
|
|
222
274
|
billingAddress: t,
|
|
223
275
|
customer: o,
|
|
@@ -226,13 +278,13 @@ const Mt = (F) => {
|
|
|
226
278
|
}), d = await e.addInformation.formatter(
|
|
227
279
|
s,
|
|
228
280
|
n
|
|
229
|
-
), { cart: p, ...
|
|
281
|
+
), { cart: p, ...et } = d || {};
|
|
230
282
|
return {
|
|
231
283
|
...p,
|
|
232
|
-
...
|
|
284
|
+
...et
|
|
233
285
|
};
|
|
234
|
-
},
|
|
235
|
-
const o = await
|
|
286
|
+
}, Y = async ({ note: t }) => {
|
|
287
|
+
const o = await b.mutateAsync({
|
|
236
288
|
cartId: c,
|
|
237
289
|
note: t
|
|
238
290
|
}), a = await e.addNote.formatter(
|
|
@@ -243,8 +295,8 @@ const Mt = (F) => {
|
|
|
243
295
|
...r,
|
|
244
296
|
...s
|
|
245
297
|
};
|
|
246
|
-
},
|
|
247
|
-
const t = await
|
|
298
|
+
}, Z = async () => {
|
|
299
|
+
const t = await B.mutateAsync({
|
|
248
300
|
cartId: c
|
|
249
301
|
}), o = await e.checkout.formatter(
|
|
250
302
|
t,
|
|
@@ -258,8 +310,8 @@ const Mt = (F) => {
|
|
|
258
310
|
return;
|
|
259
311
|
}
|
|
260
312
|
const [r] = o?.order?.options?.proceedingStep?.proceeding?.options || [], { method: s, url: d } = r || {};
|
|
261
|
-
s?.toLowerCase() === "follow" &&
|
|
262
|
-
},
|
|
313
|
+
s?.toLowerCase() === "follow" && it(d) && (window.location.href = d);
|
|
314
|
+
}, tt = async () => {
|
|
263
315
|
try {
|
|
264
316
|
const t = await m.fetchQuery({
|
|
265
317
|
queryKey: ["getCartInitialPaymentStep", c],
|
|
@@ -284,12 +336,12 @@ const Mt = (F) => {
|
|
|
284
336
|
} catch (t) {
|
|
285
337
|
return e.initialPaymentStep.error(t), Promise.reject(t);
|
|
286
338
|
}
|
|
287
|
-
},
|
|
339
|
+
}, k = async ({
|
|
288
340
|
methodId: t,
|
|
289
341
|
issuerId: o,
|
|
290
342
|
terminalId: a
|
|
291
343
|
}) => {
|
|
292
|
-
const r = await
|
|
344
|
+
const r = await U.mutateAsync({
|
|
293
345
|
cartId: c,
|
|
294
346
|
methodId: t,
|
|
295
347
|
issuerId: o,
|
|
@@ -304,29 +356,30 @@ const Mt = (F) => {
|
|
|
304
356
|
};
|
|
305
357
|
};
|
|
306
358
|
return {
|
|
307
|
-
...
|
|
359
|
+
...S,
|
|
308
360
|
...f,
|
|
309
361
|
...l,
|
|
310
|
-
...
|
|
362
|
+
...C,
|
|
311
363
|
...h,
|
|
312
|
-
|
|
313
|
-
|
|
364
|
+
addCoupon: H,
|
|
365
|
+
addCustomer: V,
|
|
366
|
+
addCustomerCountryCode: W,
|
|
314
367
|
addExpressPaymentMethod: async ({
|
|
315
368
|
methodId: t
|
|
316
369
|
}) => {
|
|
317
370
|
try {
|
|
318
|
-
return
|
|
371
|
+
return R(!0), k({ methodId: t });
|
|
319
372
|
} catch {
|
|
320
|
-
|
|
373
|
+
R(!1);
|
|
321
374
|
}
|
|
322
375
|
},
|
|
323
|
-
addInformation:
|
|
324
|
-
addNote:
|
|
325
|
-
addPaymentMethod:
|
|
376
|
+
addInformation: X,
|
|
377
|
+
addNote: Y,
|
|
378
|
+
addPaymentMethod: k,
|
|
326
379
|
addPickupPoint: async ({
|
|
327
380
|
pickupPointId: t
|
|
328
381
|
}) => {
|
|
329
|
-
const o = await
|
|
382
|
+
const o = await _.mutateAsync({
|
|
330
383
|
cartId: c,
|
|
331
384
|
pickupPointId: t
|
|
332
385
|
}), a = await e.addPickupPoint.formatter(
|
|
@@ -341,7 +394,7 @@ const Mt = (F) => {
|
|
|
341
394
|
addShippingMethod: async ({
|
|
342
395
|
methodId: t
|
|
343
396
|
}) => {
|
|
344
|
-
const o = await
|
|
397
|
+
const o = await $.mutateAsync({
|
|
345
398
|
cartId: c,
|
|
346
399
|
methodId: t
|
|
347
400
|
}), a = await e.addShippingMethod.formatter(
|
|
@@ -353,8 +406,8 @@ const Mt = (F) => {
|
|
|
353
406
|
...s
|
|
354
407
|
};
|
|
355
408
|
},
|
|
356
|
-
checkout:
|
|
357
|
-
getInitialPaymentStep:
|
|
409
|
+
checkout: Z,
|
|
410
|
+
getInitialPaymentStep: tt,
|
|
358
411
|
getPaymentMethods: async () => {
|
|
359
412
|
try {
|
|
360
413
|
const t = await m.fetchQuery({
|
|
@@ -457,10 +510,11 @@ const Mt = (F) => {
|
|
|
457
510
|
}
|
|
458
511
|
},
|
|
459
512
|
isLoading: L,
|
|
513
|
+
removeCoupon: J,
|
|
460
514
|
setAgreementTemplate: async ({
|
|
461
515
|
agreementId: t
|
|
462
516
|
}) => {
|
|
463
|
-
const o = await
|
|
517
|
+
const o = await G.mutateAsync({
|
|
464
518
|
cartId: c,
|
|
465
519
|
agreementId: t
|
|
466
520
|
}), a = await e.setAgreementTemplate.formatter(
|
|
@@ -475,5 +529,5 @@ const Mt = (F) => {
|
|
|
475
529
|
};
|
|
476
530
|
};
|
|
477
531
|
export {
|
|
478
|
-
|
|
532
|
+
kt as useCheckoutCart
|
|
479
533
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CheckoutCreateSummaryFn, CheckoutSettings, CheckoutSteps, DeepPartial, StorefrontClient } from '../types';
|
|
2
2
|
import { CheckoutOrderOperations } from '../operations/orderOperations';
|
|
3
3
|
import { CheckoutAuthOperations } from '../operations/authOperations';
|
|
4
|
+
import { AddCouponToOrderParams } from '../mutations/addCouponToOrder';
|
|
4
5
|
import { AddCustomerToOrderParams } from '../mutations/addCustomerToOrder';
|
|
5
6
|
import { AddCustomerCountryCodeToOrderParams } from '../mutations/addCustomerCountryCodeToOrder';
|
|
6
7
|
import { AddInformationToOrderParams } from '../mutations/addInformationToOrder';
|
|
@@ -10,6 +11,7 @@ import { AddPickupPointToOrderParams } from '../mutations/addPickupPointToOrder'
|
|
|
10
11
|
import { AddShippingMethodToOrderParams } from '../mutations/addShippingMethodToOrder';
|
|
11
12
|
import { GetOrderPickupPointsParams } from '../queries/getOrderPickupPointsQuery';
|
|
12
13
|
import { GetOrderShippingMethodsParams } from '../queries/getOrderShippingMethodsQuery';
|
|
14
|
+
import { RemoveCouponFromOrderParams } from '../mutations/removeCouponFromOrder';
|
|
13
15
|
import { SetAgreementTemplateForOrderParams } from '../mutations/setAgreementTemplateForOrder';
|
|
14
16
|
import { CheckoutAnalytics } from '../constants/analyticsEvents';
|
|
15
17
|
import { Channel } from '@afosto/storefront';
|
|
@@ -28,7 +30,25 @@ export interface UseCheckoutOrderOptions {
|
|
|
28
30
|
operations: CheckoutAuthOperations & CheckoutOrderOperations;
|
|
29
31
|
}
|
|
30
32
|
export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
31
|
-
|
|
33
|
+
addCoupon: ({ coupon, }: Omit<AddCouponToOrderParams, "orderId">) => Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
acceptance: {
|
|
36
|
+
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
37
|
+
};
|
|
38
|
+
adjustments: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAdjustment[];
|
|
39
|
+
checkout: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionCheckout;
|
|
40
|
+
coupons: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionCoupon[];
|
|
41
|
+
items: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionItem[];
|
|
42
|
+
currency: string;
|
|
43
|
+
isIncludingVat: boolean;
|
|
44
|
+
isVatShifted: boolean;
|
|
45
|
+
subtotal: number;
|
|
46
|
+
total: number;
|
|
47
|
+
totalExcludingVat: number;
|
|
48
|
+
fees: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionFees;
|
|
49
|
+
vat: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionVat[];
|
|
50
|
+
}>;
|
|
51
|
+
addCustomer: ({ customer, }: Omit<AddCustomerToOrderParams, "orderId">) => Promise<{
|
|
32
52
|
id: string;
|
|
33
53
|
acceptance: {
|
|
34
54
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -51,7 +71,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
51
71
|
countryCode: string;
|
|
52
72
|
};
|
|
53
73
|
}>;
|
|
54
|
-
addCustomerCountryCode: ({ countryCode }: Omit<AddCustomerCountryCodeToOrderParams, "orderId">) => Promise<{
|
|
74
|
+
addCustomerCountryCode: ({ countryCode, }: Omit<AddCustomerCountryCodeToOrderParams, "orderId">) => Promise<{
|
|
55
75
|
id: string;
|
|
56
76
|
acceptance: {
|
|
57
77
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -69,7 +89,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
69
89
|
fees: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionFees;
|
|
70
90
|
vat: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionVat[];
|
|
71
91
|
}>;
|
|
72
|
-
addExpressPaymentMethod: ({ methodId }: Omit<AddPaymentMethodToOrderParams, "orderId">) => Promise<{
|
|
92
|
+
addExpressPaymentMethod: ({ methodId, }: Omit<AddPaymentMethodToOrderParams, "orderId">) => Promise<{
|
|
73
93
|
id: string;
|
|
74
94
|
acceptance: {
|
|
75
95
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -106,7 +126,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
106
126
|
};
|
|
107
127
|
};
|
|
108
128
|
} | undefined>;
|
|
109
|
-
addInformation: ({ billingAddress, customer, phoneNumber, shippingAddress }: Omit<AddInformationToOrderParams, "orderId">) => Promise<{
|
|
129
|
+
addInformation: ({ billingAddress, customer, phoneNumber, shippingAddress, }: Omit<AddInformationToOrderParams, "orderId">) => Promise<{
|
|
110
130
|
id: string;
|
|
111
131
|
acceptance: {
|
|
112
132
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -156,7 +176,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
156
176
|
notes: string;
|
|
157
177
|
};
|
|
158
178
|
}>;
|
|
159
|
-
addPaymentMethod: ({ methodId, issuerId, terminalId }: Omit<AddPaymentMethodToOrderParams, "orderId">) => Promise<{
|
|
179
|
+
addPaymentMethod: ({ methodId, issuerId, terminalId, }: Omit<AddPaymentMethodToOrderParams, "orderId">) => Promise<{
|
|
160
180
|
id: string;
|
|
161
181
|
acceptance: {
|
|
162
182
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -193,7 +213,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
193
213
|
};
|
|
194
214
|
};
|
|
195
215
|
}>;
|
|
196
|
-
addPickupPoint: ({ pickupPointId }: Omit<AddPickupPointToOrderParams, "orderId">) => Promise<{
|
|
216
|
+
addPickupPoint: ({ pickupPointId, }: Omit<AddPickupPointToOrderParams, "orderId">) => Promise<{
|
|
197
217
|
id: string;
|
|
198
218
|
acceptance: {
|
|
199
219
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -221,7 +241,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
221
241
|
};
|
|
222
242
|
};
|
|
223
243
|
}>;
|
|
224
|
-
addShippingMethod: ({ methodId }: Omit<AddShippingMethodToOrderParams, "orderId">) => Promise<{
|
|
244
|
+
addShippingMethod: ({ methodId, }: Omit<AddShippingMethodToOrderParams, "orderId">) => Promise<{
|
|
225
245
|
id: string;
|
|
226
246
|
acceptance: {
|
|
227
247
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -268,7 +288,7 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
268
288
|
paymentMethods: import('..').CheckoutPaymentMethodOptionType[];
|
|
269
289
|
payments: import('..').GetOrderPaymentMethodsResponsePayment[];
|
|
270
290
|
}>;
|
|
271
|
-
getPickupPoints: ({ countryCode, postalCode }: Omit<GetOrderPickupPointsParams, "id">) => Promise<{
|
|
291
|
+
getPickupPoints: ({ countryCode, postalCode, }: Omit<GetOrderPickupPointsParams, "id">) => Promise<{
|
|
272
292
|
pickupPoints: import('..').CheckoutShippingMethodPickupPoint[];
|
|
273
293
|
}>;
|
|
274
294
|
getReviewCheckoutData: () => Promise<{
|
|
@@ -288,14 +308,32 @@ export declare const useCheckoutOrder: (options: UseCheckoutOrderOptions) => {
|
|
|
288
308
|
issuer: import('..').GetOrderReviewCheckoutDataQueryResponse["order"]["billing"]["payment"]["issuer"];
|
|
289
309
|
amountCovered: number;
|
|
290
310
|
}>;
|
|
291
|
-
getShippingMethods: ({ countryCode, postalCode }: Omit<GetOrderShippingMethodsParams, "id">) => Promise<{
|
|
311
|
+
getShippingMethods: ({ countryCode, postalCode, }: Omit<GetOrderShippingMethodsParams, "id">) => Promise<{
|
|
292
312
|
currentShippingMethod: {
|
|
293
313
|
id: string;
|
|
294
314
|
};
|
|
295
315
|
shippingMethods: import('..').CheckoutShippingMethodOptionType[];
|
|
296
316
|
}>;
|
|
297
317
|
isLoading: boolean;
|
|
298
|
-
|
|
318
|
+
removeCoupon: ({ coupon, }: Omit<RemoveCouponFromOrderParams, "orderId">) => Promise<{
|
|
319
|
+
id: string;
|
|
320
|
+
acceptance: {
|
|
321
|
+
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
322
|
+
};
|
|
323
|
+
adjustments: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAdjustment[];
|
|
324
|
+
checkout: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionCheckout;
|
|
325
|
+
coupons: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionCoupon[];
|
|
326
|
+
items: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionItem[];
|
|
327
|
+
currency: string;
|
|
328
|
+
isIncludingVat: boolean;
|
|
329
|
+
isVatShifted: boolean;
|
|
330
|
+
subtotal: number;
|
|
331
|
+
total: number;
|
|
332
|
+
totalExcludingVat: number;
|
|
333
|
+
fees: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionFees;
|
|
334
|
+
vat: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionVat[];
|
|
335
|
+
}>;
|
|
336
|
+
setAgreementTemplate: ({ agreementId, }: Omit<SetAgreementTemplateForOrderParams, "orderId">) => Promise<{
|
|
299
337
|
id: string;
|
|
300
338
|
acceptance: {
|
|
301
339
|
agreements: import('../fragments/CoreOrderProjectionFields').CoreOrderProjectionAgreement[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckoutOrder.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckoutOrder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,mCA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