@teamnovu/kit-shopware-composables 0.0.30 → 0.0.32
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/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject as Y, unref as
|
|
1
|
+
import { inject as Y, unref as o, computed as c, reactive as Z, watch as H, toRef as W } from "vue";
|
|
2
2
|
import { until as J } from "@vueuse/core";
|
|
3
3
|
import { queryOptions as v, useQuery as q, useQueryClient as Q, useMutation as h } from "@tanstack/vue-query";
|
|
4
4
|
import "@teamnovu/kit-shopware-api-client";
|
|
@@ -9,15 +9,15 @@ function g() {
|
|
|
9
9
|
throw new Error("Shopware client not provided!");
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const A = {
|
|
13
13
|
all: () => ["context"]
|
|
14
14
|
}, ee = {
|
|
15
15
|
all: () => ["language"]
|
|
16
|
-
},
|
|
16
|
+
}, N = {
|
|
17
17
|
all: () => ["category"],
|
|
18
|
-
lists: () => [...
|
|
18
|
+
lists: () => [...N.all(), "list"],
|
|
19
19
|
list: (e) => [
|
|
20
|
-
...
|
|
20
|
+
...N.all(),
|
|
21
21
|
"list",
|
|
22
22
|
{
|
|
23
23
|
body: e
|
|
@@ -43,20 +43,20 @@ const w = {
|
|
|
43
43
|
body: t
|
|
44
44
|
}
|
|
45
45
|
]
|
|
46
|
-
},
|
|
46
|
+
}, O = {
|
|
47
47
|
all: () => ["product"],
|
|
48
|
-
lists: () => [...
|
|
48
|
+
lists: () => [...O.all(), "list"],
|
|
49
49
|
list: (e, s) => [
|
|
50
|
-
...
|
|
50
|
+
...O.all(),
|
|
51
51
|
"list",
|
|
52
52
|
{
|
|
53
53
|
url: e,
|
|
54
54
|
body: s
|
|
55
55
|
}
|
|
56
56
|
],
|
|
57
|
-
details: () => [...
|
|
57
|
+
details: () => [...O.all(), "detail"],
|
|
58
58
|
customDetail: (e, s) => [
|
|
59
|
-
...
|
|
59
|
+
...O.details(),
|
|
60
60
|
"custom",
|
|
61
61
|
{
|
|
62
62
|
url: e,
|
|
@@ -64,27 +64,27 @@ const w = {
|
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
66
|
headlessDetail: (e) => [
|
|
67
|
-
...
|
|
67
|
+
...O.details(),
|
|
68
68
|
{
|
|
69
69
|
body: e
|
|
70
70
|
}
|
|
71
71
|
],
|
|
72
72
|
detail: (e, s) => [
|
|
73
|
-
...
|
|
73
|
+
...O.details(),
|
|
74
74
|
e,
|
|
75
75
|
{
|
|
76
76
|
body: s
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
search: (e) => [
|
|
80
|
-
...
|
|
80
|
+
...O.all(),
|
|
81
81
|
"search",
|
|
82
82
|
{
|
|
83
83
|
body: e
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
86
|
searchSuggest: (e) => [
|
|
87
|
-
...
|
|
87
|
+
...O.all(),
|
|
88
88
|
"searchSuggest",
|
|
89
89
|
{
|
|
90
90
|
body: e
|
|
@@ -108,21 +108,21 @@ const w = {
|
|
|
108
108
|
],
|
|
109
109
|
details: () => [...F.all(), "detail"],
|
|
110
110
|
detail: (e, s) => [...F.details(), e, ...s ? [{ body: s }] : []]
|
|
111
|
-
},
|
|
111
|
+
}, b = {
|
|
112
112
|
all: () => ["shippingMethod"],
|
|
113
|
-
lists: () => [...
|
|
113
|
+
lists: () => [...b.all(), "list"],
|
|
114
114
|
list: (e) => [
|
|
115
|
-
...
|
|
115
|
+
...b.all(),
|
|
116
116
|
"list",
|
|
117
117
|
{
|
|
118
118
|
body: e
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
|
-
},
|
|
121
|
+
}, k = {
|
|
122
122
|
all: () => ["paymentMethod"],
|
|
123
|
-
lists: () => [...
|
|
123
|
+
lists: () => [...k.all(), "list"],
|
|
124
124
|
list: (e) => [
|
|
125
|
-
...
|
|
125
|
+
...k.lists(),
|
|
126
126
|
{
|
|
127
127
|
body: e
|
|
128
128
|
}
|
|
@@ -170,10 +170,10 @@ const w = {
|
|
|
170
170
|
]
|
|
171
171
|
};
|
|
172
172
|
function y(e) {
|
|
173
|
-
const s =
|
|
173
|
+
const s = o(e);
|
|
174
174
|
return Object.fromEntries(
|
|
175
175
|
Object.entries(s ?? {}).map(
|
|
176
|
-
([t, n]) => [t,
|
|
176
|
+
([t, n]) => [t, o(n)]
|
|
177
177
|
)
|
|
178
178
|
);
|
|
179
179
|
}
|
|
@@ -205,20 +205,20 @@ function Ct(e, s, t) {
|
|
|
205
205
|
await n.cancelQueries({ queryKey: e });
|
|
206
206
|
const a = n.getQueryData(e);
|
|
207
207
|
if (n.setQueryData(e, (u) => s(r, u)), t) {
|
|
208
|
-
const u =
|
|
209
|
-
|
|
208
|
+
const u = o(t), i = o(u.onMutate);
|
|
209
|
+
i == null || i(r);
|
|
210
210
|
}
|
|
211
211
|
return { previousValue: a };
|
|
212
212
|
},
|
|
213
213
|
onError: (r, a, u) => {
|
|
214
214
|
if (u && n.setQueryData(e, u.previousValue), t) {
|
|
215
|
-
const
|
|
215
|
+
const i = o(t), f = o(i.onError);
|
|
216
216
|
f == null || f(r, a, u);
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
219
|
onSettled: (...r) => {
|
|
220
220
|
if (n.invalidateQueries({ queryKey: e }), t) {
|
|
221
|
-
const a =
|
|
221
|
+
const a = o(t), u = o(a.onSettled);
|
|
222
222
|
u == null || u(...r);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -228,14 +228,14 @@ const re = "readContext get /context";
|
|
|
228
228
|
function ae(e) {
|
|
229
229
|
const s = g();
|
|
230
230
|
return v({
|
|
231
|
-
queryKey:
|
|
231
|
+
queryKey: A.all(),
|
|
232
232
|
queryFn: ({ signal: t }) => s.query(re, {
|
|
233
233
|
...y(e),
|
|
234
234
|
signal: t
|
|
235
235
|
})
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function B(e) {
|
|
239
239
|
return q(ae(e));
|
|
240
240
|
}
|
|
241
241
|
const ue = "updateContext patch /context";
|
|
@@ -243,20 +243,20 @@ function $(e) {
|
|
|
243
243
|
const s = g(), t = Q();
|
|
244
244
|
return h({
|
|
245
245
|
...e,
|
|
246
|
-
mutationFn: async (n) => (t.cancelQueries({ queryKey:
|
|
246
|
+
mutationFn: async (n) => (t.cancelQueries({ queryKey: A.all() }), s.query(ue, {
|
|
247
247
|
body: n
|
|
248
248
|
})),
|
|
249
249
|
onSuccess: async (n, r, a) => {
|
|
250
|
-
var u,
|
|
250
|
+
var u, i;
|
|
251
251
|
await Promise.all([
|
|
252
|
-
t.invalidateQueries({ queryKey:
|
|
252
|
+
t.invalidateQueries({ queryKey: A.all() }),
|
|
253
253
|
t.invalidateQueries({ queryKey: L.get() })
|
|
254
|
-
]), await ((
|
|
254
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
258
|
function Qt() {
|
|
259
|
-
const e = $(), s =
|
|
259
|
+
const e = $(), s = B(), t = se(), n = c(() => s.isFetching.value || e.isPending.value), r = async (d) => {
|
|
260
260
|
await e.mutateAsync({
|
|
261
261
|
billingAddressId: d.id
|
|
262
262
|
}), await J(n).toBe(!1);
|
|
@@ -267,23 +267,23 @@ function Qt() {
|
|
|
267
267
|
}, u = c(() => {
|
|
268
268
|
var d, M;
|
|
269
269
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeBillingAddress;
|
|
270
|
-
}),
|
|
270
|
+
}), i = c(() => {
|
|
271
271
|
var d, M;
|
|
272
272
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeShippingAddress;
|
|
273
273
|
}), f = c(() => {
|
|
274
274
|
var d;
|
|
275
275
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
276
276
|
(M) => {
|
|
277
|
-
var
|
|
278
|
-
return M.id !== ((
|
|
277
|
+
var K;
|
|
278
|
+
return M.id !== ((K = u.value) == null ? void 0 : K.id);
|
|
279
279
|
}
|
|
280
280
|
)) ?? [];
|
|
281
281
|
}), P = c(() => {
|
|
282
282
|
var d;
|
|
283
283
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
284
284
|
(M) => {
|
|
285
|
-
var
|
|
286
|
-
return M.id !== ((
|
|
285
|
+
var K;
|
|
286
|
+
return M.id !== ((K = i.value) == null ? void 0 : K.id);
|
|
287
287
|
}
|
|
288
288
|
)) ?? [];
|
|
289
289
|
});
|
|
@@ -295,19 +295,19 @@ function Qt() {
|
|
|
295
295
|
setShippingAddress: a,
|
|
296
296
|
isSaving: n,
|
|
297
297
|
activeBillingAddress: u,
|
|
298
|
-
activeShippingAddress:
|
|
298
|
+
activeShippingAddress: i,
|
|
299
299
|
inactiveBillingAddresses: f,
|
|
300
300
|
inactiveShippingAddresses: P
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
const
|
|
304
|
-
function
|
|
303
|
+
const ie = "readOrder post /order";
|
|
304
|
+
function oe(e) {
|
|
305
305
|
const s = g(), t = U.detail(e);
|
|
306
306
|
return v({
|
|
307
307
|
queryKey: t,
|
|
308
308
|
queryFn: async ({ signal: n }) => {
|
|
309
309
|
const r = y(e);
|
|
310
|
-
return s.query(
|
|
310
|
+
return s.query(ie, {
|
|
311
311
|
...r,
|
|
312
312
|
signal: n
|
|
313
313
|
});
|
|
@@ -315,11 +315,11 @@ function ie(e) {
|
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
function ce(e) {
|
|
318
|
-
return q(
|
|
318
|
+
return q(oe(e));
|
|
319
319
|
}
|
|
320
320
|
function Pt(e, s) {
|
|
321
321
|
const t = c(() => {
|
|
322
|
-
const l =
|
|
322
|
+
const l = o(e);
|
|
323
323
|
if (l)
|
|
324
324
|
return {
|
|
325
325
|
body: {
|
|
@@ -343,7 +343,7 @@ function Pt(e, s) {
|
|
|
343
343
|
}), u = c(() => {
|
|
344
344
|
var l, m, C;
|
|
345
345
|
return (C = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : C.name;
|
|
346
|
-
}),
|
|
346
|
+
}), i = c(() => {
|
|
347
347
|
var l, m;
|
|
348
348
|
return (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.technicalName;
|
|
349
349
|
}), f = c(() => {
|
|
@@ -362,7 +362,7 @@ function Pt(e, s) {
|
|
|
362
362
|
firstName: (x = (C = r.value) == null ? void 0 : C.orderCustomer) == null ? void 0 : x.firstName,
|
|
363
363
|
lastName: (G = (z = r.value) == null ? void 0 : z.orderCustomer) == null ? void 0 : G.lastName
|
|
364
364
|
};
|
|
365
|
-
}),
|
|
365
|
+
}), K = c(() => {
|
|
366
366
|
var l, m;
|
|
367
367
|
return (m = (l = r.value) == null ? void 0 : l.addresses) == null ? void 0 : m.find(
|
|
368
368
|
({ id: C }) => {
|
|
@@ -380,27 +380,27 @@ function Pt(e, s) {
|
|
|
380
380
|
const l = (m = r.value) == null ? void 0 : m.transactions;
|
|
381
381
|
if (l != null && l.length)
|
|
382
382
|
return (C = l.at(-1)) == null ? void 0 : C.paymentMethod;
|
|
383
|
-
}),
|
|
383
|
+
}), w = c(() => {
|
|
384
384
|
var m, C;
|
|
385
385
|
const l = (m = r.value) == null ? void 0 : m.deliveries;
|
|
386
386
|
if (l != null && l.length)
|
|
387
387
|
return (C = l.at(-1)) == null ? void 0 : C.shippingMethod;
|
|
388
388
|
}), R = c(() => {
|
|
389
389
|
var m;
|
|
390
|
-
const l =
|
|
390
|
+
const l = o(e);
|
|
391
391
|
return ((m = a.value) == null ? void 0 : m[l]) ?? !1;
|
|
392
392
|
});
|
|
393
393
|
return {
|
|
394
394
|
order: r,
|
|
395
395
|
status: u,
|
|
396
|
-
statusTechnicalName:
|
|
396
|
+
statusTechnicalName: i,
|
|
397
397
|
total: f,
|
|
398
398
|
subtotal: P,
|
|
399
399
|
shippingCosts: d,
|
|
400
400
|
shippingAddress: p,
|
|
401
|
-
billingAddress:
|
|
401
|
+
billingAddress: K,
|
|
402
402
|
personalDetails: M,
|
|
403
|
-
shippingMethod:
|
|
403
|
+
shippingMethod: w,
|
|
404
404
|
paymentMethod: S,
|
|
405
405
|
paymentChangeable: R,
|
|
406
406
|
orderQuery: n
|
|
@@ -409,9 +409,9 @@ function Pt(e, s) {
|
|
|
409
409
|
function Mt(e) {
|
|
410
410
|
const s = c(() => {
|
|
411
411
|
var r, a;
|
|
412
|
-
return (a = (r =
|
|
413
|
-
var
|
|
414
|
-
return ((
|
|
412
|
+
return (a = (r = o(e)) == null ? void 0 : r.transactions) == null ? void 0 : a.find((u) => {
|
|
413
|
+
var i;
|
|
414
|
+
return ((i = u.paymentMethod) == null ? void 0 : i.active) === !0;
|
|
415
415
|
});
|
|
416
416
|
}), t = c(() => {
|
|
417
417
|
var r;
|
|
@@ -427,37 +427,37 @@ function Mt(e) {
|
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
429
|
const le = "createCustomerAddress post /account/address";
|
|
430
|
-
function
|
|
430
|
+
function Kt(e) {
|
|
431
431
|
const s = g(), t = Q();
|
|
432
432
|
return h({
|
|
433
433
|
...e,
|
|
434
434
|
mutationFn: async (n) => s.query(le, y(n)),
|
|
435
435
|
onSuccess: async (n, r, a) => {
|
|
436
|
-
var u,
|
|
437
|
-
await t.invalidateQueries({ queryKey: F.lists() }), await ((
|
|
436
|
+
var u, i;
|
|
437
|
+
await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
438
438
|
}
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
const de = "deleteCustomerAddress delete /account/address/{addressId}";
|
|
442
|
-
function
|
|
442
|
+
function Ot(e) {
|
|
443
443
|
const s = g(), t = Q();
|
|
444
444
|
return h({
|
|
445
445
|
...e,
|
|
446
446
|
mutationFn: async (n) => s.query(de, y(n)),
|
|
447
447
|
onSuccess: async (n, r, a) => {
|
|
448
|
-
var u,
|
|
449
|
-
await t.invalidateQueries({ queryKey: F.lists() }), await ((
|
|
448
|
+
var u, i;
|
|
449
|
+
await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
453
|
const ye = "updateCustomerAddress patch /account/address/{addressId}";
|
|
454
|
-
function
|
|
454
|
+
function wt(e) {
|
|
455
455
|
const s = g(), t = Q();
|
|
456
456
|
return h({
|
|
457
457
|
...e,
|
|
458
458
|
mutationFn: async (n) => s.query(ye, y(n)),
|
|
459
459
|
onSuccess: async (n, r, a) => {
|
|
460
|
-
var
|
|
460
|
+
var i, f;
|
|
461
461
|
const { addressId: u } = y(r).params;
|
|
462
462
|
t.setQueryData(F.detail(u), n), await Promise.all([
|
|
463
463
|
t.invalidateQueries({ queryKey: F.lists() }),
|
|
@@ -465,12 +465,12 @@ function At(e) {
|
|
|
465
465
|
queryKey: F.detail(y(r).params.addressId),
|
|
466
466
|
predicate: (P) => P.queryKey.at(-1) !== u
|
|
467
467
|
})
|
|
468
|
-
]), await ((f =
|
|
468
|
+
]), await ((f = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
469
469
|
}
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
const pe = "addLineItem post /checkout/cart/line-item";
|
|
473
|
-
function
|
|
473
|
+
function At(e) {
|
|
474
474
|
const s = g(), t = Q();
|
|
475
475
|
return h({
|
|
476
476
|
...e,
|
|
@@ -478,8 +478,15 @@ function wt(e) {
|
|
|
478
478
|
body: n
|
|
479
479
|
}),
|
|
480
480
|
onSuccess: async (n, r, a) => {
|
|
481
|
-
var u,
|
|
482
|
-
t.setQueryData(L.get(), n), await
|
|
481
|
+
var u, i;
|
|
482
|
+
t.setQueryData(L.get(), n), await Promise.all([
|
|
483
|
+
t.invalidateQueries({ queryKey: k.lists() }),
|
|
484
|
+
t.invalidateQueries({ queryKey: b.lists() })
|
|
485
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(
|
|
486
|
+
n,
|
|
487
|
+
r,
|
|
488
|
+
a
|
|
489
|
+
));
|
|
483
490
|
}
|
|
484
491
|
});
|
|
485
492
|
}
|
|
@@ -506,8 +513,15 @@ function Ft(e) {
|
|
|
506
513
|
body: n
|
|
507
514
|
}),
|
|
508
515
|
onSuccess: async (n, r, a) => {
|
|
509
|
-
var u,
|
|
510
|
-
t.setQueryData(L.get(), n), await
|
|
516
|
+
var u, i;
|
|
517
|
+
t.setQueryData(L.get(), n), await Promise.all([
|
|
518
|
+
t.invalidateQueries({ queryKey: k.lists() }),
|
|
519
|
+
t.invalidateQueries({ queryKey: b.lists() })
|
|
520
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(
|
|
521
|
+
n,
|
|
522
|
+
r,
|
|
523
|
+
a
|
|
524
|
+
));
|
|
511
525
|
}
|
|
512
526
|
});
|
|
513
527
|
}
|
|
@@ -520,8 +534,8 @@ function Lt(e) {
|
|
|
520
534
|
body: n
|
|
521
535
|
}),
|
|
522
536
|
onSuccess: async (n, r, a) => {
|
|
523
|
-
var u,
|
|
524
|
-
t.setQueryData(L.get(), n), await ((
|
|
537
|
+
var u, i;
|
|
538
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
525
539
|
}
|
|
526
540
|
});
|
|
527
541
|
}
|
|
@@ -532,13 +546,13 @@ function It(e) {
|
|
|
532
546
|
...e,
|
|
533
547
|
mutationFn: async (n) => s.query(ve, y(n)),
|
|
534
548
|
onSuccess: async (n, r, a) => {
|
|
535
|
-
var u,
|
|
549
|
+
var u, i;
|
|
536
550
|
await Promise.all([
|
|
537
551
|
// Clear cart after successful order creation
|
|
538
552
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
539
553
|
// Invalidate order list to refetch data
|
|
540
554
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
541
|
-
]), await ((
|
|
555
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
542
556
|
}
|
|
543
557
|
});
|
|
544
558
|
}
|
|
@@ -579,8 +593,8 @@ function Dt(e) {
|
|
|
579
593
|
...e,
|
|
580
594
|
mutationFn: async (n) => s.query(Pe, y(n)),
|
|
581
595
|
onSuccess: async (n, r, a) => {
|
|
582
|
-
var u,
|
|
583
|
-
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey:
|
|
596
|
+
var u, i;
|
|
597
|
+
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: A.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
584
598
|
}
|
|
585
599
|
});
|
|
586
600
|
}
|
|
@@ -591,61 +605,61 @@ function bt(e) {
|
|
|
591
605
|
...e,
|
|
592
606
|
mutationFn: async (n) => s.query(Me, y(n)),
|
|
593
607
|
onSuccess: async (n, r, a) => {
|
|
594
|
-
var u,
|
|
608
|
+
var u, i;
|
|
595
609
|
await Promise.all([
|
|
596
610
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
597
|
-
t.invalidateQueries({ queryKey:
|
|
598
|
-
]), await ((
|
|
611
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
612
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
599
613
|
}
|
|
600
614
|
});
|
|
601
615
|
}
|
|
602
|
-
const
|
|
616
|
+
const Ke = "loginCustomer post /account/login";
|
|
603
617
|
function kt(e) {
|
|
604
618
|
const s = g(), t = Q();
|
|
605
619
|
return h({
|
|
606
620
|
...e,
|
|
607
621
|
mutationFn: async (n) => {
|
|
608
|
-
const r = await s.queryRaw(
|
|
622
|
+
const r = await s.queryRaw(Ke, {
|
|
609
623
|
body: n
|
|
610
624
|
}), a = r.headers.get("sw-context-token");
|
|
611
625
|
return a && (s.contextToken = a), r.json();
|
|
612
626
|
},
|
|
613
627
|
onSuccess: async (n, r, a) => {
|
|
614
|
-
var u,
|
|
628
|
+
var u, i;
|
|
615
629
|
await Promise.all([
|
|
616
|
-
t.resetQueries({ queryKey:
|
|
630
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
617
631
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
618
632
|
t.invalidateQueries({ queryKey: I.all() })
|
|
619
|
-
]), await ((
|
|
633
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
620
634
|
}
|
|
621
635
|
});
|
|
622
636
|
}
|
|
623
|
-
const
|
|
637
|
+
const Oe = "logoutCustomer post /account/logout";
|
|
624
638
|
function Bt(e) {
|
|
625
639
|
const s = g(), t = Q();
|
|
626
640
|
return h({
|
|
627
641
|
...e,
|
|
628
|
-
mutationFn: async (n) => s.query(
|
|
642
|
+
mutationFn: async (n) => s.query(Oe, y(n)),
|
|
629
643
|
onSuccess: async (n, r, a) => {
|
|
630
|
-
var u,
|
|
644
|
+
var u, i;
|
|
631
645
|
await Promise.all([
|
|
632
|
-
t.resetQueries({ queryKey:
|
|
646
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
633
647
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
634
648
|
t.invalidateQueries({ queryKey: I.all() })
|
|
635
|
-
]), await ((
|
|
649
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
636
650
|
}
|
|
637
651
|
});
|
|
638
652
|
}
|
|
639
|
-
const
|
|
640
|
-
function
|
|
653
|
+
const we = "readCustomer post /account/customer";
|
|
654
|
+
function Ae(e) {
|
|
641
655
|
const s = g(), t = I.detail(c(() => y(e).body ?? {}));
|
|
642
656
|
return v({
|
|
643
657
|
queryKey: t,
|
|
644
|
-
queryFn: async () => s.query(
|
|
658
|
+
queryFn: async () => s.query(we, y(e))
|
|
645
659
|
});
|
|
646
660
|
}
|
|
647
661
|
function Re(e) {
|
|
648
|
-
return q(
|
|
662
|
+
return q(Ae(e));
|
|
649
663
|
}
|
|
650
664
|
const Fe = "register post /account/register";
|
|
651
665
|
function Nt(e) {
|
|
@@ -654,11 +668,11 @@ function Nt(e) {
|
|
|
654
668
|
...e,
|
|
655
669
|
mutationFn: async (n) => s.query(Fe, y(n)),
|
|
656
670
|
onSuccess: async (n, r, a) => {
|
|
657
|
-
var u,
|
|
671
|
+
var u, i;
|
|
658
672
|
await Promise.all([
|
|
659
|
-
t.resetQueries({ queryKey:
|
|
673
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
660
674
|
t.invalidateQueries({ queryKey: I.all() })
|
|
661
|
-
]), await ((
|
|
675
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
662
676
|
}
|
|
663
677
|
});
|
|
664
678
|
}
|
|
@@ -669,11 +683,11 @@ function Tt(e) {
|
|
|
669
683
|
...e,
|
|
670
684
|
mutationFn: async (n) => s.query(Le, y(n)),
|
|
671
685
|
onSuccess: async (n, r, a) => {
|
|
672
|
-
var u,
|
|
686
|
+
var u, i;
|
|
673
687
|
await Promise.all([
|
|
674
688
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
675
|
-
t.invalidateQueries({ queryKey:
|
|
676
|
-
]), await ((
|
|
689
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
690
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
677
691
|
}
|
|
678
692
|
});
|
|
679
693
|
}
|
|
@@ -684,11 +698,11 @@ function Et(e) {
|
|
|
684
698
|
...e,
|
|
685
699
|
mutationFn: async (n) => s.query(Ie, y(n)),
|
|
686
700
|
onSuccess: async (n, r, a) => {
|
|
687
|
-
var u,
|
|
701
|
+
var u, i;
|
|
688
702
|
await Promise.all([
|
|
689
703
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
690
|
-
t.invalidateQueries({ queryKey:
|
|
691
|
-
]), await ((
|
|
704
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
705
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
692
706
|
}
|
|
693
707
|
});
|
|
694
708
|
}
|
|
@@ -699,12 +713,12 @@ function jt(e) {
|
|
|
699
713
|
...e,
|
|
700
714
|
mutationFn: async (n) => s.query(xe, y(n)),
|
|
701
715
|
onSuccess: async (n, r, a) => {
|
|
702
|
-
var u,
|
|
716
|
+
var u, i;
|
|
703
717
|
await Promise.all([
|
|
704
718
|
t.resetQueries({ queryKey: I.all() }),
|
|
705
|
-
t.resetQueries({ queryKey:
|
|
719
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
706
720
|
t.resetQueries({ queryKey: L.get() })
|
|
707
|
-
]), await ((
|
|
721
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
708
722
|
}
|
|
709
723
|
});
|
|
710
724
|
}
|
|
@@ -721,7 +735,7 @@ function Vt(e) {
|
|
|
721
735
|
},
|
|
722
736
|
onSuccess: async (t, n, r) => {
|
|
723
737
|
var a, u;
|
|
724
|
-
await ((u =
|
|
738
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
725
739
|
}
|
|
726
740
|
});
|
|
727
741
|
}
|
|
@@ -733,7 +747,7 @@ function $t(e) {
|
|
|
733
747
|
mutationFn: async (t) => s.query(De, y(t)),
|
|
734
748
|
onSuccess: async (t, n, r) => {
|
|
735
749
|
var a, u;
|
|
736
|
-
await ((u =
|
|
750
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
737
751
|
}
|
|
738
752
|
});
|
|
739
753
|
}
|
|
@@ -745,7 +759,7 @@ function zt(e) {
|
|
|
745
759
|
mutationFn: async (t) => s.query(be, y(t)),
|
|
746
760
|
onSuccess: async (t, n, r) => {
|
|
747
761
|
var a, u;
|
|
748
|
-
await ((u =
|
|
762
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
749
763
|
}
|
|
750
764
|
});
|
|
751
765
|
}
|
|
@@ -768,7 +782,7 @@ function Ht(e) {
|
|
|
768
782
|
mutationFn: async (t) => s.query(Ne, y(t)),
|
|
769
783
|
onSuccess: async (t, n, r) => {
|
|
770
784
|
var a, u;
|
|
771
|
-
await ((u =
|
|
785
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
772
786
|
}
|
|
773
787
|
});
|
|
774
788
|
}
|
|
@@ -777,11 +791,11 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
777
791
|
return v({
|
|
778
792
|
queryKey: a,
|
|
779
793
|
queryFn: async ({ signal: u }) => {
|
|
780
|
-
const
|
|
794
|
+
const i = o(s), f = o(t), P = y(n);
|
|
781
795
|
return r.query(Te, {
|
|
782
796
|
...P,
|
|
783
797
|
params: {
|
|
784
|
-
activeId:
|
|
798
|
+
activeId: i,
|
|
785
799
|
rootId: f
|
|
786
800
|
},
|
|
787
801
|
signal: u
|
|
@@ -794,7 +808,7 @@ function Wt(e, s, t) {
|
|
|
794
808
|
}
|
|
795
809
|
const je = "readPaymentMethod post /payment-method";
|
|
796
810
|
function Ve(e) {
|
|
797
|
-
const s = g(), t =
|
|
811
|
+
const s = g(), t = k.list(c(() => {
|
|
798
812
|
var n;
|
|
799
813
|
return (n = y(e)) == null ? void 0 : n.body;
|
|
800
814
|
}));
|
|
@@ -816,8 +830,8 @@ function Jt(e) {
|
|
|
816
830
|
...e,
|
|
817
831
|
mutationFn: async (n) => s.query(ze, y(n)),
|
|
818
832
|
onSuccess: async (n, r, a) => {
|
|
819
|
-
var u,
|
|
820
|
-
await t.invalidateQueries({ queryKey: L.get() }), await ((
|
|
833
|
+
var u, i;
|
|
834
|
+
await t.invalidateQueries({ queryKey: L.get() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
821
835
|
}
|
|
822
836
|
});
|
|
823
837
|
}
|
|
@@ -828,13 +842,13 @@ function Xt(e) {
|
|
|
828
842
|
...e,
|
|
829
843
|
mutationFn: async (n) => s.query(Ge, y(n)),
|
|
830
844
|
onSuccess: async (n, r, a) => {
|
|
831
|
-
var u,
|
|
832
|
-
await t.invalidateQueries({ queryKey: U.all() }), await ((
|
|
845
|
+
var u, i;
|
|
846
|
+
await t.invalidateQueries({ queryKey: U.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
833
847
|
}
|
|
834
848
|
});
|
|
835
849
|
}
|
|
836
850
|
const He = "readCategoryList post /category", We = function(s) {
|
|
837
|
-
const t = g(), n =
|
|
851
|
+
const t = g(), n = N.list(s);
|
|
838
852
|
return v({
|
|
839
853
|
queryKey: n,
|
|
840
854
|
queryFn: async ({ signal: r }) => t.query(He, {
|
|
@@ -848,7 +862,7 @@ function Yt(e) {
|
|
|
848
862
|
}
|
|
849
863
|
const Je = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
850
864
|
function Xe(e, s) {
|
|
851
|
-
const t = g(), n =
|
|
865
|
+
const t = g(), n = O.list(e, s);
|
|
852
866
|
return v({
|
|
853
867
|
queryKey: n,
|
|
854
868
|
queryFn: async ({ signal: r }) => {
|
|
@@ -857,7 +871,7 @@ function Xe(e, s) {
|
|
|
857
871
|
...a,
|
|
858
872
|
params: {
|
|
859
873
|
...a.params,
|
|
860
|
-
seoUrl: V(
|
|
874
|
+
seoUrl: V(o(e))
|
|
861
875
|
},
|
|
862
876
|
signal: r
|
|
863
877
|
});
|
|
@@ -869,7 +883,7 @@ function Zt(e, s) {
|
|
|
869
883
|
}
|
|
870
884
|
const Ye = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
871
885
|
function Ze(e, s) {
|
|
872
|
-
const t = g(), n =
|
|
886
|
+
const t = g(), n = O.customDetail(e, s);
|
|
873
887
|
return v({
|
|
874
888
|
queryKey: n,
|
|
875
889
|
queryFn: async ({ signal: r }) => {
|
|
@@ -878,7 +892,7 @@ function Ze(e, s) {
|
|
|
878
892
|
...a,
|
|
879
893
|
params: {
|
|
880
894
|
...a.params,
|
|
881
|
-
seoUrl: V(
|
|
895
|
+
seoUrl: V(o(e))
|
|
882
896
|
},
|
|
883
897
|
signal: r
|
|
884
898
|
});
|
|
@@ -890,7 +904,7 @@ function _t(e, s) {
|
|
|
890
904
|
}
|
|
891
905
|
const _e = "searchPage post /search";
|
|
892
906
|
function et(e) {
|
|
893
|
-
const s = g(), t =
|
|
907
|
+
const s = g(), t = O.search(e);
|
|
894
908
|
return v({
|
|
895
909
|
queryKey: t,
|
|
896
910
|
queryFn: async ({ signal: n }) => {
|
|
@@ -907,7 +921,7 @@ function en(e) {
|
|
|
907
921
|
}
|
|
908
922
|
const tt = "searchSuggest post /search-suggest";
|
|
909
923
|
function nt(e) {
|
|
910
|
-
const s = g(), t =
|
|
924
|
+
const s = g(), t = O.searchSuggest(e);
|
|
911
925
|
return v({
|
|
912
926
|
queryKey: t,
|
|
913
927
|
queryFn: async ({ signal: n }) => {
|
|
@@ -924,7 +938,7 @@ function tn(e) {
|
|
|
924
938
|
}
|
|
925
939
|
const st = "readProduct post /product";
|
|
926
940
|
function rt(e) {
|
|
927
|
-
const s = g(), t =
|
|
941
|
+
const s = g(), t = O.headlessDetail(e);
|
|
928
942
|
return v({
|
|
929
943
|
queryKey: t,
|
|
930
944
|
queryFn: async ({ signal: n }) => {
|
|
@@ -941,7 +955,7 @@ function nn(e) {
|
|
|
941
955
|
}
|
|
942
956
|
const at = "readProductDetail post /product/{productId}";
|
|
943
957
|
function ut(e, s) {
|
|
944
|
-
const t = g(), n =
|
|
958
|
+
const t = g(), n = O.detail(e, s);
|
|
945
959
|
return v({
|
|
946
960
|
queryKey: n,
|
|
947
961
|
queryFn: async ({ signal: r }) => {
|
|
@@ -950,7 +964,7 @@ function ut(e, s) {
|
|
|
950
964
|
...a,
|
|
951
965
|
params: {
|
|
952
966
|
...a.params,
|
|
953
|
-
productId:
|
|
967
|
+
productId: o(e)
|
|
954
968
|
},
|
|
955
969
|
signal: r
|
|
956
970
|
});
|
|
@@ -960,13 +974,13 @@ function ut(e, s) {
|
|
|
960
974
|
function sn(e, s) {
|
|
961
975
|
return q(ut(e, s));
|
|
962
976
|
}
|
|
963
|
-
const
|
|
977
|
+
const it = "readSalutation post /salutation", ot = function(s) {
|
|
964
978
|
const t = g(), n = E.list(s);
|
|
965
979
|
return v({
|
|
966
980
|
queryKey: n,
|
|
967
981
|
queryFn: async ({ signal: r }) => {
|
|
968
982
|
const a = y(s);
|
|
969
|
-
return t.query(
|
|
983
|
+
return t.query(it, {
|
|
970
984
|
...a,
|
|
971
985
|
signal: r
|
|
972
986
|
});
|
|
@@ -974,7 +988,7 @@ const ot = "readSalutation post /salutation", it = function(s) {
|
|
|
974
988
|
});
|
|
975
989
|
};
|
|
976
990
|
function rn(e) {
|
|
977
|
-
return q(
|
|
991
|
+
return q(ot(e));
|
|
978
992
|
}
|
|
979
993
|
const ct = "readSeoUrl post /seo-url", lt = function(s) {
|
|
980
994
|
const t = g(), n = T.list(s);
|
|
@@ -994,7 +1008,7 @@ function an(e) {
|
|
|
994
1008
|
}
|
|
995
1009
|
const dt = "readShippingMethod post /shipping-method";
|
|
996
1010
|
function yt(e) {
|
|
997
|
-
const s = g(), t =
|
|
1011
|
+
const s = g(), t = b.list(c(() => {
|
|
998
1012
|
var n;
|
|
999
1013
|
return (n = y(e)) == null ? void 0 : n.body;
|
|
1000
1014
|
}));
|
|
@@ -1010,18 +1024,18 @@ function pt(e) {
|
|
|
1010
1024
|
return q(yt(e));
|
|
1011
1025
|
}
|
|
1012
1026
|
function un() {
|
|
1013
|
-
const e =
|
|
1027
|
+
const e = B(), s = $(), t = $e({
|
|
1014
1028
|
query: {
|
|
1015
1029
|
onlyAvailable: !0
|
|
1016
1030
|
}
|
|
1017
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1018
|
-
paymentMethodId:
|
|
1031
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1032
|
+
paymentMethodId: i
|
|
1019
1033
|
}), a = c(() => {
|
|
1020
|
-
var
|
|
1021
|
-
return (f = (
|
|
1034
|
+
var i, f;
|
|
1035
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
|
|
1022
1036
|
}), u = c(() => {
|
|
1023
|
-
var
|
|
1024
|
-
return ((P = (f = (
|
|
1037
|
+
var i, f, P;
|
|
1038
|
+
return ((P = (f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements) == null ? void 0 : P.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
|
|
1025
1039
|
});
|
|
1026
1040
|
return {
|
|
1027
1041
|
contextUpdateMutation: s,
|
|
@@ -1034,18 +1048,18 @@ function un() {
|
|
|
1034
1048
|
};
|
|
1035
1049
|
}
|
|
1036
1050
|
function on() {
|
|
1037
|
-
const e =
|
|
1051
|
+
const e = B(), s = $(), t = pt({
|
|
1038
1052
|
query: {
|
|
1039
1053
|
onlyAvailable: !0
|
|
1040
1054
|
}
|
|
1041
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1042
|
-
shippingMethodId:
|
|
1055
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1056
|
+
shippingMethodId: i
|
|
1043
1057
|
}), a = c(() => {
|
|
1044
|
-
var
|
|
1045
|
-
return (f = (
|
|
1058
|
+
var i, f;
|
|
1059
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
|
|
1046
1060
|
}), u = c(() => {
|
|
1047
|
-
var
|
|
1048
|
-
return ((f = (
|
|
1061
|
+
var i, f;
|
|
1062
|
+
return ((f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements.sort((P, d) => (P.position ?? 0) - (d.position ?? 0))) ?? [];
|
|
1049
1063
|
});
|
|
1050
1064
|
return {
|
|
1051
1065
|
contextUpdateMutation: s,
|
|
@@ -1066,13 +1080,13 @@ const gt = (e, s) => {
|
|
|
1066
1080
|
}
|
|
1067
1081
|
return (t == null ? void 0 : t[s]) ?? "";
|
|
1068
1082
|
}, cn = () => {
|
|
1069
|
-
const e =
|
|
1083
|
+
const e = B(), s = c(() => {
|
|
1070
1084
|
var t, n, r;
|
|
1071
1085
|
return ((r = (n = (t = e.data) == null ? void 0 : t.value) == null ? void 0 : n.context) == null ? void 0 : r.languageIdChain) ?? [];
|
|
1072
1086
|
});
|
|
1073
1087
|
return (t, n) => {
|
|
1074
1088
|
const r = [n, ...s.value];
|
|
1075
|
-
return gt(
|
|
1089
|
+
return gt(o(t), o(r));
|
|
1076
1090
|
};
|
|
1077
1091
|
};
|
|
1078
1092
|
function ln(e) {
|
|
@@ -1081,31 +1095,31 @@ function ln(e) {
|
|
|
1081
1095
|
total: s ?? 0,
|
|
1082
1096
|
limit: t,
|
|
1083
1097
|
totalCountMode: r
|
|
1084
|
-
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))),
|
|
1098
|
+
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))), i = c({
|
|
1085
1099
|
get() {
|
|
1086
1100
|
return a.page;
|
|
1087
1101
|
},
|
|
1088
|
-
set(
|
|
1089
|
-
a.page = Math.max(1, Math.min(
|
|
1102
|
+
set(K) {
|
|
1103
|
+
a.page = Math.max(1, Math.min(o(u), K));
|
|
1090
1104
|
}
|
|
1091
1105
|
});
|
|
1092
1106
|
H(
|
|
1093
|
-
[() =>
|
|
1094
|
-
([
|
|
1095
|
-
a.page = Math.min(
|
|
1107
|
+
[() => o(u), () => a],
|
|
1108
|
+
([K, p]) => {
|
|
1109
|
+
a.page = Math.min(K, a.page), a.total = p.total ?? 0, a.limit = p.limit;
|
|
1096
1110
|
}
|
|
1097
1111
|
);
|
|
1098
|
-
const f = c(() => a.page ===
|
|
1112
|
+
const f = c(() => a.page === o(u)), P = c(() => a.page === 1), d = c(() => ({
|
|
1099
1113
|
p: a.page,
|
|
1100
1114
|
limit: a.limit,
|
|
1101
1115
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
1102
|
-
})), M = (
|
|
1103
|
-
H(() =>
|
|
1116
|
+
})), M = (K) => {
|
|
1117
|
+
H(() => o(K), (p) => {
|
|
1104
1118
|
p && (a.total = (p == null ? void 0 : p.total) ?? 0, a.limit = (p == null ? void 0 : p.limit) ?? 0);
|
|
1105
1119
|
});
|
|
1106
1120
|
};
|
|
1107
1121
|
return {
|
|
1108
|
-
page: i
|
|
1122
|
+
page: o(i),
|
|
1109
1123
|
total: W(a, "total"),
|
|
1110
1124
|
limit: W(a, "limit"),
|
|
1111
1125
|
pageCount: u,
|
|
@@ -1133,8 +1147,8 @@ function dn(e) {
|
|
|
1133
1147
|
return (p = e.value) == null ? void 0 : p.calculatedCheapestPrice;
|
|
1134
1148
|
}), t = c(
|
|
1135
1149
|
() => {
|
|
1136
|
-
var p, S,
|
|
1137
|
-
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 0 ? (R = (
|
|
1150
|
+
var p, S, w, R, l;
|
|
1151
|
+
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 0 ? (R = (w = e.value) == null ? void 0 : w.calculatedPrices) == null ? void 0 : R[0] : (l = e.value) == null ? void 0 : l.calculatedPrice;
|
|
1138
1152
|
}
|
|
1139
1153
|
), n = c(() => {
|
|
1140
1154
|
var p;
|
|
@@ -1144,15 +1158,15 @@ function dn(e) {
|
|
|
1144
1158
|
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 1;
|
|
1145
1159
|
}), a = c(
|
|
1146
1160
|
() => {
|
|
1147
|
-
var p, S,
|
|
1148
|
-
return !!((p = e.value) != null && p.parentId) && ((
|
|
1161
|
+
var p, S, w, R, l, m;
|
|
1162
|
+
return !!((p = e.value) != null && p.parentId) && ((w = (S = e.value) == null ? void 0 : S.calculatedCheapestPrice) == null ? void 0 : w.hasRange) && ((R = t == null ? void 0 : t.value) == null ? void 0 : R.unitPrice) !== ((l = s == null ? void 0 : s.value) == null ? void 0 : l.unitPrice) && ((m = s == null ? void 0 : s.value) == null ? void 0 : m.unitPrice);
|
|
1149
1163
|
}
|
|
1150
1164
|
), u = c(
|
|
1151
1165
|
() => {
|
|
1152
1166
|
var p, S;
|
|
1153
|
-
return r.value && X(e.value).length > 1 ? (S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.reduce((
|
|
1167
|
+
return r.value && X(e.value).length > 1 ? (S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.reduce((w, R) => R.unitPrice < w.unitPrice ? R : w) : t.value;
|
|
1154
1168
|
}
|
|
1155
|
-
),
|
|
1169
|
+
), i = c(
|
|
1156
1170
|
() => {
|
|
1157
1171
|
var p;
|
|
1158
1172
|
return (p = u.value) == null ? void 0 : p.unitPrice;
|
|
@@ -1169,17 +1183,17 @@ function dn(e) {
|
|
|
1169
1183
|
return !!((S = (p = u.value) == null ? void 0 : p.listPrice) != null && S.percentage);
|
|
1170
1184
|
}), M = c(
|
|
1171
1185
|
() => {
|
|
1172
|
-
var p, S,
|
|
1173
|
-
return (
|
|
1186
|
+
var p, S, w;
|
|
1187
|
+
return (w = (S = (p = e.value) == null ? void 0 : p.calculatedPrice) == null ? void 0 : S.regulationPrice) == null ? void 0 : w.price;
|
|
1174
1188
|
}
|
|
1175
|
-
),
|
|
1189
|
+
), K = c(() => X(e.value));
|
|
1176
1190
|
return {
|
|
1177
1191
|
price: P,
|
|
1178
1192
|
totalPrice: f,
|
|
1179
|
-
unitPrice:
|
|
1193
|
+
unitPrice: i,
|
|
1180
1194
|
displayFromVariants: a,
|
|
1181
1195
|
displayFrom: r,
|
|
1182
|
-
tierPrices:
|
|
1196
|
+
tierPrices: K,
|
|
1183
1197
|
referencePrice: n,
|
|
1184
1198
|
isListPrice: d,
|
|
1185
1199
|
regulationPrice: M
|
|
@@ -1197,12 +1211,12 @@ function mt(e, s) {
|
|
|
1197
1211
|
});
|
|
1198
1212
|
}
|
|
1199
1213
|
function yn(e, s) {
|
|
1200
|
-
return c(() => mt(
|
|
1214
|
+
return c(() => mt(o(e), o(s)));
|
|
1201
1215
|
}
|
|
1202
1216
|
function pn(e) {
|
|
1203
1217
|
return c(() => {
|
|
1204
1218
|
var s, t, n, r, a, u;
|
|
1205
|
-
return !!((t = (s =
|
|
1219
|
+
return !!((t = (s = o(e)) == null ? void 0 : s.customer) != null && t.id) && !!((r = (n = o(e)) == null ? void 0 : n.customer) != null && r.active) && !((u = (a = o(e)) == null ? void 0 : a.customer) != null && u.guest);
|
|
1206
1220
|
});
|
|
1207
1221
|
}
|
|
1208
1222
|
function gn(e) {
|
|
@@ -1227,7 +1241,7 @@ function gn(e) {
|
|
|
1227
1241
|
var d;
|
|
1228
1242
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
|
|
1229
1243
|
}
|
|
1230
|
-
),
|
|
1244
|
+
), i = c(
|
|
1231
1245
|
() => {
|
|
1232
1246
|
var d;
|
|
1233
1247
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
|
|
@@ -1250,7 +1264,7 @@ function gn(e) {
|
|
|
1250
1264
|
isCustomerSession: r,
|
|
1251
1265
|
isGuestSession: a,
|
|
1252
1266
|
defaultBillingAddressId: u,
|
|
1253
|
-
defaultShippingAddressId:
|
|
1267
|
+
defaultShippingAddressId: i,
|
|
1254
1268
|
userDefaultBillingAddress: f,
|
|
1255
1269
|
userDefaultShippingAddress: P,
|
|
1256
1270
|
// Expose queries and mutations directly
|
|
@@ -1261,34 +1275,34 @@ export {
|
|
|
1261
1275
|
St as absolutizeSeoUrl,
|
|
1262
1276
|
F as addressKeys,
|
|
1263
1277
|
L as cartKeys,
|
|
1264
|
-
|
|
1265
|
-
|
|
1278
|
+
N as categoryKeys,
|
|
1279
|
+
A as contextKeys,
|
|
1266
1280
|
j as countryKeys,
|
|
1267
1281
|
I as customerKeys,
|
|
1268
1282
|
mt as getProductVariantForOptions,
|
|
1269
1283
|
ee as languageKey,
|
|
1270
1284
|
D as navigationKeys,
|
|
1271
1285
|
U as orderKeys,
|
|
1272
|
-
|
|
1273
|
-
|
|
1286
|
+
k as paymentKeys,
|
|
1287
|
+
O as productKeys,
|
|
1274
1288
|
je as readPaymentMethodOperation,
|
|
1275
1289
|
dt as readShippingMethodOperation,
|
|
1276
1290
|
V as relativizeSeoUrl,
|
|
1277
1291
|
E as salutationKeys,
|
|
1278
1292
|
T as seoUrlKeys,
|
|
1279
|
-
|
|
1293
|
+
b as shippingKeys,
|
|
1280
1294
|
_ as shopwareClientKey,
|
|
1281
1295
|
y as unrefOptions,
|
|
1282
|
-
|
|
1296
|
+
At as useAddLineItemMutation,
|
|
1283
1297
|
Dt as useChangeEmailMutation,
|
|
1284
1298
|
zt as useChangePasswordMutation,
|
|
1285
1299
|
bt as useChangeProfileMutation,
|
|
1286
1300
|
Qt as useCheckoutAddresses,
|
|
1287
|
-
|
|
1301
|
+
Kt as useCreateCustomerAddressMutation,
|
|
1288
1302
|
It as useCreateOrderMutation,
|
|
1289
1303
|
Tt as useDefaultBillingAddressMutation,
|
|
1290
1304
|
Et as useDefaultShippingAddressMutation,
|
|
1291
|
-
|
|
1305
|
+
Ot as useDeleteCustomerAddressMutation,
|
|
1292
1306
|
jt as useDeleteCustomerMutation,
|
|
1293
1307
|
Jt as useHandlePaymentMutation,
|
|
1294
1308
|
Gt as useImitateCustomerLoginQuery,
|
|
@@ -1312,20 +1326,20 @@ export {
|
|
|
1312
1326
|
We as useReadCategoryListQueryOptions,
|
|
1313
1327
|
Zt as useReadCompactProductListingQuery,
|
|
1314
1328
|
Xe as useReadCompactProductListingQueryOptions,
|
|
1315
|
-
|
|
1329
|
+
B as useReadContextQuery,
|
|
1316
1330
|
ae as useReadContextQueryOptions,
|
|
1317
1331
|
Ut as useReadCountryQuery,
|
|
1318
1332
|
Qe as useReadCountryQueryOptions,
|
|
1319
1333
|
Ze as useReadCustomProductDetailOptions,
|
|
1320
1334
|
_t as useReadCustomProductDetailQuery,
|
|
1321
1335
|
Re as useReadCustomerQuery,
|
|
1322
|
-
|
|
1336
|
+
Ae as useReadCustomerQueryOptions,
|
|
1323
1337
|
xt as useReadLanguageQuery,
|
|
1324
1338
|
Se as useReadLanguageQueryOptions,
|
|
1325
1339
|
Wt as useReadNavigationQuery,
|
|
1326
1340
|
Ee as useReadNavigationQueryOptions,
|
|
1327
1341
|
ce as useReadOrderQuery,
|
|
1328
|
-
|
|
1342
|
+
oe as useReadOrderQueryOptions,
|
|
1329
1343
|
$e as useReadPaymentMethodQuery,
|
|
1330
1344
|
Ve as useReadPaymentMethodQueryOptions,
|
|
1331
1345
|
sn as useReadProductDetailQuery,
|
|
@@ -1333,7 +1347,7 @@ export {
|
|
|
1333
1347
|
nn as useReadProductQuery,
|
|
1334
1348
|
rt as useReadProductQueryOptions,
|
|
1335
1349
|
rn as useReadSalutationQuery,
|
|
1336
|
-
|
|
1350
|
+
ot as useReadSalutationQueryOptions,
|
|
1337
1351
|
an as useReadSeoUrlQuery,
|
|
1338
1352
|
lt as useReadSeoUrlQueryOptions,
|
|
1339
1353
|
pt as useReadShippingMethodQuery,
|
|
@@ -1351,7 +1365,7 @@ export {
|
|
|
1351
1365
|
on as useShippingMethods,
|
|
1352
1366
|
g as useShopwareQueryClient,
|
|
1353
1367
|
$ as useUpdateContextMutation,
|
|
1354
|
-
|
|
1368
|
+
wt as useUpdateCustomerAddressMutation,
|
|
1355
1369
|
Lt as useUpdateLineItemMutation,
|
|
1356
1370
|
gn as useUser
|
|
1357
1371
|
};
|
package/package.json
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useMutation,
|
|
3
|
+
type UseMutationOptions,
|
|
4
|
+
useQueryClient,
|
|
5
|
+
} from '@tanstack/vue-query'
|
|
2
6
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
3
7
|
import { unref } from 'vue'
|
|
4
8
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
|
-
import { cartKeys,
|
|
6
|
-
import type {
|
|
9
|
+
import { cartKeys, paymentKeys, shippingKeys } from '../../keys'
|
|
10
|
+
import type {
|
|
11
|
+
OperationBody,
|
|
12
|
+
OperationKey,
|
|
13
|
+
OperationResponse,
|
|
14
|
+
} from '../types/query'
|
|
7
15
|
|
|
8
16
|
const addCartItemOperation = 'addLineItem post /checkout/cart/line-item' satisfies OperationKey
|
|
9
17
|
|
|
10
18
|
type LineItem = OperationBody<typeof addCartItemOperation>['items'][number]
|
|
11
19
|
|
|
12
|
-
type LineItemPayload =
|
|
13
|
-
Partial<Omit<LineItem, 'id' | 'quantity' | 'type'>> &
|
|
20
|
+
type LineItemPayload = Partial<Omit<LineItem, 'id' | 'quantity' | 'type'>> &
|
|
14
21
|
Required<Pick<LineItem, 'id' | 'quantity' | 'type'>>
|
|
15
22
|
|
|
16
|
-
type Body = Omit<
|
|
17
|
-
OperationBody<typeof addCartItemOperation>,
|
|
18
|
-
'items'
|
|
19
|
-
> & {
|
|
23
|
+
type Body = Omit<OperationBody<typeof addCartItemOperation>, 'items'> & {
|
|
20
24
|
items: LineItemPayload[]
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -39,9 +43,16 @@ export function useAddLineItemMutation(
|
|
|
39
43
|
},
|
|
40
44
|
onSuccess: async (newCart, variables, context) => {
|
|
41
45
|
queryClient.setQueryData(cartKeys.get(), newCart)
|
|
42
|
-
await
|
|
46
|
+
await Promise.all([
|
|
47
|
+
queryClient.invalidateQueries({ queryKey: paymentKeys.lists() }),
|
|
48
|
+
queryClient.invalidateQueries({ queryKey: shippingKeys.lists() }),
|
|
49
|
+
])
|
|
43
50
|
// queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
44
|
-
await unref(unref(mutationOptions)?.onSuccess)?.(
|
|
51
|
+
await unref(unref(mutationOptions)?.onSuccess)?.(
|
|
52
|
+
newCart,
|
|
53
|
+
variables,
|
|
54
|
+
context,
|
|
55
|
+
)
|
|
45
56
|
},
|
|
46
57
|
})
|
|
47
58
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useMutation,
|
|
3
|
+
type UseMutationOptions,
|
|
4
|
+
useQueryClient,
|
|
5
|
+
} from '@tanstack/vue-query'
|
|
2
6
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
3
7
|
import { unref } from 'vue'
|
|
4
8
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
|
-
import { cartKeys } from '../../keys'
|
|
6
|
-
import type {
|
|
9
|
+
import { cartKeys, paymentKeys, shippingKeys } from '../../keys'
|
|
10
|
+
import type {
|
|
11
|
+
OperationBody,
|
|
12
|
+
OperationKey,
|
|
13
|
+
OperationResponse,
|
|
14
|
+
} from '../types/query'
|
|
7
15
|
|
|
8
16
|
const removeCartItemOperation = 'removeLineItem post /checkout/cart/line-item/delete' satisfies OperationKey
|
|
9
17
|
|
|
@@ -26,8 +34,16 @@ export function useRemoveLineItemMutation(
|
|
|
26
34
|
},
|
|
27
35
|
onSuccess: async (newCart, variables, context) => {
|
|
28
36
|
queryClient.setQueryData(cartKeys.get(), newCart)
|
|
37
|
+
await Promise.all([
|
|
38
|
+
queryClient.invalidateQueries({ queryKey: paymentKeys.lists() }),
|
|
39
|
+
queryClient.invalidateQueries({ queryKey: shippingKeys.lists() }),
|
|
40
|
+
])
|
|
29
41
|
// queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
30
|
-
await unref(unref(mutationOptions)?.onSuccess)?.(
|
|
42
|
+
await unref(unref(mutationOptions)?.onSuccess)?.(
|
|
43
|
+
newCart,
|
|
44
|
+
variables,
|
|
45
|
+
context,
|
|
46
|
+
)
|
|
31
47
|
},
|
|
32
48
|
})
|
|
33
49
|
}
|