@teamnovu/kit-shopware-composables 0.0.30 → 0.0.31
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,7 +9,7 @@ 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"]
|
|
@@ -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,7 +228,7 @@ 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
|
|
@@ -243,15 +243,15 @@ 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
|
}
|
|
@@ -267,7 +267,7 @@ 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(() => {
|
|
@@ -283,7 +283,7 @@ function Qt() {
|
|
|
283
283
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
284
284
|
(M) => {
|
|
285
285
|
var O;
|
|
286
|
-
return M.id !== ((O =
|
|
286
|
+
return M.id !== ((O = i.value) == null ? void 0 : O.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(() => {
|
|
@@ -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
401
|
billingAddress: O,
|
|
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;
|
|
@@ -433,8 +433,8 @@ function Ot(e) {
|
|
|
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
|
}
|
|
@@ -445,19 +445,19 @@ function Kt(e) {
|
|
|
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,8 @@ 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 t.invalidateQueries({ queryKey: b.lists() }), await ((
|
|
481
|
+
var u, i;
|
|
482
|
+
t.setQueryData(L.get(), n), await t.invalidateQueries({ queryKey: b.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
483
483
|
}
|
|
484
484
|
});
|
|
485
485
|
}
|
|
@@ -506,8 +506,8 @@ function Ft(e) {
|
|
|
506
506
|
body: n
|
|
507
507
|
}),
|
|
508
508
|
onSuccess: async (n, r, a) => {
|
|
509
|
-
var u,
|
|
510
|
-
t.setQueryData(L.get(), n), await ((
|
|
509
|
+
var u, i;
|
|
510
|
+
t.setQueryData(L.get(), n), await t.invalidateQueries({ queryKey: b.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
511
511
|
}
|
|
512
512
|
});
|
|
513
513
|
}
|
|
@@ -520,8 +520,8 @@ function Lt(e) {
|
|
|
520
520
|
body: n
|
|
521
521
|
}),
|
|
522
522
|
onSuccess: async (n, r, a) => {
|
|
523
|
-
var u,
|
|
524
|
-
t.setQueryData(L.get(), n), await ((
|
|
523
|
+
var u, i;
|
|
524
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
525
525
|
}
|
|
526
526
|
});
|
|
527
527
|
}
|
|
@@ -532,13 +532,13 @@ function It(e) {
|
|
|
532
532
|
...e,
|
|
533
533
|
mutationFn: async (n) => s.query(ve, y(n)),
|
|
534
534
|
onSuccess: async (n, r, a) => {
|
|
535
|
-
var u,
|
|
535
|
+
var u, i;
|
|
536
536
|
await Promise.all([
|
|
537
537
|
// Clear cart after successful order creation
|
|
538
538
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
539
539
|
// Invalidate order list to refetch data
|
|
540
540
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
541
|
-
]), await ((
|
|
541
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
542
542
|
}
|
|
543
543
|
});
|
|
544
544
|
}
|
|
@@ -579,8 +579,8 @@ function Dt(e) {
|
|
|
579
579
|
...e,
|
|
580
580
|
mutationFn: async (n) => s.query(Pe, y(n)),
|
|
581
581
|
onSuccess: async (n, r, a) => {
|
|
582
|
-
var u,
|
|
583
|
-
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey:
|
|
582
|
+
var u, i;
|
|
583
|
+
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
584
|
}
|
|
585
585
|
});
|
|
586
586
|
}
|
|
@@ -591,11 +591,11 @@ function bt(e) {
|
|
|
591
591
|
...e,
|
|
592
592
|
mutationFn: async (n) => s.query(Me, y(n)),
|
|
593
593
|
onSuccess: async (n, r, a) => {
|
|
594
|
-
var u,
|
|
594
|
+
var u, i;
|
|
595
595
|
await Promise.all([
|
|
596
596
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
597
|
-
t.invalidateQueries({ queryKey:
|
|
598
|
-
]), await ((
|
|
597
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
598
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
599
599
|
}
|
|
600
600
|
});
|
|
601
601
|
}
|
|
@@ -611,12 +611,12 @@ function kt(e) {
|
|
|
611
611
|
return a && (s.contextToken = a), r.json();
|
|
612
612
|
},
|
|
613
613
|
onSuccess: async (n, r, a) => {
|
|
614
|
-
var u,
|
|
614
|
+
var u, i;
|
|
615
615
|
await Promise.all([
|
|
616
|
-
t.resetQueries({ queryKey:
|
|
616
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
617
617
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
618
618
|
t.invalidateQueries({ queryKey: I.all() })
|
|
619
|
-
]), await ((
|
|
619
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
620
620
|
}
|
|
621
621
|
});
|
|
622
622
|
}
|
|
@@ -627,25 +627,25 @@ function Bt(e) {
|
|
|
627
627
|
...e,
|
|
628
628
|
mutationFn: async (n) => s.query(Ke, y(n)),
|
|
629
629
|
onSuccess: async (n, r, a) => {
|
|
630
|
-
var u,
|
|
630
|
+
var u, i;
|
|
631
631
|
await Promise.all([
|
|
632
|
-
t.resetQueries({ queryKey:
|
|
632
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
633
633
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
634
634
|
t.invalidateQueries({ queryKey: I.all() })
|
|
635
|
-
]), await ((
|
|
635
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
636
636
|
}
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
|
-
const
|
|
640
|
-
function
|
|
639
|
+
const we = "readCustomer post /account/customer";
|
|
640
|
+
function Ae(e) {
|
|
641
641
|
const s = g(), t = I.detail(c(() => y(e).body ?? {}));
|
|
642
642
|
return v({
|
|
643
643
|
queryKey: t,
|
|
644
|
-
queryFn: async () => s.query(
|
|
644
|
+
queryFn: async () => s.query(we, y(e))
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
function Re(e) {
|
|
648
|
-
return q(
|
|
648
|
+
return q(Ae(e));
|
|
649
649
|
}
|
|
650
650
|
const Fe = "register post /account/register";
|
|
651
651
|
function Nt(e) {
|
|
@@ -654,11 +654,11 @@ function Nt(e) {
|
|
|
654
654
|
...e,
|
|
655
655
|
mutationFn: async (n) => s.query(Fe, y(n)),
|
|
656
656
|
onSuccess: async (n, r, a) => {
|
|
657
|
-
var u,
|
|
657
|
+
var u, i;
|
|
658
658
|
await Promise.all([
|
|
659
|
-
t.resetQueries({ queryKey:
|
|
659
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
660
660
|
t.invalidateQueries({ queryKey: I.all() })
|
|
661
|
-
]), await ((
|
|
661
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
@@ -669,11 +669,11 @@ function Tt(e) {
|
|
|
669
669
|
...e,
|
|
670
670
|
mutationFn: async (n) => s.query(Le, y(n)),
|
|
671
671
|
onSuccess: async (n, r, a) => {
|
|
672
|
-
var u,
|
|
672
|
+
var u, i;
|
|
673
673
|
await Promise.all([
|
|
674
674
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
675
|
-
t.invalidateQueries({ queryKey:
|
|
676
|
-
]), await ((
|
|
675
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
676
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
677
677
|
}
|
|
678
678
|
});
|
|
679
679
|
}
|
|
@@ -684,11 +684,11 @@ function Et(e) {
|
|
|
684
684
|
...e,
|
|
685
685
|
mutationFn: async (n) => s.query(Ie, y(n)),
|
|
686
686
|
onSuccess: async (n, r, a) => {
|
|
687
|
-
var u,
|
|
687
|
+
var u, i;
|
|
688
688
|
await Promise.all([
|
|
689
689
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
690
|
-
t.invalidateQueries({ queryKey:
|
|
691
|
-
]), await ((
|
|
690
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
691
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
692
692
|
}
|
|
693
693
|
});
|
|
694
694
|
}
|
|
@@ -699,12 +699,12 @@ function jt(e) {
|
|
|
699
699
|
...e,
|
|
700
700
|
mutationFn: async (n) => s.query(xe, y(n)),
|
|
701
701
|
onSuccess: async (n, r, a) => {
|
|
702
|
-
var u,
|
|
702
|
+
var u, i;
|
|
703
703
|
await Promise.all([
|
|
704
704
|
t.resetQueries({ queryKey: I.all() }),
|
|
705
|
-
t.resetQueries({ queryKey:
|
|
705
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
706
706
|
t.resetQueries({ queryKey: L.get() })
|
|
707
|
-
]), await ((
|
|
707
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
708
708
|
}
|
|
709
709
|
});
|
|
710
710
|
}
|
|
@@ -721,7 +721,7 @@ function Vt(e) {
|
|
|
721
721
|
},
|
|
722
722
|
onSuccess: async (t, n, r) => {
|
|
723
723
|
var a, u;
|
|
724
|
-
await ((u =
|
|
724
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
725
725
|
}
|
|
726
726
|
});
|
|
727
727
|
}
|
|
@@ -733,7 +733,7 @@ function $t(e) {
|
|
|
733
733
|
mutationFn: async (t) => s.query(De, y(t)),
|
|
734
734
|
onSuccess: async (t, n, r) => {
|
|
735
735
|
var a, u;
|
|
736
|
-
await ((u =
|
|
736
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
737
737
|
}
|
|
738
738
|
});
|
|
739
739
|
}
|
|
@@ -745,7 +745,7 @@ function zt(e) {
|
|
|
745
745
|
mutationFn: async (t) => s.query(be, y(t)),
|
|
746
746
|
onSuccess: async (t, n, r) => {
|
|
747
747
|
var a, u;
|
|
748
|
-
await ((u =
|
|
748
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
}
|
|
@@ -768,7 +768,7 @@ function Ht(e) {
|
|
|
768
768
|
mutationFn: async (t) => s.query(Ne, y(t)),
|
|
769
769
|
onSuccess: async (t, n, r) => {
|
|
770
770
|
var a, u;
|
|
771
|
-
await ((u =
|
|
771
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
772
772
|
}
|
|
773
773
|
});
|
|
774
774
|
}
|
|
@@ -777,11 +777,11 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
777
777
|
return v({
|
|
778
778
|
queryKey: a,
|
|
779
779
|
queryFn: async ({ signal: u }) => {
|
|
780
|
-
const
|
|
780
|
+
const i = o(s), f = o(t), P = y(n);
|
|
781
781
|
return r.query(Te, {
|
|
782
782
|
...P,
|
|
783
783
|
params: {
|
|
784
|
-
activeId:
|
|
784
|
+
activeId: i,
|
|
785
785
|
rootId: f
|
|
786
786
|
},
|
|
787
787
|
signal: u
|
|
@@ -816,8 +816,8 @@ function Jt(e) {
|
|
|
816
816
|
...e,
|
|
817
817
|
mutationFn: async (n) => s.query(ze, y(n)),
|
|
818
818
|
onSuccess: async (n, r, a) => {
|
|
819
|
-
var u,
|
|
820
|
-
await t.invalidateQueries({ queryKey: L.get() }), await ((
|
|
819
|
+
var u, i;
|
|
820
|
+
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
821
|
}
|
|
822
822
|
});
|
|
823
823
|
}
|
|
@@ -828,8 +828,8 @@ function Xt(e) {
|
|
|
828
828
|
...e,
|
|
829
829
|
mutationFn: async (n) => s.query(Ge, y(n)),
|
|
830
830
|
onSuccess: async (n, r, a) => {
|
|
831
|
-
var u,
|
|
832
|
-
await t.invalidateQueries({ queryKey: U.all() }), await ((
|
|
831
|
+
var u, i;
|
|
832
|
+
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
833
|
}
|
|
834
834
|
});
|
|
835
835
|
}
|
|
@@ -857,7 +857,7 @@ function Xe(e, s) {
|
|
|
857
857
|
...a,
|
|
858
858
|
params: {
|
|
859
859
|
...a.params,
|
|
860
|
-
seoUrl: V(
|
|
860
|
+
seoUrl: V(o(e))
|
|
861
861
|
},
|
|
862
862
|
signal: r
|
|
863
863
|
});
|
|
@@ -878,7 +878,7 @@ function Ze(e, s) {
|
|
|
878
878
|
...a,
|
|
879
879
|
params: {
|
|
880
880
|
...a.params,
|
|
881
|
-
seoUrl: V(
|
|
881
|
+
seoUrl: V(o(e))
|
|
882
882
|
},
|
|
883
883
|
signal: r
|
|
884
884
|
});
|
|
@@ -950,7 +950,7 @@ function ut(e, s) {
|
|
|
950
950
|
...a,
|
|
951
951
|
params: {
|
|
952
952
|
...a.params,
|
|
953
|
-
productId:
|
|
953
|
+
productId: o(e)
|
|
954
954
|
},
|
|
955
955
|
signal: r
|
|
956
956
|
});
|
|
@@ -960,13 +960,13 @@ function ut(e, s) {
|
|
|
960
960
|
function sn(e, s) {
|
|
961
961
|
return q(ut(e, s));
|
|
962
962
|
}
|
|
963
|
-
const
|
|
963
|
+
const it = "readSalutation post /salutation", ot = function(s) {
|
|
964
964
|
const t = g(), n = E.list(s);
|
|
965
965
|
return v({
|
|
966
966
|
queryKey: n,
|
|
967
967
|
queryFn: async ({ signal: r }) => {
|
|
968
968
|
const a = y(s);
|
|
969
|
-
return t.query(
|
|
969
|
+
return t.query(it, {
|
|
970
970
|
...a,
|
|
971
971
|
signal: r
|
|
972
972
|
});
|
|
@@ -974,7 +974,7 @@ const ot = "readSalutation post /salutation", it = function(s) {
|
|
|
974
974
|
});
|
|
975
975
|
};
|
|
976
976
|
function rn(e) {
|
|
977
|
-
return q(
|
|
977
|
+
return q(ot(e));
|
|
978
978
|
}
|
|
979
979
|
const ct = "readSeoUrl post /seo-url", lt = function(s) {
|
|
980
980
|
const t = g(), n = T.list(s);
|
|
@@ -1014,14 +1014,14 @@ function un() {
|
|
|
1014
1014
|
query: {
|
|
1015
1015
|
onlyAvailable: !0
|
|
1016
1016
|
}
|
|
1017
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1018
|
-
paymentMethodId:
|
|
1017
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1018
|
+
paymentMethodId: i
|
|
1019
1019
|
}), a = c(() => {
|
|
1020
|
-
var
|
|
1021
|
-
return (f = (
|
|
1020
|
+
var i, f;
|
|
1021
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
|
|
1022
1022
|
}), u = c(() => {
|
|
1023
|
-
var
|
|
1024
|
-
return ((P = (f = (
|
|
1023
|
+
var i, f, P;
|
|
1024
|
+
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
1025
|
});
|
|
1026
1026
|
return {
|
|
1027
1027
|
contextUpdateMutation: s,
|
|
@@ -1038,14 +1038,14 @@ function on() {
|
|
|
1038
1038
|
query: {
|
|
1039
1039
|
onlyAvailable: !0
|
|
1040
1040
|
}
|
|
1041
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1042
|
-
shippingMethodId:
|
|
1041
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1042
|
+
shippingMethodId: i
|
|
1043
1043
|
}), a = c(() => {
|
|
1044
|
-
var
|
|
1045
|
-
return (f = (
|
|
1044
|
+
var i, f;
|
|
1045
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
|
|
1046
1046
|
}), u = c(() => {
|
|
1047
|
-
var
|
|
1048
|
-
return ((f = (
|
|
1047
|
+
var i, f;
|
|
1048
|
+
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
1049
|
});
|
|
1050
1050
|
return {
|
|
1051
1051
|
contextUpdateMutation: s,
|
|
@@ -1072,7 +1072,7 @@ const gt = (e, s) => {
|
|
|
1072
1072
|
});
|
|
1073
1073
|
return (t, n) => {
|
|
1074
1074
|
const r = [n, ...s.value];
|
|
1075
|
-
return gt(
|
|
1075
|
+
return gt(o(t), o(r));
|
|
1076
1076
|
};
|
|
1077
1077
|
};
|
|
1078
1078
|
function ln(e) {
|
|
@@ -1081,31 +1081,31 @@ function ln(e) {
|
|
|
1081
1081
|
total: s ?? 0,
|
|
1082
1082
|
limit: t,
|
|
1083
1083
|
totalCountMode: r
|
|
1084
|
-
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))),
|
|
1084
|
+
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))), i = c({
|
|
1085
1085
|
get() {
|
|
1086
1086
|
return a.page;
|
|
1087
1087
|
},
|
|
1088
1088
|
set(O) {
|
|
1089
|
-
a.page = Math.max(1, Math.min(
|
|
1089
|
+
a.page = Math.max(1, Math.min(o(u), O));
|
|
1090
1090
|
}
|
|
1091
1091
|
});
|
|
1092
1092
|
H(
|
|
1093
|
-
[() =>
|
|
1093
|
+
[() => o(u), () => a],
|
|
1094
1094
|
([O, p]) => {
|
|
1095
1095
|
a.page = Math.min(O, a.page), a.total = p.total ?? 0, a.limit = p.limit;
|
|
1096
1096
|
}
|
|
1097
1097
|
);
|
|
1098
|
-
const f = c(() => a.page ===
|
|
1098
|
+
const f = c(() => a.page === o(u)), P = c(() => a.page === 1), d = c(() => ({
|
|
1099
1099
|
p: a.page,
|
|
1100
1100
|
limit: a.limit,
|
|
1101
1101
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
1102
1102
|
})), M = (O) => {
|
|
1103
|
-
H(() =>
|
|
1103
|
+
H(() => o(O), (p) => {
|
|
1104
1104
|
p && (a.total = (p == null ? void 0 : p.total) ?? 0, a.limit = (p == null ? void 0 : p.limit) ?? 0);
|
|
1105
1105
|
});
|
|
1106
1106
|
};
|
|
1107
1107
|
return {
|
|
1108
|
-
page: i
|
|
1108
|
+
page: o(i),
|
|
1109
1109
|
total: W(a, "total"),
|
|
1110
1110
|
limit: W(a, "limit"),
|
|
1111
1111
|
pageCount: u,
|
|
@@ -1133,8 +1133,8 @@ function dn(e) {
|
|
|
1133
1133
|
return (p = e.value) == null ? void 0 : p.calculatedCheapestPrice;
|
|
1134
1134
|
}), t = c(
|
|
1135
1135
|
() => {
|
|
1136
|
-
var p, S,
|
|
1137
|
-
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 0 ? (R = (
|
|
1136
|
+
var p, S, w, R, l;
|
|
1137
|
+
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
1138
|
}
|
|
1139
1139
|
), n = c(() => {
|
|
1140
1140
|
var p;
|
|
@@ -1144,15 +1144,15 @@ function dn(e) {
|
|
|
1144
1144
|
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 1;
|
|
1145
1145
|
}), a = c(
|
|
1146
1146
|
() => {
|
|
1147
|
-
var p, S,
|
|
1148
|
-
return !!((p = e.value) != null && p.parentId) && ((
|
|
1147
|
+
var p, S, w, R, l, m;
|
|
1148
|
+
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
1149
|
}
|
|
1150
1150
|
), u = c(
|
|
1151
1151
|
() => {
|
|
1152
1152
|
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((
|
|
1153
|
+
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
1154
|
}
|
|
1155
|
-
),
|
|
1155
|
+
), i = c(
|
|
1156
1156
|
() => {
|
|
1157
1157
|
var p;
|
|
1158
1158
|
return (p = u.value) == null ? void 0 : p.unitPrice;
|
|
@@ -1169,14 +1169,14 @@ function dn(e) {
|
|
|
1169
1169
|
return !!((S = (p = u.value) == null ? void 0 : p.listPrice) != null && S.percentage);
|
|
1170
1170
|
}), M = c(
|
|
1171
1171
|
() => {
|
|
1172
|
-
var p, S,
|
|
1173
|
-
return (
|
|
1172
|
+
var p, S, w;
|
|
1173
|
+
return (w = (S = (p = e.value) == null ? void 0 : p.calculatedPrice) == null ? void 0 : S.regulationPrice) == null ? void 0 : w.price;
|
|
1174
1174
|
}
|
|
1175
1175
|
), O = c(() => X(e.value));
|
|
1176
1176
|
return {
|
|
1177
1177
|
price: P,
|
|
1178
1178
|
totalPrice: f,
|
|
1179
|
-
unitPrice:
|
|
1179
|
+
unitPrice: i,
|
|
1180
1180
|
displayFromVariants: a,
|
|
1181
1181
|
displayFrom: r,
|
|
1182
1182
|
tierPrices: O,
|
|
@@ -1197,12 +1197,12 @@ function mt(e, s) {
|
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
1199
|
function yn(e, s) {
|
|
1200
|
-
return c(() => mt(
|
|
1200
|
+
return c(() => mt(o(e), o(s)));
|
|
1201
1201
|
}
|
|
1202
1202
|
function pn(e) {
|
|
1203
1203
|
return c(() => {
|
|
1204
1204
|
var s, t, n, r, a, u;
|
|
1205
|
-
return !!((t = (s =
|
|
1205
|
+
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
1206
|
});
|
|
1207
1207
|
}
|
|
1208
1208
|
function gn(e) {
|
|
@@ -1227,7 +1227,7 @@ function gn(e) {
|
|
|
1227
1227
|
var d;
|
|
1228
1228
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
|
|
1229
1229
|
}
|
|
1230
|
-
),
|
|
1230
|
+
), i = c(
|
|
1231
1231
|
() => {
|
|
1232
1232
|
var d;
|
|
1233
1233
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
|
|
@@ -1250,7 +1250,7 @@ function gn(e) {
|
|
|
1250
1250
|
isCustomerSession: r,
|
|
1251
1251
|
isGuestSession: a,
|
|
1252
1252
|
defaultBillingAddressId: u,
|
|
1253
|
-
defaultShippingAddressId:
|
|
1253
|
+
defaultShippingAddressId: i,
|
|
1254
1254
|
userDefaultBillingAddress: f,
|
|
1255
1255
|
userDefaultShippingAddress: P,
|
|
1256
1256
|
// Expose queries and mutations directly
|
|
@@ -1262,7 +1262,7 @@ export {
|
|
|
1262
1262
|
F as addressKeys,
|
|
1263
1263
|
L as cartKeys,
|
|
1264
1264
|
B as categoryKeys,
|
|
1265
|
-
|
|
1265
|
+
A as contextKeys,
|
|
1266
1266
|
j as countryKeys,
|
|
1267
1267
|
I as customerKeys,
|
|
1268
1268
|
mt as getProductVariantForOptions,
|
|
@@ -1279,7 +1279,7 @@ export {
|
|
|
1279
1279
|
N as shippingKeys,
|
|
1280
1280
|
_ as shopwareClientKey,
|
|
1281
1281
|
y as unrefOptions,
|
|
1282
|
-
|
|
1282
|
+
At as useAddLineItemMutation,
|
|
1283
1283
|
Dt as useChangeEmailMutation,
|
|
1284
1284
|
zt as useChangePasswordMutation,
|
|
1285
1285
|
bt as useChangeProfileMutation,
|
|
@@ -1319,13 +1319,13 @@ export {
|
|
|
1319
1319
|
Ze as useReadCustomProductDetailOptions,
|
|
1320
1320
|
_t as useReadCustomProductDetailQuery,
|
|
1321
1321
|
Re as useReadCustomerQuery,
|
|
1322
|
-
|
|
1322
|
+
Ae as useReadCustomerQueryOptions,
|
|
1323
1323
|
xt as useReadLanguageQuery,
|
|
1324
1324
|
Se as useReadLanguageQueryOptions,
|
|
1325
1325
|
Wt as useReadNavigationQuery,
|
|
1326
1326
|
Ee as useReadNavigationQueryOptions,
|
|
1327
1327
|
ce as useReadOrderQuery,
|
|
1328
|
-
|
|
1328
|
+
oe as useReadOrderQueryOptions,
|
|
1329
1329
|
$e as useReadPaymentMethodQuery,
|
|
1330
1330
|
Ve as useReadPaymentMethodQueryOptions,
|
|
1331
1331
|
sn as useReadProductDetailQuery,
|
|
@@ -1333,7 +1333,7 @@ export {
|
|
|
1333
1333
|
nn as useReadProductQuery,
|
|
1334
1334
|
rt as useReadProductQueryOptions,
|
|
1335
1335
|
rn as useReadSalutationQuery,
|
|
1336
|
-
|
|
1336
|
+
ot as useReadSalutationQueryOptions,
|
|
1337
1337
|
an as useReadSeoUrlQuery,
|
|
1338
1338
|
lt as useReadSeoUrlQueryOptions,
|
|
1339
1339
|
pt as useReadShippingMethodQuery,
|
|
@@ -1351,7 +1351,7 @@ export {
|
|
|
1351
1351
|
on as useShippingMethods,
|
|
1352
1352
|
g as useShopwareQueryClient,
|
|
1353
1353
|
$ as useUpdateContextMutation,
|
|
1354
|
-
|
|
1354
|
+
wt as useUpdateCustomerAddressMutation,
|
|
1355
1355
|
Lt as useUpdateLineItemMutation,
|
|
1356
1356
|
gn as useUser
|
|
1357
1357
|
};
|
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 { cartKeys,
|
|
5
|
+
import { cartKeys, paymentKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const addCartItemOperation = 'addLineItem post /checkout/cart/line-item' satisfies OperationKey
|
|
@@ -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 { cartKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, paymentKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const removeCartItemOperation = 'removeLineItem post /checkout/cart/line-item/delete' satisfies OperationKey
|
|
@@ -26,6 +26,7 @@ export function useRemoveLineItemMutation(
|
|
|
26
26
|
},
|
|
27
27
|
onSuccess: async (newCart, variables, context) => {
|
|
28
28
|
queryClient.setQueryData(cartKeys.get(), newCart)
|
|
29
|
+
await queryClient.invalidateQueries({ queryKey: paymentKeys.lists() })
|
|
29
30
|
// queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
30
31
|
await unref(unref(mutationOptions)?.onSuccess)?.(newCart, variables, context)
|
|
31
32
|
},
|