@teamnovu/kit-shopware-composables 0.0.20 → 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 S, useQuery as P, useQueryClient as Q, useMutation as h } from "@tanstack/vue-query";
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
- }, x = {
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 S({
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 P(ne(e));
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 ht(e, s, t) {
189
- const n = Q();
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 S({
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 P(ae(e));
226
+ return Q(ae(e));
227
227
  }
228
228
  const ue = "updateContext patch /context";
229
229
  function $(e) {
230
- const s = g(), t = Q();
231
- return h({
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 vt() {
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
- }), C = c(() => {
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: C
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 S({
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 P(ie(e));
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, I;
323
- return (I = (q = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : q.elements) == null ? void 0 : I[0];
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
- }), C = c(() => {
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, I, z, G;
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: (I = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : I.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 I;
354
- return q === ((I = r.value) == null ? void 0 : I.billingAddressId);
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
- ), v = c(() => {
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: C,
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: v,
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 = Q();
416
- return h({
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 = Q();
428
- return h({
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 = Q();
440
- return h({
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: (C) => C.queryKey.at(-1) !== u
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 = Q();
459
- return h({
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(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
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 = x.get();
473
- return S({
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,47 +479,47 @@ function me(e) {
479
479
  });
480
480
  }
481
481
  function Ot() {
482
- return P(me());
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 = Q();
487
- return h({
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(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
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 he = "updateLineItem patch /checkout/cart/line-item";
498
+ const ve = "updateLineItem patch /checkout/cart/line-item";
499
499
  function At(e) {
500
- const s = g(), t = Q();
501
- return h({
500
+ const s = g(), t = C();
501
+ return v({
502
502
  ...e,
503
- mutationFn: async (n) => s.query(he, {
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(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
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 ve = "createOrder post /checkout/order";
512
+ const he = "createOrder post /checkout/order";
513
513
  function wt(e) {
514
- const s = g(), t = Q();
515
- return h({
514
+ const s = g(), t = C();
515
+ return v({
516
516
  ...e,
517
- mutationFn: async (n) => s.query(ve, p(n)),
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
521
  // Clear cart after successful order creation
522
- t.invalidateQueries({ queryKey: x.get() }),
522
+ t.invalidateQueries({ queryKey: I.get() }),
523
523
  // Invalidate order list to refetch data
524
524
  t.invalidateQueries({ queryKey: U.lists() })
525
525
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
@@ -529,7 +529,7 @@ function wt(e) {
529
529
  const qe = "readLanguages post /language";
530
530
  function Ce(e) {
531
531
  const s = g();
532
- return S({
532
+ return P({
533
533
  queryKey: ee.all(),
534
534
  queryFn: ({ signal: t }) => s.query(qe, {
535
535
  ...p(e),
@@ -538,11 +538,11 @@ function Ce(e) {
538
538
  });
539
539
  }
540
540
  function Rt(e) {
541
- return P(Ce(e));
541
+ return Q(Ce(e));
542
542
  }
543
543
  const Se = "readCountry post /country", Pe = function(s) {
544
544
  const t = g(), n = j.list(s);
545
- return S({
545
+ return P({
546
546
  queryKey: n,
547
547
  queryFn: async ({ signal: r }) => {
548
548
  const a = p(s);
@@ -554,12 +554,12 @@ const Se = "readCountry post /country", Pe = function(s) {
554
554
  });
555
555
  };
556
556
  function Ft(e) {
557
- return P(Pe(e));
557
+ return Q(Pe(e));
558
558
  }
559
559
  const Qe = "changeEmail post /account/change-email";
560
560
  function Lt(e) {
561
- const s = g(), t = Q();
562
- return h({
561
+ const s = g(), t = C();
562
+ return v({
563
563
  ...e,
564
564
  mutationFn: async (n) => s.query(Qe, p(n)),
565
565
  onSuccess: async (n, r, a) => {
@@ -570,8 +570,8 @@ function Lt(e) {
570
570
  }
571
571
  const Me = "changeProfile post /account/change-profile";
572
572
  function It(e) {
573
- const s = g(), t = Q();
574
- return h({
573
+ const s = g(), t = C();
574
+ return v({
575
575
  ...e,
576
576
  mutationFn: async (n) => s.query(Me, p(n)),
577
577
  onSuccess: async (n, r, a) => {
@@ -585,8 +585,8 @@ function It(e) {
585
585
  }
586
586
  const Oe = "loginCustomer post /account/login";
587
587
  function xt(e) {
588
- const s = g(), t = Q();
589
- return h({
588
+ const s = g(), t = C();
589
+ return v({
590
590
  ...e,
591
591
  mutationFn: async (n) => {
592
592
  const r = await s.queryRaw(Oe, {
@@ -598,7 +598,7 @@ function xt(e) {
598
598
  var u, o;
599
599
  await Promise.all([
600
600
  t.resetQueries({ queryKey: F.all() }),
601
- t.invalidateQueries({ queryKey: x.get() }),
601
+ t.invalidateQueries({ queryKey: I.get() }),
602
602
  t.invalidateQueries({ queryKey: L.all() })
603
603
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
604
604
  }
@@ -606,15 +606,15 @@ function xt(e) {
606
606
  }
607
607
  const Ke = "logoutCustomer post /account/logout";
608
608
  function Ut(e) {
609
- const s = g(), t = Q();
610
- return h({
609
+ const s = g(), t = C();
610
+ return v({
611
611
  ...e,
612
612
  mutationFn: async (n) => s.query(Ke, p(n)),
613
613
  onSuccess: async (n, r, a) => {
614
614
  var u, o;
615
615
  await Promise.all([
616
616
  t.resetQueries({ queryKey: F.all() }),
617
- t.invalidateQueries({ queryKey: x.get() }),
617
+ t.invalidateQueries({ queryKey: I.get() }),
618
618
  t.invalidateQueries({ queryKey: L.all() })
619
619
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
620
620
  }
@@ -623,18 +623,18 @@ function Ut(e) {
623
623
  const Ae = "readCustomer post /account/customer";
624
624
  function we(e) {
625
625
  const s = g(), t = L.detail(c(() => p(e).body ?? {}));
626
- return S({
626
+ return P({
627
627
  queryKey: t,
628
628
  queryFn: async () => s.query(Ae, p(e))
629
629
  });
630
630
  }
631
631
  function Re(e) {
632
- return P(we(e));
632
+ return Q(we(e));
633
633
  }
634
634
  const Fe = "register post /account/register";
635
635
  function bt(e) {
636
- const s = g(), t = Q();
637
- return h({
636
+ const s = g(), t = C();
637
+ return v({
638
638
  ...e,
639
639
  mutationFn: async (n) => s.query(Fe, p(n)),
640
640
  onSuccess: async (n, r, a) => {
@@ -645,8 +645,8 @@ function bt(e) {
645
645
  }
646
646
  const Le = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
647
647
  function kt(e) {
648
- const s = g(), t = Q();
649
- return h({
648
+ const s = g(), t = C();
649
+ return v({
650
650
  ...e,
651
651
  mutationFn: async (n) => s.query(Le, p(n)),
652
652
  onSuccess: async (n, r, a) => {
@@ -660,8 +660,8 @@ function kt(e) {
660
660
  }
661
661
  const Ie = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
662
662
  function Bt(e) {
663
- const s = g(), t = Q();
664
- return h({
663
+ const s = g(), t = C();
664
+ return v({
665
665
  ...e,
666
666
  mutationFn: async (n) => s.query(Ie, p(n)),
667
667
  onSuccess: async (n, r, a) => {
@@ -675,8 +675,8 @@ function Bt(e) {
675
675
  }
676
676
  const xe = "deleteCustomer delete /account/customer";
677
677
  function Dt(e) {
678
- const s = g(), t = Q();
679
- return h({
678
+ const s = g(), t = C();
679
+ return v({
680
680
  ...e,
681
681
  mutationFn: async (n) => s.query(xe, p(n)),
682
682
  onSuccess: async (n, r, a) => {
@@ -684,7 +684,7 @@ function Dt(e) {
684
684
  await Promise.all([
685
685
  t.resetQueries({ queryKey: L.all() }),
686
686
  t.resetQueries({ queryKey: F.all() }),
687
- t.resetQueries({ queryKey: x.get() })
687
+ t.resetQueries({ queryKey: I.get() })
688
688
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
689
689
  }
690
690
  });
@@ -692,7 +692,7 @@ function Dt(e) {
692
692
  const Ue = "registerConfirm post /account/register-confirm";
693
693
  function Nt(e) {
694
694
  const s = g();
695
- return h({
695
+ return v({
696
696
  ...e,
697
697
  mutationFn: async (t) => {
698
698
  const n = await s.queryRaw(Ue, {
@@ -709,7 +709,7 @@ function Nt(e) {
709
709
  const be = "sendRecoveryMail post /account/recovery-password";
710
710
  function Tt(e) {
711
711
  const s = g();
712
- return h({
712
+ return v({
713
713
  ...e,
714
714
  mutationFn: async (t) => s.query(be, p(t)),
715
715
  onSuccess: async (t, n, r) => {
@@ -721,7 +721,7 @@ function Tt(e) {
721
721
  const ke = "changePassword post /account/change-password";
722
722
  function Et(e) {
723
723
  const s = g();
724
- return h({
724
+ return v({
725
725
  ...e,
726
726
  mutationFn: async (t) => s.query(ke, p(t)),
727
727
  onSuccess: async (t, n, r) => {
@@ -733,18 +733,18 @@ function Et(e) {
733
733
  const Be = "imitateCustomerLogin post /account/login/imitate-customer";
734
734
  function De(e) {
735
735
  const s = g(), t = L.imitateLogin(c(() => p(e).body ?? {}));
736
- return S({
736
+ return P({
737
737
  queryKey: t,
738
738
  queryFn: async () => s.query(Be, p(e))
739
739
  });
740
740
  }
741
741
  function jt(e) {
742
- return P(De(e));
742
+ return Q(De(e));
743
743
  }
744
744
  const Ne = "recoveryPassword post /account/recovery-password-confirm";
745
745
  function Vt(e) {
746
746
  const s = g();
747
- return h({
747
+ return v({
748
748
  ...e,
749
749
  mutationFn: async (t) => s.query(Ne, p(t)),
750
750
  onSuccess: async (t, n, r) => {
@@ -755,12 +755,12 @@ function Vt(e) {
755
755
  }
756
756
  const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(s, t, n) {
757
757
  const r = g(), a = b.detail(s, t, n);
758
- return S({
758
+ return P({
759
759
  queryKey: a,
760
760
  queryFn: async ({ signal: u }) => {
761
- const o = i(s), f = i(t), C = p(n);
761
+ const o = i(s), f = i(t), S = p(n);
762
762
  return r.query(Te, {
763
- ...C,
763
+ ...S,
764
764
  params: {
765
765
  activeId: o,
766
766
  rootId: f
@@ -771,7 +771,7 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
771
771
  });
772
772
  };
773
773
  function $t(e, s, t) {
774
- return P(Ee(e, s, t));
774
+ return Q(Ee(e, s, t));
775
775
  }
776
776
  const je = "readPaymentMethod post /payment-method";
777
777
  function Ve(e) {
@@ -779,7 +779,7 @@ function Ve(e) {
779
779
  var n;
780
780
  return (n = p(e)) == null ? void 0 : n.body;
781
781
  }));
782
- return S({
782
+ return P({
783
783
  queryKey: t,
784
784
  queryFn: ({ signal: n }) => s.query(je, {
785
785
  ...p(e),
@@ -788,24 +788,24 @@ function Ve(e) {
788
788
  });
789
789
  }
790
790
  function $e(e) {
791
- return P(Ve(e));
791
+ return Q(Ve(e));
792
792
  }
793
793
  const ze = "handlePaymentMethod post /handle-payment";
794
794
  function zt(e) {
795
- const s = g();
796
- return h({
795
+ const s = g(), t = C();
796
+ return v({
797
797
  ...e,
798
- mutationFn: async (t) => s.query(ze, p(t)),
799
- onSuccess: async (t, n, r) => {
800
- var a, u;
801
- await ((u = i((a = i(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
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));
802
802
  }
803
803
  });
804
804
  }
805
805
  const Ge = "orderSetPayment post /order/payment";
806
806
  function Gt(e) {
807
- const s = g(), t = Q();
808
- return h({
807
+ const s = g(), t = C();
808
+ return v({
809
809
  ...e,
810
810
  mutationFn: async (n) => s.query(Ge, p(n)),
811
811
  onSuccess: async (n, r, a) => {
@@ -816,7 +816,7 @@ function Gt(e) {
816
816
  }
817
817
  const He = "readCategoryList post /category", We = function(s) {
818
818
  const t = g(), n = B.list(s);
819
- return S({
819
+ return P({
820
820
  queryKey: n,
821
821
  queryFn: async ({ signal: r }) => t.query(He, {
822
822
  ...p(s),
@@ -825,12 +825,12 @@ const He = "readCategoryList post /category", We = function(s) {
825
825
  });
826
826
  };
827
827
  function Ht(e) {
828
- return P(We(e));
828
+ return Q(We(e));
829
829
  }
830
830
  const Je = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
831
831
  function Xe(e, s) {
832
832
  const t = g(), n = w.list(e, s);
833
- return S({
833
+ return P({
834
834
  queryKey: n,
835
835
  queryFn: async ({ signal: r }) => {
836
836
  const a = p(s);
@@ -846,12 +846,12 @@ function Xe(e, s) {
846
846
  });
847
847
  }
848
848
  function Wt(e, s) {
849
- return P(Xe(e, s));
849
+ return Q(Xe(e, s));
850
850
  }
851
851
  const Ye = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
852
852
  function Ze(e, s) {
853
853
  const t = g(), n = w.customDetail(e, s);
854
- return S({
854
+ return P({
855
855
  queryKey: n,
856
856
  queryFn: async ({ signal: r }) => {
857
857
  const a = p(s);
@@ -867,12 +867,12 @@ function Ze(e, s) {
867
867
  });
868
868
  }
869
869
  function Jt(e, s) {
870
- return P(Ze(e, s));
870
+ return Q(Ze(e, s));
871
871
  }
872
872
  const _e = "searchPage post /search";
873
873
  function et(e) {
874
874
  const s = g(), t = w.search(e);
875
- return S({
875
+ return P({
876
876
  queryKey: t,
877
877
  queryFn: async ({ signal: n }) => {
878
878
  const r = p(e);
@@ -884,12 +884,12 @@ function et(e) {
884
884
  });
885
885
  }
886
886
  function Xt(e) {
887
- return P(et(e));
887
+ return Q(et(e));
888
888
  }
889
889
  const tt = "readProduct post /product";
890
890
  function nt(e) {
891
891
  const s = g(), t = w.detail(e);
892
- return S({
892
+ return P({
893
893
  queryKey: t,
894
894
  queryFn: async ({ signal: n }) => {
895
895
  const r = p(e);
@@ -901,11 +901,11 @@ function nt(e) {
901
901
  });
902
902
  }
903
903
  function Yt(e) {
904
- return P(nt(e));
904
+ return Q(nt(e));
905
905
  }
906
906
  const st = "readSalutation post /salutation", rt = function(s) {
907
907
  const t = g(), n = E.list(s);
908
- return S({
908
+ return P({
909
909
  queryKey: n,
910
910
  queryFn: async ({ signal: r }) => {
911
911
  const a = p(s);
@@ -917,11 +917,11 @@ const st = "readSalutation post /salutation", rt = function(s) {
917
917
  });
918
918
  };
919
919
  function Zt(e) {
920
- return P(rt(e));
920
+ return Q(rt(e));
921
921
  }
922
922
  const at = "readSeoUrl post /seo-url", ut = function(s) {
923
923
  const t = g(), n = T.list(s);
924
- return S({
924
+ return P({
925
925
  queryKey: n,
926
926
  queryFn: async ({ signal: r }) => {
927
927
  const a = p(s);
@@ -933,7 +933,7 @@ const at = "readSeoUrl post /seo-url", ut = function(s) {
933
933
  });
934
934
  };
935
935
  function _t(e) {
936
- return P(ut(e));
936
+ return Q(ut(e));
937
937
  }
938
938
  const ot = "readShippingMethod post /shipping-method";
939
939
  function it(e) {
@@ -941,7 +941,7 @@ function it(e) {
941
941
  var n;
942
942
  return (n = p(e)) == null ? void 0 : n.body;
943
943
  }));
944
- return S({
944
+ return P({
945
945
  queryKey: t,
946
946
  queryFn: ({ signal: n }) => s.query(ot, {
947
947
  ...p(e),
@@ -950,7 +950,7 @@ function it(e) {
950
950
  });
951
951
  }
952
952
  function ct(e) {
953
- return P(it(e));
953
+ return Q(it(e));
954
954
  }
955
955
  function en() {
956
956
  const e = k(), s = $(), t = $e({
@@ -963,8 +963,8 @@ function en() {
963
963
  var o, f;
964
964
  return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.paymentMethod;
965
965
  }), u = c(() => {
966
- var o, f, C;
967
- return ((C = (f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements) == null ? void 0 : C.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
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))) ?? [];
968
968
  });
969
969
  return {
970
970
  contextUpdateMutation: s,
@@ -988,7 +988,7 @@ function tn() {
988
988
  return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.shippingMethod;
989
989
  }), u = c(() => {
990
990
  var o, f;
991
- return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((C, d) => (C.position ?? 0) - (d.position ?? 0))) ?? [];
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))) ?? [];
992
992
  });
993
993
  return {
994
994
  contextUpdateMutation: s,
@@ -1038,7 +1038,7 @@ function sn(e) {
1038
1038
  a.page = Math.min(O, a.page), a.total = y.total ?? 0, a.limit = y.limit;
1039
1039
  }
1040
1040
  );
1041
- const f = c(() => a.page === i(u)), C = c(() => a.page === 1), d = c(() => ({
1041
+ const f = c(() => a.page === i(u)), S = c(() => a.page === 1), d = c(() => ({
1042
1042
  p: a.page,
1043
1043
  limit: a.limit,
1044
1044
  "total-count-mode": a.totalCountMode ?? "none"
@@ -1053,7 +1053,7 @@ function sn(e) {
1053
1053
  limit: W(a, "limit"),
1054
1054
  pageCount: u,
1055
1055
  isLastPage: f,
1056
- isFirstPage: C,
1056
+ isFirstPage: S,
1057
1057
  usePaginationSync: M,
1058
1058
  // This can be used to pass the pagination options directly to the query options
1059
1059
  queryOptions: d
@@ -1076,24 +1076,24 @@ function rn(e) {
1076
1076
  return (y = e.value) == null ? void 0 : y.calculatedCheapestPrice;
1077
1077
  }), t = c(
1078
1078
  () => {
1079
- var y, v, K, A, l;
1080
- return (((v = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : v.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
+ 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;
1081
1081
  }
1082
1082
  ), n = c(() => {
1083
1083
  var y;
1084
1084
  return (y = t == null ? void 0 : t.value) == null ? void 0 : y.referencePrice;
1085
1085
  }), r = c(() => {
1086
- var y, v;
1087
- return (((v = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : v.length) ?? 0) > 1;
1086
+ var y, h;
1087
+ return (((h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.length) ?? 0) > 1;
1088
1088
  }), a = c(
1089
1089
  () => {
1090
- var y, v, K, A, l, m;
1091
- return !!((y = e.value) != null && y.parentId) && ((K = (v = e.value) == null ? void 0 : v.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
+ 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);
1092
1092
  }
1093
1093
  ), u = c(
1094
1094
  () => {
1095
- var y, v;
1096
- return r.value && X(e.value).length > 1 ? (v = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : v.reduce((K, A) => A.unitPrice < K.unitPrice ? A : K) : t.value;
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;
1097
1097
  }
1098
1098
  ), o = c(
1099
1099
  () => {
@@ -1105,19 +1105,19 @@ function rn(e) {
1105
1105
  var y;
1106
1106
  return (y = u.value) == null ? void 0 : y.totalPrice;
1107
1107
  }
1108
- ), C = c(
1108
+ ), S = c(
1109
1109
  () => u.value
1110
1110
  ), d = c(() => {
1111
- var y, v;
1112
- return !!((v = (y = u.value) == null ? void 0 : y.listPrice) != null && v.percentage);
1111
+ var y, h;
1112
+ return !!((h = (y = u.value) == null ? void 0 : y.listPrice) != null && h.percentage);
1113
1113
  }), M = c(
1114
1114
  () => {
1115
- var y, v, K;
1116
- return (K = (v = (y = e.value) == null ? void 0 : y.calculatedPrice) == null ? void 0 : v.regulationPrice) == null ? void 0 : K.price;
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;
1117
1117
  }
1118
1118
  ), O = c(() => X(e.value));
1119
1119
  return {
1120
- price: C,
1120
+ price: S,
1121
1121
  totalPrice: f,
1122
1122
  unitPrice: o,
1123
1123
  displayFromVariants: a,
@@ -1180,7 +1180,7 @@ function on(e) {
1180
1180
  var d;
1181
1181
  return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
1182
1182
  }
1183
- ), C = c(
1183
+ ), S = c(
1184
1184
  () => {
1185
1185
  var d;
1186
1186
  return ((d = t.value) == null ? void 0 : d.defaultShippingAddress) || null;
@@ -1195,7 +1195,7 @@ function on(e) {
1195
1195
  defaultBillingAddressId: u,
1196
1196
  defaultShippingAddressId: o,
1197
1197
  userDefaultBillingAddress: f,
1198
- userDefaultShippingAddress: C,
1198
+ userDefaultShippingAddress: S,
1199
1199
  // Expose queries and mutations directly
1200
1200
  customerQuery: s
1201
1201
  };
@@ -1203,7 +1203,7 @@ function on(e) {
1203
1203
  export {
1204
1204
  ft as absolutizeSeoUrl,
1205
1205
  R as addressKeys,
1206
- x as cartKeys,
1206
+ I as cartKeys,
1207
1207
  B as categoryKeys,
1208
1208
  F as contextKeys,
1209
1209
  j as countryKeys,
@@ -1226,7 +1226,7 @@ export {
1226
1226
  Lt as useChangeEmailMutation,
1227
1227
  Et as useChangePasswordMutation,
1228
1228
  It as useChangeProfileMutation,
1229
- vt as useCheckoutAddresses,
1229
+ ht as useCheckoutAddresses,
1230
1230
  St as useCreateCustomerAddressMutation,
1231
1231
  wt as useCreateOrderMutation,
1232
1232
  kt as useDefaultBillingAddressMutation,
@@ -1241,7 +1241,7 @@ export {
1241
1241
  ne as useListAddressQueryOptions,
1242
1242
  xt as useLoginCustomerMutation,
1243
1243
  Ut as useLogoutCustomerMutation,
1244
- ht as useOptimistic,
1244
+ vt as useOptimistic,
1245
1245
  qt as useOrderDetails,
1246
1246
  Ct as useOrderPayment,
1247
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -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 type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
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
  })