@teamnovu/kit-shopware-composables 0.0.19 → 0.0.21
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,6 +1,6 @@
|
|
|
1
1
|
import { inject as Y, unref as i, computed as c, reactive as Z, watch as H, toRef as W } from "vue";
|
|
2
2
|
import { until as J } from "@vueuse/core";
|
|
3
|
-
import { queryOptions as
|
|
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";
|
|
5
5
|
const _ = Symbol("shopwareClient");
|
|
6
6
|
function g() {
|
|
@@ -76,7 +76,7 @@ const F = {
|
|
|
76
76
|
body: e
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
|
-
},
|
|
79
|
+
}, I = {
|
|
80
80
|
get: () => ["cart"]
|
|
81
81
|
}, L = {
|
|
82
82
|
all: () => ["customer"],
|
|
@@ -170,7 +170,7 @@ function ne(e) {
|
|
|
170
170
|
var n;
|
|
171
171
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
172
172
|
}));
|
|
173
|
-
return
|
|
173
|
+
return P({
|
|
174
174
|
queryKey: t,
|
|
175
175
|
queryFn: ({ signal: n }) => s.query(te, {
|
|
176
176
|
...p(e),
|
|
@@ -179,14 +179,14 @@ function ne(e) {
|
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
function se(e) {
|
|
182
|
-
return
|
|
182
|
+
return Q(ne(e));
|
|
183
183
|
}
|
|
184
184
|
const V = (e) => {
|
|
185
185
|
const s = e.replace(/\/?$/, "");
|
|
186
186
|
return s.startsWith("/") ? s.slice(1) : s;
|
|
187
187
|
}, ft = (e) => `/${V(e)}`;
|
|
188
|
-
function
|
|
189
|
-
const n =
|
|
188
|
+
function vt(e, s, t) {
|
|
189
|
+
const n = C();
|
|
190
190
|
return {
|
|
191
191
|
onMutate: async (r) => {
|
|
192
192
|
await n.cancelQueries({ queryKey: e });
|
|
@@ -214,7 +214,7 @@ function ht(e, s, t) {
|
|
|
214
214
|
const re = "readContext get /context";
|
|
215
215
|
function ae(e) {
|
|
216
216
|
const s = g();
|
|
217
|
-
return
|
|
217
|
+
return P({
|
|
218
218
|
queryKey: F.all(),
|
|
219
219
|
queryFn: ({ signal: t }) => s.query(re, {
|
|
220
220
|
...p(e),
|
|
@@ -223,12 +223,12 @@ function ae(e) {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
function k(e) {
|
|
226
|
-
return
|
|
226
|
+
return Q(ae(e));
|
|
227
227
|
}
|
|
228
228
|
const ue = "updateContext patch /context";
|
|
229
229
|
function $(e) {
|
|
230
|
-
const s = g(), t =
|
|
231
|
-
return
|
|
230
|
+
const s = g(), t = C();
|
|
231
|
+
return v({
|
|
232
232
|
...e,
|
|
233
233
|
mutationFn: async (n) => (t.cancelQueries({ queryKey: F.all() }), s.query(ue, {
|
|
234
234
|
body: n
|
|
@@ -239,7 +239,7 @@ function $(e) {
|
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ht() {
|
|
243
243
|
const e = $(), s = k(), t = se(), n = c(() => s.isFetching.value || e.isPending.value), r = async (d) => {
|
|
244
244
|
await e.mutateAsync({
|
|
245
245
|
billingAddressId: d.id
|
|
@@ -262,7 +262,7 @@ function vt() {
|
|
|
262
262
|
return M.id !== ((O = u.value) == null ? void 0 : O.id);
|
|
263
263
|
}
|
|
264
264
|
)) ?? [];
|
|
265
|
-
}),
|
|
265
|
+
}), S = c(() => {
|
|
266
266
|
var d;
|
|
267
267
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
268
268
|
(M) => {
|
|
@@ -281,13 +281,13 @@ function vt() {
|
|
|
281
281
|
activeBillingAddress: u,
|
|
282
282
|
activeShippingAddress: o,
|
|
283
283
|
inactiveBillingAddresses: f,
|
|
284
|
-
inactiveShippingAddresses:
|
|
284
|
+
inactiveShippingAddresses: S
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
const oe = "readOrder post /order";
|
|
288
288
|
function ie(e) {
|
|
289
289
|
const s = g(), t = U.detail(e);
|
|
290
|
-
return
|
|
290
|
+
return P({
|
|
291
291
|
queryKey: t,
|
|
292
292
|
queryFn: async ({ signal: n }) => {
|
|
293
293
|
const r = p(e);
|
|
@@ -299,7 +299,7 @@ function ie(e) {
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
function ce(e) {
|
|
302
|
-
return
|
|
302
|
+
return Q(ie(e));
|
|
303
303
|
}
|
|
304
304
|
function qt(e, s) {
|
|
305
305
|
const t = c(() => {
|
|
@@ -319,8 +319,8 @@ function qt(e, s) {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
}), n = ce(t.value), r = c(() => {
|
|
322
|
-
var l, m, q,
|
|
323
|
-
return (
|
|
322
|
+
var l, m, q, x;
|
|
323
|
+
return (x = (q = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : q.elements) == null ? void 0 : x[0];
|
|
324
324
|
}), a = c(() => {
|
|
325
325
|
var l, m;
|
|
326
326
|
return ((m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.paymentChangeable) || {};
|
|
@@ -333,25 +333,25 @@ function qt(e, s) {
|
|
|
333
333
|
}), f = c(() => {
|
|
334
334
|
var l, m;
|
|
335
335
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.totalPrice;
|
|
336
|
-
}),
|
|
336
|
+
}), S = c(() => {
|
|
337
337
|
var l, m;
|
|
338
338
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.positionPrice;
|
|
339
339
|
}), d = c(() => {
|
|
340
340
|
var l;
|
|
341
341
|
return (l = r.value) == null ? void 0 : l.shippingTotal;
|
|
342
342
|
}), M = c(() => {
|
|
343
|
-
var l, m, q,
|
|
343
|
+
var l, m, q, x, z, G;
|
|
344
344
|
return {
|
|
345
345
|
email: (m = (l = r.value) == null ? void 0 : l.orderCustomer) == null ? void 0 : m.email,
|
|
346
|
-
firstName: (
|
|
346
|
+
firstName: (x = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : x.firstName,
|
|
347
347
|
lastName: (G = (z = r.value) == null ? void 0 : z.orderCustomer) == null ? void 0 : G.lastName
|
|
348
348
|
};
|
|
349
349
|
}), O = c(() => {
|
|
350
350
|
var l, m;
|
|
351
351
|
return (m = (l = r.value) == null ? void 0 : l.addresses) == null ? void 0 : m.find(
|
|
352
352
|
({ id: q }) => {
|
|
353
|
-
var
|
|
354
|
-
return q === ((
|
|
353
|
+
var x;
|
|
354
|
+
return q === ((x = r.value) == null ? void 0 : x.billingAddressId);
|
|
355
355
|
}
|
|
356
356
|
);
|
|
357
357
|
}), y = c(
|
|
@@ -359,7 +359,7 @@ function qt(e, s) {
|
|
|
359
359
|
var l, m, q;
|
|
360
360
|
return (q = (m = (l = r.value) == null ? void 0 : l.deliveries) == null ? void 0 : m[0]) == null ? void 0 : q.shippingOrderAddress;
|
|
361
361
|
}
|
|
362
|
-
),
|
|
362
|
+
), h = c(() => {
|
|
363
363
|
var m, q;
|
|
364
364
|
const l = (m = r.value) == null ? void 0 : m.transactions;
|
|
365
365
|
if (l != null && l.length)
|
|
@@ -379,13 +379,13 @@ function qt(e, s) {
|
|
|
379
379
|
status: u,
|
|
380
380
|
statusTechnicalName: o,
|
|
381
381
|
total: f,
|
|
382
|
-
subtotal:
|
|
382
|
+
subtotal: S,
|
|
383
383
|
shippingCosts: d,
|
|
384
384
|
shippingAddress: y,
|
|
385
385
|
billingAddress: O,
|
|
386
386
|
personalDetails: M,
|
|
387
387
|
shippingMethod: K,
|
|
388
|
-
paymentMethod:
|
|
388
|
+
paymentMethod: h,
|
|
389
389
|
paymentChangeable: A,
|
|
390
390
|
orderQuery: n
|
|
391
391
|
};
|
|
@@ -412,8 +412,8 @@ function Ct(e) {
|
|
|
412
412
|
}
|
|
413
413
|
const le = "createCustomerAddress post /account/address";
|
|
414
414
|
function St(e) {
|
|
415
|
-
const s = g(), t =
|
|
416
|
-
return
|
|
415
|
+
const s = g(), t = C();
|
|
416
|
+
return v({
|
|
417
417
|
...e,
|
|
418
418
|
mutationFn: async (n) => s.query(le, p(n)),
|
|
419
419
|
onSuccess: async (n, r, a) => {
|
|
@@ -424,8 +424,8 @@ function St(e) {
|
|
|
424
424
|
}
|
|
425
425
|
const de = "deleteCustomerAddress delete /account/address/{addressId}";
|
|
426
426
|
function Pt(e) {
|
|
427
|
-
const s = g(), t =
|
|
428
|
-
return
|
|
427
|
+
const s = g(), t = C();
|
|
428
|
+
return v({
|
|
429
429
|
...e,
|
|
430
430
|
mutationFn: async (n) => s.query(de, p(n)),
|
|
431
431
|
onSuccess: async (n, r, a) => {
|
|
@@ -436,8 +436,8 @@ function Pt(e) {
|
|
|
436
436
|
}
|
|
437
437
|
const ye = "updateCustomerAddress patch /account/address/{addressId}";
|
|
438
438
|
function Qt(e) {
|
|
439
|
-
const s = g(), t =
|
|
440
|
-
return
|
|
439
|
+
const s = g(), t = C();
|
|
440
|
+
return v({
|
|
441
441
|
...e,
|
|
442
442
|
mutationFn: async (n) => s.query(ye, p(n)),
|
|
443
443
|
onSuccess: async (n, r, a) => {
|
|
@@ -447,7 +447,7 @@ function Qt(e) {
|
|
|
447
447
|
t.invalidateQueries({ queryKey: R.lists() }),
|
|
448
448
|
t.invalidateQueries({
|
|
449
449
|
queryKey: R.detail(p(r).params.addressId),
|
|
450
|
-
predicate: (
|
|
450
|
+
predicate: (S) => S.queryKey.at(-1) !== u
|
|
451
451
|
})
|
|
452
452
|
]), await ((f = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
453
453
|
}
|
|
@@ -455,22 +455,22 @@ function Qt(e) {
|
|
|
455
455
|
}
|
|
456
456
|
const pe = "addLineItem post /checkout/cart/line-item";
|
|
457
457
|
function Mt(e) {
|
|
458
|
-
const s = g(), t =
|
|
459
|
-
return
|
|
458
|
+
const s = g(), t = C();
|
|
459
|
+
return v({
|
|
460
460
|
...e,
|
|
461
461
|
mutationFn: async (n) => s.query(pe, {
|
|
462
462
|
body: n
|
|
463
463
|
}),
|
|
464
464
|
onSuccess: async (n, r, a) => {
|
|
465
465
|
var u, o;
|
|
466
|
-
t.setQueryData(
|
|
466
|
+
t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
467
467
|
}
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
const ge = "readCart get /checkout/cart";
|
|
471
471
|
function me(e) {
|
|
472
|
-
const s = g(), t =
|
|
473
|
-
return
|
|
472
|
+
const s = g(), t = I.get();
|
|
473
|
+
return P({
|
|
474
474
|
queryKey: t,
|
|
475
475
|
queryFn: async ({ signal: n }) => s.query(ge, {
|
|
476
476
|
...p(e),
|
|
@@ -479,45 +479,47 @@ function me(e) {
|
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
481
|
function Ot() {
|
|
482
|
-
return
|
|
482
|
+
return Q(me());
|
|
483
483
|
}
|
|
484
484
|
const fe = "removeLineItem post /checkout/cart/line-item/delete";
|
|
485
485
|
function Kt(e) {
|
|
486
|
-
const s = g(), t =
|
|
487
|
-
return
|
|
486
|
+
const s = g(), t = C();
|
|
487
|
+
return v({
|
|
488
488
|
...e,
|
|
489
489
|
mutationFn: async (n) => s.query(fe, {
|
|
490
490
|
body: n
|
|
491
491
|
}),
|
|
492
492
|
onSuccess: async (n, r, a) => {
|
|
493
493
|
var u, o;
|
|
494
|
-
t.setQueryData(
|
|
494
|
+
t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
497
|
}
|
|
498
|
-
const
|
|
498
|
+
const ve = "updateLineItem patch /checkout/cart/line-item";
|
|
499
499
|
function At(e) {
|
|
500
|
-
const s = g(), t =
|
|
501
|
-
return
|
|
500
|
+
const s = g(), t = C();
|
|
501
|
+
return v({
|
|
502
502
|
...e,
|
|
503
|
-
mutationFn: async (n) => s.query(
|
|
503
|
+
mutationFn: async (n) => s.query(ve, {
|
|
504
504
|
body: n
|
|
505
505
|
}),
|
|
506
506
|
onSuccess: async (n, r, a) => {
|
|
507
507
|
var u, o;
|
|
508
|
-
t.setQueryData(
|
|
508
|
+
t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
509
509
|
}
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
|
-
const
|
|
512
|
+
const he = "createOrder post /checkout/order";
|
|
513
513
|
function wt(e) {
|
|
514
|
-
const s = g(), t =
|
|
515
|
-
return
|
|
514
|
+
const s = g(), t = C();
|
|
515
|
+
return v({
|
|
516
516
|
...e,
|
|
517
|
-
mutationFn: async (n) => s.query(
|
|
517
|
+
mutationFn: async (n) => s.query(he, p(n)),
|
|
518
518
|
onSuccess: async (n, r, a) => {
|
|
519
519
|
var u, o;
|
|
520
520
|
await Promise.all([
|
|
521
|
+
// Clear cart after successful order creation
|
|
522
|
+
t.invalidateQueries({ queryKey: I.get() }),
|
|
521
523
|
// Invalidate order list to refetch data
|
|
522
524
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
523
525
|
]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
@@ -527,7 +529,7 @@ function wt(e) {
|
|
|
527
529
|
const qe = "readLanguages post /language";
|
|
528
530
|
function Ce(e) {
|
|
529
531
|
const s = g();
|
|
530
|
-
return
|
|
532
|
+
return P({
|
|
531
533
|
queryKey: ee.all(),
|
|
532
534
|
queryFn: ({ signal: t }) => s.query(qe, {
|
|
533
535
|
...p(e),
|
|
@@ -536,11 +538,11 @@ function Ce(e) {
|
|
|
536
538
|
});
|
|
537
539
|
}
|
|
538
540
|
function Rt(e) {
|
|
539
|
-
return
|
|
541
|
+
return Q(Ce(e));
|
|
540
542
|
}
|
|
541
543
|
const Se = "readCountry post /country", Pe = function(s) {
|
|
542
544
|
const t = g(), n = j.list(s);
|
|
543
|
-
return
|
|
545
|
+
return P({
|
|
544
546
|
queryKey: n,
|
|
545
547
|
queryFn: async ({ signal: r }) => {
|
|
546
548
|
const a = p(s);
|
|
@@ -552,12 +554,12 @@ const Se = "readCountry post /country", Pe = function(s) {
|
|
|
552
554
|
});
|
|
553
555
|
};
|
|
554
556
|
function Ft(e) {
|
|
555
|
-
return
|
|
557
|
+
return Q(Pe(e));
|
|
556
558
|
}
|
|
557
559
|
const Qe = "changeEmail post /account/change-email";
|
|
558
560
|
function Lt(e) {
|
|
559
|
-
const s = g(), t =
|
|
560
|
-
return
|
|
561
|
+
const s = g(), t = C();
|
|
562
|
+
return v({
|
|
561
563
|
...e,
|
|
562
564
|
mutationFn: async (n) => s.query(Qe, p(n)),
|
|
563
565
|
onSuccess: async (n, r, a) => {
|
|
@@ -568,8 +570,8 @@ function Lt(e) {
|
|
|
568
570
|
}
|
|
569
571
|
const Me = "changeProfile post /account/change-profile";
|
|
570
572
|
function It(e) {
|
|
571
|
-
const s = g(), t =
|
|
572
|
-
return
|
|
573
|
+
const s = g(), t = C();
|
|
574
|
+
return v({
|
|
573
575
|
...e,
|
|
574
576
|
mutationFn: async (n) => s.query(Me, p(n)),
|
|
575
577
|
onSuccess: async (n, r, a) => {
|
|
@@ -583,8 +585,8 @@ function It(e) {
|
|
|
583
585
|
}
|
|
584
586
|
const Oe = "loginCustomer post /account/login";
|
|
585
587
|
function xt(e) {
|
|
586
|
-
const s = g(), t =
|
|
587
|
-
return
|
|
588
|
+
const s = g(), t = C();
|
|
589
|
+
return v({
|
|
588
590
|
...e,
|
|
589
591
|
mutationFn: async (n) => {
|
|
590
592
|
const r = await s.queryRaw(Oe, {
|
|
@@ -596,7 +598,7 @@ function xt(e) {
|
|
|
596
598
|
var u, o;
|
|
597
599
|
await Promise.all([
|
|
598
600
|
t.resetQueries({ queryKey: F.all() }),
|
|
599
|
-
t.invalidateQueries({ queryKey:
|
|
601
|
+
t.invalidateQueries({ queryKey: I.get() }),
|
|
600
602
|
t.invalidateQueries({ queryKey: L.all() })
|
|
601
603
|
]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
602
604
|
}
|
|
@@ -604,15 +606,15 @@ function xt(e) {
|
|
|
604
606
|
}
|
|
605
607
|
const Ke = "logoutCustomer post /account/logout";
|
|
606
608
|
function Ut(e) {
|
|
607
|
-
const s = g(), t =
|
|
608
|
-
return
|
|
609
|
+
const s = g(), t = C();
|
|
610
|
+
return v({
|
|
609
611
|
...e,
|
|
610
612
|
mutationFn: async (n) => s.query(Ke, p(n)),
|
|
611
613
|
onSuccess: async (n, r, a) => {
|
|
612
614
|
var u, o;
|
|
613
615
|
await Promise.all([
|
|
614
616
|
t.resetQueries({ queryKey: F.all() }),
|
|
615
|
-
t.invalidateQueries({ queryKey:
|
|
617
|
+
t.invalidateQueries({ queryKey: I.get() }),
|
|
616
618
|
t.invalidateQueries({ queryKey: L.all() })
|
|
617
619
|
]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
618
620
|
}
|
|
@@ -621,18 +623,18 @@ function Ut(e) {
|
|
|
621
623
|
const Ae = "readCustomer post /account/customer";
|
|
622
624
|
function we(e) {
|
|
623
625
|
const s = g(), t = L.detail(c(() => p(e).body ?? {}));
|
|
624
|
-
return
|
|
626
|
+
return P({
|
|
625
627
|
queryKey: t,
|
|
626
628
|
queryFn: async () => s.query(Ae, p(e))
|
|
627
629
|
});
|
|
628
630
|
}
|
|
629
631
|
function Re(e) {
|
|
630
|
-
return
|
|
632
|
+
return Q(we(e));
|
|
631
633
|
}
|
|
632
634
|
const Fe = "register post /account/register";
|
|
633
635
|
function bt(e) {
|
|
634
|
-
const s = g(), t =
|
|
635
|
-
return
|
|
636
|
+
const s = g(), t = C();
|
|
637
|
+
return v({
|
|
636
638
|
...e,
|
|
637
639
|
mutationFn: async (n) => s.query(Fe, p(n)),
|
|
638
640
|
onSuccess: async (n, r, a) => {
|
|
@@ -643,8 +645,8 @@ function bt(e) {
|
|
|
643
645
|
}
|
|
644
646
|
const Le = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
|
|
645
647
|
function kt(e) {
|
|
646
|
-
const s = g(), t =
|
|
647
|
-
return
|
|
648
|
+
const s = g(), t = C();
|
|
649
|
+
return v({
|
|
648
650
|
...e,
|
|
649
651
|
mutationFn: async (n) => s.query(Le, p(n)),
|
|
650
652
|
onSuccess: async (n, r, a) => {
|
|
@@ -658,8 +660,8 @@ function kt(e) {
|
|
|
658
660
|
}
|
|
659
661
|
const Ie = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
|
|
660
662
|
function Bt(e) {
|
|
661
|
-
const s = g(), t =
|
|
662
|
-
return
|
|
663
|
+
const s = g(), t = C();
|
|
664
|
+
return v({
|
|
663
665
|
...e,
|
|
664
666
|
mutationFn: async (n) => s.query(Ie, p(n)),
|
|
665
667
|
onSuccess: async (n, r, a) => {
|
|
@@ -673,8 +675,8 @@ function Bt(e) {
|
|
|
673
675
|
}
|
|
674
676
|
const xe = "deleteCustomer delete /account/customer";
|
|
675
677
|
function Dt(e) {
|
|
676
|
-
const s = g(), t =
|
|
677
|
-
return
|
|
678
|
+
const s = g(), t = C();
|
|
679
|
+
return v({
|
|
678
680
|
...e,
|
|
679
681
|
mutationFn: async (n) => s.query(xe, p(n)),
|
|
680
682
|
onSuccess: async (n, r, a) => {
|
|
@@ -682,7 +684,7 @@ function Dt(e) {
|
|
|
682
684
|
await Promise.all([
|
|
683
685
|
t.resetQueries({ queryKey: L.all() }),
|
|
684
686
|
t.resetQueries({ queryKey: F.all() }),
|
|
685
|
-
t.resetQueries({ queryKey:
|
|
687
|
+
t.resetQueries({ queryKey: I.get() })
|
|
686
688
|
]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
687
689
|
}
|
|
688
690
|
});
|
|
@@ -690,7 +692,7 @@ function Dt(e) {
|
|
|
690
692
|
const Ue = "registerConfirm post /account/register-confirm";
|
|
691
693
|
function Nt(e) {
|
|
692
694
|
const s = g();
|
|
693
|
-
return
|
|
695
|
+
return v({
|
|
694
696
|
...e,
|
|
695
697
|
mutationFn: async (t) => {
|
|
696
698
|
const n = await s.queryRaw(Ue, {
|
|
@@ -707,7 +709,7 @@ function Nt(e) {
|
|
|
707
709
|
const be = "sendRecoveryMail post /account/recovery-password";
|
|
708
710
|
function Tt(e) {
|
|
709
711
|
const s = g();
|
|
710
|
-
return
|
|
712
|
+
return v({
|
|
711
713
|
...e,
|
|
712
714
|
mutationFn: async (t) => s.query(be, p(t)),
|
|
713
715
|
onSuccess: async (t, n, r) => {
|
|
@@ -719,7 +721,7 @@ function Tt(e) {
|
|
|
719
721
|
const ke = "changePassword post /account/change-password";
|
|
720
722
|
function Et(e) {
|
|
721
723
|
const s = g();
|
|
722
|
-
return
|
|
724
|
+
return v({
|
|
723
725
|
...e,
|
|
724
726
|
mutationFn: async (t) => s.query(ke, p(t)),
|
|
725
727
|
onSuccess: async (t, n, r) => {
|
|
@@ -731,18 +733,18 @@ function Et(e) {
|
|
|
731
733
|
const Be = "imitateCustomerLogin post /account/login/imitate-customer";
|
|
732
734
|
function De(e) {
|
|
733
735
|
const s = g(), t = L.imitateLogin(c(() => p(e).body ?? {}));
|
|
734
|
-
return
|
|
736
|
+
return P({
|
|
735
737
|
queryKey: t,
|
|
736
738
|
queryFn: async () => s.query(Be, p(e))
|
|
737
739
|
});
|
|
738
740
|
}
|
|
739
741
|
function jt(e) {
|
|
740
|
-
return
|
|
742
|
+
return Q(De(e));
|
|
741
743
|
}
|
|
742
744
|
const Ne = "recoveryPassword post /account/recovery-password-confirm";
|
|
743
745
|
function Vt(e) {
|
|
744
746
|
const s = g();
|
|
745
|
-
return
|
|
747
|
+
return v({
|
|
746
748
|
...e,
|
|
747
749
|
mutationFn: async (t) => s.query(Ne, p(t)),
|
|
748
750
|
onSuccess: async (t, n, r) => {
|
|
@@ -753,12 +755,12 @@ function Vt(e) {
|
|
|
753
755
|
}
|
|
754
756
|
const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(s, t, n) {
|
|
755
757
|
const r = g(), a = b.detail(s, t, n);
|
|
756
|
-
return
|
|
758
|
+
return P({
|
|
757
759
|
queryKey: a,
|
|
758
760
|
queryFn: async ({ signal: u }) => {
|
|
759
|
-
const o = i(s), f = i(t),
|
|
761
|
+
const o = i(s), f = i(t), S = p(n);
|
|
760
762
|
return r.query(Te, {
|
|
761
|
-
...
|
|
763
|
+
...S,
|
|
762
764
|
params: {
|
|
763
765
|
activeId: o,
|
|
764
766
|
rootId: f
|
|
@@ -769,7 +771,7 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
769
771
|
});
|
|
770
772
|
};
|
|
771
773
|
function $t(e, s, t) {
|
|
772
|
-
return
|
|
774
|
+
return Q(Ee(e, s, t));
|
|
773
775
|
}
|
|
774
776
|
const je = "readPaymentMethod post /payment-method";
|
|
775
777
|
function Ve(e) {
|
|
@@ -777,7 +779,7 @@ function Ve(e) {
|
|
|
777
779
|
var n;
|
|
778
780
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
779
781
|
}));
|
|
780
|
-
return
|
|
782
|
+
return P({
|
|
781
783
|
queryKey: t,
|
|
782
784
|
queryFn: ({ signal: n }) => s.query(je, {
|
|
783
785
|
...p(e),
|
|
@@ -786,24 +788,24 @@ function Ve(e) {
|
|
|
786
788
|
});
|
|
787
789
|
}
|
|
788
790
|
function $e(e) {
|
|
789
|
-
return
|
|
791
|
+
return Q(Ve(e));
|
|
790
792
|
}
|
|
791
793
|
const ze = "handlePaymentMethod post /handle-payment";
|
|
792
794
|
function zt(e) {
|
|
793
|
-
const s = g();
|
|
794
|
-
return
|
|
795
|
+
const s = g(), t = C();
|
|
796
|
+
return v({
|
|
795
797
|
...e,
|
|
796
|
-
mutationFn: async (
|
|
797
|
-
onSuccess: async (
|
|
798
|
-
var
|
|
799
|
-
await ((
|
|
798
|
+
mutationFn: async (n) => s.query(ze, p(n)),
|
|
799
|
+
onSuccess: async (n, r, a) => {
|
|
800
|
+
var u, o;
|
|
801
|
+
await t.invalidateQueries({ queryKey: I.get() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
800
802
|
}
|
|
801
803
|
});
|
|
802
804
|
}
|
|
803
805
|
const Ge = "orderSetPayment post /order/payment";
|
|
804
806
|
function Gt(e) {
|
|
805
|
-
const s = g(), t =
|
|
806
|
-
return
|
|
807
|
+
const s = g(), t = C();
|
|
808
|
+
return v({
|
|
807
809
|
...e,
|
|
808
810
|
mutationFn: async (n) => s.query(Ge, p(n)),
|
|
809
811
|
onSuccess: async (n, r, a) => {
|
|
@@ -814,7 +816,7 @@ function Gt(e) {
|
|
|
814
816
|
}
|
|
815
817
|
const He = "readCategoryList post /category", We = function(s) {
|
|
816
818
|
const t = g(), n = B.list(s);
|
|
817
|
-
return
|
|
819
|
+
return P({
|
|
818
820
|
queryKey: n,
|
|
819
821
|
queryFn: async ({ signal: r }) => t.query(He, {
|
|
820
822
|
...p(s),
|
|
@@ -823,12 +825,12 @@ const He = "readCategoryList post /category", We = function(s) {
|
|
|
823
825
|
});
|
|
824
826
|
};
|
|
825
827
|
function Ht(e) {
|
|
826
|
-
return
|
|
828
|
+
return Q(We(e));
|
|
827
829
|
}
|
|
828
830
|
const Je = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
829
831
|
function Xe(e, s) {
|
|
830
832
|
const t = g(), n = w.list(e, s);
|
|
831
|
-
return
|
|
833
|
+
return P({
|
|
832
834
|
queryKey: n,
|
|
833
835
|
queryFn: async ({ signal: r }) => {
|
|
834
836
|
const a = p(s);
|
|
@@ -844,12 +846,12 @@ function Xe(e, s) {
|
|
|
844
846
|
});
|
|
845
847
|
}
|
|
846
848
|
function Wt(e, s) {
|
|
847
|
-
return
|
|
849
|
+
return Q(Xe(e, s));
|
|
848
850
|
}
|
|
849
851
|
const Ye = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
850
852
|
function Ze(e, s) {
|
|
851
853
|
const t = g(), n = w.customDetail(e, s);
|
|
852
|
-
return
|
|
854
|
+
return P({
|
|
853
855
|
queryKey: n,
|
|
854
856
|
queryFn: async ({ signal: r }) => {
|
|
855
857
|
const a = p(s);
|
|
@@ -865,12 +867,12 @@ function Ze(e, s) {
|
|
|
865
867
|
});
|
|
866
868
|
}
|
|
867
869
|
function Jt(e, s) {
|
|
868
|
-
return
|
|
870
|
+
return Q(Ze(e, s));
|
|
869
871
|
}
|
|
870
872
|
const _e = "searchPage post /search";
|
|
871
873
|
function et(e) {
|
|
872
874
|
const s = g(), t = w.search(e);
|
|
873
|
-
return
|
|
875
|
+
return P({
|
|
874
876
|
queryKey: t,
|
|
875
877
|
queryFn: async ({ signal: n }) => {
|
|
876
878
|
const r = p(e);
|
|
@@ -882,12 +884,12 @@ function et(e) {
|
|
|
882
884
|
});
|
|
883
885
|
}
|
|
884
886
|
function Xt(e) {
|
|
885
|
-
return
|
|
887
|
+
return Q(et(e));
|
|
886
888
|
}
|
|
887
889
|
const tt = "readProduct post /product";
|
|
888
890
|
function nt(e) {
|
|
889
891
|
const s = g(), t = w.detail(e);
|
|
890
|
-
return
|
|
892
|
+
return P({
|
|
891
893
|
queryKey: t,
|
|
892
894
|
queryFn: async ({ signal: n }) => {
|
|
893
895
|
const r = p(e);
|
|
@@ -899,11 +901,11 @@ function nt(e) {
|
|
|
899
901
|
});
|
|
900
902
|
}
|
|
901
903
|
function Yt(e) {
|
|
902
|
-
return
|
|
904
|
+
return Q(nt(e));
|
|
903
905
|
}
|
|
904
906
|
const st = "readSalutation post /salutation", rt = function(s) {
|
|
905
907
|
const t = g(), n = E.list(s);
|
|
906
|
-
return
|
|
908
|
+
return P({
|
|
907
909
|
queryKey: n,
|
|
908
910
|
queryFn: async ({ signal: r }) => {
|
|
909
911
|
const a = p(s);
|
|
@@ -915,11 +917,11 @@ const st = "readSalutation post /salutation", rt = function(s) {
|
|
|
915
917
|
});
|
|
916
918
|
};
|
|
917
919
|
function Zt(e) {
|
|
918
|
-
return
|
|
920
|
+
return Q(rt(e));
|
|
919
921
|
}
|
|
920
922
|
const at = "readSeoUrl post /seo-url", ut = function(s) {
|
|
921
923
|
const t = g(), n = T.list(s);
|
|
922
|
-
return
|
|
924
|
+
return P({
|
|
923
925
|
queryKey: n,
|
|
924
926
|
queryFn: async ({ signal: r }) => {
|
|
925
927
|
const a = p(s);
|
|
@@ -931,7 +933,7 @@ const at = "readSeoUrl post /seo-url", ut = function(s) {
|
|
|
931
933
|
});
|
|
932
934
|
};
|
|
933
935
|
function _t(e) {
|
|
934
|
-
return
|
|
936
|
+
return Q(ut(e));
|
|
935
937
|
}
|
|
936
938
|
const ot = "readShippingMethod post /shipping-method";
|
|
937
939
|
function it(e) {
|
|
@@ -939,7 +941,7 @@ function it(e) {
|
|
|
939
941
|
var n;
|
|
940
942
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
941
943
|
}));
|
|
942
|
-
return
|
|
944
|
+
return P({
|
|
943
945
|
queryKey: t,
|
|
944
946
|
queryFn: ({ signal: n }) => s.query(ot, {
|
|
945
947
|
...p(e),
|
|
@@ -948,7 +950,7 @@ function it(e) {
|
|
|
948
950
|
});
|
|
949
951
|
}
|
|
950
952
|
function ct(e) {
|
|
951
|
-
return
|
|
953
|
+
return Q(it(e));
|
|
952
954
|
}
|
|
953
955
|
function en() {
|
|
954
956
|
const e = k(), s = $(), t = $e({
|
|
@@ -961,8 +963,8 @@ function en() {
|
|
|
961
963
|
var o, f;
|
|
962
964
|
return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.paymentMethod;
|
|
963
965
|
}), u = c(() => {
|
|
964
|
-
var o, f,
|
|
965
|
-
return ((
|
|
966
|
+
var o, f, S;
|
|
967
|
+
return ((S = (f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements) == null ? void 0 : S.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
|
|
966
968
|
});
|
|
967
969
|
return {
|
|
968
970
|
contextUpdateMutation: s,
|
|
@@ -986,7 +988,7 @@ function tn() {
|
|
|
986
988
|
return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.shippingMethod;
|
|
987
989
|
}), u = c(() => {
|
|
988
990
|
var o, f;
|
|
989
|
-
return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((
|
|
991
|
+
return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((S, d) => (S.position ?? 0) - (d.position ?? 0))) ?? [];
|
|
990
992
|
});
|
|
991
993
|
return {
|
|
992
994
|
contextUpdateMutation: s,
|
|
@@ -1036,7 +1038,7 @@ function sn(e) {
|
|
|
1036
1038
|
a.page = Math.min(O, a.page), a.total = y.total ?? 0, a.limit = y.limit;
|
|
1037
1039
|
}
|
|
1038
1040
|
);
|
|
1039
|
-
const f = c(() => a.page === i(u)),
|
|
1041
|
+
const f = c(() => a.page === i(u)), S = c(() => a.page === 1), d = c(() => ({
|
|
1040
1042
|
p: a.page,
|
|
1041
1043
|
limit: a.limit,
|
|
1042
1044
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
@@ -1051,7 +1053,7 @@ function sn(e) {
|
|
|
1051
1053
|
limit: W(a, "limit"),
|
|
1052
1054
|
pageCount: u,
|
|
1053
1055
|
isLastPage: f,
|
|
1054
|
-
isFirstPage:
|
|
1056
|
+
isFirstPage: S,
|
|
1055
1057
|
usePaginationSync: M,
|
|
1056
1058
|
// This can be used to pass the pagination options directly to the query options
|
|
1057
1059
|
queryOptions: d
|
|
@@ -1074,24 +1076,24 @@ function rn(e) {
|
|
|
1074
1076
|
return (y = e.value) == null ? void 0 : y.calculatedCheapestPrice;
|
|
1075
1077
|
}), t = c(
|
|
1076
1078
|
() => {
|
|
1077
|
-
var y,
|
|
1078
|
-
return (((
|
|
1079
|
+
var y, h, K, A, l;
|
|
1080
|
+
return (((h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.length) ?? 0) > 0 ? (A = (K = e.value) == null ? void 0 : K.calculatedPrices) == null ? void 0 : A[0] : (l = e.value) == null ? void 0 : l.calculatedPrice;
|
|
1079
1081
|
}
|
|
1080
1082
|
), n = c(() => {
|
|
1081
1083
|
var y;
|
|
1082
1084
|
return (y = t == null ? void 0 : t.value) == null ? void 0 : y.referencePrice;
|
|
1083
1085
|
}), r = c(() => {
|
|
1084
|
-
var y,
|
|
1085
|
-
return (((
|
|
1086
|
+
var y, h;
|
|
1087
|
+
return (((h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.length) ?? 0) > 1;
|
|
1086
1088
|
}), a = c(
|
|
1087
1089
|
() => {
|
|
1088
|
-
var y,
|
|
1089
|
-
return !!((y = e.value) != null && y.parentId) && ((K = (
|
|
1090
|
+
var y, h, K, A, l, m;
|
|
1091
|
+
return !!((y = e.value) != null && y.parentId) && ((K = (h = e.value) == null ? void 0 : h.calculatedCheapestPrice) == null ? void 0 : K.hasRange) && ((A = t == null ? void 0 : t.value) == null ? void 0 : A.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);
|
|
1090
1092
|
}
|
|
1091
1093
|
), u = c(
|
|
1092
1094
|
() => {
|
|
1093
|
-
var y,
|
|
1094
|
-
return r.value && X(e.value).length > 1 ? (
|
|
1095
|
+
var y, h;
|
|
1096
|
+
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;
|
|
1095
1097
|
}
|
|
1096
1098
|
), o = c(
|
|
1097
1099
|
() => {
|
|
@@ -1103,19 +1105,19 @@ function rn(e) {
|
|
|
1103
1105
|
var y;
|
|
1104
1106
|
return (y = u.value) == null ? void 0 : y.totalPrice;
|
|
1105
1107
|
}
|
|
1106
|
-
),
|
|
1108
|
+
), S = c(
|
|
1107
1109
|
() => u.value
|
|
1108
1110
|
), d = c(() => {
|
|
1109
|
-
var y,
|
|
1110
|
-
return !!((
|
|
1111
|
+
var y, h;
|
|
1112
|
+
return !!((h = (y = u.value) == null ? void 0 : y.listPrice) != null && h.percentage);
|
|
1111
1113
|
}), M = c(
|
|
1112
1114
|
() => {
|
|
1113
|
-
var y,
|
|
1114
|
-
return (K = (
|
|
1115
|
+
var y, h, K;
|
|
1116
|
+
return (K = (h = (y = e.value) == null ? void 0 : y.calculatedPrice) == null ? void 0 : h.regulationPrice) == null ? void 0 : K.price;
|
|
1115
1117
|
}
|
|
1116
1118
|
), O = c(() => X(e.value));
|
|
1117
1119
|
return {
|
|
1118
|
-
price:
|
|
1120
|
+
price: S,
|
|
1119
1121
|
totalPrice: f,
|
|
1120
1122
|
unitPrice: o,
|
|
1121
1123
|
displayFromVariants: a,
|
|
@@ -1178,7 +1180,7 @@ function on(e) {
|
|
|
1178
1180
|
var d;
|
|
1179
1181
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
|
|
1180
1182
|
}
|
|
1181
|
-
),
|
|
1183
|
+
), S = c(
|
|
1182
1184
|
() => {
|
|
1183
1185
|
var d;
|
|
1184
1186
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddress) || null;
|
|
@@ -1193,7 +1195,7 @@ function on(e) {
|
|
|
1193
1195
|
defaultBillingAddressId: u,
|
|
1194
1196
|
defaultShippingAddressId: o,
|
|
1195
1197
|
userDefaultBillingAddress: f,
|
|
1196
|
-
userDefaultShippingAddress:
|
|
1198
|
+
userDefaultShippingAddress: S,
|
|
1197
1199
|
// Expose queries and mutations directly
|
|
1198
1200
|
customerQuery: s
|
|
1199
1201
|
};
|
|
@@ -1201,7 +1203,7 @@ function on(e) {
|
|
|
1201
1203
|
export {
|
|
1202
1204
|
ft as absolutizeSeoUrl,
|
|
1203
1205
|
R as addressKeys,
|
|
1204
|
-
|
|
1206
|
+
I as cartKeys,
|
|
1205
1207
|
B as categoryKeys,
|
|
1206
1208
|
F as contextKeys,
|
|
1207
1209
|
j as countryKeys,
|
|
@@ -1224,7 +1226,7 @@ export {
|
|
|
1224
1226
|
Lt as useChangeEmailMutation,
|
|
1225
1227
|
Et as useChangePasswordMutation,
|
|
1226
1228
|
It as useChangeProfileMutation,
|
|
1227
|
-
|
|
1229
|
+
ht as useCheckoutAddresses,
|
|
1228
1230
|
St as useCreateCustomerAddressMutation,
|
|
1229
1231
|
wt as useCreateOrderMutation,
|
|
1230
1232
|
kt as useDefaultBillingAddressMutation,
|
|
@@ -1239,7 +1241,7 @@ export {
|
|
|
1239
1241
|
ne as useListAddressQueryOptions,
|
|
1240
1242
|
xt as useLoginCustomerMutation,
|
|
1241
1243
|
Ut as useLogoutCustomerMutation,
|
|
1242
|
-
|
|
1244
|
+
vt as useOptimistic,
|
|
1243
1245
|
qt as useOrderDetails,
|
|
1244
1246
|
Ct as useOrderPayment,
|
|
1245
1247
|
Gt as useOrderSetPaymentMutation,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
2
1
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
|
|
2
|
+
import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
3
|
import { OperationOptions, OperationResponse } from '../types/query';
|
|
4
4
|
declare const handlePaymentOperation = "handlePaymentMethod post /handle-payment";
|
|
5
5
|
export declare function useHandlePaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof handlePaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof handlePaymentOperation>>): UseMutationReturnType<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset">>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient, type UseMutationOptions } 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 { orderKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, orderKeys } from '../../keys'
|
|
6
6
|
import { unrefOptions } from '../../util/unrefOptions'
|
|
7
7
|
import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
|
|
8
8
|
|
|
@@ -25,6 +25,9 @@ export function useCreateOrderMutation(
|
|
|
25
25
|
},
|
|
26
26
|
onSuccess: async (data, variables, context) => {
|
|
27
27
|
await Promise.all([
|
|
28
|
+
// Clear cart after successful order creation
|
|
29
|
+
queryClient.invalidateQueries({ queryKey: cartKeys.get() }),
|
|
30
|
+
|
|
28
31
|
// Invalidate order list to refetch data
|
|
29
32
|
queryClient.invalidateQueries({ queryKey: orderKeys.lists() }),
|
|
30
33
|
])
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useMutation, type UseMutationOptions } from '@tanstack/vue-query'
|
|
2
1
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
2
|
+
import { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/vue-query'
|
|
3
3
|
import { unref } from 'vue'
|
|
4
|
+
import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
|
|
4
5
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
6
|
import { unrefOptions } from '../../util/unrefOptions'
|
|
6
|
-
import
|
|
7
|
+
import { cartKeys } from '../../keys'
|
|
7
8
|
|
|
8
9
|
const handlePaymentOperation = 'handlePaymentMethod post /handle-payment' satisfies OperationKey
|
|
9
10
|
|
|
@@ -15,6 +16,7 @@ export function useHandlePaymentMutation(
|
|
|
15
16
|
>,
|
|
16
17
|
) {
|
|
17
18
|
const client = useShopwareQueryClient()
|
|
19
|
+
const queryClient = useQueryClient()
|
|
18
20
|
|
|
19
21
|
return useMutation({
|
|
20
22
|
...mutationOptions,
|
|
@@ -22,6 +24,8 @@ export function useHandlePaymentMutation(
|
|
|
22
24
|
return client.query(handlePaymentOperation, unrefOptions(options))
|
|
23
25
|
},
|
|
24
26
|
onSuccess: async (data, variables, context) => {
|
|
27
|
+
await queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
28
|
+
|
|
25
29
|
await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
|
|
26
30
|
},
|
|
27
31
|
})
|