@teamnovu/kit-shopware-composables 0.0.17 → 0.0.19

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