@teamnovu/kit-shopware-composables 0.0.33 → 0.0.35

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 o, computed as c, reactive as Z, watch as H, toRef as W } from "vue";
2
2
  import { until as J } from "@vueuse/core";
3
- import { queryOptions as v, useQuery as q, useQueryClient as Q, useMutation as h } from "@tanstack/vue-query";
3
+ import { queryOptions as h, useQuery as q, useQueryClient as C, useMutation as f } from "@tanstack/vue-query";
4
4
  import "@teamnovu/kit-shopware-api-client";
5
5
  const _ = Symbol("shopwareClient");
6
6
  function g() {
@@ -9,7 +9,7 @@ function g() {
9
9
  throw new Error("Shopware client not provided!");
10
10
  return e;
11
11
  }
12
- const A = {
12
+ const w = {
13
13
  all: () => ["context"]
14
14
  }, ee = {
15
15
  all: () => ["language"]
@@ -96,18 +96,18 @@ const A = {
96
96
  all: () => ["customer"],
97
97
  detail: (e) => ["customer", { body: e }],
98
98
  imitateLogin: (e) => ["customer", "imitateLogin", { body: e }]
99
- }, F = {
99
+ }, R = {
100
100
  all: () => ["address"],
101
- lists: () => [...F.all(), "list"],
101
+ lists: () => [...R.all(), "list"],
102
102
  list: (e) => [
103
- ...F.all(),
103
+ ...R.all(),
104
104
  "list",
105
105
  {
106
106
  body: e
107
107
  }
108
108
  ],
109
- details: () => [...F.all(), "detail"],
110
- detail: (e, s) => [...F.details(), e, ...s ? [{ body: s }] : []]
109
+ details: () => [...R.all(), "detail"],
110
+ detail: (e, s) => [...R.details(), e, ...s ? [{ body: s }] : []]
111
111
  }, D = {
112
112
  all: () => ["shippingMethod"],
113
113
  lists: () => [...D.all(), "list"],
@@ -179,11 +179,11 @@ function y(e) {
179
179
  }
180
180
  const te = "listAddress post /account/list-address";
181
181
  function ne(e) {
182
- const s = g(), t = F.list(c(() => {
182
+ const s = g(), t = R.list(c(() => {
183
183
  var n;
184
184
  return (n = y(e)) == null ? void 0 : n.body;
185
185
  }));
186
- return v({
186
+ return h({
187
187
  queryKey: t,
188
188
  queryFn: ({ signal: n }) => s.query(te, {
189
189
  ...y(e),
@@ -197,9 +197,9 @@ function se(e) {
197
197
  const V = (e) => {
198
198
  const s = e.replace(/\/?$/, "");
199
199
  return s.startsWith("/") ? s.slice(1) : s;
200
- }, St = (e) => `/${V(e)}`;
201
- function Ct(e, s, t) {
202
- const n = Q();
200
+ }, Qt = (e) => `/${V(e)}`;
201
+ function St(e, s, t) {
202
+ const n = C();
203
203
  return {
204
204
  onMutate: async (r) => {
205
205
  await n.cancelQueries({ queryKey: e });
@@ -212,8 +212,8 @@ function Ct(e, s, t) {
212
212
  },
213
213
  onError: (r, a, u) => {
214
214
  if (u && n.setQueryData(e, u.previousValue), t) {
215
- const i = o(t), f = o(i.onError);
216
- f == null || f(r, a, u);
215
+ const i = o(t), v = o(i.onError);
216
+ v == null || v(r, a, u);
217
217
  }
218
218
  },
219
219
  onSettled: (...r) => {
@@ -227,8 +227,8 @@ function Ct(e, s, t) {
227
227
  const re = "readContext get /context";
228
228
  function ae(e) {
229
229
  const s = g();
230
- return v({
231
- queryKey: A.all(),
230
+ return h({
231
+ queryKey: w.all(),
232
232
  queryFn: ({ signal: t }) => s.query(re, {
233
233
  ...y(e),
234
234
  signal: t
@@ -240,16 +240,16 @@ function B(e) {
240
240
  }
241
241
  const ue = "updateContext patch /context";
242
242
  function $(e) {
243
- const s = g(), t = Q();
244
- return h({
243
+ const s = g(), t = C();
244
+ return f({
245
245
  ...e,
246
- mutationFn: async (n) => (t.cancelQueries({ queryKey: A.all() }), s.query(ue, {
246
+ mutationFn: async (n) => (t.cancelQueries({ queryKey: w.all() }), s.query(ue, {
247
247
  body: n
248
248
  })),
249
249
  onSuccess: async (n, r, a) => {
250
250
  var u, i;
251
251
  await Promise.all([
252
- t.invalidateQueries({ queryKey: A.all() }),
252
+ t.invalidateQueries({ queryKey: w.all() }),
253
253
  t.invalidateQueries({ queryKey: L.get() }),
254
254
  t.invalidateQueries({ queryKey: b.lists() }),
255
255
  t.invalidateQueries({ queryKey: D.lists() })
@@ -257,7 +257,7 @@ function $(e) {
257
257
  }
258
258
  });
259
259
  }
260
- function Qt() {
260
+ function Ct() {
261
261
  const e = $(), s = B(), t = se(), n = c(() => s.isFetching.value || e.isPending.value), r = async (d) => {
262
262
  await e.mutateAsync({
263
263
  billingAddressId: d.id
@@ -267,25 +267,25 @@ function Qt() {
267
267
  shippingAddressId: d.id
268
268
  }), await J(n).toBe(!1);
269
269
  }, u = c(() => {
270
- var d, M;
271
- return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeBillingAddress;
270
+ var d, K;
271
+ return (K = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : K.activeBillingAddress;
272
272
  }), i = c(() => {
273
- var d, M;
274
- return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeShippingAddress;
275
- }), f = c(() => {
273
+ var d, K;
274
+ return (K = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : K.activeShippingAddress;
275
+ }), v = c(() => {
276
276
  var d;
277
277
  return ((d = t.data.value) == null ? void 0 : d.elements.filter(
278
- (M) => {
279
- var K;
280
- return M.id !== ((K = u.value) == null ? void 0 : K.id);
278
+ (K) => {
279
+ var M;
280
+ return K.id !== ((M = u.value) == null ? void 0 : M.id);
281
281
  }
282
282
  )) ?? [];
283
283
  }), P = c(() => {
284
284
  var d;
285
285
  return ((d = t.data.value) == null ? void 0 : d.elements.filter(
286
- (M) => {
287
- var K;
288
- return M.id !== ((K = i.value) == null ? void 0 : K.id);
286
+ (K) => {
287
+ var M;
288
+ return K.id !== ((M = i.value) == null ? void 0 : M.id);
289
289
  }
290
290
  )) ?? [];
291
291
  });
@@ -298,14 +298,14 @@ function Qt() {
298
298
  isSaving: n,
299
299
  activeBillingAddress: u,
300
300
  activeShippingAddress: i,
301
- inactiveBillingAddresses: f,
301
+ inactiveBillingAddresses: v,
302
302
  inactiveShippingAddresses: P
303
303
  };
304
304
  }
305
305
  const ie = "readOrder post /order";
306
306
  function oe(e) {
307
307
  const s = g(), t = U.detail(e);
308
- return v({
308
+ return h({
309
309
  queryKey: t,
310
310
  queryFn: async ({ signal: n }) => {
311
311
  const r = y(e);
@@ -337,18 +337,18 @@ function Pt(e, s) {
337
337
  }
338
338
  };
339
339
  }), n = ce(t.value), r = c(() => {
340
- var l, m, C, x;
341
- return (x = (C = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : C.elements) == null ? void 0 : x[0];
340
+ var l, m, S, x;
341
+ return (x = (S = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : S.elements) == null ? void 0 : x[0];
342
342
  }), a = c(() => {
343
343
  var l, m;
344
344
  return ((m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.paymentChangeable) || {};
345
345
  }), u = c(() => {
346
- var l, m, C;
347
- return (C = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : C.name;
346
+ var l, m, S;
347
+ return (S = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : S.name;
348
348
  }), i = c(() => {
349
349
  var l, m;
350
350
  return (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.technicalName;
351
- }), f = c(() => {
351
+ }), v = c(() => {
352
352
  var l, m;
353
353
  return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.totalPrice;
354
354
  }), P = c(() => {
@@ -357,37 +357,37 @@ function Pt(e, s) {
357
357
  }), d = c(() => {
358
358
  var l;
359
359
  return (l = r.value) == null ? void 0 : l.shippingTotal;
360
- }), M = c(() => {
361
- var l, m, C, x, z, G;
360
+ }), K = c(() => {
361
+ var l, m, S, x, z, G;
362
362
  return {
363
363
  email: (m = (l = r.value) == null ? void 0 : l.orderCustomer) == null ? void 0 : m.email,
364
- firstName: (x = (C = r.value) == null ? void 0 : C.orderCustomer) == null ? void 0 : x.firstName,
364
+ firstName: (x = (S = r.value) == null ? void 0 : S.orderCustomer) == null ? void 0 : x.firstName,
365
365
  lastName: (G = (z = r.value) == null ? void 0 : z.orderCustomer) == null ? void 0 : G.lastName
366
366
  };
367
- }), K = c(() => {
367
+ }), M = c(() => {
368
368
  var l, m;
369
369
  return (m = (l = r.value) == null ? void 0 : l.addresses) == null ? void 0 : m.find(
370
- ({ id: C }) => {
370
+ ({ id: S }) => {
371
371
  var x;
372
- return C === ((x = r.value) == null ? void 0 : x.billingAddressId);
372
+ return S === ((x = r.value) == null ? void 0 : x.billingAddressId);
373
373
  }
374
374
  );
375
375
  }), p = c(
376
376
  () => {
377
- var l, m, C;
378
- return (C = (m = (l = r.value) == null ? void 0 : l.deliveries) == null ? void 0 : m[0]) == null ? void 0 : C.shippingOrderAddress;
377
+ var l, m, S;
378
+ return (S = (m = (l = r.value) == null ? void 0 : l.deliveries) == null ? void 0 : m[0]) == null ? void 0 : S.shippingOrderAddress;
379
379
  }
380
- ), S = c(() => {
381
- var m, C;
380
+ ), Q = c(() => {
381
+ var m, S;
382
382
  const l = (m = r.value) == null ? void 0 : m.transactions;
383
383
  if (l != null && l.length)
384
- return (C = l.at(-1)) == null ? void 0 : C.paymentMethod;
385
- }), w = c(() => {
386
- var m, C;
384
+ return (S = l.at(-1)) == null ? void 0 : S.paymentMethod;
385
+ }), A = c(() => {
386
+ var m, S;
387
387
  const l = (m = r.value) == null ? void 0 : m.deliveries;
388
388
  if (l != null && l.length)
389
- return (C = l.at(-1)) == null ? void 0 : C.shippingMethod;
390
- }), R = c(() => {
389
+ return (S = l.at(-1)) == null ? void 0 : S.shippingMethod;
390
+ }), F = c(() => {
391
391
  var m;
392
392
  const l = o(e);
393
393
  return ((m = a.value) == null ? void 0 : m[l]) ?? !1;
@@ -396,19 +396,19 @@ function Pt(e, s) {
396
396
  order: r,
397
397
  status: u,
398
398
  statusTechnicalName: i,
399
- total: f,
399
+ total: v,
400
400
  subtotal: P,
401
401
  shippingCosts: d,
402
402
  shippingAddress: p,
403
- billingAddress: K,
404
- personalDetails: M,
405
- shippingMethod: w,
406
- paymentMethod: S,
407
- paymentChangeable: R,
403
+ billingAddress: M,
404
+ personalDetails: K,
405
+ shippingMethod: A,
406
+ paymentMethod: Q,
407
+ paymentChangeable: F,
408
408
  orderQuery: n
409
409
  };
410
410
  }
411
- function Mt(e) {
411
+ function Kt(e) {
412
412
  const s = c(() => {
413
413
  var r, a;
414
414
  return (a = (r = o(e)) == null ? void 0 : r.transactions) == null ? void 0 : a.find((u) => {
@@ -429,52 +429,73 @@ function Mt(e) {
429
429
  };
430
430
  }
431
431
  const le = "createCustomerAddress post /account/address";
432
- function Kt(e) {
433
- const s = g(), t = Q();
434
- return h({
432
+ function Mt(e) {
433
+ const s = g(), t = C();
434
+ return f({
435
435
  ...e,
436
- mutationFn: async (n) => s.query(le, y(n)),
436
+ mutationFn: async (n) => s.query(
437
+ le,
438
+ y(n)
439
+ ),
437
440
  onSuccess: async (n, r, a) => {
438
441
  var u, i;
439
- await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
442
+ await Promise.all([
443
+ t.invalidateQueries({ queryKey: R.lists() }),
444
+ t.invalidateQueries({ queryKey: w.all() })
445
+ ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(
446
+ n,
447
+ r,
448
+ a
449
+ ));
440
450
  }
441
451
  });
442
452
  }
443
453
  const de = "deleteCustomerAddress delete /account/address/{addressId}";
444
454
  function Ot(e) {
445
- const s = g(), t = Q();
446
- return h({
455
+ const s = g(), t = C();
456
+ return f({
447
457
  ...e,
448
- mutationFn: async (n) => s.query(de, y(n)),
458
+ mutationFn: async (n) => s.query(
459
+ de,
460
+ y(n)
461
+ ),
449
462
  onSuccess: async (n, r, a) => {
450
463
  var u, i;
451
- await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
464
+ await Promise.all([
465
+ t.invalidateQueries({ queryKey: R.lists() }),
466
+ t.invalidateQueries({ queryKey: w.all() })
467
+ ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(
468
+ n,
469
+ r,
470
+ a
471
+ ));
452
472
  }
453
473
  });
454
474
  }
455
475
  const ye = "updateCustomerAddress patch /account/address/{addressId}";
456
476
  function wt(e) {
457
- const s = g(), t = Q();
458
- return h({
477
+ const s = g(), t = C();
478
+ return f({
459
479
  ...e,
460
480
  mutationFn: async (n) => s.query(ye, y(n)),
461
481
  onSuccess: async (n, r, a) => {
462
- var i, f;
482
+ var i, v;
463
483
  const { addressId: u } = y(r).params;
464
- t.setQueryData(F.detail(u), n), await Promise.all([
465
- t.invalidateQueries({ queryKey: F.lists() }),
484
+ t.setQueryData(R.detail(u), n), await Promise.all([
485
+ t.invalidateQueries({ queryKey: w.all() }),
486
+ t.invalidateQueries({ queryKey: R.lists() }),
466
487
  t.invalidateQueries({
467
- queryKey: F.detail(y(r).params.addressId),
488
+ queryKey: R.detail(y(r).params.addressId),
468
489
  predicate: (P) => P.queryKey.at(-1) !== u
469
490
  })
470
- ]), await ((f = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : f(n, r, a));
491
+ ]), await ((v = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : v(n, r, a));
471
492
  }
472
493
  });
473
494
  }
474
495
  const pe = "addLineItem post /checkout/cart/line-item";
475
496
  function At(e) {
476
- const s = g(), t = Q();
477
- return h({
497
+ const s = g(), t = C();
498
+ return f({
478
499
  ...e,
479
500
  mutationFn: async (n) => s.query(pe, {
480
501
  body: n
@@ -495,7 +516,7 @@ function At(e) {
495
516
  const ge = "readCart get /checkout/cart";
496
517
  function me(e) {
497
518
  const s = g(), t = L.get();
498
- return v({
519
+ return h({
499
520
  queryKey: t,
500
521
  queryFn: async ({ signal: n }) => s.query(ge, {
501
522
  ...y(e),
@@ -506,12 +527,12 @@ function me(e) {
506
527
  function Rt() {
507
528
  return q(me());
508
529
  }
509
- const fe = "removeLineItem post /checkout/cart/line-item/delete";
530
+ const ve = "removeLineItem post /checkout/cart/line-item/delete";
510
531
  function Ft(e) {
511
- const s = g(), t = Q();
512
- return h({
532
+ const s = g(), t = C();
533
+ return f({
513
534
  ...e,
514
- mutationFn: async (n) => s.query(fe, {
535
+ mutationFn: async (n) => s.query(ve, {
515
536
  body: n
516
537
  }),
517
538
  onSuccess: async (n, r, a) => {
@@ -527,12 +548,12 @@ function Ft(e) {
527
548
  }
528
549
  });
529
550
  }
530
- const he = "updateLineItem patch /checkout/cart/line-item";
551
+ const fe = "updateLineItem patch /checkout/cart/line-item";
531
552
  function Lt(e) {
532
- const s = g(), t = Q();
533
- return h({
553
+ const s = g(), t = C();
554
+ return f({
534
555
  ...e,
535
- mutationFn: async (n) => s.query(he, {
556
+ mutationFn: async (n) => s.query(fe, {
536
557
  body: n
537
558
  }),
538
559
  onSuccess: async (n, r, a) => {
@@ -541,12 +562,12 @@ function Lt(e) {
541
562
  }
542
563
  });
543
564
  }
544
- const ve = "createOrder post /checkout/order";
565
+ const he = "createOrder post /checkout/order";
545
566
  function It(e) {
546
- const s = g(), t = Q();
547
- return h({
567
+ const s = g(), t = C();
568
+ return f({
548
569
  ...e,
549
- mutationFn: async (n) => s.query(ve, y(n)),
570
+ mutationFn: async (n) => s.query(he, y(n)),
550
571
  onSuccess: async (n, r, a) => {
551
572
  var u, i;
552
573
  await Promise.all([
@@ -559,9 +580,9 @@ function It(e) {
559
580
  });
560
581
  }
561
582
  const qe = "readLanguages post /language";
562
- function Se(e) {
583
+ function Qe(e) {
563
584
  const s = g();
564
- return v({
585
+ return h({
565
586
  queryKey: ee.all(),
566
587
  queryFn: ({ signal: t }) => s.query(qe, {
567
588
  ...y(e),
@@ -570,15 +591,15 @@ function Se(e) {
570
591
  });
571
592
  }
572
593
  function xt(e) {
573
- return q(Se(e));
594
+ return q(Qe(e));
574
595
  }
575
- const Ce = "readCountry post /country", Qe = function(s) {
596
+ const Se = "readCountry post /country", Ce = function(s) {
576
597
  const t = g(), n = j.list(s);
577
- return v({
598
+ return h({
578
599
  queryKey: n,
579
600
  queryFn: async ({ signal: r }) => {
580
601
  const a = y(s);
581
- return t.query(Ce, {
602
+ return t.query(Se, {
582
603
  ...a,
583
604
  signal: r
584
605
  });
@@ -586,42 +607,42 @@ const Ce = "readCountry post /country", Qe = function(s) {
586
607
  });
587
608
  };
588
609
  function Ut(e) {
589
- return q(Qe(e));
610
+ return q(Ce(e));
590
611
  }
591
612
  const Pe = "changeEmail post /account/change-email";
592
613
  function Dt(e) {
593
- const s = g(), t = Q();
594
- return h({
614
+ const s = g(), t = C();
615
+ return f({
595
616
  ...e,
596
617
  mutationFn: async (n) => s.query(Pe, y(n)),
597
618
  onSuccess: async (n, r, a) => {
598
619
  var u, i;
599
- await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: A.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
620
+ await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: w.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
600
621
  }
601
622
  });
602
623
  }
603
- const Me = "changeProfile post /account/change-profile";
624
+ const Ke = "changeProfile post /account/change-profile";
604
625
  function bt(e) {
605
- const s = g(), t = Q();
606
- return h({
626
+ const s = g(), t = C();
627
+ return f({
607
628
  ...e,
608
- mutationFn: async (n) => s.query(Me, y(n)),
629
+ mutationFn: async (n) => s.query(Ke, y(n)),
609
630
  onSuccess: async (n, r, a) => {
610
631
  var u, i;
611
632
  await Promise.all([
612
633
  t.invalidateQueries({ queryKey: I.all() }),
613
- t.invalidateQueries({ queryKey: A.all() })
634
+ t.invalidateQueries({ queryKey: w.all() })
614
635
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
615
636
  }
616
637
  });
617
638
  }
618
- const Ke = "loginCustomer post /account/login";
639
+ const Me = "loginCustomer post /account/login";
619
640
  function kt(e) {
620
- const s = g(), t = Q();
621
- return h({
641
+ const s = g(), t = C();
642
+ return f({
622
643
  ...e,
623
644
  mutationFn: async (n) => {
624
- const r = await s.queryRaw(Ke, {
645
+ const r = await s.queryRaw(Me, {
625
646
  body: n
626
647
  }), a = r.headers.get("sw-context-token");
627
648
  return a && (s.contextToken = a), r.json();
@@ -629,7 +650,7 @@ function kt(e) {
629
650
  onSuccess: async (n, r, a) => {
630
651
  var u, i;
631
652
  await Promise.all([
632
- t.resetQueries({ queryKey: A.all() }),
653
+ t.resetQueries({ queryKey: w.all() }),
633
654
  t.invalidateQueries({ queryKey: L.get() }),
634
655
  t.invalidateQueries({ queryKey: I.all() })
635
656
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
@@ -638,16 +659,20 @@ function kt(e) {
638
659
  }
639
660
  const Oe = "logoutCustomer post /account/logout";
640
661
  function Bt(e) {
641
- const s = g(), t = Q();
642
- return h({
662
+ const s = g(), t = C();
663
+ return f({
643
664
  ...e,
644
665
  mutationFn: async (n) => s.query(Oe, y(n)),
645
666
  onSuccess: async (n, r, a) => {
646
667
  var u, i;
647
668
  await Promise.all([
648
- t.resetQueries({ queryKey: A.all() }),
669
+ t.resetQueries({ queryKey: w.all() }),
649
670
  t.invalidateQueries({ queryKey: L.get() }),
650
- t.invalidateQueries({ queryKey: I.all() })
671
+ t.invalidateQueries({ queryKey: I.all() }),
672
+ t.invalidateQueries({ queryKey: R.all() }),
673
+ t.invalidateQueries({ queryKey: D.all() }),
674
+ t.invalidateQueries({ queryKey: b.all() }),
675
+ t.invalidateQueries({ queryKey: U.all() })
651
676
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
652
677
  }
653
678
  });
@@ -655,7 +680,7 @@ function Bt(e) {
655
680
  const we = "readCustomer post /account/customer";
656
681
  function Ae(e) {
657
682
  const s = g(), t = I.detail(c(() => y(e).body ?? {}));
658
- return v({
683
+ return h({
659
684
  queryKey: t,
660
685
  queryFn: async () => s.query(we, y(e))
661
686
  });
@@ -665,14 +690,14 @@ function Re(e) {
665
690
  }
666
691
  const Fe = "register post /account/register";
667
692
  function Nt(e) {
668
- const s = g(), t = Q();
669
- return h({
693
+ const s = g(), t = C();
694
+ return f({
670
695
  ...e,
671
696
  mutationFn: async (n) => s.query(Fe, y(n)),
672
697
  onSuccess: async (n, r, a) => {
673
698
  var u, i;
674
699
  await Promise.all([
675
- t.resetQueries({ queryKey: A.all() }),
700
+ t.resetQueries({ queryKey: w.all() }),
676
701
  t.invalidateQueries({ queryKey: I.all() })
677
702
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
678
703
  }
@@ -680,45 +705,45 @@ function Nt(e) {
680
705
  }
681
706
  const Le = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
682
707
  function Tt(e) {
683
- const s = g(), t = Q();
684
- return h({
708
+ const s = g(), t = C();
709
+ return f({
685
710
  ...e,
686
711
  mutationFn: async (n) => s.query(Le, y(n)),
687
712
  onSuccess: async (n, r, a) => {
688
713
  var u, i;
689
714
  await Promise.all([
690
715
  t.invalidateQueries({ queryKey: I.all() }),
691
- t.invalidateQueries({ queryKey: A.all() })
716
+ t.invalidateQueries({ queryKey: w.all() })
692
717
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
693
718
  }
694
719
  });
695
720
  }
696
721
  const Ie = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
697
722
  function Et(e) {
698
- const s = g(), t = Q();
699
- return h({
723
+ const s = g(), t = C();
724
+ return f({
700
725
  ...e,
701
726
  mutationFn: async (n) => s.query(Ie, y(n)),
702
727
  onSuccess: async (n, r, a) => {
703
728
  var u, i;
704
729
  await Promise.all([
705
730
  t.invalidateQueries({ queryKey: I.all() }),
706
- t.invalidateQueries({ queryKey: A.all() })
731
+ t.invalidateQueries({ queryKey: w.all() })
707
732
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
708
733
  }
709
734
  });
710
735
  }
711
736
  const xe = "deleteCustomer delete /account/customer";
712
737
  function jt(e) {
713
- const s = g(), t = Q();
714
- return h({
738
+ const s = g(), t = C();
739
+ return f({
715
740
  ...e,
716
741
  mutationFn: async (n) => s.query(xe, y(n)),
717
742
  onSuccess: async (n, r, a) => {
718
743
  var u, i;
719
744
  await Promise.all([
720
745
  t.resetQueries({ queryKey: I.all() }),
721
- t.resetQueries({ queryKey: A.all() }),
746
+ t.resetQueries({ queryKey: w.all() }),
722
747
  t.resetQueries({ queryKey: L.get() })
723
748
  ]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
724
749
  }
@@ -727,7 +752,7 @@ function jt(e) {
727
752
  const Ue = "registerConfirm post /account/register-confirm";
728
753
  function Vt(e) {
729
754
  const s = g();
730
- return h({
755
+ return f({
731
756
  ...e,
732
757
  mutationFn: async (t) => {
733
758
  const n = await s.queryRaw(Ue, {
@@ -744,7 +769,7 @@ function Vt(e) {
744
769
  const De = "sendRecoveryMail post /account/recovery-password";
745
770
  function $t(e) {
746
771
  const s = g();
747
- return h({
772
+ return f({
748
773
  ...e,
749
774
  mutationFn: async (t) => s.query(De, y(t)),
750
775
  onSuccess: async (t, n, r) => {
@@ -756,7 +781,7 @@ function $t(e) {
756
781
  const be = "changePassword post /account/change-password";
757
782
  function zt(e) {
758
783
  const s = g();
759
- return h({
784
+ return f({
760
785
  ...e,
761
786
  mutationFn: async (t) => s.query(be, y(t)),
762
787
  onSuccess: async (t, n, r) => {
@@ -768,7 +793,7 @@ function zt(e) {
768
793
  const ke = "imitateCustomerLogin post /account/login/imitate-customer";
769
794
  function Be(e) {
770
795
  const s = g(), t = I.imitateLogin(c(() => y(e).body ?? {}));
771
- return v({
796
+ return h({
772
797
  queryKey: t,
773
798
  queryFn: async () => s.query(ke, y(e))
774
799
  });
@@ -779,7 +804,7 @@ function Gt(e) {
779
804
  const Ne = "recoveryPassword post /account/recovery-password-confirm";
780
805
  function Ht(e) {
781
806
  const s = g();
782
- return h({
807
+ return f({
783
808
  ...e,
784
809
  mutationFn: async (t) => s.query(Ne, y(t)),
785
810
  onSuccess: async (t, n, r) => {
@@ -790,15 +815,15 @@ function Ht(e) {
790
815
  }
791
816
  const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(s, t, n) {
792
817
  const r = g(), a = k.detail(s, t, n);
793
- return v({
818
+ return h({
794
819
  queryKey: a,
795
820
  queryFn: async ({ signal: u }) => {
796
- const i = o(s), f = o(t), P = y(n);
821
+ const i = o(s), v = o(t), P = y(n);
797
822
  return r.query(Te, {
798
823
  ...P,
799
824
  params: {
800
825
  activeId: i,
801
- rootId: f
826
+ rootId: v
802
827
  },
803
828
  signal: u
804
829
  });
@@ -814,7 +839,7 @@ function Ve(e) {
814
839
  var n;
815
840
  return (n = y(e)) == null ? void 0 : n.body;
816
841
  }));
817
- return v({
842
+ return h({
818
843
  queryKey: t,
819
844
  queryFn: ({ signal: n }) => s.query(je, {
820
845
  ...y(e),
@@ -827,8 +852,8 @@ function $e(e) {
827
852
  }
828
853
  const ze = "handlePaymentMethod post /handle-payment";
829
854
  function Jt(e) {
830
- const s = g(), t = Q();
831
- return h({
855
+ const s = g(), t = C();
856
+ return f({
832
857
  ...e,
833
858
  mutationFn: async (n) => s.query(ze, y(n)),
834
859
  onSuccess: async (n, r, a) => {
@@ -839,8 +864,8 @@ function Jt(e) {
839
864
  }
840
865
  const Ge = "orderSetPayment post /order/payment";
841
866
  function Xt(e) {
842
- const s = g(), t = Q();
843
- return h({
867
+ const s = g(), t = C();
868
+ return f({
844
869
  ...e,
845
870
  mutationFn: async (n) => s.query(Ge, y(n)),
846
871
  onSuccess: async (n, r, a) => {
@@ -851,7 +876,7 @@ function Xt(e) {
851
876
  }
852
877
  const He = "readCategoryList post /category", We = function(s) {
853
878
  const t = g(), n = N.list(s);
854
- return v({
879
+ return h({
855
880
  queryKey: n,
856
881
  queryFn: async ({ signal: r }) => t.query(He, {
857
882
  ...y(s),
@@ -865,7 +890,7 @@ function Yt(e) {
865
890
  const Je = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
866
891
  function Xe(e, s) {
867
892
  const t = g(), n = O.list(e, s);
868
- return v({
893
+ return h({
869
894
  queryKey: n,
870
895
  queryFn: async ({ signal: r }) => {
871
896
  const a = y(s);
@@ -886,7 +911,7 @@ function Zt(e, s) {
886
911
  const Ye = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
887
912
  function Ze(e, s) {
888
913
  const t = g(), n = O.customDetail(e, s);
889
- return v({
914
+ return h({
890
915
  queryKey: n,
891
916
  queryFn: async ({ signal: r }) => {
892
917
  const a = y(s);
@@ -907,7 +932,7 @@ function _t(e, s) {
907
932
  const _e = "searchPage post /search";
908
933
  function et(e) {
909
934
  const s = g(), t = O.search(e);
910
- return v({
935
+ return h({
911
936
  queryKey: t,
912
937
  queryFn: async ({ signal: n }) => {
913
938
  const r = y(e);
@@ -924,7 +949,7 @@ function en(e) {
924
949
  const tt = "searchSuggest post /search-suggest";
925
950
  function nt(e) {
926
951
  const s = g(), t = O.searchSuggest(e);
927
- return v({
952
+ return h({
928
953
  queryKey: t,
929
954
  queryFn: async ({ signal: n }) => {
930
955
  const r = y(e);
@@ -941,7 +966,7 @@ function tn(e) {
941
966
  const st = "readProduct post /product";
942
967
  function rt(e) {
943
968
  const s = g(), t = O.headlessDetail(e);
944
- return v({
969
+ return h({
945
970
  queryKey: t,
946
971
  queryFn: async ({ signal: n }) => {
947
972
  const r = y(e);
@@ -958,7 +983,7 @@ function nn(e) {
958
983
  const at = "readProductDetail post /product/{productId}";
959
984
  function ut(e, s) {
960
985
  const t = g(), n = O.detail(e, s);
961
- return v({
986
+ return h({
962
987
  queryKey: n,
963
988
  queryFn: async ({ signal: r }) => {
964
989
  const a = y(s);
@@ -978,7 +1003,7 @@ function sn(e, s) {
978
1003
  }
979
1004
  const it = "readSalutation post /salutation", ot = function(s) {
980
1005
  const t = g(), n = E.list(s);
981
- return v({
1006
+ return h({
982
1007
  queryKey: n,
983
1008
  queryFn: async ({ signal: r }) => {
984
1009
  const a = y(s);
@@ -994,7 +1019,7 @@ function rn(e) {
994
1019
  }
995
1020
  const ct = "readSeoUrl post /seo-url", lt = function(s) {
996
1021
  const t = g(), n = T.list(s);
997
- return v({
1022
+ return h({
998
1023
  queryKey: n,
999
1024
  queryFn: async ({ signal: r }) => {
1000
1025
  const a = y(s);
@@ -1014,7 +1039,7 @@ function yt(e) {
1014
1039
  var n;
1015
1040
  return (n = y(e)) == null ? void 0 : n.body;
1016
1041
  }));
1017
- return v({
1042
+ return h({
1018
1043
  queryKey: t,
1019
1044
  queryFn: ({ signal: n }) => s.query(dt, {
1020
1045
  ...y(e),
@@ -1033,11 +1058,11 @@ function un() {
1033
1058
  }), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
1034
1059
  paymentMethodId: i
1035
1060
  }), a = c(() => {
1036
- var i, f;
1037
- return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
1061
+ var i, v;
1062
+ return (v = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : v.paymentMethod;
1038
1063
  }), u = c(() => {
1039
- var i, f, P;
1040
- return ((P = (f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements) == null ? void 0 : P.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
1064
+ var i, v, P;
1065
+ return ((P = (v = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : v.elements) == null ? void 0 : P.sort((d, K) => (d.position ?? 0) - (K.position ?? 0))) ?? [];
1041
1066
  });
1042
1067
  return {
1043
1068
  contextUpdateMutation: s,
@@ -1057,11 +1082,11 @@ function on() {
1057
1082
  }), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
1058
1083
  shippingMethodId: i
1059
1084
  }), a = c(() => {
1060
- var i, f;
1061
- return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
1085
+ var i, v;
1086
+ return (v = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : v.shippingMethod;
1062
1087
  }), u = c(() => {
1063
- var i, f;
1064
- return ((f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements.sort((P, d) => (P.position ?? 0) - (d.position ?? 0))) ?? [];
1088
+ var i, v;
1089
+ return ((v = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : v.elements.sort((P, d) => (P.position ?? 0) - (d.position ?? 0))) ?? [];
1065
1090
  });
1066
1091
  return {
1067
1092
  contextUpdateMutation: s,
@@ -1101,22 +1126,22 @@ function ln(e) {
1101
1126
  get() {
1102
1127
  return a.page;
1103
1128
  },
1104
- set(K) {
1105
- a.page = Math.max(1, Math.min(o(u), K));
1129
+ set(M) {
1130
+ a.page = Math.max(1, Math.min(o(u), M));
1106
1131
  }
1107
1132
  });
1108
1133
  H(
1109
1134
  [() => o(u), () => a],
1110
- ([K, p]) => {
1111
- a.page = Math.min(K, a.page), a.total = p.total ?? 0, a.limit = p.limit;
1135
+ ([M, p]) => {
1136
+ a.page = Math.min(M, a.page), a.total = p.total ?? 0, a.limit = p.limit;
1112
1137
  }
1113
1138
  );
1114
- const f = c(() => a.page === o(u)), P = c(() => a.page === 1), d = c(() => ({
1139
+ const v = c(() => a.page === o(u)), P = c(() => a.page === 1), d = c(() => ({
1115
1140
  p: a.page,
1116
1141
  limit: a.limit,
1117
1142
  "total-count-mode": a.totalCountMode ?? "none"
1118
- })), M = (K) => {
1119
- H(() => o(K), (p) => {
1143
+ })), K = (M) => {
1144
+ H(() => o(M), (p) => {
1120
1145
  p && (a.total = (p == null ? void 0 : p.total) ?? 0, a.limit = (p == null ? void 0 : p.limit) ?? 0);
1121
1146
  });
1122
1147
  };
@@ -1125,9 +1150,9 @@ function ln(e) {
1125
1150
  total: W(a, "total"),
1126
1151
  limit: W(a, "limit"),
1127
1152
  pageCount: u,
1128
- isLastPage: f,
1153
+ isLastPage: v,
1129
1154
  isFirstPage: P,
1130
- usePaginationSync: M,
1155
+ usePaginationSync: K,
1131
1156
  // This can be used to pass the pagination options directly to the query options
1132
1157
  queryOptions: d
1133
1158
  };
@@ -1149,31 +1174,31 @@ function dn(e) {
1149
1174
  return (p = e.value) == null ? void 0 : p.calculatedCheapestPrice;
1150
1175
  }), t = c(
1151
1176
  () => {
1152
- var p, S, w, R, l;
1153
- return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 0 ? (R = (w = e.value) == null ? void 0 : w.calculatedPrices) == null ? void 0 : R[0] : (l = e.value) == null ? void 0 : l.calculatedPrice;
1177
+ var p, Q, A, F, l;
1178
+ return (((Q = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : Q.length) ?? 0) > 0 ? (F = (A = e.value) == null ? void 0 : A.calculatedPrices) == null ? void 0 : F[0] : (l = e.value) == null ? void 0 : l.calculatedPrice;
1154
1179
  }
1155
1180
  ), n = c(() => {
1156
1181
  var p;
1157
1182
  return (p = t == null ? void 0 : t.value) == null ? void 0 : p.referencePrice;
1158
1183
  }), r = c(() => {
1159
- var p, S;
1160
- return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 1;
1184
+ var p, Q;
1185
+ return (((Q = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : Q.length) ?? 0) > 1;
1161
1186
  }), a = c(
1162
1187
  () => {
1163
- var p, S, w, R, l, m;
1164
- return !!((p = e.value) != null && p.parentId) && ((w = (S = e.value) == null ? void 0 : S.calculatedCheapestPrice) == null ? void 0 : w.hasRange) && ((R = t == null ? void 0 : t.value) == null ? void 0 : R.unitPrice) !== ((l = s == null ? void 0 : s.value) == null ? void 0 : l.unitPrice) && ((m = s == null ? void 0 : s.value) == null ? void 0 : m.unitPrice);
1188
+ var p, Q, A, F, l, m;
1189
+ return !!((p = e.value) != null && p.parentId) && ((A = (Q = e.value) == null ? void 0 : Q.calculatedCheapestPrice) == null ? void 0 : A.hasRange) && ((F = t == null ? void 0 : t.value) == null ? void 0 : F.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);
1165
1190
  }
1166
1191
  ), u = c(
1167
1192
  () => {
1168
- var p, S;
1169
- return r.value && X(e.value).length > 1 ? (S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.reduce((w, R) => R.unitPrice < w.unitPrice ? R : w) : t.value;
1193
+ var p, Q;
1194
+ return r.value && X(e.value).length > 1 ? (Q = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : Q.reduce((A, F) => F.unitPrice < A.unitPrice ? F : A) : t.value;
1170
1195
  }
1171
1196
  ), i = c(
1172
1197
  () => {
1173
1198
  var p;
1174
1199
  return (p = u.value) == null ? void 0 : p.unitPrice;
1175
1200
  }
1176
- ), f = c(
1201
+ ), v = c(
1177
1202
  () => {
1178
1203
  var p;
1179
1204
  return (p = u.value) == null ? void 0 : p.totalPrice;
@@ -1181,24 +1206,24 @@ function dn(e) {
1181
1206
  ), P = c(
1182
1207
  () => u.value
1183
1208
  ), d = c(() => {
1184
- var p, S;
1185
- return !!((S = (p = u.value) == null ? void 0 : p.listPrice) != null && S.percentage);
1186
- }), M = c(
1209
+ var p, Q;
1210
+ return !!((Q = (p = u.value) == null ? void 0 : p.listPrice) != null && Q.percentage);
1211
+ }), K = c(
1187
1212
  () => {
1188
- var p, S, w;
1189
- return (w = (S = (p = e.value) == null ? void 0 : p.calculatedPrice) == null ? void 0 : S.regulationPrice) == null ? void 0 : w.price;
1213
+ var p, Q, A;
1214
+ return (A = (Q = (p = e.value) == null ? void 0 : p.calculatedPrice) == null ? void 0 : Q.regulationPrice) == null ? void 0 : A.price;
1190
1215
  }
1191
- ), K = c(() => X(e.value));
1216
+ ), M = c(() => X(e.value));
1192
1217
  return {
1193
1218
  price: P,
1194
- totalPrice: f,
1219
+ totalPrice: v,
1195
1220
  unitPrice: i,
1196
1221
  displayFromVariants: a,
1197
1222
  displayFrom: r,
1198
- tierPrices: K,
1223
+ tierPrices: M,
1199
1224
  referencePrice: n,
1200
1225
  isListPrice: d,
1201
- regulationPrice: M
1226
+ regulationPrice: K
1202
1227
  };
1203
1228
  }
1204
1229
  function mt(e, s) {
@@ -1248,7 +1273,7 @@ function gn(e) {
1248
1273
  var d;
1249
1274
  return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
1250
1275
  }
1251
- ), f = c(
1276
+ ), v = c(
1252
1277
  () => {
1253
1278
  var d;
1254
1279
  return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
@@ -1267,18 +1292,18 @@ function gn(e) {
1267
1292
  isGuestSession: a,
1268
1293
  defaultBillingAddressId: u,
1269
1294
  defaultShippingAddressId: i,
1270
- userDefaultBillingAddress: f,
1295
+ userDefaultBillingAddress: v,
1271
1296
  userDefaultShippingAddress: P,
1272
1297
  // Expose queries and mutations directly
1273
1298
  customerQuery: s
1274
1299
  };
1275
1300
  }
1276
1301
  export {
1277
- St as absolutizeSeoUrl,
1278
- F as addressKeys,
1302
+ Qt as absolutizeSeoUrl,
1303
+ R as addressKeys,
1279
1304
  L as cartKeys,
1280
1305
  N as categoryKeys,
1281
- A as contextKeys,
1306
+ w as contextKeys,
1282
1307
  j as countryKeys,
1283
1308
  I as customerKeys,
1284
1309
  mt as getProductVariantForOptions,
@@ -1299,8 +1324,8 @@ export {
1299
1324
  Dt as useChangeEmailMutation,
1300
1325
  zt as useChangePasswordMutation,
1301
1326
  bt as useChangeProfileMutation,
1302
- Qt as useCheckoutAddresses,
1303
- Kt as useCreateCustomerAddressMutation,
1327
+ Ct as useCheckoutAddresses,
1328
+ Mt as useCreateCustomerAddressMutation,
1304
1329
  It as useCreateOrderMutation,
1305
1330
  Tt as useDefaultBillingAddressMutation,
1306
1331
  Et as useDefaultShippingAddressMutation,
@@ -1314,9 +1339,9 @@ export {
1314
1339
  ne as useListAddressQueryOptions,
1315
1340
  kt as useLoginCustomerMutation,
1316
1341
  Bt as useLogoutCustomerMutation,
1317
- Ct as useOptimistic,
1342
+ St as useOptimistic,
1318
1343
  Pt as useOrderDetails,
1319
- Mt as useOrderPayment,
1344
+ Kt as useOrderPayment,
1320
1345
  Xt as useOrderSetPaymentMutation,
1321
1346
  ln as usePagination,
1322
1347
  un as usePaymentMethods,
@@ -1331,13 +1356,13 @@ export {
1331
1356
  B as useReadContextQuery,
1332
1357
  ae as useReadContextQueryOptions,
1333
1358
  Ut as useReadCountryQuery,
1334
- Qe as useReadCountryQueryOptions,
1359
+ Ce as useReadCountryQueryOptions,
1335
1360
  Ze as useReadCustomProductDetailOptions,
1336
1361
  _t as useReadCustomProductDetailQuery,
1337
1362
  Re as useReadCustomerQuery,
1338
1363
  Ae as useReadCustomerQueryOptions,
1339
1364
  xt as useReadLanguageQuery,
1340
- Se as useReadLanguageQueryOptions,
1365
+ Qe as useReadLanguageQueryOptions,
1341
1366
  Wt as useReadNavigationQuery,
1342
1367
  Ee as useReadNavigationQueryOptions,
1343
1368
  ce as useReadOrderQuery,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -1,12 +1,21 @@
1
- import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/vue-query'
2
- import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
- import { unref } from 'vue'
4
- import { useShopwareQueryClient } from '../../inject'
5
- import { addressKeys } from '../../keys'
6
- import { unrefOptions } from '../../util/unrefOptions'
7
- import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
1
+ import {
2
+ useMutation,
3
+ type UseMutationOptions,
4
+ useQueryClient,
5
+ } from "@tanstack/vue-query";
6
+ import { ShopwareApiError } from "@teamnovu/kit-shopware-api-client";
7
+ import { unref } from "vue";
8
+ import { useShopwareQueryClient } from "../../inject";
9
+ import { addressKeys, contextKeys } from "../../keys";
10
+ import { unrefOptions } from "../../util/unrefOptions";
11
+ import type {
12
+ OperationKey,
13
+ OperationOptions,
14
+ OperationResponse,
15
+ } from "../types/query";
8
16
 
9
- const createCustomerAddressOperation = 'createCustomerAddress post /account/address' satisfies OperationKey
17
+ const createCustomerAddressOperation =
18
+ "createCustomerAddress post /account/address" satisfies OperationKey;
10
19
 
11
20
  export function useCreateCustomerAddressMutation(
12
21
  mutationOptions?: UseMutationOptions<
@@ -15,19 +24,31 @@ export function useCreateCustomerAddressMutation(
15
24
  OperationOptions<typeof createCustomerAddressOperation>
16
25
  >,
17
26
  ) {
18
- const client = useShopwareQueryClient()
19
- const queryClient = useQueryClient()
27
+ const client = useShopwareQueryClient();
28
+ const queryClient = useQueryClient();
20
29
 
21
30
  return useMutation({
22
31
  ...mutationOptions,
23
- mutationFn: async (options: OperationOptions<typeof createCustomerAddressOperation>) => {
24
- return client.query(createCustomerAddressOperation, unrefOptions(options))
32
+ mutationFn: async (
33
+ options: OperationOptions<typeof createCustomerAddressOperation>,
34
+ ) => {
35
+ return client.query(
36
+ createCustomerAddressOperation,
37
+ unrefOptions(options),
38
+ );
25
39
  },
26
40
  onSuccess: async (data, variables, context) => {
27
41
  // Invalidate address list queries to refetch data
28
- await queryClient.invalidateQueries({ queryKey: addressKeys.lists() })
42
+ await Promise.all([
43
+ queryClient.invalidateQueries({ queryKey: addressKeys.lists() }),
44
+ queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
45
+ ]);
29
46
 
30
- await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
47
+ await unref(unref(mutationOptions)?.onSuccess)?.(
48
+ data,
49
+ variables,
50
+ context,
51
+ );
31
52
  },
32
- })
53
+ });
33
54
  }
@@ -1,12 +1,21 @@
1
- import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/vue-query'
2
- import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
- import { unref } from 'vue'
4
- import { useShopwareQueryClient } from '../../inject'
5
- import { addressKeys } from '../../keys'
6
- import { unrefOptions } from '../../util/unrefOptions'
7
- import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
1
+ import {
2
+ useMutation,
3
+ type UseMutationOptions,
4
+ useQueryClient,
5
+ } from "@tanstack/vue-query";
6
+ import { ShopwareApiError } from "@teamnovu/kit-shopware-api-client";
7
+ import { unref } from "vue";
8
+ import { useShopwareQueryClient } from "../../inject";
9
+ import { addressKeys, contextKeys } from "../../keys";
10
+ import { unrefOptions } from "../../util/unrefOptions";
11
+ import type {
12
+ OperationKey,
13
+ OperationOptions,
14
+ OperationResponse,
15
+ } from "../types/query";
8
16
 
9
- const deleteCustomerAddressOperation = 'deleteCustomerAddress delete /account/address/{addressId}' satisfies OperationKey
17
+ const deleteCustomerAddressOperation =
18
+ "deleteCustomerAddress delete /account/address/{addressId}" satisfies OperationKey;
10
19
 
11
20
  export function useDeleteCustomerAddressMutation(
12
21
  mutationOptions?: UseMutationOptions<
@@ -15,19 +24,31 @@ export function useDeleteCustomerAddressMutation(
15
24
  OperationOptions<typeof deleteCustomerAddressOperation>
16
25
  >,
17
26
  ) {
18
- const client = useShopwareQueryClient()
19
- const queryClient = useQueryClient()
27
+ const client = useShopwareQueryClient();
28
+ const queryClient = useQueryClient();
20
29
 
21
30
  return useMutation({
22
31
  ...mutationOptions,
23
- mutationFn: async (options: OperationOptions<typeof deleteCustomerAddressOperation>) => {
24
- return client.query(deleteCustomerAddressOperation, unrefOptions(options))
32
+ mutationFn: async (
33
+ options: OperationOptions<typeof deleteCustomerAddressOperation>,
34
+ ) => {
35
+ return client.query(
36
+ deleteCustomerAddressOperation,
37
+ unrefOptions(options),
38
+ );
25
39
  },
26
40
  onSuccess: async (data, variables, context) => {
27
41
  // Invalidate address list queries to refetch data
28
- await queryClient.invalidateQueries({ queryKey: addressKeys.lists() })
42
+ await Promise.all([
43
+ queryClient.invalidateQueries({ queryKey: addressKeys.lists() }),
44
+ queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
45
+ ]);
29
46
 
30
- await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
47
+ await unref(unref(mutationOptions)?.onSuccess)?.(
48
+ data,
49
+ variables,
50
+ context,
51
+ );
31
52
  },
32
- })
53
+ });
33
54
  }
@@ -2,7 +2,7 @@ import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/
2
2
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
3
  import { unref } from 'vue'
4
4
  import { useShopwareQueryClient } from '../../inject'
5
- import { addressKeys } from '../../keys'
5
+ import { addressKeys, contextKeys } from '../../keys'
6
6
  import { unrefOptions } from '../../util/unrefOptions'
7
7
  import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
8
8
 
@@ -29,6 +29,7 @@ export function useUpdateCustomerAddressMutation(
29
29
 
30
30
  // Invalidate address list queries to refetch data
31
31
  await Promise.all([
32
+ queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
32
33
  queryClient.invalidateQueries({ queryKey: addressKeys.lists() }),
33
34
  queryClient.invalidateQueries({
34
35
  queryKey: addressKeys.detail(unrefOptions(variables).params.addressId),
@@ -3,7 +3,7 @@ import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/
3
3
  import { unref } from 'vue'
4
4
  import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
5
5
  import { useShopwareQueryClient } from '../../inject'
6
- import { cartKeys, contextKeys, customerKeys } from '../../keys'
6
+ import { addressKeys, cartKeys, contextKeys, customerKeys, orderKeys, paymentKeys, shippingKeys } from '../../keys'
7
7
  import { unrefOptions } from '../../util/unrefOptions'
8
8
 
9
9
  const logoutOperation = 'logoutCustomer post /account/logout' satisfies OperationKey
@@ -28,6 +28,10 @@ export function useLogoutCustomerMutation(
28
28
  queryClient.resetQueries({ queryKey: contextKeys.all() }),
29
29
  queryClient.invalidateQueries({ queryKey: cartKeys.get() }),
30
30
  queryClient.invalidateQueries({ queryKey: customerKeys.all() }),
31
+ queryClient.invalidateQueries({ queryKey: addressKeys.all() }),
32
+ queryClient.invalidateQueries({ queryKey: shippingKeys.all() }),
33
+ queryClient.invalidateQueries({ queryKey: paymentKeys.all() }),
34
+ queryClient.invalidateQueries({ queryKey: orderKeys.all() }),
31
35
  ])
32
36
 
33
37
  await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)