@teamnovu/kit-shopware-composables 0.0.21 → 0.0.22
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 +117 -114
- package/package.json +1 -1
- package/src/query/context/useUpdateContextMutation.ts +5 -2
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 P, useQuery as Q, useQueryClient as C, useMutation as v } from "@tanstack/vue-query";
|
|
4
4
|
import "@teamnovu/kit-shopware-api-client";
|
|
@@ -76,9 +76,9 @@ const F = {
|
|
|
76
76
|
body: e
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
|
-
}, I = {
|
|
80
|
-
get: () => ["cart"]
|
|
81
79
|
}, L = {
|
|
80
|
+
get: () => ["cart"]
|
|
81
|
+
}, I = {
|
|
82
82
|
all: () => ["customer"],
|
|
83
83
|
detail: (e) => ["customer", { body: e }],
|
|
84
84
|
imitateLogin: (e) => ["customer", "imitateLogin", { body: e }]
|
|
@@ -157,10 +157,10 @@ const F = {
|
|
|
157
157
|
]
|
|
158
158
|
};
|
|
159
159
|
function p(e) {
|
|
160
|
-
const s =
|
|
160
|
+
const s = o(e);
|
|
161
161
|
return Object.fromEntries(
|
|
162
162
|
Object.entries(s ?? {}).map(
|
|
163
|
-
([t, n]) => [t,
|
|
163
|
+
([t, n]) => [t, o(n)]
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
@@ -192,20 +192,20 @@ function vt(e, s, t) {
|
|
|
192
192
|
await n.cancelQueries({ queryKey: e });
|
|
193
193
|
const a = n.getQueryData(e);
|
|
194
194
|
if (n.setQueryData(e, (u) => s(r, u)), t) {
|
|
195
|
-
const u =
|
|
196
|
-
|
|
195
|
+
const u = o(t), i = o(u.onMutate);
|
|
196
|
+
i == null || i(r);
|
|
197
197
|
}
|
|
198
198
|
return { previousValue: a };
|
|
199
199
|
},
|
|
200
200
|
onError: (r, a, u) => {
|
|
201
201
|
if (u && n.setQueryData(e, u.previousValue), t) {
|
|
202
|
-
const
|
|
202
|
+
const i = o(t), f = o(i.onError);
|
|
203
203
|
f == null || f(r, a, u);
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
onSettled: (...r) => {
|
|
207
207
|
if (n.invalidateQueries({ queryKey: e }), t) {
|
|
208
|
-
const a =
|
|
208
|
+
const a = o(t), u = o(a.onSettled);
|
|
209
209
|
u == null || u(...r);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -234,8 +234,11 @@ function $(e) {
|
|
|
234
234
|
body: n
|
|
235
235
|
})),
|
|
236
236
|
onSuccess: async (n, r, a) => {
|
|
237
|
-
var u,
|
|
238
|
-
await
|
|
237
|
+
var u, i;
|
|
238
|
+
await Promise.all([
|
|
239
|
+
t.invalidateQueries({ queryKey: F.all() }),
|
|
240
|
+
t.invalidateQueries({ queryKey: L.get() })
|
|
241
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
239
242
|
}
|
|
240
243
|
});
|
|
241
244
|
}
|
|
@@ -251,7 +254,7 @@ function ht() {
|
|
|
251
254
|
}, u = c(() => {
|
|
252
255
|
var d, M;
|
|
253
256
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeBillingAddress;
|
|
254
|
-
}),
|
|
257
|
+
}), i = c(() => {
|
|
255
258
|
var d, M;
|
|
256
259
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeShippingAddress;
|
|
257
260
|
}), f = c(() => {
|
|
@@ -267,7 +270,7 @@ function ht() {
|
|
|
267
270
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
268
271
|
(M) => {
|
|
269
272
|
var O;
|
|
270
|
-
return M.id !== ((O =
|
|
273
|
+
return M.id !== ((O = i.value) == null ? void 0 : O.id);
|
|
271
274
|
}
|
|
272
275
|
)) ?? [];
|
|
273
276
|
});
|
|
@@ -279,19 +282,19 @@ function ht() {
|
|
|
279
282
|
setShippingAddress: a,
|
|
280
283
|
isSaving: n,
|
|
281
284
|
activeBillingAddress: u,
|
|
282
|
-
activeShippingAddress:
|
|
285
|
+
activeShippingAddress: i,
|
|
283
286
|
inactiveBillingAddresses: f,
|
|
284
287
|
inactiveShippingAddresses: S
|
|
285
288
|
};
|
|
286
289
|
}
|
|
287
|
-
const
|
|
288
|
-
function
|
|
290
|
+
const ie = "readOrder post /order";
|
|
291
|
+
function oe(e) {
|
|
289
292
|
const s = g(), t = U.detail(e);
|
|
290
293
|
return P({
|
|
291
294
|
queryKey: t,
|
|
292
295
|
queryFn: async ({ signal: n }) => {
|
|
293
296
|
const r = p(e);
|
|
294
|
-
return s.query(
|
|
297
|
+
return s.query(ie, {
|
|
295
298
|
...r,
|
|
296
299
|
signal: n
|
|
297
300
|
});
|
|
@@ -299,11 +302,11 @@ function ie(e) {
|
|
|
299
302
|
});
|
|
300
303
|
}
|
|
301
304
|
function ce(e) {
|
|
302
|
-
return Q(
|
|
305
|
+
return Q(oe(e));
|
|
303
306
|
}
|
|
304
307
|
function qt(e, s) {
|
|
305
308
|
const t = c(() => {
|
|
306
|
-
const l =
|
|
309
|
+
const l = o(e);
|
|
307
310
|
if (l)
|
|
308
311
|
return {
|
|
309
312
|
body: {
|
|
@@ -327,7 +330,7 @@ function qt(e, s) {
|
|
|
327
330
|
}), u = c(() => {
|
|
328
331
|
var l, m, q;
|
|
329
332
|
return (q = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : q.name;
|
|
330
|
-
}),
|
|
333
|
+
}), i = c(() => {
|
|
331
334
|
var l, m;
|
|
332
335
|
return (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.technicalName;
|
|
333
336
|
}), f = c(() => {
|
|
@@ -371,13 +374,13 @@ function qt(e, s) {
|
|
|
371
374
|
return (q = l.at(-1)) == null ? void 0 : q.shippingMethod;
|
|
372
375
|
}), A = c(() => {
|
|
373
376
|
var m;
|
|
374
|
-
const l =
|
|
377
|
+
const l = o(e);
|
|
375
378
|
return ((m = a.value) == null ? void 0 : m[l]) ?? !1;
|
|
376
379
|
});
|
|
377
380
|
return {
|
|
378
381
|
order: r,
|
|
379
382
|
status: u,
|
|
380
|
-
statusTechnicalName:
|
|
383
|
+
statusTechnicalName: i,
|
|
381
384
|
total: f,
|
|
382
385
|
subtotal: S,
|
|
383
386
|
shippingCosts: d,
|
|
@@ -393,9 +396,9 @@ function qt(e, s) {
|
|
|
393
396
|
function Ct(e) {
|
|
394
397
|
const s = c(() => {
|
|
395
398
|
var r, a;
|
|
396
|
-
return (a = (r =
|
|
397
|
-
var
|
|
398
|
-
return ((
|
|
399
|
+
return (a = (r = o(e)) == null ? void 0 : r.transactions) == null ? void 0 : a.find((u) => {
|
|
400
|
+
var i;
|
|
401
|
+
return ((i = u.paymentMethod) == null ? void 0 : i.active) === !0;
|
|
399
402
|
});
|
|
400
403
|
}), t = c(() => {
|
|
401
404
|
var r;
|
|
@@ -417,8 +420,8 @@ function St(e) {
|
|
|
417
420
|
...e,
|
|
418
421
|
mutationFn: async (n) => s.query(le, p(n)),
|
|
419
422
|
onSuccess: async (n, r, a) => {
|
|
420
|
-
var u,
|
|
421
|
-
await t.invalidateQueries({ queryKey: R.lists() }), await ((
|
|
423
|
+
var u, i;
|
|
424
|
+
await t.invalidateQueries({ queryKey: R.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
422
425
|
}
|
|
423
426
|
});
|
|
424
427
|
}
|
|
@@ -429,8 +432,8 @@ function Pt(e) {
|
|
|
429
432
|
...e,
|
|
430
433
|
mutationFn: async (n) => s.query(de, p(n)),
|
|
431
434
|
onSuccess: async (n, r, a) => {
|
|
432
|
-
var u,
|
|
433
|
-
await t.invalidateQueries({ queryKey: R.lists() }), await ((
|
|
435
|
+
var u, i;
|
|
436
|
+
await t.invalidateQueries({ queryKey: R.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
434
437
|
}
|
|
435
438
|
});
|
|
436
439
|
}
|
|
@@ -441,7 +444,7 @@ function Qt(e) {
|
|
|
441
444
|
...e,
|
|
442
445
|
mutationFn: async (n) => s.query(ye, p(n)),
|
|
443
446
|
onSuccess: async (n, r, a) => {
|
|
444
|
-
var
|
|
447
|
+
var i, f;
|
|
445
448
|
const { addressId: u } = p(r).params;
|
|
446
449
|
t.setQueryData(R.detail(u), n), await Promise.all([
|
|
447
450
|
t.invalidateQueries({ queryKey: R.lists() }),
|
|
@@ -449,7 +452,7 @@ function Qt(e) {
|
|
|
449
452
|
queryKey: R.detail(p(r).params.addressId),
|
|
450
453
|
predicate: (S) => S.queryKey.at(-1) !== u
|
|
451
454
|
})
|
|
452
|
-
]), await ((f =
|
|
455
|
+
]), await ((f = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
453
456
|
}
|
|
454
457
|
});
|
|
455
458
|
}
|
|
@@ -462,14 +465,14 @@ function Mt(e) {
|
|
|
462
465
|
body: n
|
|
463
466
|
}),
|
|
464
467
|
onSuccess: async (n, r, a) => {
|
|
465
|
-
var u,
|
|
466
|
-
t.setQueryData(
|
|
468
|
+
var u, i;
|
|
469
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
467
470
|
}
|
|
468
471
|
});
|
|
469
472
|
}
|
|
470
473
|
const ge = "readCart get /checkout/cart";
|
|
471
474
|
function me(e) {
|
|
472
|
-
const s = g(), t =
|
|
475
|
+
const s = g(), t = L.get();
|
|
473
476
|
return P({
|
|
474
477
|
queryKey: t,
|
|
475
478
|
queryFn: async ({ signal: n }) => s.query(ge, {
|
|
@@ -490,8 +493,8 @@ function Kt(e) {
|
|
|
490
493
|
body: n
|
|
491
494
|
}),
|
|
492
495
|
onSuccess: async (n, r, a) => {
|
|
493
|
-
var u,
|
|
494
|
-
t.setQueryData(
|
|
496
|
+
var u, i;
|
|
497
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
495
498
|
}
|
|
496
499
|
});
|
|
497
500
|
}
|
|
@@ -504,8 +507,8 @@ function At(e) {
|
|
|
504
507
|
body: n
|
|
505
508
|
}),
|
|
506
509
|
onSuccess: async (n, r, a) => {
|
|
507
|
-
var u,
|
|
508
|
-
t.setQueryData(
|
|
510
|
+
var u, i;
|
|
511
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
509
512
|
}
|
|
510
513
|
});
|
|
511
514
|
}
|
|
@@ -516,13 +519,13 @@ function wt(e) {
|
|
|
516
519
|
...e,
|
|
517
520
|
mutationFn: async (n) => s.query(he, p(n)),
|
|
518
521
|
onSuccess: async (n, r, a) => {
|
|
519
|
-
var u,
|
|
522
|
+
var u, i;
|
|
520
523
|
await Promise.all([
|
|
521
524
|
// Clear cart after successful order creation
|
|
522
|
-
t.invalidateQueries({ queryKey:
|
|
525
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
523
526
|
// Invalidate order list to refetch data
|
|
524
527
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
525
|
-
]), await ((
|
|
528
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
526
529
|
}
|
|
527
530
|
});
|
|
528
531
|
}
|
|
@@ -563,8 +566,8 @@ function Lt(e) {
|
|
|
563
566
|
...e,
|
|
564
567
|
mutationFn: async (n) => s.query(Qe, p(n)),
|
|
565
568
|
onSuccess: async (n, r, a) => {
|
|
566
|
-
var u,
|
|
567
|
-
await t.invalidateQueries({ queryKey:
|
|
569
|
+
var u, i;
|
|
570
|
+
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
568
571
|
}
|
|
569
572
|
});
|
|
570
573
|
}
|
|
@@ -575,11 +578,11 @@ function It(e) {
|
|
|
575
578
|
...e,
|
|
576
579
|
mutationFn: async (n) => s.query(Me, p(n)),
|
|
577
580
|
onSuccess: async (n, r, a) => {
|
|
578
|
-
var u,
|
|
581
|
+
var u, i;
|
|
579
582
|
await Promise.all([
|
|
580
|
-
t.invalidateQueries({ queryKey:
|
|
583
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
581
584
|
t.invalidateQueries({ queryKey: F.all() })
|
|
582
|
-
]), await ((
|
|
585
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
583
586
|
}
|
|
584
587
|
});
|
|
585
588
|
}
|
|
@@ -595,12 +598,12 @@ function xt(e) {
|
|
|
595
598
|
return a && (s.contextToken = a), r.json();
|
|
596
599
|
},
|
|
597
600
|
onSuccess: async (n, r, a) => {
|
|
598
|
-
var u,
|
|
601
|
+
var u, i;
|
|
599
602
|
await Promise.all([
|
|
600
603
|
t.resetQueries({ queryKey: F.all() }),
|
|
601
|
-
t.invalidateQueries({ queryKey:
|
|
602
|
-
t.invalidateQueries({ queryKey:
|
|
603
|
-
]), await ((
|
|
604
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
605
|
+
t.invalidateQueries({ queryKey: I.all() })
|
|
606
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
604
607
|
}
|
|
605
608
|
});
|
|
606
609
|
}
|
|
@@ -611,18 +614,18 @@ function Ut(e) {
|
|
|
611
614
|
...e,
|
|
612
615
|
mutationFn: async (n) => s.query(Ke, p(n)),
|
|
613
616
|
onSuccess: async (n, r, a) => {
|
|
614
|
-
var u,
|
|
617
|
+
var u, i;
|
|
615
618
|
await Promise.all([
|
|
616
619
|
t.resetQueries({ queryKey: F.all() }),
|
|
617
|
-
t.invalidateQueries({ queryKey:
|
|
618
|
-
t.invalidateQueries({ queryKey:
|
|
619
|
-
]), await ((
|
|
620
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
621
|
+
t.invalidateQueries({ queryKey: I.all() })
|
|
622
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
620
623
|
}
|
|
621
624
|
});
|
|
622
625
|
}
|
|
623
626
|
const Ae = "readCustomer post /account/customer";
|
|
624
627
|
function we(e) {
|
|
625
|
-
const s = g(), t =
|
|
628
|
+
const s = g(), t = I.detail(c(() => p(e).body ?? {}));
|
|
626
629
|
return P({
|
|
627
630
|
queryKey: t,
|
|
628
631
|
queryFn: async () => s.query(Ae, p(e))
|
|
@@ -638,8 +641,8 @@ function bt(e) {
|
|
|
638
641
|
...e,
|
|
639
642
|
mutationFn: async (n) => s.query(Fe, p(n)),
|
|
640
643
|
onSuccess: async (n, r, a) => {
|
|
641
|
-
var u,
|
|
642
|
-
await t.invalidateQueries({ queryKey:
|
|
644
|
+
var u, i;
|
|
645
|
+
await t.invalidateQueries({ queryKey: I.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
643
646
|
}
|
|
644
647
|
});
|
|
645
648
|
}
|
|
@@ -650,11 +653,11 @@ function kt(e) {
|
|
|
650
653
|
...e,
|
|
651
654
|
mutationFn: async (n) => s.query(Le, p(n)),
|
|
652
655
|
onSuccess: async (n, r, a) => {
|
|
653
|
-
var u,
|
|
656
|
+
var u, i;
|
|
654
657
|
await Promise.all([
|
|
655
|
-
t.invalidateQueries({ queryKey:
|
|
658
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
656
659
|
t.invalidateQueries({ queryKey: F.all() })
|
|
657
|
-
]), await ((
|
|
660
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
658
661
|
}
|
|
659
662
|
});
|
|
660
663
|
}
|
|
@@ -665,11 +668,11 @@ function Bt(e) {
|
|
|
665
668
|
...e,
|
|
666
669
|
mutationFn: async (n) => s.query(Ie, p(n)),
|
|
667
670
|
onSuccess: async (n, r, a) => {
|
|
668
|
-
var u,
|
|
671
|
+
var u, i;
|
|
669
672
|
await Promise.all([
|
|
670
|
-
t.invalidateQueries({ queryKey:
|
|
673
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
671
674
|
t.invalidateQueries({ queryKey: F.all() })
|
|
672
|
-
]), await ((
|
|
675
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
673
676
|
}
|
|
674
677
|
});
|
|
675
678
|
}
|
|
@@ -680,12 +683,12 @@ function Dt(e) {
|
|
|
680
683
|
...e,
|
|
681
684
|
mutationFn: async (n) => s.query(xe, p(n)),
|
|
682
685
|
onSuccess: async (n, r, a) => {
|
|
683
|
-
var u,
|
|
686
|
+
var u, i;
|
|
684
687
|
await Promise.all([
|
|
685
|
-
t.resetQueries({ queryKey:
|
|
688
|
+
t.resetQueries({ queryKey: I.all() }),
|
|
686
689
|
t.resetQueries({ queryKey: F.all() }),
|
|
687
|
-
t.resetQueries({ queryKey:
|
|
688
|
-
]), await ((
|
|
690
|
+
t.resetQueries({ queryKey: L.get() })
|
|
691
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
689
692
|
}
|
|
690
693
|
});
|
|
691
694
|
}
|
|
@@ -702,7 +705,7 @@ function Nt(e) {
|
|
|
702
705
|
},
|
|
703
706
|
onSuccess: async (t, n, r) => {
|
|
704
707
|
var a, u;
|
|
705
|
-
await ((u =
|
|
708
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
706
709
|
}
|
|
707
710
|
});
|
|
708
711
|
}
|
|
@@ -714,7 +717,7 @@ function Tt(e) {
|
|
|
714
717
|
mutationFn: async (t) => s.query(be, p(t)),
|
|
715
718
|
onSuccess: async (t, n, r) => {
|
|
716
719
|
var a, u;
|
|
717
|
-
await ((u =
|
|
720
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
718
721
|
}
|
|
719
722
|
});
|
|
720
723
|
}
|
|
@@ -726,13 +729,13 @@ function Et(e) {
|
|
|
726
729
|
mutationFn: async (t) => s.query(ke, p(t)),
|
|
727
730
|
onSuccess: async (t, n, r) => {
|
|
728
731
|
var a, u;
|
|
729
|
-
await ((u =
|
|
732
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
730
733
|
}
|
|
731
734
|
});
|
|
732
735
|
}
|
|
733
736
|
const Be = "imitateCustomerLogin post /account/login/imitate-customer";
|
|
734
737
|
function De(e) {
|
|
735
|
-
const s = g(), t =
|
|
738
|
+
const s = g(), t = I.imitateLogin(c(() => p(e).body ?? {}));
|
|
736
739
|
return P({
|
|
737
740
|
queryKey: t,
|
|
738
741
|
queryFn: async () => s.query(Be, p(e))
|
|
@@ -749,7 +752,7 @@ function Vt(e) {
|
|
|
749
752
|
mutationFn: async (t) => s.query(Ne, p(t)),
|
|
750
753
|
onSuccess: async (t, n, r) => {
|
|
751
754
|
var a, u;
|
|
752
|
-
await ((u =
|
|
755
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
753
756
|
}
|
|
754
757
|
});
|
|
755
758
|
}
|
|
@@ -758,11 +761,11 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
758
761
|
return P({
|
|
759
762
|
queryKey: a,
|
|
760
763
|
queryFn: async ({ signal: u }) => {
|
|
761
|
-
const
|
|
764
|
+
const i = o(s), f = o(t), S = p(n);
|
|
762
765
|
return r.query(Te, {
|
|
763
766
|
...S,
|
|
764
767
|
params: {
|
|
765
|
-
activeId:
|
|
768
|
+
activeId: i,
|
|
766
769
|
rootId: f
|
|
767
770
|
},
|
|
768
771
|
signal: u
|
|
@@ -797,8 +800,8 @@ function zt(e) {
|
|
|
797
800
|
...e,
|
|
798
801
|
mutationFn: async (n) => s.query(ze, p(n)),
|
|
799
802
|
onSuccess: async (n, r, a) => {
|
|
800
|
-
var u,
|
|
801
|
-
await t.invalidateQueries({ queryKey:
|
|
803
|
+
var u, i;
|
|
804
|
+
await t.invalidateQueries({ queryKey: L.get() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
802
805
|
}
|
|
803
806
|
});
|
|
804
807
|
}
|
|
@@ -809,8 +812,8 @@ function Gt(e) {
|
|
|
809
812
|
...e,
|
|
810
813
|
mutationFn: async (n) => s.query(Ge, p(n)),
|
|
811
814
|
onSuccess: async (n, r, a) => {
|
|
812
|
-
var u,
|
|
813
|
-
await t.invalidateQueries({ queryKey: U.all() }), await ((
|
|
815
|
+
var u, i;
|
|
816
|
+
await t.invalidateQueries({ queryKey: U.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
814
817
|
}
|
|
815
818
|
});
|
|
816
819
|
}
|
|
@@ -838,7 +841,7 @@ function Xe(e, s) {
|
|
|
838
841
|
...a,
|
|
839
842
|
params: {
|
|
840
843
|
...a.params,
|
|
841
|
-
seoUrl: V(
|
|
844
|
+
seoUrl: V(o(e))
|
|
842
845
|
},
|
|
843
846
|
signal: r
|
|
844
847
|
});
|
|
@@ -859,7 +862,7 @@ function Ze(e, s) {
|
|
|
859
862
|
...a,
|
|
860
863
|
params: {
|
|
861
864
|
...a.params,
|
|
862
|
-
seoUrl: V(
|
|
865
|
+
seoUrl: V(o(e))
|
|
863
866
|
},
|
|
864
867
|
signal: r
|
|
865
868
|
});
|
|
@@ -935,36 +938,36 @@ const at = "readSeoUrl post /seo-url", ut = function(s) {
|
|
|
935
938
|
function _t(e) {
|
|
936
939
|
return Q(ut(e));
|
|
937
940
|
}
|
|
938
|
-
const
|
|
939
|
-
function
|
|
941
|
+
const it = "readShippingMethod post /shipping-method";
|
|
942
|
+
function ot(e) {
|
|
940
943
|
const s = g(), t = D.list(c(() => {
|
|
941
944
|
var n;
|
|
942
945
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
943
946
|
}));
|
|
944
947
|
return P({
|
|
945
948
|
queryKey: t,
|
|
946
|
-
queryFn: ({ signal: n }) => s.query(
|
|
949
|
+
queryFn: ({ signal: n }) => s.query(it, {
|
|
947
950
|
...p(e),
|
|
948
951
|
signal: n
|
|
949
952
|
})
|
|
950
953
|
});
|
|
951
954
|
}
|
|
952
955
|
function ct(e) {
|
|
953
|
-
return Q(
|
|
956
|
+
return Q(ot(e));
|
|
954
957
|
}
|
|
955
958
|
function en() {
|
|
956
959
|
const e = k(), s = $(), t = $e({
|
|
957
960
|
query: {
|
|
958
961
|
onlyAvailable: !0
|
|
959
962
|
}
|
|
960
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
961
|
-
paymentMethodId:
|
|
963
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
964
|
+
paymentMethodId: i
|
|
962
965
|
}), a = c(() => {
|
|
963
|
-
var
|
|
964
|
-
return (f = (
|
|
966
|
+
var i, f;
|
|
967
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
|
|
965
968
|
}), u = c(() => {
|
|
966
|
-
var
|
|
967
|
-
return ((S = (f = (
|
|
969
|
+
var i, f, S;
|
|
970
|
+
return ((S = (f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements) == null ? void 0 : S.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
|
|
968
971
|
});
|
|
969
972
|
return {
|
|
970
973
|
contextUpdateMutation: s,
|
|
@@ -981,14 +984,14 @@ function tn() {
|
|
|
981
984
|
query: {
|
|
982
985
|
onlyAvailable: !0
|
|
983
986
|
}
|
|
984
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
985
|
-
shippingMethodId:
|
|
987
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
988
|
+
shippingMethodId: i
|
|
986
989
|
}), a = c(() => {
|
|
987
|
-
var
|
|
988
|
-
return (f = (
|
|
990
|
+
var i, f;
|
|
991
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
|
|
989
992
|
}), u = c(() => {
|
|
990
|
-
var
|
|
991
|
-
return ((f = (
|
|
993
|
+
var i, f;
|
|
994
|
+
return ((f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements.sort((S, d) => (S.position ?? 0) - (d.position ?? 0))) ?? [];
|
|
992
995
|
});
|
|
993
996
|
return {
|
|
994
997
|
contextUpdateMutation: s,
|
|
@@ -1015,7 +1018,7 @@ const lt = (e, s) => {
|
|
|
1015
1018
|
});
|
|
1016
1019
|
return (t, n) => {
|
|
1017
1020
|
const r = [n, ...s.value];
|
|
1018
|
-
return lt(
|
|
1021
|
+
return lt(o(t), o(r));
|
|
1019
1022
|
};
|
|
1020
1023
|
};
|
|
1021
1024
|
function sn(e) {
|
|
@@ -1024,31 +1027,31 @@ function sn(e) {
|
|
|
1024
1027
|
total: s ?? 0,
|
|
1025
1028
|
limit: t,
|
|
1026
1029
|
totalCountMode: r
|
|
1027
|
-
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))),
|
|
1030
|
+
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))), i = c({
|
|
1028
1031
|
get() {
|
|
1029
1032
|
return a.page;
|
|
1030
1033
|
},
|
|
1031
1034
|
set(O) {
|
|
1032
|
-
a.page = Math.max(1, Math.min(
|
|
1035
|
+
a.page = Math.max(1, Math.min(o(u), O));
|
|
1033
1036
|
}
|
|
1034
1037
|
});
|
|
1035
1038
|
H(
|
|
1036
|
-
[() =>
|
|
1039
|
+
[() => o(u), () => a],
|
|
1037
1040
|
([O, y]) => {
|
|
1038
1041
|
a.page = Math.min(O, a.page), a.total = y.total ?? 0, a.limit = y.limit;
|
|
1039
1042
|
}
|
|
1040
1043
|
);
|
|
1041
|
-
const f = c(() => a.page ===
|
|
1044
|
+
const f = c(() => a.page === o(u)), S = c(() => a.page === 1), d = c(() => ({
|
|
1042
1045
|
p: a.page,
|
|
1043
1046
|
limit: a.limit,
|
|
1044
1047
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
1045
1048
|
})), M = (O) => {
|
|
1046
|
-
H(() =>
|
|
1049
|
+
H(() => o(O), (y) => {
|
|
1047
1050
|
y && (a.total = (y == null ? void 0 : y.total) ?? 0, a.limit = (y == null ? void 0 : y.limit) ?? 0);
|
|
1048
1051
|
});
|
|
1049
1052
|
};
|
|
1050
1053
|
return {
|
|
1051
|
-
page: i
|
|
1054
|
+
page: o(i),
|
|
1052
1055
|
total: W(a, "total"),
|
|
1053
1056
|
limit: W(a, "limit"),
|
|
1054
1057
|
pageCount: u,
|
|
@@ -1095,7 +1098,7 @@ function rn(e) {
|
|
|
1095
1098
|
var y, h;
|
|
1096
1099
|
return r.value && X(e.value).length > 1 ? (h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.reduce((K, A) => A.unitPrice < K.unitPrice ? A : K) : t.value;
|
|
1097
1100
|
}
|
|
1098
|
-
),
|
|
1101
|
+
), i = c(
|
|
1099
1102
|
() => {
|
|
1100
1103
|
var y;
|
|
1101
1104
|
return (y = u.value) == null ? void 0 : y.unitPrice;
|
|
@@ -1119,7 +1122,7 @@ function rn(e) {
|
|
|
1119
1122
|
return {
|
|
1120
1123
|
price: S,
|
|
1121
1124
|
totalPrice: f,
|
|
1122
|
-
unitPrice:
|
|
1125
|
+
unitPrice: i,
|
|
1123
1126
|
displayFromVariants: a,
|
|
1124
1127
|
displayFrom: r,
|
|
1125
1128
|
tierPrices: O,
|
|
@@ -1140,12 +1143,12 @@ function dt(e, s) {
|
|
|
1140
1143
|
});
|
|
1141
1144
|
}
|
|
1142
1145
|
function an(e, s) {
|
|
1143
|
-
return c(() => dt(
|
|
1146
|
+
return c(() => dt(o(e), o(s)));
|
|
1144
1147
|
}
|
|
1145
1148
|
function un(e) {
|
|
1146
1149
|
return c(() => {
|
|
1147
1150
|
var s, t, n, r, a, u;
|
|
1148
|
-
return !!((t = (s =
|
|
1151
|
+
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);
|
|
1149
1152
|
});
|
|
1150
1153
|
}
|
|
1151
1154
|
function on(e) {
|
|
@@ -1170,7 +1173,7 @@ function on(e) {
|
|
|
1170
1173
|
var d;
|
|
1171
1174
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
|
|
1172
1175
|
}
|
|
1173
|
-
),
|
|
1176
|
+
), i = c(
|
|
1174
1177
|
() => {
|
|
1175
1178
|
var d;
|
|
1176
1179
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
|
|
@@ -1193,7 +1196,7 @@ function on(e) {
|
|
|
1193
1196
|
isCustomerSession: r,
|
|
1194
1197
|
isGuestSession: a,
|
|
1195
1198
|
defaultBillingAddressId: u,
|
|
1196
|
-
defaultShippingAddressId:
|
|
1199
|
+
defaultShippingAddressId: i,
|
|
1197
1200
|
userDefaultBillingAddress: f,
|
|
1198
1201
|
userDefaultShippingAddress: S,
|
|
1199
1202
|
// Expose queries and mutations directly
|
|
@@ -1203,11 +1206,11 @@ function on(e) {
|
|
|
1203
1206
|
export {
|
|
1204
1207
|
ft as absolutizeSeoUrl,
|
|
1205
1208
|
R as addressKeys,
|
|
1206
|
-
|
|
1209
|
+
L as cartKeys,
|
|
1207
1210
|
B as categoryKeys,
|
|
1208
1211
|
F as contextKeys,
|
|
1209
1212
|
j as countryKeys,
|
|
1210
|
-
|
|
1213
|
+
I as customerKeys,
|
|
1211
1214
|
dt as getProductVariantForOptions,
|
|
1212
1215
|
ee as languageKey,
|
|
1213
1216
|
b as navigationKeys,
|
|
@@ -1215,7 +1218,7 @@ export {
|
|
|
1215
1218
|
N as paymentKeys,
|
|
1216
1219
|
w as productKeys,
|
|
1217
1220
|
je as readPaymentMethodOperation,
|
|
1218
|
-
|
|
1221
|
+
it as readShippingMethodOperation,
|
|
1219
1222
|
V as relativizeSeoUrl,
|
|
1220
1223
|
E as salutationKeys,
|
|
1221
1224
|
T as seoUrlKeys,
|
|
@@ -1268,7 +1271,7 @@ export {
|
|
|
1268
1271
|
$t as useReadNavigationQuery,
|
|
1269
1272
|
Ee as useReadNavigationQueryOptions,
|
|
1270
1273
|
ce as useReadOrderQuery,
|
|
1271
|
-
|
|
1274
|
+
oe as useReadOrderQueryOptions,
|
|
1272
1275
|
$e as useReadPaymentMethodQuery,
|
|
1273
1276
|
Ve as useReadPaymentMethodQueryOptions,
|
|
1274
1277
|
Yt as useReadProductQuery,
|
|
@@ -1278,7 +1281,7 @@ export {
|
|
|
1278
1281
|
_t as useReadSeoUrlQuery,
|
|
1279
1282
|
ut as useReadSeoUrlQueryOptions,
|
|
1280
1283
|
ct as useReadShippingMethodQuery,
|
|
1281
|
-
|
|
1284
|
+
ot as useReadShippingMethodQueryOptions,
|
|
1282
1285
|
Vt as useRecoveryPasswordMutation,
|
|
1283
1286
|
Nt as useRegisterConfirmMutation,
|
|
1284
1287
|
bt as useRegisterCustomerMutation,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/
|
|
|
2
2
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
3
3
|
import { unref } from 'vue'
|
|
4
4
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
|
-
import { contextKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, contextKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const updateContextOperation = 'updateContext patch /context' satisfies OperationKey
|
|
@@ -29,7 +29,10 @@ export function useUpdateContextMutation(
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
onSuccess: async (newContext, variables, context) => {
|
|
32
|
-
await
|
|
32
|
+
await Promise.all([
|
|
33
|
+
queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
|
|
34
|
+
queryClient.invalidateQueries({ queryKey: cartKeys.get() }),
|
|
35
|
+
])
|
|
33
36
|
|
|
34
37
|
await unref(unref(mutationOptions)?.onSuccess)?.(newContext, variables, context)
|
|
35
38
|
},
|