@afosto/checkout-ui 0.0.8 → 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 +1 -0
- package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
- package/dist/constants/paymentMethodIconMapping.js +54 -52
- 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 +130 -126
- 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/index.d.ts +1 -0
- package/dist/icons/paymentMethods/index.d.ts.map +1 -1
- package/dist/icons/paymentMethods/index.js +80 -78
- package/dist/index.js +301 -289
- 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/package.json +1 -1
|
@@ -1,251 +1,303 @@
|
|
|
1
|
-
import { useCheckoutForm as
|
|
2
|
-
import { useCheckoutState as
|
|
3
|
-
import { useCheckoutAuth as
|
|
4
|
-
import { useQueryClient as
|
|
5
|
-
import { useCheckoutSummary as
|
|
6
|
-
import { isDefined as
|
|
7
|
-
import { useCheckoutAnalytics as
|
|
8
|
-
const
|
|
1
|
+
import { useCheckoutForm as ot } from "./useCheckoutForm.js";
|
|
2
|
+
import { useCheckoutState as nt } from "./useCheckoutState.js";
|
|
3
|
+
import { useCheckoutAuth as rt } from "./useCheckoutAuth.js";
|
|
4
|
+
import { useQueryClient as st, useMutation as d } from "@tanstack/react-query";
|
|
5
|
+
import { useCheckoutSummary as at } from "./useCheckoutSummary.js";
|
|
6
|
+
import { isDefined as ct } from "@afosto/utils";
|
|
7
|
+
import { useCheckoutAnalytics as dt } from "./useCheckoutAnalytics.js";
|
|
8
|
+
const kt = (F) => {
|
|
9
9
|
const {
|
|
10
10
|
orderId: c,
|
|
11
11
|
analytics: q,
|
|
12
|
-
channel:
|
|
12
|
+
channel: w,
|
|
13
13
|
createSummary: A,
|
|
14
14
|
defaultOperations: O,
|
|
15
15
|
isLoading: y = !1,
|
|
16
|
-
isLoadingChannel:
|
|
16
|
+
isLoadingChannel: C,
|
|
17
17
|
locale: D,
|
|
18
18
|
settings: u,
|
|
19
|
-
storefront:
|
|
19
|
+
storefront: P,
|
|
20
20
|
operations: e,
|
|
21
21
|
steps: T
|
|
22
|
-
} = F || {},
|
|
22
|
+
} = F || {}, M = "order", m = st(), h = dt({
|
|
23
23
|
analytics: q,
|
|
24
|
-
flow:
|
|
24
|
+
flow: M,
|
|
25
25
|
settings: u
|
|
26
|
-
}), { track:
|
|
26
|
+
}), { track: v } = h, f = rt({
|
|
27
27
|
operations: e,
|
|
28
28
|
settings: u,
|
|
29
|
-
storefront:
|
|
30
|
-
track:
|
|
31
|
-
}), { isInitializingAuth: E } = f,
|
|
32
|
-
channel:
|
|
29
|
+
storefront: P,
|
|
30
|
+
track: v
|
|
31
|
+
}), { isInitializingAuth: E } = f, l = at(), g = ot({
|
|
32
|
+
channel: w,
|
|
33
33
|
locale: D,
|
|
34
34
|
settings: u,
|
|
35
35
|
steps: T
|
|
36
|
-
}), { initializeSteps:
|
|
36
|
+
}), { initializeSteps: I } = g, n = {
|
|
37
37
|
...f,
|
|
38
|
-
...
|
|
38
|
+
...l,
|
|
39
39
|
...g,
|
|
40
40
|
...h,
|
|
41
|
-
channel:
|
|
41
|
+
channel: w,
|
|
42
42
|
createSummary: A,
|
|
43
43
|
defaultOperations: O,
|
|
44
|
-
flow:
|
|
44
|
+
flow: M,
|
|
45
45
|
operations: e,
|
|
46
46
|
settings: u,
|
|
47
|
-
storefront:
|
|
48
|
-
},
|
|
49
|
-
enabled: !!c && !E && !
|
|
47
|
+
storefront: P
|
|
48
|
+
}, R = nt({
|
|
49
|
+
enabled: !!c && !E && !C && !y,
|
|
50
50
|
notFound: !y && !c,
|
|
51
51
|
onError: e.initial.error,
|
|
52
52
|
onFormat: async (t) => {
|
|
53
53
|
const o = await e.initial.formatter(
|
|
54
54
|
t,
|
|
55
|
-
|
|
55
|
+
n
|
|
56
56
|
);
|
|
57
57
|
return o?.order ? o : null;
|
|
58
58
|
},
|
|
59
59
|
onSuccess: async (t) => {
|
|
60
|
-
await e.initial.success(t,
|
|
60
|
+
await e.initial.success(t, n);
|
|
61
61
|
try {
|
|
62
62
|
const { skipCheckCompletedSteps: o } = t || {};
|
|
63
|
-
|
|
63
|
+
I(t.order, t, { skipCheckCompletedSteps: o });
|
|
64
64
|
} catch {
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
queryKey: ["initialCheckoutOrderState", c],
|
|
68
|
-
queryFn: async () => e.initial.queryFn({ id: c },
|
|
69
|
-
}), { isInitializing: L, setIsAddingExpressPaymentMethod: S } =
|
|
70
|
-
mutationFn: async (t) => e.
|
|
68
|
+
queryFn: async () => e.initial.queryFn({ id: c }, n)
|
|
69
|
+
}), { isInitializing: L, setIsAddingExpressPaymentMethod: S } = R, N = L || C || y, x = d({
|
|
70
|
+
mutationFn: async (t) => e.addCoupon.queryFn(t, n),
|
|
71
|
+
onSuccess: async (t) => {
|
|
72
|
+
const o = await e.addCoupon.formatter(
|
|
73
|
+
t,
|
|
74
|
+
n
|
|
75
|
+
);
|
|
76
|
+
e.addCoupon.success(o, n);
|
|
77
|
+
},
|
|
78
|
+
onError: (t) => {
|
|
79
|
+
e.addCoupon.error(t);
|
|
80
|
+
}
|
|
81
|
+
}), K = d({
|
|
82
|
+
mutationFn: async (t) => e.removeCoupon.queryFn(t, n),
|
|
83
|
+
onSuccess: async (t) => {
|
|
84
|
+
const o = await e.removeCoupon.formatter(
|
|
85
|
+
t,
|
|
86
|
+
n
|
|
87
|
+
);
|
|
88
|
+
e.removeCoupon.success(o, n);
|
|
89
|
+
},
|
|
90
|
+
onError: (t) => {
|
|
91
|
+
e.removeCoupon.error(t);
|
|
92
|
+
}
|
|
93
|
+
}), Q = d({
|
|
94
|
+
mutationFn: async (t) => e.addCustomer.queryFn(t, n),
|
|
71
95
|
onSuccess: async (t) => {
|
|
72
96
|
const o = await e.addCustomer.formatter(
|
|
73
97
|
t,
|
|
74
|
-
|
|
98
|
+
n
|
|
75
99
|
);
|
|
76
|
-
e.addCustomer.success(o,
|
|
100
|
+
e.addCustomer.success(o, n);
|
|
77
101
|
},
|
|
78
102
|
onError: (t) => {
|
|
79
103
|
e.addCustomer.error(t);
|
|
80
104
|
}
|
|
81
|
-
}),
|
|
82
|
-
mutationFn: async (t) => e.addCustomerCountryCode.queryFn(t,
|
|
105
|
+
}), j = d({
|
|
106
|
+
mutationFn: async (t) => e.addCustomerCountryCode.queryFn(t, n),
|
|
83
107
|
onSuccess: async (t) => {
|
|
84
108
|
const o = await e.addCustomerCountryCode.formatter(
|
|
85
109
|
t,
|
|
86
|
-
|
|
110
|
+
n
|
|
87
111
|
);
|
|
88
112
|
e.addCustomerCountryCode.success(
|
|
89
113
|
o,
|
|
90
|
-
|
|
114
|
+
n
|
|
91
115
|
);
|
|
92
116
|
},
|
|
93
117
|
onError: (t) => {
|
|
94
118
|
e.addCustomerCountryCode.error(t);
|
|
95
119
|
}
|
|
96
|
-
}),
|
|
97
|
-
mutationFn: async (t) => e.addInformation.queryFn(t,
|
|
120
|
+
}), z = d({
|
|
121
|
+
mutationFn: async (t) => e.addInformation.queryFn(t, n),
|
|
98
122
|
onSuccess: async (t) => {
|
|
99
123
|
const o = await e.addInformation.formatter(
|
|
100
124
|
t,
|
|
101
|
-
|
|
125
|
+
n
|
|
102
126
|
);
|
|
103
|
-
e.addInformation.success(o,
|
|
127
|
+
e.addInformation.success(o, n);
|
|
104
128
|
},
|
|
105
129
|
onError: (t) => {
|
|
106
130
|
e.addInformation.error(t);
|
|
107
131
|
}
|
|
108
|
-
}),
|
|
109
|
-
mutationFn: async (t) => e.addNote.queryFn(t,
|
|
132
|
+
}), b = d({
|
|
133
|
+
mutationFn: async (t) => e.addNote.queryFn(t, n),
|
|
110
134
|
onSuccess: async (t) => {
|
|
111
135
|
const o = await e.addNote.formatter(
|
|
112
136
|
t,
|
|
113
|
-
|
|
137
|
+
n
|
|
114
138
|
);
|
|
115
|
-
e.addNote.success(o,
|
|
139
|
+
e.addNote.success(o, n);
|
|
116
140
|
},
|
|
117
141
|
onError: (t) => {
|
|
118
142
|
e.addNote.error(t);
|
|
119
143
|
}
|
|
120
|
-
}),
|
|
121
|
-
mutationFn: async (t) => e.addPaymentMethod.queryFn(t,
|
|
144
|
+
}), $ = d({
|
|
145
|
+
mutationFn: async (t) => e.addPaymentMethod.queryFn(t, n),
|
|
122
146
|
onSuccess: async (t) => {
|
|
123
147
|
const o = await e.addPaymentMethod.formatter(
|
|
124
148
|
t,
|
|
125
|
-
|
|
149
|
+
n
|
|
126
150
|
);
|
|
127
|
-
e.addPaymentMethod.success(o,
|
|
151
|
+
e.addPaymentMethod.success(o, n);
|
|
128
152
|
},
|
|
129
153
|
onError: (t) => {
|
|
130
154
|
e.addPaymentMethod.error(t);
|
|
131
155
|
}
|
|
132
|
-
}),
|
|
133
|
-
mutationFn: async (t) => e.addPickupPoint.queryFn(t,
|
|
156
|
+
}), U = d({
|
|
157
|
+
mutationFn: async (t) => e.addPickupPoint.queryFn(t, n),
|
|
134
158
|
onSuccess: async (t) => {
|
|
135
159
|
const o = await e.addPickupPoint.formatter(
|
|
136
160
|
t,
|
|
137
|
-
|
|
161
|
+
n
|
|
138
162
|
);
|
|
139
|
-
e.addPickupPoint.success(o,
|
|
163
|
+
e.addPickupPoint.success(o, n);
|
|
140
164
|
},
|
|
141
165
|
onError: (t) => {
|
|
142
166
|
e.addPickupPoint.error(t);
|
|
143
167
|
}
|
|
144
|
-
}),
|
|
145
|
-
mutationFn: async (t) => e.addShippingMethod.queryFn(t,
|
|
168
|
+
}), _ = d({
|
|
169
|
+
mutationFn: async (t) => e.addShippingMethod.queryFn(t, n),
|
|
146
170
|
onSuccess: async (t) => {
|
|
147
171
|
const o = await e.addShippingMethod.formatter(
|
|
148
172
|
t,
|
|
149
|
-
|
|
173
|
+
n
|
|
150
174
|
);
|
|
151
|
-
e.addShippingMethod.success(o,
|
|
175
|
+
e.addShippingMethod.success(o, n);
|
|
152
176
|
},
|
|
153
177
|
onError: (t) => {
|
|
154
178
|
e.addShippingMethod.error(t);
|
|
155
179
|
}
|
|
156
|
-
}),
|
|
157
|
-
mutationFn: async (t) => e.checkout.queryFn(t,
|
|
180
|
+
}), B = d({
|
|
181
|
+
mutationFn: async (t) => e.checkout.queryFn(t, n),
|
|
158
182
|
onSuccess: async (t) => {
|
|
159
183
|
const o = await e.checkout.formatter(
|
|
160
184
|
t,
|
|
161
|
-
|
|
185
|
+
n
|
|
162
186
|
);
|
|
163
|
-
e.checkout.success(o,
|
|
187
|
+
e.checkout.success(o, n);
|
|
164
188
|
},
|
|
165
189
|
onError: (t) => {
|
|
166
190
|
e.checkout.error(t);
|
|
167
191
|
}
|
|
168
|
-
}),
|
|
169
|
-
mutationFn: async (t) => e.setAgreementTemplate.queryFn(t,
|
|
192
|
+
}), G = d({
|
|
193
|
+
mutationFn: async (t) => e.setAgreementTemplate.queryFn(t, n),
|
|
170
194
|
onSuccess: async (t) => {
|
|
171
195
|
const o = await e.setAgreementTemplate.formatter(
|
|
172
196
|
t,
|
|
173
|
-
|
|
197
|
+
n
|
|
174
198
|
);
|
|
175
199
|
e.setAgreementTemplate.success(
|
|
176
200
|
o,
|
|
177
|
-
|
|
201
|
+
n
|
|
178
202
|
);
|
|
179
203
|
},
|
|
180
204
|
onError: (t) => {
|
|
181
205
|
e.setAgreementTemplate.error(t);
|
|
182
206
|
}
|
|
183
|
-
}),
|
|
184
|
-
|
|
207
|
+
}), H = async ({
|
|
208
|
+
coupon: t
|
|
185
209
|
}) => {
|
|
186
210
|
const o = await x.mutateAsync({
|
|
211
|
+
orderId: c,
|
|
212
|
+
coupon: t
|
|
213
|
+
}), r = await e.addCoupon.formatter(
|
|
214
|
+
o,
|
|
215
|
+
n
|
|
216
|
+
), { order: s, ...a } = r || {};
|
|
217
|
+
return {
|
|
218
|
+
...s,
|
|
219
|
+
...a
|
|
220
|
+
};
|
|
221
|
+
}, J = async ({
|
|
222
|
+
coupon: t
|
|
223
|
+
}) => {
|
|
224
|
+
const o = await K.mutateAsync({
|
|
225
|
+
orderId: c,
|
|
226
|
+
coupon: t
|
|
227
|
+
}), r = await e.removeCoupon.formatter(
|
|
228
|
+
o,
|
|
229
|
+
n
|
|
230
|
+
), { order: s, ...a } = r || {};
|
|
231
|
+
return {
|
|
232
|
+
...s,
|
|
233
|
+
...a
|
|
234
|
+
};
|
|
235
|
+
}, V = async ({
|
|
236
|
+
customer: t
|
|
237
|
+
}) => {
|
|
238
|
+
const o = await Q.mutateAsync({
|
|
187
239
|
orderId: c,
|
|
188
240
|
customer: t
|
|
189
|
-
}),
|
|
241
|
+
}), r = await e.addCustomer.formatter(
|
|
190
242
|
o,
|
|
191
|
-
|
|
192
|
-
), { order: s, ...a } =
|
|
243
|
+
n
|
|
244
|
+
), { order: s, ...a } = r || {};
|
|
193
245
|
return {
|
|
194
246
|
...s,
|
|
195
247
|
...a
|
|
196
248
|
};
|
|
197
|
-
},
|
|
249
|
+
}, W = async ({
|
|
198
250
|
countryCode: t
|
|
199
251
|
}) => {
|
|
200
|
-
const o = await
|
|
252
|
+
const o = await j.mutateAsync({
|
|
201
253
|
orderId: c,
|
|
202
254
|
countryCode: t
|
|
203
|
-
}),
|
|
255
|
+
}), r = await e.addCustomerCountryCode.formatter(
|
|
204
256
|
o,
|
|
205
|
-
|
|
206
|
-
), { order: s, ...a } =
|
|
257
|
+
n
|
|
258
|
+
), { order: s, ...a } = r || {};
|
|
207
259
|
return {
|
|
208
260
|
...s,
|
|
209
261
|
...a
|
|
210
262
|
};
|
|
211
|
-
},
|
|
263
|
+
}, X = async ({
|
|
212
264
|
billingAddress: t,
|
|
213
265
|
customer: o,
|
|
214
|
-
phoneNumber:
|
|
266
|
+
phoneNumber: r,
|
|
215
267
|
shippingAddress: s
|
|
216
268
|
}) => {
|
|
217
|
-
const a = await
|
|
269
|
+
const a = await z.mutateAsync({
|
|
218
270
|
orderId: c,
|
|
219
271
|
billingAddress: t,
|
|
220
272
|
customer: o,
|
|
221
|
-
phoneNumber:
|
|
273
|
+
phoneNumber: r,
|
|
222
274
|
shippingAddress: s
|
|
223
|
-
}),
|
|
275
|
+
}), i = await e.addInformation.formatter(
|
|
224
276
|
a,
|
|
225
|
-
|
|
226
|
-
), { order: p, ...
|
|
277
|
+
n
|
|
278
|
+
), { order: p, ...et } = i || {};
|
|
227
279
|
return {
|
|
228
280
|
...p,
|
|
229
|
-
...
|
|
281
|
+
...et
|
|
230
282
|
};
|
|
231
|
-
},
|
|
232
|
-
const o = await
|
|
283
|
+
}, Y = async ({ note: t }) => {
|
|
284
|
+
const o = await b.mutateAsync({
|
|
233
285
|
orderId: c,
|
|
234
286
|
note: t
|
|
235
|
-
}),
|
|
287
|
+
}), r = await e.addNote.formatter(
|
|
236
288
|
o,
|
|
237
|
-
|
|
238
|
-
), { order: s, ...a } =
|
|
289
|
+
n
|
|
290
|
+
), { order: s, ...a } = r || {};
|
|
239
291
|
return {
|
|
240
292
|
...s,
|
|
241
293
|
...a
|
|
242
294
|
};
|
|
243
|
-
},
|
|
244
|
-
const t = await
|
|
295
|
+
}, Z = async () => {
|
|
296
|
+
const t = await B.mutateAsync({
|
|
245
297
|
id: c
|
|
246
298
|
}), o = await e.checkout.formatter(
|
|
247
299
|
t,
|
|
248
|
-
|
|
300
|
+
n
|
|
249
301
|
);
|
|
250
302
|
if (!o?.order)
|
|
251
303
|
return;
|
|
@@ -254,80 +306,81 @@ const lt = (F) => {
|
|
|
254
306
|
window.location.href = `${p}/payment/execute?order_id=${o?.order?.id}`;
|
|
255
307
|
return;
|
|
256
308
|
}
|
|
257
|
-
const [s] = o?.order?.options?.proceedingStep?.proceeding?.options || [], { method: a, url:
|
|
258
|
-
a?.toLowerCase() === "follow" &&
|
|
259
|
-
},
|
|
309
|
+
const [s] = o?.order?.options?.proceedingStep?.proceeding?.options || [], { method: a, url: i } = s || {};
|
|
310
|
+
a?.toLowerCase() === "follow" && ct(i) && (window.location.href = i);
|
|
311
|
+
}, tt = async () => {
|
|
260
312
|
try {
|
|
261
313
|
const t = await m.fetchQuery({
|
|
262
314
|
queryKey: ["getOrderInitialPaymentStep", c],
|
|
263
315
|
queryFn: async () => e.initialPaymentStep.queryFn(
|
|
264
316
|
{ id: c },
|
|
265
|
-
|
|
317
|
+
n
|
|
266
318
|
)
|
|
267
319
|
}), o = await e.initialPaymentStep.formatter(
|
|
268
320
|
t,
|
|
269
|
-
|
|
270
|
-
), { agreementOptions:
|
|
321
|
+
n
|
|
322
|
+
), { agreementOptions: r, agreementTemplate: s, paymentMethods: a } = o || {};
|
|
271
323
|
return e.initialPaymentStep.success(
|
|
272
324
|
o,
|
|
273
|
-
|
|
325
|
+
n
|
|
274
326
|
), {
|
|
275
|
-
agreementOptions:
|
|
327
|
+
agreementOptions: r,
|
|
276
328
|
agreementTemplate: s,
|
|
277
329
|
paymentMethods: a
|
|
278
330
|
};
|
|
279
331
|
} catch (t) {
|
|
280
332
|
return e.initialPaymentStep.error(t), Promise.reject(t);
|
|
281
333
|
}
|
|
282
|
-
},
|
|
334
|
+
}, k = async ({
|
|
283
335
|
methodId: t,
|
|
284
336
|
issuerId: o,
|
|
285
|
-
terminalId:
|
|
337
|
+
terminalId: r
|
|
286
338
|
}) => {
|
|
287
|
-
const s = await
|
|
339
|
+
const s = await $.mutateAsync({
|
|
288
340
|
orderId: c,
|
|
289
341
|
methodId: t,
|
|
290
342
|
issuerId: o,
|
|
291
|
-
terminalId:
|
|
343
|
+
terminalId: r
|
|
292
344
|
}), a = await e.addPaymentMethod.formatter(
|
|
293
345
|
s,
|
|
294
|
-
|
|
295
|
-
), { order:
|
|
346
|
+
n
|
|
347
|
+
), { order: i, ...p } = a || {};
|
|
296
348
|
return {
|
|
297
|
-
...
|
|
349
|
+
...i,
|
|
298
350
|
...p
|
|
299
351
|
};
|
|
300
352
|
};
|
|
301
353
|
return {
|
|
302
|
-
...
|
|
354
|
+
...R,
|
|
303
355
|
...f,
|
|
304
|
-
...
|
|
356
|
+
...l,
|
|
305
357
|
...g,
|
|
306
358
|
...h,
|
|
307
|
-
|
|
308
|
-
|
|
359
|
+
addCoupon: H,
|
|
360
|
+
addCustomer: V,
|
|
361
|
+
addCustomerCountryCode: W,
|
|
309
362
|
addExpressPaymentMethod: async ({
|
|
310
363
|
methodId: t
|
|
311
364
|
}) => {
|
|
312
365
|
try {
|
|
313
|
-
return S(!0),
|
|
366
|
+
return S(!0), k({ methodId: t });
|
|
314
367
|
} catch {
|
|
315
368
|
S(!1);
|
|
316
369
|
}
|
|
317
370
|
},
|
|
318
|
-
addInformation:
|
|
319
|
-
addNote:
|
|
320
|
-
addPaymentMethod:
|
|
371
|
+
addInformation: X,
|
|
372
|
+
addNote: Y,
|
|
373
|
+
addPaymentMethod: k,
|
|
321
374
|
addPickupPoint: async ({
|
|
322
375
|
pickupPointId: t
|
|
323
376
|
}) => {
|
|
324
|
-
const o = await
|
|
377
|
+
const o = await U.mutateAsync({
|
|
325
378
|
orderId: c,
|
|
326
379
|
pickupPointId: t
|
|
327
|
-
}),
|
|
380
|
+
}), r = await e.addPickupPoint.formatter(
|
|
328
381
|
o,
|
|
329
|
-
|
|
330
|
-
), { order: s, ...a } =
|
|
382
|
+
n
|
|
383
|
+
), { order: s, ...a } = r || {};
|
|
331
384
|
return {
|
|
332
385
|
...s,
|
|
333
386
|
...a
|
|
@@ -336,38 +389,38 @@ const lt = (F) => {
|
|
|
336
389
|
addShippingMethod: async ({
|
|
337
390
|
methodId: t
|
|
338
391
|
}) => {
|
|
339
|
-
const o = await
|
|
392
|
+
const o = await _.mutateAsync({
|
|
340
393
|
orderId: c,
|
|
341
394
|
methodId: t
|
|
342
|
-
}),
|
|
395
|
+
}), r = await e.addShippingMethod.formatter(
|
|
343
396
|
o,
|
|
344
|
-
|
|
345
|
-
), { order: s, ...a } =
|
|
397
|
+
n
|
|
398
|
+
), { order: s, ...a } = r || {};
|
|
346
399
|
return {
|
|
347
400
|
...s,
|
|
348
401
|
...a
|
|
349
402
|
};
|
|
350
403
|
},
|
|
351
|
-
checkout:
|
|
352
|
-
getInitialPaymentStep:
|
|
404
|
+
checkout: Z,
|
|
405
|
+
getInitialPaymentStep: tt,
|
|
353
406
|
getPaymentMethods: async () => {
|
|
354
407
|
try {
|
|
355
408
|
const t = await m.fetchQuery({
|
|
356
409
|
queryKey: ["getOrderPaymentMethods", c],
|
|
357
410
|
queryFn: async () => e.getPaymentMethods.queryFn(
|
|
358
411
|
{ id: c },
|
|
359
|
-
|
|
412
|
+
n
|
|
360
413
|
)
|
|
361
414
|
}), o = await e.getPaymentMethods.formatter(
|
|
362
415
|
t,
|
|
363
|
-
|
|
416
|
+
n
|
|
364
417
|
), {
|
|
365
|
-
currentPaymentMethod:
|
|
418
|
+
currentPaymentMethod: r,
|
|
366
419
|
paymentMethods: s,
|
|
367
420
|
payments: a = []
|
|
368
421
|
} = o || {};
|
|
369
|
-
return e.getPaymentMethods.success(o,
|
|
370
|
-
currentPaymentMethod:
|
|
422
|
+
return e.getPaymentMethods.success(o, n), {
|
|
423
|
+
currentPaymentMethod: r,
|
|
371
424
|
paymentMethods: s,
|
|
372
425
|
payments: a
|
|
373
426
|
};
|
|
@@ -380,7 +433,7 @@ const lt = (F) => {
|
|
|
380
433
|
postalCode: o
|
|
381
434
|
}) => {
|
|
382
435
|
try {
|
|
383
|
-
const
|
|
436
|
+
const r = await m.fetchQuery({
|
|
384
437
|
queryKey: ["getOrderPickupPoints", t, o],
|
|
385
438
|
queryFn: async () => e.getPickupPoints.queryFn(
|
|
386
439
|
{
|
|
@@ -388,17 +441,17 @@ const lt = (F) => {
|
|
|
388
441
|
countryCode: t,
|
|
389
442
|
postalCode: o
|
|
390
443
|
},
|
|
391
|
-
|
|
444
|
+
n
|
|
392
445
|
)
|
|
393
446
|
}), s = await e.getPickupPoints.formatter(
|
|
394
|
-
|
|
395
|
-
|
|
447
|
+
r,
|
|
448
|
+
n
|
|
396
449
|
), { pickupPoints: a } = s || {};
|
|
397
|
-
return e.getPickupPoints.success(s,
|
|
450
|
+
return e.getPickupPoints.success(s, n), {
|
|
398
451
|
pickupPoints: a
|
|
399
452
|
};
|
|
400
|
-
} catch (
|
|
401
|
-
return e.getPickupPoints.error(
|
|
453
|
+
} catch (r) {
|
|
454
|
+
return e.getPickupPoints.error(r), Promise.reject(r);
|
|
402
455
|
}
|
|
403
456
|
},
|
|
404
457
|
getReviewCheckoutData: async () => {
|
|
@@ -407,15 +460,15 @@ const lt = (F) => {
|
|
|
407
460
|
queryKey: ["getOrderReviewCheckoutData", c],
|
|
408
461
|
queryFn: async () => e.getReviewCheckoutData.queryFn(
|
|
409
462
|
{ id: c },
|
|
410
|
-
|
|
463
|
+
n
|
|
411
464
|
)
|
|
412
465
|
}), o = await e.getReviewCheckoutData.formatter(
|
|
413
466
|
t,
|
|
414
|
-
|
|
415
|
-
), { order:
|
|
467
|
+
n
|
|
468
|
+
), { order: r, ...s } = o || {};
|
|
416
469
|
return e.getReviewCheckoutData.success(
|
|
417
470
|
o,
|
|
418
|
-
|
|
471
|
+
n
|
|
419
472
|
), s;
|
|
420
473
|
} catch (t) {
|
|
421
474
|
return e.getReviewCheckoutData.error(t), Promise.reject(t);
|
|
@@ -426,7 +479,7 @@ const lt = (F) => {
|
|
|
426
479
|
postalCode: o
|
|
427
480
|
}) => {
|
|
428
481
|
try {
|
|
429
|
-
const
|
|
482
|
+
const r = await m.fetchQuery({
|
|
430
483
|
queryKey: ["getOrderShippingMethods", t, o],
|
|
431
484
|
queryFn: async () => e.getShippingMethods.queryFn(
|
|
432
485
|
{
|
|
@@ -434,34 +487,35 @@ const lt = (F) => {
|
|
|
434
487
|
countryCode: t,
|
|
435
488
|
postalCode: o
|
|
436
489
|
},
|
|
437
|
-
|
|
490
|
+
n
|
|
438
491
|
)
|
|
439
492
|
}), s = await e.getShippingMethods.formatter(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
), { currentShippingMethod: a, shippingMethods:
|
|
493
|
+
r,
|
|
494
|
+
n
|
|
495
|
+
), { currentShippingMethod: a, shippingMethods: i } = s || {};
|
|
443
496
|
return e.getShippingMethods.success(
|
|
444
497
|
s,
|
|
445
|
-
|
|
498
|
+
n
|
|
446
499
|
), {
|
|
447
500
|
currentShippingMethod: a,
|
|
448
|
-
shippingMethods:
|
|
501
|
+
shippingMethods: i
|
|
449
502
|
};
|
|
450
|
-
} catch (
|
|
451
|
-
return e.getShippingMethods.error(
|
|
503
|
+
} catch (r) {
|
|
504
|
+
return e.getShippingMethods.error(r), Promise.reject(r);
|
|
452
505
|
}
|
|
453
506
|
},
|
|
454
507
|
isLoading: N,
|
|
508
|
+
removeCoupon: J,
|
|
455
509
|
setAgreementTemplate: async ({
|
|
456
510
|
agreementId: t
|
|
457
511
|
}) => {
|
|
458
|
-
const o = await
|
|
512
|
+
const o = await G.mutateAsync({
|
|
459
513
|
orderId: c,
|
|
460
514
|
agreementId: t
|
|
461
|
-
}),
|
|
515
|
+
}), r = await e.setAgreementTemplate.formatter(
|
|
462
516
|
o,
|
|
463
|
-
|
|
464
|
-
), { order: s, ...a } =
|
|
517
|
+
n
|
|
518
|
+
), { order: s, ...a } = r || {};
|
|
465
519
|
return {
|
|
466
520
|
...s,
|
|
467
521
|
...a
|
|
@@ -470,5 +524,5 @@ const lt = (F) => {
|
|
|
470
524
|
};
|
|
471
525
|
};
|
|
472
526
|
export {
|
|
473
|
-
|
|
527
|
+
kt as useCheckoutOrder
|
|
474
528
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngleRightSolid.d.ts","sourceRoot":"","sources":["../../src/icons/AngleRightSolid.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,eAAe,GAAI,OAAO,YAAY,qDAIlD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon as t } from "@afosto/components";
|
|
3
|
+
const c = (r) => /* @__PURE__ */ o(t, { ...r, children: /* @__PURE__ */ o("path", { d: "M16.63 11.12c.5.49.5 1.28 0 1.77l-6.25 6.25a1.25 1.25 0 0 1-1.77-1.77L13.98 12 8.62 6.63a1.25 1.25 0 0 1 1.77-1.77l6.25 6.25Z" }) });
|
|
4
|
+
export {
|
|
5
|
+
c as AngleRightSolid
|
|
6
|
+
};
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './paymentMethods';
|
|
|
3
3
|
export { AngleDownRegular } from './AngleDownRegular';
|
|
4
4
|
export { AngleRightLight } from './AngleRightLight';
|
|
5
5
|
export { AngleRightRegular } from './AngleRightRegular';
|
|
6
|
+
export { AngleRightSolid } from './AngleRightSolid';
|
|
6
7
|
export { CheckSolid } from './CheckSolid';
|
|
7
8
|
export { LongArrowLeftSolid } from './LongArrowLeftSolid';
|
|
8
9
|
export { MinusSolid } from './MinusSolid';
|