@teamnovu/kit-shopware-composables 0.0.9 → 0.0.10

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,10 +1,8 @@
1
1
  import { GenericRecord } from '../../../api-types/storeApiTypes.d.ts';
2
- import { MaybeRef, ComputedRef } from 'vue';
3
2
  interface SeoUrlEntity {
4
3
  extensions?: {
5
4
  novuSeoUrls?: GenericRecord;
6
5
  };
7
6
  }
8
- export declare const getSeoUrl: <T extends SeoUrlEntity>(entity: T, languageId: string) => string;
9
- export declare const useSeoUrl: <T extends SeoUrlEntity>(entity: MaybeRef<T>, languageId: MaybeRef<string>) => ComputedRef<string>;
7
+ export declare const useSeoUrl: <T extends SeoUrlEntity>() => (entity: T, languageId: string) => string;
10
8
  export {};
package/dist/index.mjs CHANGED
@@ -11,11 +11,11 @@ function g() {
11
11
  }
12
12
  const F = {
13
13
  all: () => ["context"]
14
- }, k = {
14
+ }, B = {
15
15
  all: () => ["category"],
16
- lists: () => [...k.all(), "list"],
16
+ lists: () => [...B.all(), "list"],
17
17
  list: (e) => [
18
- ...k.all(),
18
+ ...B.all(),
19
19
  "list",
20
20
  {
21
21
  body: e
@@ -41,20 +41,20 @@ const F = {
41
41
  body: t
42
42
  }
43
43
  ]
44
- }, L = {
44
+ }, x = {
45
45
  all: () => ["product"],
46
- lists: () => [...L.all(), "list"],
46
+ lists: () => [...x.all(), "list"],
47
47
  list: (e, s) => [
48
- ...L.all(),
48
+ ...x.all(),
49
49
  "list",
50
50
  {
51
51
  url: e,
52
52
  body: s
53
53
  }
54
54
  ],
55
- details: () => [...L.all(), "detail"],
55
+ details: () => [...x.all(), "detail"],
56
56
  detail: (e, s) => [
57
- ...L.all(),
57
+ ...x.all(),
58
58
  "detail",
59
59
  {
60
60
  url: e,
@@ -62,13 +62,13 @@ const F = {
62
62
  }
63
63
  ],
64
64
  search: (e) => [
65
- ...L.all(),
65
+ ...x.all(),
66
66
  "search",
67
67
  {
68
68
  body: e
69
69
  }
70
70
  ]
71
- }, x = {
71
+ }, L = {
72
72
  get: () => ["cart"]
73
73
  }, R = {
74
74
  all: () => ["customer"],
@@ -85,21 +85,21 @@ const F = {
85
85
  ],
86
86
  details: () => [...w.all(), "detail"],
87
87
  detail: (e, s) => [...w.details(), e, ...s ? [{ body: s }] : []]
88
- }, B = {
88
+ }, N = {
89
89
  all: () => ["shippingMethod"],
90
- lists: () => [...B.all(), "list"],
90
+ lists: () => [...N.all(), "list"],
91
91
  list: (e) => [
92
- ...B.all(),
92
+ ...N.all(),
93
93
  "list",
94
94
  {
95
95
  body: e
96
96
  }
97
97
  ]
98
- }, N = {
98
+ }, D = {
99
99
  all: () => ["paymentMethod"],
100
- lists: () => [...N.all(), "list"],
100
+ lists: () => [...D.all(), "list"],
101
101
  list: (e) => [
102
- ...N.all(),
102
+ ...D.all(),
103
103
  "list",
104
104
  {
105
105
  body: e
@@ -116,31 +116,31 @@ const F = {
116
116
  body: e
117
117
  }
118
118
  ]
119
- }, D = {
119
+ }, E = {
120
120
  all: () => ["seoUrl"],
121
- lists: () => [...D.all(), "list"],
121
+ lists: () => [...E.all(), "list"],
122
122
  list: (e) => [
123
- ...D.all(),
123
+ ...E.all(),
124
124
  "list",
125
125
  {
126
126
  body: e
127
127
  }
128
128
  ]
129
- }, E = {
129
+ }, j = {
130
130
  all: () => ["salutation"],
131
- lists: () => [...E.all(), "list"],
131
+ lists: () => [...j.all(), "list"],
132
132
  list: (e) => [
133
- ...E.all(),
133
+ ...j.all(),
134
134
  "list",
135
135
  {
136
136
  body: e
137
137
  }
138
138
  ]
139
- }, j = {
139
+ }, T = {
140
140
  all: () => ["country"],
141
- lists: () => [...j.all(), "list"],
141
+ lists: () => [...T.all(), "list"],
142
142
  list: (e) => [
143
- ...j.all(),
143
+ ...T.all(),
144
144
  "list",
145
145
  {
146
146
  body: e
@@ -172,41 +172,41 @@ function te(e) {
172
172
  function ne(e) {
173
173
  return O(te(e));
174
174
  }
175
- const T = (e) => {
175
+ const V = (e) => {
176
176
  const s = e.replace(/\/?$/, "");
177
177
  return s.startsWith("/") ? s.slice(1) : s;
178
- }, lt = (e) => `/${T(e)}`;
178
+ }, lt = (e) => `/${V(e)}`;
179
179
  function dt(e, s, t) {
180
180
  const n = S();
181
181
  return {
182
182
  onMutate: async (a) => {
183
183
  await n.cancelQueries({ queryKey: e });
184
184
  const r = n.getQueryData(e);
185
- if (n.setQueryData(e, (u) => s(a, u)), t) {
186
- const u = i(t), o = i(u.onMutate);
187
- o == null || o(a);
185
+ if (n.setQueryData(e, (o) => s(a, o)), t) {
186
+ const o = i(t), u = i(o.onMutate);
187
+ u == null || u(a);
188
188
  }
189
189
  return { previousValue: r };
190
190
  },
191
- onError: (a, r, u) => {
192
- if (u && n.setQueryData(e, u.previousValue), t) {
193
- const o = i(t), h = i(o.onError);
194
- h == null || h(a, r, u);
191
+ onError: (a, r, o) => {
192
+ if (o && n.setQueryData(e, o.previousValue), t) {
193
+ const u = i(t), h = i(u.onError);
194
+ h == null || h(a, r, o);
195
195
  }
196
196
  },
197
197
  onSettled: (...a) => {
198
198
  if (n.invalidateQueries({ queryKey: e }), t) {
199
- const r = i(t), u = i(r.onSettled);
200
- u == null || u(...a);
199
+ const r = i(t), o = i(r.onSettled);
200
+ o == null || o(...a);
201
201
  }
202
202
  }
203
203
  };
204
204
  }
205
205
  const se = (e) => {
206
206
  var t, n, a, r;
207
- const s = (n = (t = i(e)) == null ? void 0 : t.transactions) == null ? void 0 : n.find((u) => {
208
- var o;
209
- return (o = u.paymentMethod) == null ? void 0 : o.active;
207
+ const s = (n = (t = i(e)) == null ? void 0 : t.transactions) == null ? void 0 : n.find((o) => {
208
+ var u;
209
+ return (u = o.paymentMethod) == null ? void 0 : u.active;
210
210
  });
211
211
  return ((a = s == null ? void 0 : s.paymentMethod) == null ? void 0 : a.asynchronous) && ((r = s == null ? void 0 : s.paymentMethod) == null ? void 0 : r.afterOrderEnabled);
212
212
  }, re = "readContext get /context";
@@ -220,25 +220,25 @@ function ae(e) {
220
220
  })
221
221
  });
222
222
  }
223
- function V(e) {
223
+ function k(e) {
224
224
  return O(ae(e));
225
225
  }
226
- const ue = "updateContext patch /context";
226
+ const oe = "updateContext patch /context";
227
227
  function $(e) {
228
228
  const s = g(), t = S();
229
229
  return f({
230
230
  ...e,
231
- mutationFn: async (n) => (t.cancelQueries({ queryKey: F.all() }), s.query(ue, {
231
+ mutationFn: async (n) => (t.cancelQueries({ queryKey: F.all() }), s.query(oe, {
232
232
  body: n
233
233
  })),
234
234
  onSuccess: async (n, a, r) => {
235
- var u, o;
236
- await t.invalidateQueries({ queryKey: F.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
235
+ var o, u;
236
+ await t.invalidateQueries({ queryKey: F.all() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
237
237
  }
238
238
  });
239
239
  }
240
240
  function yt() {
241
- const e = $(), s = V(), t = ne(), n = c(() => s.isFetching.value || e.isPending.value), a = async (d) => {
241
+ const e = $(), s = k(), t = ne(), n = c(() => s.isFetching.value || e.isPending.value), a = async (d) => {
242
242
  await e.mutateAsync({
243
243
  billingAddressId: d.id
244
244
  }), await J(n).toBe(!1);
@@ -246,10 +246,10 @@ function yt() {
246
246
  await e.mutateAsync({
247
247
  shippingAddressId: d.id
248
248
  }), await J(n).toBe(!1);
249
- }, u = c(() => {
249
+ }, o = c(() => {
250
250
  var d, P;
251
251
  return (P = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : P.activeBillingAddress;
252
- }), o = c(() => {
252
+ }), u = c(() => {
253
253
  var d, P;
254
254
  return (P = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : P.activeShippingAddress;
255
255
  }), h = c(() => {
@@ -257,7 +257,7 @@ function yt() {
257
257
  return ((d = t.data.value) == null ? void 0 : d.elements.filter(
258
258
  (P) => {
259
259
  var Q;
260
- return P.id !== ((Q = u.value) == null ? void 0 : Q.id);
260
+ return P.id !== ((Q = o.value) == null ? void 0 : Q.id);
261
261
  }
262
262
  )) ?? [];
263
263
  }), C = c(() => {
@@ -265,7 +265,7 @@ function yt() {
265
265
  return ((d = t.data.value) == null ? void 0 : d.elements.filter(
266
266
  (P) => {
267
267
  var Q;
268
- return P.id !== ((Q = o.value) == null ? void 0 : Q.id);
268
+ return P.id !== ((Q = u.value) == null ? void 0 : Q.id);
269
269
  }
270
270
  )) ?? [];
271
271
  });
@@ -276,20 +276,20 @@ function yt() {
276
276
  setBillingAddress: a,
277
277
  setShippingAddress: r,
278
278
  isSaving: n,
279
- activeBillingAddress: u,
280
- activeShippingAddress: o,
279
+ activeBillingAddress: o,
280
+ activeShippingAddress: u,
281
281
  inactiveBillingAddresses: h,
282
282
  inactiveShippingAddresses: C
283
283
  };
284
284
  }
285
- const oe = "readOrder post /order";
285
+ const ue = "readOrder post /order";
286
286
  function ie(e) {
287
287
  const s = g(), t = U.detail(e);
288
288
  return M({
289
289
  queryKey: t,
290
290
  queryFn: async ({ signal: n }) => {
291
291
  const a = m(e);
292
- return s.query(oe, {
292
+ return s.query(ue, {
293
293
  ...a,
294
294
  signal: n
295
295
  });
@@ -322,10 +322,10 @@ function pt(e, s) {
322
322
  }), r = c(() => {
323
323
  var l, p;
324
324
  return ((p = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : p.paymentChangeable) || {};
325
- }), u = c(() => {
325
+ }), o = c(() => {
326
326
  var l, p, q;
327
327
  return (q = (p = (l = a.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : p.translated) == null ? void 0 : q.name;
328
- }), o = c(() => {
328
+ }), u = c(() => {
329
329
  var l, p;
330
330
  return (p = (l = a.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : p.technicalName;
331
331
  }), h = c(() => {
@@ -374,8 +374,8 @@ function pt(e, s) {
374
374
  });
375
375
  return {
376
376
  order: a,
377
- status: u,
378
- statusTechnicalName: o,
377
+ status: o,
378
+ statusTechnicalName: u,
379
379
  total: h,
380
380
  subtotal: C,
381
381
  shippingCosts: d,
@@ -390,10 +390,10 @@ function pt(e, s) {
390
390
  }
391
391
  function mt(e) {
392
392
  const s = c(() => {
393
- var r, u;
394
- return (u = (r = i(e)) == null ? void 0 : r.transactions) == null ? void 0 : u.find((o) => {
393
+ var r, o;
394
+ return (o = (r = i(e)) == null ? void 0 : r.transactions) == null ? void 0 : o.find((u) => {
395
395
  var h;
396
- return ((h = o.paymentMethod) == null ? void 0 : h.active) === !0;
396
+ return ((h = u.paymentMethod) == null ? void 0 : h.active) === !0;
397
397
  });
398
398
  }), t = c(() => {
399
399
  var r;
@@ -416,8 +416,8 @@ function gt(e) {
416
416
  ...e,
417
417
  mutationFn: async (n) => s.query(le, m(n)),
418
418
  onSuccess: async (n, a, r) => {
419
- var u, o;
420
- await t.invalidateQueries({ queryKey: w.lists() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
419
+ var o, u;
420
+ await t.invalidateQueries({ queryKey: w.lists() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
421
421
  }
422
422
  });
423
423
  }
@@ -428,8 +428,8 @@ function ht(e) {
428
428
  ...e,
429
429
  mutationFn: async (n) => s.query(de, m(n)),
430
430
  onSuccess: async (n, a, r) => {
431
- var u, o;
432
- await t.invalidateQueries({ queryKey: w.lists() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
431
+ var o, u;
432
+ await t.invalidateQueries({ queryKey: w.lists() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
433
433
  }
434
434
  });
435
435
  }
@@ -440,15 +440,15 @@ function ft(e) {
440
440
  ...e,
441
441
  mutationFn: async (n) => s.query(ye, m(n)),
442
442
  onSuccess: async (n, a, r) => {
443
- var o, h;
444
- const { addressId: u } = m(a).params;
445
- t.setQueryData(w.detail(u), n), await Promise.all([
443
+ var u, h;
444
+ const { addressId: o } = m(a).params;
445
+ t.setQueryData(w.detail(o), n), await Promise.all([
446
446
  t.invalidateQueries({ queryKey: w.lists() }),
447
447
  t.invalidateQueries({
448
448
  queryKey: w.detail(m(a).params.addressId),
449
- predicate: (C) => C.queryKey.at(-1) !== u
449
+ predicate: (C) => C.queryKey.at(-1) !== o
450
450
  })
451
- ]), await ((h = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : h(n, a, r));
451
+ ]), await ((h = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : h(n, a, r));
452
452
  }
453
453
  });
454
454
  }
@@ -461,14 +461,14 @@ function vt(e) {
461
461
  body: n
462
462
  }),
463
463
  onSuccess: async (n, a, r) => {
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, a, r));
464
+ var o, u;
465
+ t.setQueryData(L.get(), n), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
466
466
  }
467
467
  });
468
468
  }
469
469
  const me = "readCart get /checkout/cart";
470
470
  function ge(e) {
471
- const s = g(), t = x.get();
471
+ const s = g(), t = L.get();
472
472
  return M({
473
473
  queryKey: t,
474
474
  queryFn: async ({ signal: n }) => s.query(me, {
@@ -489,8 +489,8 @@ function Ct(e) {
489
489
  body: n
490
490
  }),
491
491
  onSuccess: async (n, a, r) => {
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, a, r));
492
+ var o, u;
493
+ t.setQueryData(L.get(), n), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
494
494
  }
495
495
  });
496
496
  }
@@ -503,8 +503,8 @@ function St(e) {
503
503
  body: n
504
504
  }),
505
505
  onSuccess: async (n, a, r) => {
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, a, r));
506
+ var o, u;
507
+ t.setQueryData(L.get(), n), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
508
508
  }
509
509
  });
510
510
  }
@@ -515,18 +515,18 @@ function Pt(e) {
515
515
  ...e,
516
516
  mutationFn: async (n) => s.query(ve, m(n)),
517
517
  onSuccess: async (n, a, r) => {
518
- var u, o;
518
+ var o, u;
519
519
  await Promise.all([
520
520
  // Clear cart after successful order creation
521
- t.invalidateQueries({ queryKey: x.get() }),
521
+ t.invalidateQueries({ queryKey: L.get() }),
522
522
  // Invalidate order list to refetch data
523
523
  t.invalidateQueries({ queryKey: U.lists() })
524
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
524
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
525
525
  }
526
526
  });
527
527
  }
528
528
  const qe = "readCountry post /country", Ce = function(s) {
529
- const t = g(), n = j.list(s);
529
+ const t = g(), n = T.list(s);
530
530
  return M({
531
531
  queryKey: n,
532
532
  queryFn: async ({ signal: a }) => {
@@ -548,8 +548,8 @@ function Mt(e) {
548
548
  ...e,
549
549
  mutationFn: async (n) => s.query(Se, m(n)),
550
550
  onSuccess: async (n, a, r) => {
551
- var u, o;
552
- await t.invalidateQueries({ queryKey: R.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
551
+ var o, u;
552
+ await t.invalidateQueries({ queryKey: R.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
553
553
  }
554
554
  });
555
555
  }
@@ -560,11 +560,11 @@ function Ot(e) {
560
560
  ...e,
561
561
  mutationFn: async (n) => s.query(Pe, m(n)),
562
562
  onSuccess: async (n, a, r) => {
563
- var u, o;
563
+ var o, u;
564
564
  await Promise.all([
565
565
  t.invalidateQueries({ queryKey: R.all() }),
566
566
  t.invalidateQueries({ queryKey: F.all() })
567
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
567
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
568
568
  }
569
569
  });
570
570
  }
@@ -577,15 +577,15 @@ function At(e) {
577
577
  const a = await s.queryRaw(Qe, {
578
578
  body: n
579
579
  }), r = a.headers.get("sw-context-token");
580
- return r && s.setContextToken(r), a.json();
580
+ return r && (s.contextToken = r), a.json();
581
581
  },
582
582
  onSuccess: async (n, a, r) => {
583
- var u, o;
583
+ var o, u;
584
584
  await Promise.all([
585
585
  t.removeQueries({ queryKey: F.all() }),
586
- t.invalidateQueries({ queryKey: x.get() }),
586
+ t.invalidateQueries({ queryKey: L.get() }),
587
587
  t.invalidateQueries({ queryKey: R.all() })
588
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
588
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
589
589
  }
590
590
  });
591
591
  }
@@ -596,12 +596,12 @@ function Kt(e) {
596
596
  ...e,
597
597
  mutationFn: async (n) => s.query(Me, m(n)),
598
598
  onSuccess: async (n, a, r) => {
599
- var u, o;
599
+ var o, u;
600
600
  await Promise.all([
601
601
  t.removeQueries({ queryKey: F.all() }),
602
- t.invalidateQueries({ queryKey: x.get() }),
602
+ t.invalidateQueries({ queryKey: L.get() }),
603
603
  t.invalidateQueries({ queryKey: R.all() })
604
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
604
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
605
605
  }
606
606
  });
607
607
  }
@@ -623,8 +623,8 @@ function wt(e) {
623
623
  ...e,
624
624
  mutationFn: async (n) => s.query(we, m(n)),
625
625
  onSuccess: async (n, a, r) => {
626
- var u, o;
627
- await t.invalidateQueries({ queryKey: R.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
626
+ var o, u;
627
+ await t.invalidateQueries({ queryKey: R.all() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
628
628
  }
629
629
  });
630
630
  }
@@ -635,11 +635,11 @@ function Ft(e) {
635
635
  ...e,
636
636
  mutationFn: async (n) => s.query(Fe, m(n)),
637
637
  onSuccess: async (n, a, r) => {
638
- var u, o;
638
+ var o, u;
639
639
  await Promise.all([
640
640
  t.invalidateQueries({ queryKey: R.all() }),
641
641
  t.invalidateQueries({ queryKey: F.all() })
642
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
642
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
643
643
  }
644
644
  });
645
645
  }
@@ -650,11 +650,11 @@ function Rt(e) {
650
650
  ...e,
651
651
  mutationFn: async (n) => s.query(Re, m(n)),
652
652
  onSuccess: async (n, a, r) => {
653
- var u, o;
653
+ var o, u;
654
654
  await Promise.all([
655
655
  t.invalidateQueries({ queryKey: R.all() }),
656
656
  t.invalidateQueries({ queryKey: F.all() })
657
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
657
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
658
658
  }
659
659
  });
660
660
  }
@@ -665,41 +665,41 @@ function It(e) {
665
665
  ...e,
666
666
  mutationFn: async (n) => s.query(Ie, m(n)),
667
667
  onSuccess: async (n, a, r) => {
668
- var u, o;
668
+ var o, u;
669
669
  await Promise.all([
670
670
  t.resetQueries({ queryKey: R.all() }),
671
671
  t.resetQueries({ queryKey: F.all() }),
672
- t.resetQueries({ queryKey: x.get() })
673
- ]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
672
+ t.resetQueries({ queryKey: L.get() })
673
+ ]), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
674
674
  }
675
675
  });
676
676
  }
677
- const Le = "registerConfirm post /account/register-confirm";
678
- function Lt(e) {
677
+ const xe = "registerConfirm post /account/register-confirm";
678
+ function xt(e) {
679
679
  const s = g();
680
680
  return f({
681
681
  ...e,
682
682
  mutationFn: async (t) => {
683
- const n = await s.queryRaw(Le, {
683
+ const n = await s.queryRaw(xe, {
684
684
  body: t
685
685
  }), a = n.headers.get("sw-context-token");
686
- return a && s.setContextToken(a), n.json();
686
+ return a && (s.contextToken = a), n.json();
687
687
  },
688
688
  onSuccess: async (t, n, a) => {
689
- var r, u;
690
- await ((u = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : u(t, n, a));
689
+ var r, o;
690
+ await ((o = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : o(t, n, a));
691
691
  }
692
692
  });
693
693
  }
694
- const xe = "sendRecoveryMail post /account/recovery-password";
695
- function xt(e) {
694
+ const Le = "sendRecoveryMail post /account/recovery-password";
695
+ function Lt(e) {
696
696
  const s = g();
697
697
  return f({
698
698
  ...e,
699
- mutationFn: async (t) => s.query(xe, m(t)),
699
+ mutationFn: async (t) => s.query(Le, m(t)),
700
700
  onSuccess: async (t, n, a) => {
701
- var r, u;
702
- await ((u = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : u(t, n, a));
701
+ var r, o;
702
+ await ((o = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : o(t, n, a));
703
703
  }
704
704
  });
705
705
  }
@@ -710,8 +710,8 @@ function Ut(e) {
710
710
  ...e,
711
711
  mutationFn: async (t) => s.query(Ue, m(t)),
712
712
  onSuccess: async (t, n, a) => {
713
- var r, u;
714
- await ((u = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : u(t, n, a));
713
+ var r, o;
714
+ await ((o = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : o(t, n, a));
715
715
  }
716
716
  });
717
717
  }
@@ -722,8 +722,8 @@ function bt(e) {
722
722
  ...e,
723
723
  mutationFn: async (t) => s.query(be, m(t)),
724
724
  onSuccess: async (t, n, a) => {
725
- var r, u;
726
- await ((u = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : u(t, n, a));
725
+ var r, o;
726
+ await ((o = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : o(t, n, a));
727
727
  }
728
728
  });
729
729
  }
@@ -731,15 +731,15 @@ const ke = "readNavigation post /navigation/{activeId}/{rootId}", Be = function(
731
731
  const a = g(), r = b.detail(s, t, n);
732
732
  return M({
733
733
  queryKey: r,
734
- queryFn: async ({ signal: u }) => {
735
- const o = i(s), h = i(t), C = m(n);
734
+ queryFn: async ({ signal: o }) => {
735
+ const u = i(s), h = i(t), C = m(n);
736
736
  return a.query(ke, {
737
737
  ...C,
738
738
  params: {
739
- activeId: o,
739
+ activeId: u,
740
740
  rootId: h
741
741
  },
742
- signal: u
742
+ signal: o
743
743
  });
744
744
  }
745
745
  });
@@ -749,7 +749,7 @@ function kt(e, s, t) {
749
749
  }
750
750
  const Ne = "readPaymentMethod post /payment-method";
751
751
  function De(e) {
752
- const s = g(), t = N.list(c(() => {
752
+ const s = g(), t = D.list(c(() => {
753
753
  var n;
754
754
  return (n = m(e)) == null ? void 0 : n.body;
755
755
  }));
@@ -771,8 +771,8 @@ function Bt(e) {
771
771
  ...e,
772
772
  mutationFn: async (t) => s.query(je, m(t)),
773
773
  onSuccess: async (t, n, a) => {
774
- var r, u;
775
- await ((u = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : u(t, n, a));
774
+ var r, o;
775
+ await ((o = i((r = i(e)) == null ? void 0 : r.onSuccess)) == null ? void 0 : o(t, n, a));
776
776
  }
777
777
  });
778
778
  }
@@ -783,13 +783,13 @@ function Nt(e) {
783
783
  ...e,
784
784
  mutationFn: async (n) => s.query(Te, m(n)),
785
785
  onSuccess: async (n, a, r) => {
786
- var u, o;
787
- await t.invalidateQueries({ queryKey: U.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, a, r));
786
+ var o, u;
787
+ await t.invalidateQueries({ queryKey: U.all() }), await ((u = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : u(n, a, r));
788
788
  }
789
789
  });
790
790
  }
791
791
  const Ve = "readCategoryList post /category", $e = function(s) {
792
- const t = g(), n = k.list(s);
792
+ const t = g(), n = B.list(s);
793
793
  return M({
794
794
  queryKey: n,
795
795
  queryFn: async ({ signal: a }) => t.query(Ve, {
@@ -803,7 +803,7 @@ function Dt(e) {
803
803
  }
804
804
  const ze = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
805
805
  function Ge(e, s) {
806
- const t = g(), n = L.list(e, s);
806
+ const t = g(), n = x.list(e, s);
807
807
  return M({
808
808
  queryKey: n,
809
809
  queryFn: async ({ signal: a }) => {
@@ -812,7 +812,7 @@ function Ge(e, s) {
812
812
  ...r,
813
813
  params: {
814
814
  ...r.params,
815
- seoUrl: T(i(e))
815
+ seoUrl: V(i(e))
816
816
  },
817
817
  signal: a
818
818
  });
@@ -824,7 +824,7 @@ function Et(e, s) {
824
824
  }
825
825
  const He = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
826
826
  function We(e, s) {
827
- const t = g(), n = L.detail(e, s);
827
+ const t = g(), n = x.detail(e, s);
828
828
  return M({
829
829
  queryKey: n,
830
830
  queryFn: async ({ signal: a }) => {
@@ -833,7 +833,7 @@ function We(e, s) {
833
833
  ...r,
834
834
  params: {
835
835
  ...r.params,
836
- seoUrl: T(i(e))
836
+ seoUrl: V(i(e))
837
837
  },
838
838
  signal: a
839
839
  });
@@ -845,7 +845,7 @@ function jt(e, s) {
845
845
  }
846
846
  const Je = "searchPage post /search";
847
847
  function Xe(e) {
848
- const s = g(), t = L.search(e);
848
+ const s = g(), t = x.search(e);
849
849
  return M({
850
850
  queryKey: t,
851
851
  queryFn: async ({ signal: n }) => {
@@ -861,7 +861,7 @@ function Tt(e) {
861
861
  return O(Xe(e));
862
862
  }
863
863
  const Ye = "readSalutation post /salutation", Ze = function(s) {
864
- const t = g(), n = E.list(s);
864
+ const t = g(), n = j.list(s);
865
865
  return M({
866
866
  queryKey: n,
867
867
  queryFn: async ({ signal: a }) => {
@@ -877,7 +877,7 @@ function Vt(e) {
877
877
  return O(Ze(e));
878
878
  }
879
879
  const _e = "readSeoUrl post /seo-url", et = function(s) {
880
- const t = g(), n = D.list(s);
880
+ const t = g(), n = E.list(s);
881
881
  return M({
882
882
  queryKey: n,
883
883
  queryFn: async ({ signal: a }) => {
@@ -894,7 +894,7 @@ function $t(e) {
894
894
  }
895
895
  const tt = "readShippingMethod post /shipping-method";
896
896
  function nt(e) {
897
- const s = g(), t = B.list(c(() => {
897
+ const s = g(), t = N.list(c(() => {
898
898
  var n;
899
899
  return (n = m(e)) == null ? void 0 : n.body;
900
900
  }));
@@ -910,18 +910,18 @@ function st(e) {
910
910
  return O(nt(e));
911
911
  }
912
912
  function zt() {
913
- const e = V(), s = $(), t = Ee({
913
+ const e = k(), s = $(), t = Ee({
914
914
  query: {
915
915
  onlyAvailable: !0
916
916
  }
917
- }), n = c(() => s.isPending.value), a = async (o) => s.mutateAsync({
918
- paymentMethodId: o
917
+ }), n = c(() => s.isPending.value), a = async (u) => s.mutateAsync({
918
+ paymentMethodId: u
919
919
  }), r = c(() => {
920
- var o, h;
921
- return (h = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : h.paymentMethod;
922
- }), u = c(() => {
923
- var o, h, C;
924
- return ((C = (h = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : h.elements) == null ? void 0 : C.sort((d, P) => (d.position ?? 0) - (P.position ?? 0))) ?? [];
920
+ var u, h;
921
+ return (h = (u = e.data) == null ? void 0 : u.value) == null ? void 0 : h.paymentMethod;
922
+ }), o = c(() => {
923
+ var u, h, C;
924
+ return ((C = (h = (u = t.data) == null ? void 0 : u.value) == null ? void 0 : h.elements) == null ? void 0 : C.sort((d, P) => (d.position ?? 0) - (P.position ?? 0))) ?? [];
925
925
  });
926
926
  return {
927
927
  contextUpdateMutation: s,
@@ -930,22 +930,22 @@ function zt() {
930
930
  activePaymentMethod: r,
931
931
  setPaymentMethod: a,
932
932
  isSaving: n,
933
- paymentMethods: u
933
+ paymentMethods: o
934
934
  };
935
935
  }
936
936
  function Gt() {
937
- const e = V(), s = $(), t = st({
937
+ const e = k(), s = $(), t = st({
938
938
  query: {
939
939
  onlyAvailable: !0
940
940
  }
941
- }), n = c(() => s.isPending.value), a = async (o) => s.mutateAsync({
942
- shippingMethodId: o
941
+ }), n = c(() => s.isPending.value), a = async (u) => s.mutateAsync({
942
+ shippingMethodId: u
943
943
  }), r = c(() => {
944
- var o, h;
945
- return (h = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : h.shippingMethod;
946
- }), u = c(() => {
947
- var o, h;
948
- return ((h = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : h.elements.sort((C, d) => (C.position ?? 0) - (d.position ?? 0))) ?? [];
944
+ var u, h;
945
+ return (h = (u = e.data) == null ? void 0 : u.value) == null ? void 0 : h.shippingMethod;
946
+ }), o = c(() => {
947
+ var u, h;
948
+ return ((h = (u = t.data) == null ? void 0 : u.value) == null ? void 0 : h.elements.sort((C, d) => (C.position ?? 0) - (d.position ?? 0))) ?? [];
949
949
  });
950
950
  return {
951
951
  contextUpdateMutation: s,
@@ -954,35 +954,48 @@ function Gt() {
954
954
  activeShippingMethod: r,
955
955
  setShippingMethod: a,
956
956
  isSaving: n,
957
- shippingMethods: u
957
+ shippingMethods: o
958
958
  };
959
959
  }
960
960
  const rt = (e, s) => {
961
961
  var n;
962
- const t = (n = e.extensions) == null ? void 0 : n.novuSeoUrls;
962
+ const t = (n = e == null ? void 0 : e.extensions) == null ? void 0 : n.novuSeoUrls;
963
+ if (Array.isArray(s)) {
964
+ const a = s.find((r) => !!(t != null && t[r]));
965
+ return a ? (t == null ? void 0 : t[a]) ?? "" : "";
966
+ }
963
967
  return (t == null ? void 0 : t[s]) ?? "";
964
- }, Ht = (e, s) => c(() => rt(i(e), i(s)));
968
+ }, Ht = () => {
969
+ const e = k(), s = c(() => {
970
+ var t, n, a;
971
+ return ((a = (n = (t = e.data) == null ? void 0 : t.value) == null ? void 0 : n.context) == null ? void 0 : a.languageIdChain) ?? [];
972
+ });
973
+ return (t, n) => {
974
+ const a = [n, ...s.value];
975
+ return rt(i(t), i(a));
976
+ };
977
+ };
965
978
  function Wt(e) {
966
979
  const { total: s, limit: t, page: n, totalCountMode: a } = e ?? {}, r = Z({
967
980
  page: n ?? 1,
968
981
  total: s ?? 0,
969
982
  limit: t,
970
983
  totalCountMode: a
971
- }), u = c(() => r.limit === void 0 ? 1 : Math.max(1, Math.ceil(r.total / r.limit))), o = c({
984
+ }), o = c(() => r.limit === void 0 ? 1 : Math.max(1, Math.ceil(r.total / r.limit))), u = c({
972
985
  get() {
973
986
  return r.page;
974
987
  },
975
988
  set(Q) {
976
- r.page = Math.max(1, Math.min(i(u), Q));
989
+ r.page = Math.max(1, Math.min(i(o), Q));
977
990
  }
978
991
  });
979
992
  H(
980
- [() => i(u), () => r],
993
+ [() => i(o), () => r],
981
994
  ([Q, y]) => {
982
995
  r.page = Math.min(Q, r.page), r.total = y.total ?? 0, r.limit = y.limit;
983
996
  }
984
997
  );
985
- const h = c(() => r.page === i(u)), C = c(() => r.page === 1), d = c(() => ({
998
+ const h = c(() => r.page === i(o)), C = c(() => r.page === 1), d = c(() => ({
986
999
  p: r.page,
987
1000
  limit: r.limit,
988
1001
  "total-count-mode": r.totalCountMode ?? "none"
@@ -992,10 +1005,10 @@ function Wt(e) {
992
1005
  });
993
1006
  };
994
1007
  return {
995
- page: i(o),
1008
+ page: i(u),
996
1009
  total: W(r, "total"),
997
1010
  limit: W(r, "limit"),
998
- pageCount: u,
1011
+ pageCount: o,
999
1012
  isLastPage: h,
1000
1013
  isFirstPage: C,
1001
1014
  usePaginationSync: P,
@@ -1034,26 +1047,26 @@ function Jt(e) {
1034
1047
  var y, v, A, K, l, p;
1035
1048
  return !!((y = e.value) != null && y.parentId) && ((A = (v = e.value) == null ? void 0 : v.calculatedCheapestPrice) == null ? void 0 : A.hasRange) && ((K = t == null ? void 0 : t.value) == null ? void 0 : K.unitPrice) !== ((l = s == null ? void 0 : s.value) == null ? void 0 : l.unitPrice) && ((p = s == null ? void 0 : s.value) == null ? void 0 : p.unitPrice);
1036
1049
  }
1037
- ), u = c(
1050
+ ), o = c(
1038
1051
  () => {
1039
1052
  var y, v;
1040
1053
  return a.value && X(e.value).length > 1 ? (v = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : v.reduce((A, K) => K.unitPrice < A.unitPrice ? K : A) : t.value;
1041
1054
  }
1042
- ), o = c(
1055
+ ), u = c(
1043
1056
  () => {
1044
1057
  var y;
1045
- return (y = u.value) == null ? void 0 : y.unitPrice;
1058
+ return (y = o.value) == null ? void 0 : y.unitPrice;
1046
1059
  }
1047
1060
  ), h = c(
1048
1061
  () => {
1049
1062
  var y;
1050
- return (y = u.value) == null ? void 0 : y.totalPrice;
1063
+ return (y = o.value) == null ? void 0 : y.totalPrice;
1051
1064
  }
1052
1065
  ), C = c(
1053
- () => u.value
1066
+ () => o.value
1054
1067
  ), d = c(() => {
1055
1068
  var y, v;
1056
- return !!((v = (y = u.value) == null ? void 0 : y.listPrice) != null && v.percentage);
1069
+ return !!((v = (y = o.value) == null ? void 0 : y.listPrice) != null && v.percentage);
1057
1070
  }), P = c(
1058
1071
  () => {
1059
1072
  var y, v, A;
@@ -1063,7 +1076,7 @@ function Jt(e) {
1063
1076
  return {
1064
1077
  price: C,
1065
1078
  totalPrice: h,
1066
- unitPrice: o,
1079
+ unitPrice: u,
1067
1080
  displayFromVariants: r,
1068
1081
  displayFrom: a,
1069
1082
  tierPrices: Q,
@@ -1080,7 +1093,7 @@ function at(e, s) {
1080
1093
  return ((r = a.optionIds) == null ? void 0 : r.length) === 0;
1081
1094
  })) ?? (t == null ? void 0 : t[0]) : t == null ? void 0 : t.find((a) => {
1082
1095
  var r;
1083
- return (r = a.optionIds) == null ? void 0 : r.every((u) => s.includes(u));
1096
+ return (r = a.optionIds) == null ? void 0 : r.every((o) => s.includes(o));
1084
1097
  });
1085
1098
  }
1086
1099
  function Xt(e, s) {
@@ -1088,8 +1101,8 @@ function Xt(e, s) {
1088
1101
  }
1089
1102
  function Yt(e) {
1090
1103
  return c(() => {
1091
- var s, t, n, a, r, u;
1092
- return !!((t = (s = i(e)) == null ? void 0 : s.customer) != null && t.id) && !!((a = (n = i(e)) == null ? void 0 : n.customer) != null && a.active) && !((u = (r = i(e)) == null ? void 0 : r.customer) != null && u.guest);
1104
+ var s, t, n, a, r, o;
1105
+ return !!((t = (s = i(e)) == null ? void 0 : s.customer) != null && t.id) && !!((a = (n = i(e)) == null ? void 0 : n.customer) != null && a.active) && !((o = (r = i(e)) == null ? void 0 : r.customer) != null && o.guest);
1093
1106
  });
1094
1107
  }
1095
1108
  function Zt(e) {
@@ -1109,12 +1122,12 @@ function Zt(e) {
1109
1122
  ), r = c(() => {
1110
1123
  var d;
1111
1124
  return !!((d = t.value) != null && d.guest);
1112
- }), u = c(
1125
+ }), o = c(
1113
1126
  () => {
1114
1127
  var d;
1115
1128
  return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
1116
1129
  }
1117
- ), o = c(
1130
+ ), u = c(
1118
1131
  () => {
1119
1132
  var d;
1120
1133
  return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
@@ -1136,8 +1149,8 @@ function Zt(e) {
1136
1149
  isLoggedIn: n,
1137
1150
  isCustomerSession: a,
1138
1151
  isGuestSession: r,
1139
- defaultBillingAddressId: u,
1140
- defaultShippingAddressId: o,
1152
+ defaultBillingAddressId: o,
1153
+ defaultShippingAddressId: u,
1141
1154
  userDefaultBillingAddress: h,
1142
1155
  userDefaultShippingAddress: C,
1143
1156
  // Expose queries and mutations directly
@@ -1147,24 +1160,23 @@ function Zt(e) {
1147
1160
  export {
1148
1161
  lt as absolutizeSeoUrl,
1149
1162
  w as addressKeys,
1150
- x as cartKeys,
1151
- k as categoryKeys,
1163
+ L as cartKeys,
1164
+ B as categoryKeys,
1152
1165
  F as contextKeys,
1153
- j as countryKeys,
1166
+ T as countryKeys,
1154
1167
  R as customerKeys,
1155
1168
  at as getProductVariantForOptions,
1156
- rt as getSeoUrl,
1157
1169
  se as isAsynchronousOrder,
1158
1170
  b as navigationKeys,
1159
1171
  U as orderKeys,
1160
- N as paymentKeys,
1161
- L as productKeys,
1172
+ D as paymentKeys,
1173
+ x as productKeys,
1162
1174
  Ne as readPaymentMethodOperation,
1163
1175
  tt as readShippingMethodOperation,
1164
- T as relativizeSeoUrl,
1165
- E as salutationKeys,
1166
- D as seoUrlKeys,
1167
- B as shippingKeys,
1176
+ V as relativizeSeoUrl,
1177
+ j as salutationKeys,
1178
+ E as seoUrlKeys,
1179
+ N as shippingKeys,
1168
1180
  _ as shopwareClientKey,
1169
1181
  m as unrefOptions,
1170
1182
  vt as useAddLineItemMutation,
@@ -1198,7 +1210,7 @@ export {
1198
1210
  $e as useReadCategoryListQueryOptions,
1199
1211
  Et as useReadCompactProductListingQuery,
1200
1212
  Ge as useReadCompactProductListingQueryOptions,
1201
- V as useReadContextQuery,
1213
+ k as useReadContextQuery,
1202
1214
  ae as useReadContextQueryOptions,
1203
1215
  Qt as useReadCountryQuery,
1204
1216
  Ce as useReadCountryQueryOptions,
@@ -1219,12 +1231,12 @@ export {
1219
1231
  st as useReadShippingMethodQuery,
1220
1232
  nt as useReadShippingMethodQueryOptions,
1221
1233
  bt as useRecoveryPasswordMutation,
1222
- Lt as useRegisterConfirmMutation,
1234
+ xt as useRegisterConfirmMutation,
1223
1235
  wt as useRegisterCustomerMutation,
1224
1236
  Ct as useRemoveLineItemMutation,
1225
1237
  Tt as useSearchPageQuery,
1226
1238
  Xe as useSearchPageQueryOptions,
1227
- xt as useSendRecoveryMailMutation,
1239
+ Lt as useSendRecoveryMailMutation,
1228
1240
  Ht as useSeoUrl,
1229
1241
  Gt as useShippingMethods,
1230
1242
  g as useShopwareQueryClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -17,7 +17,7 @@
17
17
  "peerDependencies": {
18
18
  "@tanstack/vue-query": "^5.85.3",
19
19
  "vue": "^3.0.0",
20
- "@teamnovu/kit-shopware-api-client": "0.0.7"
20
+ "@teamnovu/kit-shopware-api-client": "0.0.8"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  import type { GenericRecord } from '#store-types'
2
- import type { MaybeRef } from 'vue'
3
2
  import { computed, unref } from 'vue'
3
+ import { useReadContextQuery } from '../../query'
4
4
 
5
5
  interface SeoUrlEntity {
6
6
  extensions?: {
@@ -8,11 +8,21 @@ interface SeoUrlEntity {
8
8
  }
9
9
  }
10
10
 
11
- export const getSeoUrl = <T extends SeoUrlEntity>(entity: T, languageId: string) => {
12
- const urls = entity.extensions?.novuSeoUrls as Record<string, string>
11
+ const getSeoUrl = <T extends SeoUrlEntity>(entity: T, languageId: string | string[]) => {
12
+ const urls = entity?.extensions?.novuSeoUrls as Record<string, string>
13
+ if (Array.isArray(languageId)) {
14
+ const matchedId = languageId.find(id => !!urls?.[id])
15
+ return matchedId ? urls?.[matchedId] ?? '' : ''
16
+ }
13
17
  return urls?.[languageId] ?? ''
14
18
  }
15
19
 
16
- export const useSeoUrl = <T extends SeoUrlEntity>(entity: MaybeRef<T>, languageId: MaybeRef<string>) => {
17
- return computed(() => getSeoUrl(unref(entity), unref(languageId)))
20
+ export const useSeoUrl = <T extends SeoUrlEntity>() => {
21
+ const contextQuery = useReadContextQuery()
22
+ const contextLanguageChain = computed(() => contextQuery.data?.value?.context?.languageIdChain ?? [])
23
+
24
+ return (entity: T, languageId: string) => {
25
+ const languageChain = [languageId, ...contextLanguageChain.value]
26
+ return getSeoUrl(unref(entity), unref(languageChain))
27
+ }
18
28
  }
@@ -27,7 +27,7 @@ export function useLoginCustomerMutation(
27
27
  const contextToken = response.headers.get('sw-context-token')
28
28
 
29
29
  if (contextToken) {
30
- client.setContextToken(contextToken)
30
+ client.contextToken = contextToken
31
31
  }
32
32
 
33
33
  return response.json()
@@ -25,7 +25,7 @@ export function useRegisterConfirmMutation(
25
25
  const contextToken = response.headers.get('sw-context-token')
26
26
 
27
27
  if (contextToken) {
28
- client.setContextToken(contextToken)
28
+ client.contextToken = contextToken
29
29
  }
30
30
 
31
31
  return response.json() as Promise<never>