@teamnovu/kit-shopware-composables 0.0.13 → 0.0.15

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.
@@ -1,7 +1,8 @@
1
- import { Schemas, components, GenericRecord } from '../../../api-types/storeApiTypes.d.ts';
1
+ import { Schemas } from '../../query/types/operations';
2
2
  import { MaybeRef, ComputedRef } from 'vue';
3
- type DetailProduct<S extends Schemas> = S['CustomProductDetailResponse']['product'];
4
- export declare function getProductVariantForOptions<S extends Schemas>(product: DetailProduct<S>, optionIds: string[]): {
3
+ import { components, GenericRecord } from '../../../api-types/storeApiTypes';
4
+ type DetailProduct = Schemas['CustomProductDetailResponse']['product'];
5
+ export declare function getProductVariantForOptions<S extends DetailProduct>(product: S, optionIds: string[]): {
5
6
  active?: boolean;
6
7
  apiAlias: "product";
7
8
  readonly available?: boolean;
@@ -137,7 +138,7 @@ export declare function getProductVariantForOptions<S extends Schemas>(product:
137
138
  weight?: number;
138
139
  width?: number;
139
140
  } | undefined;
140
- export declare function useProductVariantForOptions<S extends Schemas>(product: MaybeRef<DetailProduct<S>>, optionIds: MaybeRef<string[]>): ComputedRef<{
141
+ export declare function useProductVariantForOptions<S extends DetailProduct>(product: MaybeRef<S>, optionIds: MaybeRef<string[]>): ComputedRef<{
141
142
  active?: boolean;
142
143
  apiAlias: "product";
143
144
  readonly available?: boolean;
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 Q, useQuery as M, useQueryClient as S, useMutation as v } from "@tanstack/vue-query";
3
+ import { queryOptions as Q, useQuery as M, 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,9 +76,9 @@ const F = {
76
76
  body: e
77
77
  }
78
78
  ]
79
- }, x = {
80
- get: () => ["cart"]
81
79
  }, I = {
80
+ get: () => ["cart"]
81
+ }, L = {
82
82
  all: () => ["customer"],
83
83
  detail: (e) => ["customer", { body: e }]
84
84
  }, R = {
@@ -185,7 +185,7 @@ const V = (e) => {
185
185
  return s.startsWith("/") ? s.slice(1) : s;
186
186
  }, gt = (e) => `/${V(e)}`;
187
187
  function mt(e, s, t) {
188
- const n = S();
188
+ const n = C();
189
189
  return {
190
190
  onMutate: async (r) => {
191
191
  await n.cancelQueries({ queryKey: e });
@@ -226,7 +226,7 @@ function k(e) {
226
226
  }
227
227
  const ue = "updateContext patch /context";
228
228
  function $(e) {
229
- const s = g(), t = S();
229
+ const s = g(), t = C();
230
230
  return v({
231
231
  ...e,
232
232
  mutationFn: async (n) => (t.cancelQueries({ queryKey: F.all() }), s.query(ue, {
@@ -261,7 +261,7 @@ function ft() {
261
261
  return P.id !== ((O = u.value) == null ? void 0 : O.id);
262
262
  }
263
263
  )) ?? [];
264
- }), C = c(() => {
264
+ }), S = c(() => {
265
265
  var d;
266
266
  return ((d = t.data.value) == null ? void 0 : d.elements.filter(
267
267
  (P) => {
@@ -280,7 +280,7 @@ function ft() {
280
280
  activeBillingAddress: u,
281
281
  activeShippingAddress: o,
282
282
  inactiveBillingAddresses: f,
283
- inactiveShippingAddresses: C
283
+ inactiveShippingAddresses: S
284
284
  };
285
285
  }
286
286
  const oe = "readOrder post /order";
@@ -318,8 +318,8 @@ function vt(e, s) {
318
318
  }
319
319
  };
320
320
  }), n = ce(t.value), r = c(() => {
321
- var l, m, q, L;
322
- return (L = (q = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : q.elements) == null ? void 0 : L[0];
321
+ var l, m, q, x;
322
+ 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];
323
323
  }), a = c(() => {
324
324
  var l, m;
325
325
  return ((m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.paymentChangeable) || {};
@@ -332,25 +332,25 @@ function vt(e, s) {
332
332
  }), f = c(() => {
333
333
  var l, m;
334
334
  return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.totalPrice;
335
- }), C = c(() => {
335
+ }), S = c(() => {
336
336
  var l, m;
337
337
  return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.positionPrice;
338
338
  }), d = c(() => {
339
339
  var l;
340
340
  return (l = r.value) == null ? void 0 : l.shippingTotal;
341
341
  }), P = c(() => {
342
- var l, m, q, L, z, G;
342
+ var l, m, q, x, z, G;
343
343
  return {
344
344
  email: (m = (l = r.value) == null ? void 0 : l.orderCustomer) == null ? void 0 : m.email,
345
- firstName: (L = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : L.firstName,
345
+ firstName: (x = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : x.firstName,
346
346
  lastName: (G = (z = r.value) == null ? void 0 : z.orderCustomer) == null ? void 0 : G.lastName
347
347
  };
348
348
  }), O = c(() => {
349
349
  var l, m;
350
350
  return (m = (l = r.value) == null ? void 0 : l.addresses) == null ? void 0 : m.find(
351
351
  ({ id: q }) => {
352
- var L;
353
- return q === ((L = r.value) == null ? void 0 : L.billingAddressId);
352
+ var x;
353
+ return q === ((x = r.value) == null ? void 0 : x.billingAddressId);
354
354
  }
355
355
  );
356
356
  }), y = c(
@@ -378,7 +378,7 @@ function vt(e, s) {
378
378
  status: u,
379
379
  statusTechnicalName: o,
380
380
  total: f,
381
- subtotal: C,
381
+ subtotal: S,
382
382
  shippingCosts: d,
383
383
  shippingAddress: y,
384
384
  billingAddress: O,
@@ -411,7 +411,7 @@ function ht(e) {
411
411
  }
412
412
  const le = "createCustomerAddress post /account/address";
413
413
  function qt(e) {
414
- const s = g(), t = S();
414
+ const s = g(), t = C();
415
415
  return v({
416
416
  ...e,
417
417
  mutationFn: async (n) => s.query(le, p(n)),
@@ -423,7 +423,7 @@ function qt(e) {
423
423
  }
424
424
  const de = "deleteCustomerAddress delete /account/address/{addressId}";
425
425
  function Ct(e) {
426
- const s = g(), t = S();
426
+ const s = g(), t = C();
427
427
  return v({
428
428
  ...e,
429
429
  mutationFn: async (n) => s.query(de, p(n)),
@@ -435,7 +435,7 @@ function Ct(e) {
435
435
  }
436
436
  const ye = "updateCustomerAddress patch /account/address/{addressId}";
437
437
  function St(e) {
438
- const s = g(), t = S();
438
+ const s = g(), t = C();
439
439
  return v({
440
440
  ...e,
441
441
  mutationFn: async (n) => s.query(ye, p(n)),
@@ -446,7 +446,7 @@ function St(e) {
446
446
  t.invalidateQueries({ queryKey: R.lists() }),
447
447
  t.invalidateQueries({
448
448
  queryKey: R.detail(p(r).params.addressId),
449
- predicate: (C) => C.queryKey.at(-1) !== u
449
+ predicate: (S) => S.queryKey.at(-1) !== u
450
450
  })
451
451
  ]), await ((f = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : f(n, r, a));
452
452
  }
@@ -454,7 +454,7 @@ function St(e) {
454
454
  }
455
455
  const pe = "addLineItem post /checkout/cart/line-item";
456
456
  function Pt(e) {
457
- const s = g(), t = S();
457
+ const s = g(), t = C();
458
458
  return v({
459
459
  ...e,
460
460
  mutationFn: async (n) => s.query(pe, {
@@ -462,13 +462,13 @@ function Pt(e) {
462
462
  }),
463
463
  onSuccess: async (n, r, a) => {
464
464
  var u, o;
465
- t.setQueryData(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
465
+ t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
466
466
  }
467
467
  });
468
468
  }
469
469
  const ge = "readCart get /checkout/cart";
470
470
  function me(e) {
471
- const s = g(), t = x.get();
471
+ const s = g(), t = I.get();
472
472
  return Q({
473
473
  queryKey: t,
474
474
  queryFn: async ({ signal: n }) => s.query(ge, {
@@ -482,7 +482,7 @@ function Qt() {
482
482
  }
483
483
  const fe = "removeLineItem post /checkout/cart/line-item/delete";
484
484
  function Mt(e) {
485
- const s = g(), t = S();
485
+ const s = g(), t = C();
486
486
  return v({
487
487
  ...e,
488
488
  mutationFn: async (n) => s.query(fe, {
@@ -490,13 +490,13 @@ function Mt(e) {
490
490
  }),
491
491
  onSuccess: async (n, r, a) => {
492
492
  var u, o;
493
- t.setQueryData(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
493
+ t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
494
494
  }
495
495
  });
496
496
  }
497
497
  const ve = "updateLineItem patch /checkout/cart/line-item";
498
498
  function Ot(e) {
499
- const s = g(), t = S();
499
+ const s = g(), t = C();
500
500
  return v({
501
501
  ...e,
502
502
  mutationFn: async (n) => s.query(ve, {
@@ -504,13 +504,13 @@ function Ot(e) {
504
504
  }),
505
505
  onSuccess: async (n, r, a) => {
506
506
  var u, o;
507
- t.setQueryData(x.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
507
+ t.setQueryData(I.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
508
508
  }
509
509
  });
510
510
  }
511
511
  const he = "createOrder post /checkout/order";
512
512
  function Kt(e) {
513
- const s = g(), t = S();
513
+ const s = g(), t = C();
514
514
  return v({
515
515
  ...e,
516
516
  mutationFn: async (n) => s.query(he, p(n)),
@@ -518,7 +518,7 @@ function Kt(e) {
518
518
  var u, o;
519
519
  await Promise.all([
520
520
  // Clear cart after successful order creation
521
- t.invalidateQueries({ queryKey: x.get() }),
521
+ t.invalidateQueries({ queryKey: I.get() }),
522
522
  // Invalidate order list to refetch data
523
523
  t.invalidateQueries({ queryKey: U.lists() })
524
524
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
@@ -557,26 +557,26 @@ function wt(e) {
557
557
  }
558
558
  const Qe = "changeEmail post /account/change-email";
559
559
  function Rt(e) {
560
- const s = g(), t = S();
560
+ const s = g(), t = C();
561
561
  return v({
562
562
  ...e,
563
563
  mutationFn: async (n) => s.query(Qe, p(n)),
564
564
  onSuccess: async (n, r, a) => {
565
565
  var u, o;
566
- await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
566
+ await t.invalidateQueries({ queryKey: L.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
567
567
  }
568
568
  });
569
569
  }
570
570
  const Me = "changeProfile post /account/change-profile";
571
571
  function Ft(e) {
572
- const s = g(), t = S();
572
+ const s = g(), t = C();
573
573
  return v({
574
574
  ...e,
575
575
  mutationFn: async (n) => s.query(Me, p(n)),
576
576
  onSuccess: async (n, r, a) => {
577
577
  var u, o;
578
578
  await Promise.all([
579
- t.invalidateQueries({ queryKey: I.all() }),
579
+ t.invalidateQueries({ queryKey: L.all() }),
580
580
  t.invalidateQueries({ queryKey: F.all() })
581
581
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
582
582
  }
@@ -584,7 +584,7 @@ function Ft(e) {
584
584
  }
585
585
  const Oe = "loginCustomer post /account/login";
586
586
  function It(e) {
587
- const s = g(), t = S();
587
+ const s = g(), t = C();
588
588
  return v({
589
589
  ...e,
590
590
  mutationFn: async (n) => {
@@ -597,15 +597,15 @@ function It(e) {
597
597
  var u, o;
598
598
  await Promise.all([
599
599
  t.removeQueries({ queryKey: F.all() }),
600
- t.invalidateQueries({ queryKey: x.get() }),
601
- t.invalidateQueries({ queryKey: I.all() })
600
+ t.invalidateQueries({ queryKey: I.get() }),
601
+ t.invalidateQueries({ queryKey: L.all() })
602
602
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
603
603
  }
604
604
  });
605
605
  }
606
606
  const Ke = "logoutCustomer post /account/logout";
607
607
  function Lt(e) {
608
- const s = g(), t = S();
608
+ const s = g(), t = C();
609
609
  return v({
610
610
  ...e,
611
611
  mutationFn: async (n) => s.query(Ke, p(n)),
@@ -613,15 +613,15 @@ function Lt(e) {
613
613
  var u, o;
614
614
  await Promise.all([
615
615
  t.removeQueries({ queryKey: F.all() }),
616
- t.invalidateQueries({ queryKey: x.get() }),
617
- t.invalidateQueries({ queryKey: I.all() })
616
+ t.invalidateQueries({ queryKey: I.get() }),
617
+ t.invalidateQueries({ queryKey: L.all() })
618
618
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
619
619
  }
620
620
  });
621
621
  }
622
622
  const Ae = "readCustomer post /account/customer";
623
623
  function we(e) {
624
- const s = g(), t = I.detail(c(() => p(e).body ?? {}));
624
+ const s = g(), t = L.detail(c(() => p(e).body ?? {}));
625
625
  return Q({
626
626
  queryKey: t,
627
627
  queryFn: async () => s.query(Ae, p(e))
@@ -632,26 +632,26 @@ function Re(e) {
632
632
  }
633
633
  const Fe = "register post /account/register";
634
634
  function xt(e) {
635
- const s = g(), t = S();
635
+ const s = g(), t = C();
636
636
  return v({
637
637
  ...e,
638
638
  mutationFn: async (n) => s.query(Fe, p(n)),
639
639
  onSuccess: async (n, r, a) => {
640
640
  var u, o;
641
- await t.invalidateQueries({ queryKey: I.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
641
+ await t.invalidateQueries({ queryKey: L.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
642
642
  }
643
643
  });
644
644
  }
645
645
  const Ie = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
646
646
  function Ut(e) {
647
- const s = g(), t = S();
647
+ const s = g(), t = C();
648
648
  return v({
649
649
  ...e,
650
650
  mutationFn: async (n) => s.query(Ie, p(n)),
651
651
  onSuccess: async (n, r, a) => {
652
652
  var u, o;
653
653
  await Promise.all([
654
- t.invalidateQueries({ queryKey: I.all() }),
654
+ t.invalidateQueries({ queryKey: L.all() }),
655
655
  t.invalidateQueries({ queryKey: F.all() })
656
656
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
657
657
  }
@@ -659,14 +659,14 @@ function Ut(e) {
659
659
  }
660
660
  const Le = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
661
661
  function bt(e) {
662
- const s = g(), t = S();
662
+ const s = g(), t = C();
663
663
  return v({
664
664
  ...e,
665
665
  mutationFn: async (n) => s.query(Le, p(n)),
666
666
  onSuccess: async (n, r, a) => {
667
667
  var u, o;
668
668
  await Promise.all([
669
- t.invalidateQueries({ queryKey: I.all() }),
669
+ t.invalidateQueries({ queryKey: L.all() }),
670
670
  t.invalidateQueries({ queryKey: F.all() })
671
671
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
672
672
  }
@@ -674,16 +674,16 @@ function bt(e) {
674
674
  }
675
675
  const xe = "deleteCustomer delete /account/customer";
676
676
  function kt(e) {
677
- const s = g(), t = S();
677
+ const s = g(), t = C();
678
678
  return v({
679
679
  ...e,
680
680
  mutationFn: async (n) => s.query(xe, p(n)),
681
681
  onSuccess: async (n, r, a) => {
682
682
  var u, o;
683
683
  await Promise.all([
684
- t.resetQueries({ queryKey: I.all() }),
684
+ t.resetQueries({ queryKey: L.all() }),
685
685
  t.resetQueries({ queryKey: F.all() }),
686
- t.resetQueries({ queryKey: x.get() })
686
+ t.resetQueries({ queryKey: I.get() })
687
687
  ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
688
688
  }
689
689
  });
@@ -746,9 +746,9 @@ const De = "readNavigation post /navigation/{activeId}/{rootId}", Ne = function(
746
746
  return Q({
747
747
  queryKey: a,
748
748
  queryFn: async ({ signal: u }) => {
749
- const o = i(s), f = i(t), C = p(n);
749
+ const o = i(s), f = i(t), S = p(n);
750
750
  return r.query(De, {
751
- ...C,
751
+ ...S,
752
752
  params: {
753
753
  activeId: o,
754
754
  rootId: f
@@ -780,19 +780,19 @@ function je(e) {
780
780
  }
781
781
  const Ve = "handlePaymentMethod post /handle-payment";
782
782
  function jt(e) {
783
- const s = g();
783
+ const s = g(), t = C();
784
784
  return v({
785
785
  ...e,
786
- mutationFn: async (t) => s.query(Ve, p(t)),
787
- onSuccess: async (t, n, r) => {
788
- var a, u;
789
- await ((u = i((a = i(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
786
+ mutationFn: async (n) => s.query(Ve, p(n)),
787
+ onSuccess: async (n, r, a) => {
788
+ var u, o;
789
+ await t.invalidateQueries({ queryKey: I.get() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
790
790
  }
791
791
  });
792
792
  }
793
793
  const $e = "orderSetPayment post /order/payment";
794
794
  function Vt(e) {
795
- const s = g(), t = S();
795
+ const s = g(), t = C();
796
796
  return v({
797
797
  ...e,
798
798
  mutationFn: async (n) => s.query($e, p(n)),
@@ -951,8 +951,8 @@ function Yt() {
951
951
  var o, f;
952
952
  return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.paymentMethod;
953
953
  }), u = c(() => {
954
- var o, f, C;
955
- return ((C = (f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements) == null ? void 0 : C.sort((d, P) => (d.position ?? 0) - (P.position ?? 0))) ?? [];
954
+ var o, f, S;
955
+ return ((S = (f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements) == null ? void 0 : S.sort((d, P) => (d.position ?? 0) - (P.position ?? 0))) ?? [];
956
956
  });
957
957
  return {
958
958
  contextUpdateMutation: s,
@@ -976,7 +976,7 @@ function Zt() {
976
976
  return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.shippingMethod;
977
977
  }), u = c(() => {
978
978
  var o, f;
979
- return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((C, d) => (C.position ?? 0) - (d.position ?? 0))) ?? [];
979
+ return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((S, d) => (S.position ?? 0) - (d.position ?? 0))) ?? [];
980
980
  });
981
981
  return {
982
982
  contextUpdateMutation: s,
@@ -1026,7 +1026,7 @@ function en(e) {
1026
1026
  a.page = Math.min(O, a.page), a.total = y.total ?? 0, a.limit = y.limit;
1027
1027
  }
1028
1028
  );
1029
- const f = c(() => a.page === i(u)), C = c(() => a.page === 1), d = c(() => ({
1029
+ const f = c(() => a.page === i(u)), S = c(() => a.page === 1), d = c(() => ({
1030
1030
  p: a.page,
1031
1031
  limit: a.limit,
1032
1032
  "total-count-mode": a.totalCountMode ?? "none"
@@ -1041,7 +1041,7 @@ function en(e) {
1041
1041
  limit: W(a, "limit"),
1042
1042
  pageCount: u,
1043
1043
  isLastPage: f,
1044
- isFirstPage: C,
1044
+ isFirstPage: S,
1045
1045
  usePaginationSync: P,
1046
1046
  // This can be used to pass the pagination options directly to the query options
1047
1047
  queryOptions: d
@@ -1093,7 +1093,7 @@ function tn(e) {
1093
1093
  var y;
1094
1094
  return (y = u.value) == null ? void 0 : y.totalPrice;
1095
1095
  }
1096
- ), C = c(
1096
+ ), S = c(
1097
1097
  () => u.value
1098
1098
  ), d = c(() => {
1099
1099
  var y, h;
@@ -1105,7 +1105,7 @@ function tn(e) {
1105
1105
  }
1106
1106
  ), O = c(() => X(e.value));
1107
1107
  return {
1108
- price: C,
1108
+ price: S,
1109
1109
  totalPrice: f,
1110
1110
  unitPrice: o,
1111
1111
  displayFromVariants: a,
@@ -1168,7 +1168,7 @@ function rn(e) {
1168
1168
  var d;
1169
1169
  return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
1170
1170
  }
1171
- ), C = c(
1171
+ ), S = c(
1172
1172
  () => {
1173
1173
  var d;
1174
1174
  return ((d = t.value) == null ? void 0 : d.defaultShippingAddress) || null;
@@ -1183,7 +1183,7 @@ function rn(e) {
1183
1183
  defaultBillingAddressId: u,
1184
1184
  defaultShippingAddressId: o,
1185
1185
  userDefaultBillingAddress: f,
1186
- userDefaultShippingAddress: C,
1186
+ userDefaultShippingAddress: S,
1187
1187
  // Expose queries and mutations directly
1188
1188
  customerQuery: s
1189
1189
  };
@@ -1191,11 +1191,11 @@ function rn(e) {
1191
1191
  export {
1192
1192
  gt as absolutizeSeoUrl,
1193
1193
  R as addressKeys,
1194
- x as cartKeys,
1194
+ I as cartKeys,
1195
1195
  B as categoryKeys,
1196
1196
  F as contextKeys,
1197
1197
  j as countryKeys,
1198
- I as customerKeys,
1198
+ L as customerKeys,
1199
1199
  ct as getProductVariantForOptions,
1200
1200
  ee as languageKey,
1201
1201
  b as navigationKeys,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -1,11 +1,11 @@
1
- import type { Schemas } from '#store-types'
1
+ import type { Schemas } from '../../query/types/operations'
2
2
  import type { MaybeRef } from 'vue'
3
3
  import { computed, unref } from 'vue'
4
4
 
5
- type DetailProduct<S extends Schemas> = S['CustomProductDetailResponse']['product']
5
+ type DetailProduct = Schemas['CustomProductDetailResponse']['product']
6
6
 
7
- export function getProductVariantForOptions<S extends Schemas>(
8
- product: DetailProduct<S>,
7
+ export function getProductVariantForOptions<S extends DetailProduct>(
8
+ product: S,
9
9
  optionIds: string[],
10
10
  ) {
11
11
  const variants = product.extensions?.variants
@@ -19,8 +19,8 @@ export function getProductVariantForOptions<S extends Schemas>(
19
19
  return variants?.find(v => v.optionIds?.every(optId => optionIds.includes(optId)))
20
20
  }
21
21
 
22
- export function useProductVariantForOptions<S extends Schemas>(
23
- product: MaybeRef<DetailProduct<S>>,
22
+ export function useProductVariantForOptions<S extends DetailProduct>(
23
+ product: MaybeRef<S>,
24
24
  optionIds: MaybeRef<string[]>,
25
25
  ) {
26
26
  return computed(() => getProductVariantForOptions(unref(product), unref(optionIds)))
@@ -1,9 +1,10 @@
1
1
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
2
- import { useMutation, type UseMutationOptions } from '@tanstack/vue-query'
2
+ import { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/vue-query'
3
3
  import { unref } from 'vue'
4
4
  import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
5
5
  import { useShopwareQueryClient } from '../../inject'
6
6
  import { unrefOptions } from '../../util/unrefOptions'
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
  })