@teamnovu/kit-shopware-composables 0.0.29 → 0.0.31
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
|
-
import { inject as Y, unref as
|
|
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
|
|
3
|
+
import { queryOptions as v, useQuery as q, useQueryClient as Q, useMutation as h } from "@tanstack/vue-query";
|
|
4
4
|
import "@teamnovu/kit-shopware-api-client";
|
|
5
5
|
const _ = Symbol("shopwareClient");
|
|
6
6
|
function g() {
|
|
@@ -9,15 +9,15 @@ function g() {
|
|
|
9
9
|
throw new Error("Shopware client not provided!");
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const A = {
|
|
13
13
|
all: () => ["context"]
|
|
14
14
|
}, ee = {
|
|
15
15
|
all: () => ["language"]
|
|
16
|
-
},
|
|
16
|
+
}, B = {
|
|
17
17
|
all: () => ["category"],
|
|
18
|
-
lists: () => [...
|
|
18
|
+
lists: () => [...B.all(), "list"],
|
|
19
19
|
list: (e) => [
|
|
20
|
-
...
|
|
20
|
+
...B.all(),
|
|
21
21
|
"list",
|
|
22
22
|
{
|
|
23
23
|
body: e
|
|
@@ -108,22 +108,21 @@ const w = {
|
|
|
108
108
|
],
|
|
109
109
|
details: () => [...F.all(), "detail"],
|
|
110
110
|
detail: (e, s) => [...F.details(), e, ...s ? [{ body: s }] : []]
|
|
111
|
-
},
|
|
111
|
+
}, N = {
|
|
112
112
|
all: () => ["shippingMethod"],
|
|
113
|
-
lists: () => [...
|
|
113
|
+
lists: () => [...N.all(), "list"],
|
|
114
114
|
list: (e) => [
|
|
115
|
-
...
|
|
115
|
+
...N.all(),
|
|
116
116
|
"list",
|
|
117
117
|
{
|
|
118
118
|
body: e
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
|
-
},
|
|
121
|
+
}, b = {
|
|
122
122
|
all: () => ["paymentMethod"],
|
|
123
|
-
lists: () => [...
|
|
123
|
+
lists: () => [...b.all(), "list"],
|
|
124
124
|
list: (e) => [
|
|
125
|
-
...
|
|
126
|
-
"list",
|
|
125
|
+
...b.lists(),
|
|
127
126
|
{
|
|
128
127
|
body: e
|
|
129
128
|
}
|
|
@@ -171,10 +170,10 @@ const w = {
|
|
|
171
170
|
]
|
|
172
171
|
};
|
|
173
172
|
function y(e) {
|
|
174
|
-
const s =
|
|
173
|
+
const s = o(e);
|
|
175
174
|
return Object.fromEntries(
|
|
176
175
|
Object.entries(s ?? {}).map(
|
|
177
|
-
([t, n]) => [t,
|
|
176
|
+
([t, n]) => [t, o(n)]
|
|
178
177
|
)
|
|
179
178
|
);
|
|
180
179
|
}
|
|
@@ -200,26 +199,26 @@ const V = (e) => {
|
|
|
200
199
|
return s.startsWith("/") ? s.slice(1) : s;
|
|
201
200
|
}, St = (e) => `/${V(e)}`;
|
|
202
201
|
function Ct(e, s, t) {
|
|
203
|
-
const n =
|
|
202
|
+
const n = Q();
|
|
204
203
|
return {
|
|
205
204
|
onMutate: async (r) => {
|
|
206
205
|
await n.cancelQueries({ queryKey: e });
|
|
207
206
|
const a = n.getQueryData(e);
|
|
208
207
|
if (n.setQueryData(e, (u) => s(r, u)), t) {
|
|
209
|
-
const u =
|
|
210
|
-
|
|
208
|
+
const u = o(t), i = o(u.onMutate);
|
|
209
|
+
i == null || i(r);
|
|
211
210
|
}
|
|
212
211
|
return { previousValue: a };
|
|
213
212
|
},
|
|
214
213
|
onError: (r, a, u) => {
|
|
215
214
|
if (u && n.setQueryData(e, u.previousValue), t) {
|
|
216
|
-
const
|
|
215
|
+
const i = o(t), f = o(i.onError);
|
|
217
216
|
f == null || f(r, a, u);
|
|
218
217
|
}
|
|
219
218
|
},
|
|
220
219
|
onSettled: (...r) => {
|
|
221
220
|
if (n.invalidateQueries({ queryKey: e }), t) {
|
|
222
|
-
const a =
|
|
221
|
+
const a = o(t), u = o(a.onSettled);
|
|
223
222
|
u == null || u(...r);
|
|
224
223
|
}
|
|
225
224
|
}
|
|
@@ -229,35 +228,35 @@ const re = "readContext get /context";
|
|
|
229
228
|
function ae(e) {
|
|
230
229
|
const s = g();
|
|
231
230
|
return v({
|
|
232
|
-
queryKey:
|
|
231
|
+
queryKey: A.all(),
|
|
233
232
|
queryFn: ({ signal: t }) => s.query(re, {
|
|
234
233
|
...y(e),
|
|
235
234
|
signal: t
|
|
236
235
|
})
|
|
237
236
|
});
|
|
238
237
|
}
|
|
239
|
-
function
|
|
238
|
+
function k(e) {
|
|
240
239
|
return q(ae(e));
|
|
241
240
|
}
|
|
242
241
|
const ue = "updateContext patch /context";
|
|
243
242
|
function $(e) {
|
|
244
|
-
const s = g(), t =
|
|
243
|
+
const s = g(), t = Q();
|
|
245
244
|
return h({
|
|
246
245
|
...e,
|
|
247
|
-
mutationFn: async (n) => (t.cancelQueries({ queryKey:
|
|
246
|
+
mutationFn: async (n) => (t.cancelQueries({ queryKey: A.all() }), s.query(ue, {
|
|
248
247
|
body: n
|
|
249
248
|
})),
|
|
250
249
|
onSuccess: async (n, r, a) => {
|
|
251
|
-
var u,
|
|
250
|
+
var u, i;
|
|
252
251
|
await Promise.all([
|
|
253
|
-
t.invalidateQueries({ queryKey:
|
|
252
|
+
t.invalidateQueries({ queryKey: A.all() }),
|
|
254
253
|
t.invalidateQueries({ queryKey: L.get() })
|
|
255
|
-
]), await ((
|
|
254
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
256
255
|
}
|
|
257
256
|
});
|
|
258
257
|
}
|
|
259
|
-
function
|
|
260
|
-
const e = $(), s =
|
|
258
|
+
function Qt() {
|
|
259
|
+
const e = $(), s = k(), t = se(), n = c(() => s.isFetching.value || e.isPending.value), r = async (d) => {
|
|
261
260
|
await e.mutateAsync({
|
|
262
261
|
billingAddressId: d.id
|
|
263
262
|
}), await J(n).toBe(!1);
|
|
@@ -268,7 +267,7 @@ function Pt() {
|
|
|
268
267
|
}, u = c(() => {
|
|
269
268
|
var d, M;
|
|
270
269
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeBillingAddress;
|
|
271
|
-
}),
|
|
270
|
+
}), i = c(() => {
|
|
272
271
|
var d, M;
|
|
273
272
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeShippingAddress;
|
|
274
273
|
}), f = c(() => {
|
|
@@ -279,12 +278,12 @@ function Pt() {
|
|
|
279
278
|
return M.id !== ((O = u.value) == null ? void 0 : O.id);
|
|
280
279
|
}
|
|
281
280
|
)) ?? [];
|
|
282
|
-
}),
|
|
281
|
+
}), P = c(() => {
|
|
283
282
|
var d;
|
|
284
283
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
285
284
|
(M) => {
|
|
286
285
|
var O;
|
|
287
|
-
return M.id !== ((O =
|
|
286
|
+
return M.id !== ((O = i.value) == null ? void 0 : O.id);
|
|
288
287
|
}
|
|
289
288
|
)) ?? [];
|
|
290
289
|
});
|
|
@@ -296,19 +295,19 @@ function Pt() {
|
|
|
296
295
|
setShippingAddress: a,
|
|
297
296
|
isSaving: n,
|
|
298
297
|
activeBillingAddress: u,
|
|
299
|
-
activeShippingAddress:
|
|
298
|
+
activeShippingAddress: i,
|
|
300
299
|
inactiveBillingAddresses: f,
|
|
301
|
-
inactiveShippingAddresses:
|
|
300
|
+
inactiveShippingAddresses: P
|
|
302
301
|
};
|
|
303
302
|
}
|
|
304
|
-
const
|
|
305
|
-
function
|
|
303
|
+
const ie = "readOrder post /order";
|
|
304
|
+
function oe(e) {
|
|
306
305
|
const s = g(), t = U.detail(e);
|
|
307
306
|
return v({
|
|
308
307
|
queryKey: t,
|
|
309
308
|
queryFn: async ({ signal: n }) => {
|
|
310
309
|
const r = y(e);
|
|
311
|
-
return s.query(
|
|
310
|
+
return s.query(ie, {
|
|
312
311
|
...r,
|
|
313
312
|
signal: n
|
|
314
313
|
});
|
|
@@ -316,11 +315,11 @@ function ie(e) {
|
|
|
316
315
|
});
|
|
317
316
|
}
|
|
318
317
|
function ce(e) {
|
|
319
|
-
return q(
|
|
318
|
+
return q(oe(e));
|
|
320
319
|
}
|
|
321
|
-
function
|
|
320
|
+
function Pt(e, s) {
|
|
322
321
|
const t = c(() => {
|
|
323
|
-
const l =
|
|
322
|
+
const l = o(e);
|
|
324
323
|
if (l)
|
|
325
324
|
return {
|
|
326
325
|
body: {
|
|
@@ -344,13 +343,13 @@ function Qt(e, s) {
|
|
|
344
343
|
}), u = c(() => {
|
|
345
344
|
var l, m, C;
|
|
346
345
|
return (C = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : C.name;
|
|
347
|
-
}),
|
|
346
|
+
}), i = c(() => {
|
|
348
347
|
var l, m;
|
|
349
348
|
return (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.technicalName;
|
|
350
349
|
}), f = c(() => {
|
|
351
350
|
var l, m;
|
|
352
351
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.totalPrice;
|
|
353
|
-
}),
|
|
352
|
+
}), P = c(() => {
|
|
354
353
|
var l, m;
|
|
355
354
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.positionPrice;
|
|
356
355
|
}), d = c(() => {
|
|
@@ -381,27 +380,27 @@ function Qt(e, s) {
|
|
|
381
380
|
const l = (m = r.value) == null ? void 0 : m.transactions;
|
|
382
381
|
if (l != null && l.length)
|
|
383
382
|
return (C = l.at(-1)) == null ? void 0 : C.paymentMethod;
|
|
384
|
-
}),
|
|
383
|
+
}), w = c(() => {
|
|
385
384
|
var m, C;
|
|
386
385
|
const l = (m = r.value) == null ? void 0 : m.deliveries;
|
|
387
386
|
if (l != null && l.length)
|
|
388
387
|
return (C = l.at(-1)) == null ? void 0 : C.shippingMethod;
|
|
389
388
|
}), R = c(() => {
|
|
390
389
|
var m;
|
|
391
|
-
const l =
|
|
390
|
+
const l = o(e);
|
|
392
391
|
return ((m = a.value) == null ? void 0 : m[l]) ?? !1;
|
|
393
392
|
});
|
|
394
393
|
return {
|
|
395
394
|
order: r,
|
|
396
395
|
status: u,
|
|
397
|
-
statusTechnicalName:
|
|
396
|
+
statusTechnicalName: i,
|
|
398
397
|
total: f,
|
|
399
|
-
subtotal:
|
|
398
|
+
subtotal: P,
|
|
400
399
|
shippingCosts: d,
|
|
401
400
|
shippingAddress: p,
|
|
402
401
|
billingAddress: O,
|
|
403
402
|
personalDetails: M,
|
|
404
|
-
shippingMethod:
|
|
403
|
+
shippingMethod: w,
|
|
405
404
|
paymentMethod: S,
|
|
406
405
|
paymentChangeable: R,
|
|
407
406
|
orderQuery: n
|
|
@@ -410,9 +409,9 @@ function Qt(e, s) {
|
|
|
410
409
|
function Mt(e) {
|
|
411
410
|
const s = c(() => {
|
|
412
411
|
var r, a;
|
|
413
|
-
return (a = (r =
|
|
414
|
-
var
|
|
415
|
-
return ((
|
|
412
|
+
return (a = (r = o(e)) == null ? void 0 : r.transactions) == null ? void 0 : a.find((u) => {
|
|
413
|
+
var i;
|
|
414
|
+
return ((i = u.paymentMethod) == null ? void 0 : i.active) === !0;
|
|
416
415
|
});
|
|
417
416
|
}), t = c(() => {
|
|
418
417
|
var r;
|
|
@@ -429,58 +428,58 @@ function Mt(e) {
|
|
|
429
428
|
}
|
|
430
429
|
const le = "createCustomerAddress post /account/address";
|
|
431
430
|
function Ot(e) {
|
|
432
|
-
const s = g(), t =
|
|
431
|
+
const s = g(), t = Q();
|
|
433
432
|
return h({
|
|
434
433
|
...e,
|
|
435
434
|
mutationFn: async (n) => s.query(le, y(n)),
|
|
436
435
|
onSuccess: async (n, r, a) => {
|
|
437
|
-
var u,
|
|
438
|
-
await t.invalidateQueries({ queryKey: F.lists() }), await ((
|
|
436
|
+
var u, i;
|
|
437
|
+
await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
439
438
|
}
|
|
440
439
|
});
|
|
441
440
|
}
|
|
442
441
|
const de = "deleteCustomerAddress delete /account/address/{addressId}";
|
|
443
442
|
function Kt(e) {
|
|
444
|
-
const s = g(), t =
|
|
443
|
+
const s = g(), t = Q();
|
|
445
444
|
return h({
|
|
446
445
|
...e,
|
|
447
446
|
mutationFn: async (n) => s.query(de, y(n)),
|
|
448
447
|
onSuccess: async (n, r, a) => {
|
|
449
|
-
var u,
|
|
450
|
-
await t.invalidateQueries({ queryKey: F.lists() }), await ((
|
|
448
|
+
var u, i;
|
|
449
|
+
await t.invalidateQueries({ queryKey: F.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
451
450
|
}
|
|
452
451
|
});
|
|
453
452
|
}
|
|
454
453
|
const ye = "updateCustomerAddress patch /account/address/{addressId}";
|
|
455
|
-
function
|
|
456
|
-
const s = g(), t =
|
|
454
|
+
function wt(e) {
|
|
455
|
+
const s = g(), t = Q();
|
|
457
456
|
return h({
|
|
458
457
|
...e,
|
|
459
458
|
mutationFn: async (n) => s.query(ye, y(n)),
|
|
460
459
|
onSuccess: async (n, r, a) => {
|
|
461
|
-
var
|
|
460
|
+
var i, f;
|
|
462
461
|
const { addressId: u } = y(r).params;
|
|
463
462
|
t.setQueryData(F.detail(u), n), await Promise.all([
|
|
464
463
|
t.invalidateQueries({ queryKey: F.lists() }),
|
|
465
464
|
t.invalidateQueries({
|
|
466
465
|
queryKey: F.detail(y(r).params.addressId),
|
|
467
|
-
predicate: (
|
|
466
|
+
predicate: (P) => P.queryKey.at(-1) !== u
|
|
468
467
|
})
|
|
469
|
-
]), await ((f =
|
|
468
|
+
]), await ((f = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
470
469
|
}
|
|
471
470
|
});
|
|
472
471
|
}
|
|
473
472
|
const pe = "addLineItem post /checkout/cart/line-item";
|
|
474
|
-
function
|
|
475
|
-
const s = g(), t =
|
|
473
|
+
function At(e) {
|
|
474
|
+
const s = g(), t = Q();
|
|
476
475
|
return h({
|
|
477
476
|
...e,
|
|
478
477
|
mutationFn: async (n) => s.query(pe, {
|
|
479
478
|
body: n
|
|
480
479
|
}),
|
|
481
480
|
onSuccess: async (n, r, a) => {
|
|
482
|
-
var u,
|
|
483
|
-
t.setQueryData(L.get(), n), await ((
|
|
481
|
+
var u, i;
|
|
482
|
+
t.setQueryData(L.get(), n), await t.invalidateQueries({ queryKey: b.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
484
483
|
}
|
|
485
484
|
});
|
|
486
485
|
}
|
|
@@ -500,46 +499,46 @@ function Rt() {
|
|
|
500
499
|
}
|
|
501
500
|
const fe = "removeLineItem post /checkout/cart/line-item/delete";
|
|
502
501
|
function Ft(e) {
|
|
503
|
-
const s = g(), t =
|
|
502
|
+
const s = g(), t = Q();
|
|
504
503
|
return h({
|
|
505
504
|
...e,
|
|
506
505
|
mutationFn: async (n) => s.query(fe, {
|
|
507
506
|
body: n
|
|
508
507
|
}),
|
|
509
508
|
onSuccess: async (n, r, a) => {
|
|
510
|
-
var u,
|
|
511
|
-
t.setQueryData(L.get(), n), await ((
|
|
509
|
+
var u, i;
|
|
510
|
+
t.setQueryData(L.get(), n), await t.invalidateQueries({ queryKey: b.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
512
511
|
}
|
|
513
512
|
});
|
|
514
513
|
}
|
|
515
514
|
const he = "updateLineItem patch /checkout/cart/line-item";
|
|
516
515
|
function Lt(e) {
|
|
517
|
-
const s = g(), t =
|
|
516
|
+
const s = g(), t = Q();
|
|
518
517
|
return h({
|
|
519
518
|
...e,
|
|
520
519
|
mutationFn: async (n) => s.query(he, {
|
|
521
520
|
body: n
|
|
522
521
|
}),
|
|
523
522
|
onSuccess: async (n, r, a) => {
|
|
524
|
-
var u,
|
|
525
|
-
t.setQueryData(L.get(), n), await ((
|
|
523
|
+
var u, i;
|
|
524
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
526
525
|
}
|
|
527
526
|
});
|
|
528
527
|
}
|
|
529
528
|
const ve = "createOrder post /checkout/order";
|
|
530
529
|
function It(e) {
|
|
531
|
-
const s = g(), t =
|
|
530
|
+
const s = g(), t = Q();
|
|
532
531
|
return h({
|
|
533
532
|
...e,
|
|
534
533
|
mutationFn: async (n) => s.query(ve, y(n)),
|
|
535
534
|
onSuccess: async (n, r, a) => {
|
|
536
|
-
var u,
|
|
535
|
+
var u, i;
|
|
537
536
|
await Promise.all([
|
|
538
537
|
// Clear cart after successful order creation
|
|
539
538
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
540
539
|
// Invalidate order list to refetch data
|
|
541
540
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
542
|
-
]), await ((
|
|
541
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
543
542
|
}
|
|
544
543
|
});
|
|
545
544
|
}
|
|
@@ -557,7 +556,7 @@ function Se(e) {
|
|
|
557
556
|
function xt(e) {
|
|
558
557
|
return q(Se(e));
|
|
559
558
|
}
|
|
560
|
-
const Ce = "readCountry post /country",
|
|
559
|
+
const Ce = "readCountry post /country", Qe = function(s) {
|
|
561
560
|
const t = g(), n = j.list(s);
|
|
562
561
|
return v({
|
|
563
562
|
queryKey: n,
|
|
@@ -571,38 +570,38 @@ const Ce = "readCountry post /country", Pe = function(s) {
|
|
|
571
570
|
});
|
|
572
571
|
};
|
|
573
572
|
function Ut(e) {
|
|
574
|
-
return q(
|
|
573
|
+
return q(Qe(e));
|
|
575
574
|
}
|
|
576
|
-
const
|
|
575
|
+
const Pe = "changeEmail post /account/change-email";
|
|
577
576
|
function Dt(e) {
|
|
578
|
-
const s = g(), t =
|
|
577
|
+
const s = g(), t = Q();
|
|
579
578
|
return h({
|
|
580
579
|
...e,
|
|
581
|
-
mutationFn: async (n) => s.query(
|
|
580
|
+
mutationFn: async (n) => s.query(Pe, y(n)),
|
|
582
581
|
onSuccess: async (n, r, a) => {
|
|
583
|
-
var u,
|
|
584
|
-
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey:
|
|
582
|
+
var u, i;
|
|
583
|
+
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));
|
|
585
584
|
}
|
|
586
585
|
});
|
|
587
586
|
}
|
|
588
587
|
const Me = "changeProfile post /account/change-profile";
|
|
589
588
|
function bt(e) {
|
|
590
|
-
const s = g(), t =
|
|
589
|
+
const s = g(), t = Q();
|
|
591
590
|
return h({
|
|
592
591
|
...e,
|
|
593
592
|
mutationFn: async (n) => s.query(Me, y(n)),
|
|
594
593
|
onSuccess: async (n, r, a) => {
|
|
595
|
-
var u,
|
|
594
|
+
var u, i;
|
|
596
595
|
await Promise.all([
|
|
597
596
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
598
|
-
t.invalidateQueries({ queryKey:
|
|
599
|
-
]), await ((
|
|
597
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
598
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
600
599
|
}
|
|
601
600
|
});
|
|
602
601
|
}
|
|
603
602
|
const Oe = "loginCustomer post /account/login";
|
|
604
603
|
function kt(e) {
|
|
605
|
-
const s = g(), t =
|
|
604
|
+
const s = g(), t = Q();
|
|
606
605
|
return h({
|
|
607
606
|
...e,
|
|
608
607
|
mutationFn: async (n) => {
|
|
@@ -612,100 +611,100 @@ function kt(e) {
|
|
|
612
611
|
return a && (s.contextToken = a), r.json();
|
|
613
612
|
},
|
|
614
613
|
onSuccess: async (n, r, a) => {
|
|
615
|
-
var u,
|
|
614
|
+
var u, i;
|
|
616
615
|
await Promise.all([
|
|
617
|
-
t.resetQueries({ queryKey:
|
|
616
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
618
617
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
619
618
|
t.invalidateQueries({ queryKey: I.all() })
|
|
620
|
-
]), await ((
|
|
619
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
621
620
|
}
|
|
622
621
|
});
|
|
623
622
|
}
|
|
624
623
|
const Ke = "logoutCustomer post /account/logout";
|
|
625
624
|
function Bt(e) {
|
|
626
|
-
const s = g(), t =
|
|
625
|
+
const s = g(), t = Q();
|
|
627
626
|
return h({
|
|
628
627
|
...e,
|
|
629
628
|
mutationFn: async (n) => s.query(Ke, y(n)),
|
|
630
629
|
onSuccess: async (n, r, a) => {
|
|
631
|
-
var u,
|
|
630
|
+
var u, i;
|
|
632
631
|
await Promise.all([
|
|
633
|
-
t.resetQueries({ queryKey:
|
|
632
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
634
633
|
t.invalidateQueries({ queryKey: L.get() }),
|
|
635
634
|
t.invalidateQueries({ queryKey: I.all() })
|
|
636
|
-
]), await ((
|
|
635
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
637
636
|
}
|
|
638
637
|
});
|
|
639
638
|
}
|
|
640
|
-
const
|
|
641
|
-
function
|
|
639
|
+
const we = "readCustomer post /account/customer";
|
|
640
|
+
function Ae(e) {
|
|
642
641
|
const s = g(), t = I.detail(c(() => y(e).body ?? {}));
|
|
643
642
|
return v({
|
|
644
643
|
queryKey: t,
|
|
645
|
-
queryFn: async () => s.query(
|
|
644
|
+
queryFn: async () => s.query(we, y(e))
|
|
646
645
|
});
|
|
647
646
|
}
|
|
648
647
|
function Re(e) {
|
|
649
|
-
return q(
|
|
648
|
+
return q(Ae(e));
|
|
650
649
|
}
|
|
651
650
|
const Fe = "register post /account/register";
|
|
652
651
|
function Nt(e) {
|
|
653
|
-
const s = g(), t =
|
|
652
|
+
const s = g(), t = Q();
|
|
654
653
|
return h({
|
|
655
654
|
...e,
|
|
656
655
|
mutationFn: async (n) => s.query(Fe, y(n)),
|
|
657
656
|
onSuccess: async (n, r, a) => {
|
|
658
|
-
var u,
|
|
657
|
+
var u, i;
|
|
659
658
|
await Promise.all([
|
|
660
|
-
t.resetQueries({ queryKey:
|
|
659
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
661
660
|
t.invalidateQueries({ queryKey: I.all() })
|
|
662
|
-
]), await ((
|
|
661
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
663
662
|
}
|
|
664
663
|
});
|
|
665
664
|
}
|
|
666
665
|
const Le = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
|
|
667
666
|
function Tt(e) {
|
|
668
|
-
const s = g(), t =
|
|
667
|
+
const s = g(), t = Q();
|
|
669
668
|
return h({
|
|
670
669
|
...e,
|
|
671
670
|
mutationFn: async (n) => s.query(Le, y(n)),
|
|
672
671
|
onSuccess: async (n, r, a) => {
|
|
673
|
-
var u,
|
|
672
|
+
var u, i;
|
|
674
673
|
await Promise.all([
|
|
675
674
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
676
|
-
t.invalidateQueries({ queryKey:
|
|
677
|
-
]), await ((
|
|
675
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
676
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
678
677
|
}
|
|
679
678
|
});
|
|
680
679
|
}
|
|
681
680
|
const Ie = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
|
|
682
681
|
function Et(e) {
|
|
683
|
-
const s = g(), t =
|
|
682
|
+
const s = g(), t = Q();
|
|
684
683
|
return h({
|
|
685
684
|
...e,
|
|
686
685
|
mutationFn: async (n) => s.query(Ie, y(n)),
|
|
687
686
|
onSuccess: async (n, r, a) => {
|
|
688
|
-
var u,
|
|
687
|
+
var u, i;
|
|
689
688
|
await Promise.all([
|
|
690
689
|
t.invalidateQueries({ queryKey: I.all() }),
|
|
691
|
-
t.invalidateQueries({ queryKey:
|
|
692
|
-
]), await ((
|
|
690
|
+
t.invalidateQueries({ queryKey: A.all() })
|
|
691
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
693
692
|
}
|
|
694
693
|
});
|
|
695
694
|
}
|
|
696
695
|
const xe = "deleteCustomer delete /account/customer";
|
|
697
696
|
function jt(e) {
|
|
698
|
-
const s = g(), t =
|
|
697
|
+
const s = g(), t = Q();
|
|
699
698
|
return h({
|
|
700
699
|
...e,
|
|
701
700
|
mutationFn: async (n) => s.query(xe, y(n)),
|
|
702
701
|
onSuccess: async (n, r, a) => {
|
|
703
|
-
var u,
|
|
702
|
+
var u, i;
|
|
704
703
|
await Promise.all([
|
|
705
704
|
t.resetQueries({ queryKey: I.all() }),
|
|
706
|
-
t.resetQueries({ queryKey:
|
|
705
|
+
t.resetQueries({ queryKey: A.all() }),
|
|
707
706
|
t.resetQueries({ queryKey: L.get() })
|
|
708
|
-
]), await ((
|
|
707
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
709
708
|
}
|
|
710
709
|
});
|
|
711
710
|
}
|
|
@@ -722,7 +721,7 @@ function Vt(e) {
|
|
|
722
721
|
},
|
|
723
722
|
onSuccess: async (t, n, r) => {
|
|
724
723
|
var a, u;
|
|
725
|
-
await ((u =
|
|
724
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
726
725
|
}
|
|
727
726
|
});
|
|
728
727
|
}
|
|
@@ -734,7 +733,7 @@ function $t(e) {
|
|
|
734
733
|
mutationFn: async (t) => s.query(De, y(t)),
|
|
735
734
|
onSuccess: async (t, n, r) => {
|
|
736
735
|
var a, u;
|
|
737
|
-
await ((u =
|
|
736
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
738
737
|
}
|
|
739
738
|
});
|
|
740
739
|
}
|
|
@@ -746,7 +745,7 @@ function zt(e) {
|
|
|
746
745
|
mutationFn: async (t) => s.query(be, y(t)),
|
|
747
746
|
onSuccess: async (t, n, r) => {
|
|
748
747
|
var a, u;
|
|
749
|
-
await ((u =
|
|
748
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
750
749
|
}
|
|
751
750
|
});
|
|
752
751
|
}
|
|
@@ -769,7 +768,7 @@ function Ht(e) {
|
|
|
769
768
|
mutationFn: async (t) => s.query(Ne, y(t)),
|
|
770
769
|
onSuccess: async (t, n, r) => {
|
|
771
770
|
var a, u;
|
|
772
|
-
await ((u =
|
|
771
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
773
772
|
}
|
|
774
773
|
});
|
|
775
774
|
}
|
|
@@ -778,11 +777,11 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
778
777
|
return v({
|
|
779
778
|
queryKey: a,
|
|
780
779
|
queryFn: async ({ signal: u }) => {
|
|
781
|
-
const
|
|
780
|
+
const i = o(s), f = o(t), P = y(n);
|
|
782
781
|
return r.query(Te, {
|
|
783
|
-
...
|
|
782
|
+
...P,
|
|
784
783
|
params: {
|
|
785
|
-
activeId:
|
|
784
|
+
activeId: i,
|
|
786
785
|
rootId: f
|
|
787
786
|
},
|
|
788
787
|
signal: u
|
|
@@ -795,7 +794,7 @@ function Wt(e, s, t) {
|
|
|
795
794
|
}
|
|
796
795
|
const je = "readPaymentMethod post /payment-method";
|
|
797
796
|
function Ve(e) {
|
|
798
|
-
const s = g(), t =
|
|
797
|
+
const s = g(), t = b.list(c(() => {
|
|
799
798
|
var n;
|
|
800
799
|
return (n = y(e)) == null ? void 0 : n.body;
|
|
801
800
|
}));
|
|
@@ -812,30 +811,30 @@ function $e(e) {
|
|
|
812
811
|
}
|
|
813
812
|
const ze = "handlePaymentMethod post /handle-payment";
|
|
814
813
|
function Jt(e) {
|
|
815
|
-
const s = g(), t =
|
|
814
|
+
const s = g(), t = Q();
|
|
816
815
|
return h({
|
|
817
816
|
...e,
|
|
818
817
|
mutationFn: async (n) => s.query(ze, y(n)),
|
|
819
818
|
onSuccess: async (n, r, a) => {
|
|
820
|
-
var u,
|
|
821
|
-
await t.invalidateQueries({ queryKey: L.get() }), await ((
|
|
819
|
+
var u, i;
|
|
820
|
+
await t.invalidateQueries({ queryKey: L.get() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
822
821
|
}
|
|
823
822
|
});
|
|
824
823
|
}
|
|
825
824
|
const Ge = "orderSetPayment post /order/payment";
|
|
826
825
|
function Xt(e) {
|
|
827
|
-
const s = g(), t =
|
|
826
|
+
const s = g(), t = Q();
|
|
828
827
|
return h({
|
|
829
828
|
...e,
|
|
830
829
|
mutationFn: async (n) => s.query(Ge, y(n)),
|
|
831
830
|
onSuccess: async (n, r, a) => {
|
|
832
|
-
var u,
|
|
833
|
-
await t.invalidateQueries({ queryKey: U.all() }), await ((
|
|
831
|
+
var u, i;
|
|
832
|
+
await t.invalidateQueries({ queryKey: U.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
834
833
|
}
|
|
835
834
|
});
|
|
836
835
|
}
|
|
837
836
|
const He = "readCategoryList post /category", We = function(s) {
|
|
838
|
-
const t = g(), n =
|
|
837
|
+
const t = g(), n = B.list(s);
|
|
839
838
|
return v({
|
|
840
839
|
queryKey: n,
|
|
841
840
|
queryFn: async ({ signal: r }) => t.query(He, {
|
|
@@ -858,7 +857,7 @@ function Xe(e, s) {
|
|
|
858
857
|
...a,
|
|
859
858
|
params: {
|
|
860
859
|
...a.params,
|
|
861
|
-
seoUrl: V(
|
|
860
|
+
seoUrl: V(o(e))
|
|
862
861
|
},
|
|
863
862
|
signal: r
|
|
864
863
|
});
|
|
@@ -879,7 +878,7 @@ function Ze(e, s) {
|
|
|
879
878
|
...a,
|
|
880
879
|
params: {
|
|
881
880
|
...a.params,
|
|
882
|
-
seoUrl: V(
|
|
881
|
+
seoUrl: V(o(e))
|
|
883
882
|
},
|
|
884
883
|
signal: r
|
|
885
884
|
});
|
|
@@ -951,7 +950,7 @@ function ut(e, s) {
|
|
|
951
950
|
...a,
|
|
952
951
|
params: {
|
|
953
952
|
...a.params,
|
|
954
|
-
productId:
|
|
953
|
+
productId: o(e)
|
|
955
954
|
},
|
|
956
955
|
signal: r
|
|
957
956
|
});
|
|
@@ -961,13 +960,13 @@ function ut(e, s) {
|
|
|
961
960
|
function sn(e, s) {
|
|
962
961
|
return q(ut(e, s));
|
|
963
962
|
}
|
|
964
|
-
const
|
|
963
|
+
const it = "readSalutation post /salutation", ot = function(s) {
|
|
965
964
|
const t = g(), n = E.list(s);
|
|
966
965
|
return v({
|
|
967
966
|
queryKey: n,
|
|
968
967
|
queryFn: async ({ signal: r }) => {
|
|
969
968
|
const a = y(s);
|
|
970
|
-
return t.query(
|
|
969
|
+
return t.query(it, {
|
|
971
970
|
...a,
|
|
972
971
|
signal: r
|
|
973
972
|
});
|
|
@@ -975,7 +974,7 @@ const ot = "readSalutation post /salutation", it = function(s) {
|
|
|
975
974
|
});
|
|
976
975
|
};
|
|
977
976
|
function rn(e) {
|
|
978
|
-
return q(
|
|
977
|
+
return q(ot(e));
|
|
979
978
|
}
|
|
980
979
|
const ct = "readSeoUrl post /seo-url", lt = function(s) {
|
|
981
980
|
const t = g(), n = T.list(s);
|
|
@@ -995,7 +994,7 @@ function an(e) {
|
|
|
995
994
|
}
|
|
996
995
|
const dt = "readShippingMethod post /shipping-method";
|
|
997
996
|
function yt(e) {
|
|
998
|
-
const s = g(), t =
|
|
997
|
+
const s = g(), t = N.list(c(() => {
|
|
999
998
|
var n;
|
|
1000
999
|
return (n = y(e)) == null ? void 0 : n.body;
|
|
1001
1000
|
}));
|
|
@@ -1011,18 +1010,18 @@ function pt(e) {
|
|
|
1011
1010
|
return q(yt(e));
|
|
1012
1011
|
}
|
|
1013
1012
|
function un() {
|
|
1014
|
-
const e =
|
|
1013
|
+
const e = k(), s = $(), t = $e({
|
|
1015
1014
|
query: {
|
|
1016
1015
|
onlyAvailable: !0
|
|
1017
1016
|
}
|
|
1018
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1019
|
-
paymentMethodId:
|
|
1017
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1018
|
+
paymentMethodId: i
|
|
1020
1019
|
}), a = c(() => {
|
|
1021
|
-
var
|
|
1022
|
-
return (f = (
|
|
1020
|
+
var i, f;
|
|
1021
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
|
|
1023
1022
|
}), u = c(() => {
|
|
1024
|
-
var
|
|
1025
|
-
return ((
|
|
1023
|
+
var i, f, P;
|
|
1024
|
+
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))) ?? [];
|
|
1026
1025
|
});
|
|
1027
1026
|
return {
|
|
1028
1027
|
contextUpdateMutation: s,
|
|
@@ -1035,18 +1034,18 @@ function un() {
|
|
|
1035
1034
|
};
|
|
1036
1035
|
}
|
|
1037
1036
|
function on() {
|
|
1038
|
-
const e =
|
|
1037
|
+
const e = k(), s = $(), t = pt({
|
|
1039
1038
|
query: {
|
|
1040
1039
|
onlyAvailable: !0
|
|
1041
1040
|
}
|
|
1042
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
1043
|
-
shippingMethodId:
|
|
1041
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
1042
|
+
shippingMethodId: i
|
|
1044
1043
|
}), a = c(() => {
|
|
1045
|
-
var
|
|
1046
|
-
return (f = (
|
|
1044
|
+
var i, f;
|
|
1045
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
|
|
1047
1046
|
}), u = c(() => {
|
|
1048
|
-
var
|
|
1049
|
-
return ((f = (
|
|
1047
|
+
var i, f;
|
|
1048
|
+
return ((f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements.sort((P, d) => (P.position ?? 0) - (d.position ?? 0))) ?? [];
|
|
1050
1049
|
});
|
|
1051
1050
|
return {
|
|
1052
1051
|
contextUpdateMutation: s,
|
|
@@ -1067,13 +1066,13 @@ const gt = (e, s) => {
|
|
|
1067
1066
|
}
|
|
1068
1067
|
return (t == null ? void 0 : t[s]) ?? "";
|
|
1069
1068
|
}, cn = () => {
|
|
1070
|
-
const e =
|
|
1069
|
+
const e = k(), s = c(() => {
|
|
1071
1070
|
var t, n, r;
|
|
1072
1071
|
return ((r = (n = (t = e.data) == null ? void 0 : t.value) == null ? void 0 : n.context) == null ? void 0 : r.languageIdChain) ?? [];
|
|
1073
1072
|
});
|
|
1074
1073
|
return (t, n) => {
|
|
1075
1074
|
const r = [n, ...s.value];
|
|
1076
|
-
return gt(
|
|
1075
|
+
return gt(o(t), o(r));
|
|
1077
1076
|
};
|
|
1078
1077
|
};
|
|
1079
1078
|
function ln(e) {
|
|
@@ -1082,36 +1081,36 @@ function ln(e) {
|
|
|
1082
1081
|
total: s ?? 0,
|
|
1083
1082
|
limit: t,
|
|
1084
1083
|
totalCountMode: r
|
|
1085
|
-
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))),
|
|
1084
|
+
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))), i = c({
|
|
1086
1085
|
get() {
|
|
1087
1086
|
return a.page;
|
|
1088
1087
|
},
|
|
1089
1088
|
set(O) {
|
|
1090
|
-
a.page = Math.max(1, Math.min(
|
|
1089
|
+
a.page = Math.max(1, Math.min(o(u), O));
|
|
1091
1090
|
}
|
|
1092
1091
|
});
|
|
1093
1092
|
H(
|
|
1094
|
-
[() =>
|
|
1093
|
+
[() => o(u), () => a],
|
|
1095
1094
|
([O, p]) => {
|
|
1096
1095
|
a.page = Math.min(O, a.page), a.total = p.total ?? 0, a.limit = p.limit;
|
|
1097
1096
|
}
|
|
1098
1097
|
);
|
|
1099
|
-
const f = c(() => a.page ===
|
|
1098
|
+
const f = c(() => a.page === o(u)), P = c(() => a.page === 1), d = c(() => ({
|
|
1100
1099
|
p: a.page,
|
|
1101
1100
|
limit: a.limit,
|
|
1102
1101
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
1103
1102
|
})), M = (O) => {
|
|
1104
|
-
H(() =>
|
|
1103
|
+
H(() => o(O), (p) => {
|
|
1105
1104
|
p && (a.total = (p == null ? void 0 : p.total) ?? 0, a.limit = (p == null ? void 0 : p.limit) ?? 0);
|
|
1106
1105
|
});
|
|
1107
1106
|
};
|
|
1108
1107
|
return {
|
|
1109
|
-
page: i
|
|
1108
|
+
page: o(i),
|
|
1110
1109
|
total: W(a, "total"),
|
|
1111
1110
|
limit: W(a, "limit"),
|
|
1112
1111
|
pageCount: u,
|
|
1113
1112
|
isLastPage: f,
|
|
1114
|
-
isFirstPage:
|
|
1113
|
+
isFirstPage: P,
|
|
1115
1114
|
usePaginationSync: M,
|
|
1116
1115
|
// This can be used to pass the pagination options directly to the query options
|
|
1117
1116
|
queryOptions: d
|
|
@@ -1134,8 +1133,8 @@ function dn(e) {
|
|
|
1134
1133
|
return (p = e.value) == null ? void 0 : p.calculatedCheapestPrice;
|
|
1135
1134
|
}), t = c(
|
|
1136
1135
|
() => {
|
|
1137
|
-
var p, S,
|
|
1138
|
-
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 0 ? (R = (
|
|
1136
|
+
var p, S, w, R, l;
|
|
1137
|
+
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;
|
|
1139
1138
|
}
|
|
1140
1139
|
), n = c(() => {
|
|
1141
1140
|
var p;
|
|
@@ -1145,15 +1144,15 @@ function dn(e) {
|
|
|
1145
1144
|
return (((S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.length) ?? 0) > 1;
|
|
1146
1145
|
}), a = c(
|
|
1147
1146
|
() => {
|
|
1148
|
-
var p, S,
|
|
1149
|
-
return !!((p = e.value) != null && p.parentId) && ((
|
|
1147
|
+
var p, S, w, R, l, m;
|
|
1148
|
+
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);
|
|
1150
1149
|
}
|
|
1151
1150
|
), u = c(
|
|
1152
1151
|
() => {
|
|
1153
1152
|
var p, S;
|
|
1154
|
-
return r.value && X(e.value).length > 1 ? (S = (p = e.value) == null ? void 0 : p.calculatedPrices) == null ? void 0 : S.reduce((
|
|
1153
|
+
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;
|
|
1155
1154
|
}
|
|
1156
|
-
),
|
|
1155
|
+
), i = c(
|
|
1157
1156
|
() => {
|
|
1158
1157
|
var p;
|
|
1159
1158
|
return (p = u.value) == null ? void 0 : p.unitPrice;
|
|
@@ -1163,21 +1162,21 @@ function dn(e) {
|
|
|
1163
1162
|
var p;
|
|
1164
1163
|
return (p = u.value) == null ? void 0 : p.totalPrice;
|
|
1165
1164
|
}
|
|
1166
|
-
),
|
|
1165
|
+
), P = c(
|
|
1167
1166
|
() => u.value
|
|
1168
1167
|
), d = c(() => {
|
|
1169
1168
|
var p, S;
|
|
1170
1169
|
return !!((S = (p = u.value) == null ? void 0 : p.listPrice) != null && S.percentage);
|
|
1171
1170
|
}), M = c(
|
|
1172
1171
|
() => {
|
|
1173
|
-
var p, S,
|
|
1174
|
-
return (
|
|
1172
|
+
var p, S, w;
|
|
1173
|
+
return (w = (S = (p = e.value) == null ? void 0 : p.calculatedPrice) == null ? void 0 : S.regulationPrice) == null ? void 0 : w.price;
|
|
1175
1174
|
}
|
|
1176
1175
|
), O = c(() => X(e.value));
|
|
1177
1176
|
return {
|
|
1178
|
-
price:
|
|
1177
|
+
price: P,
|
|
1179
1178
|
totalPrice: f,
|
|
1180
|
-
unitPrice:
|
|
1179
|
+
unitPrice: i,
|
|
1181
1180
|
displayFromVariants: a,
|
|
1182
1181
|
displayFrom: r,
|
|
1183
1182
|
tierPrices: O,
|
|
@@ -1198,12 +1197,12 @@ function mt(e, s) {
|
|
|
1198
1197
|
});
|
|
1199
1198
|
}
|
|
1200
1199
|
function yn(e, s) {
|
|
1201
|
-
return c(() => mt(
|
|
1200
|
+
return c(() => mt(o(e), o(s)));
|
|
1202
1201
|
}
|
|
1203
1202
|
function pn(e) {
|
|
1204
1203
|
return c(() => {
|
|
1205
1204
|
var s, t, n, r, a, u;
|
|
1206
|
-
return !!((t = (s =
|
|
1205
|
+
return !!((t = (s = o(e)) == null ? void 0 : s.customer) != null && t.id) && !!((r = (n = o(e)) == null ? void 0 : n.customer) != null && r.active) && !((u = (a = o(e)) == null ? void 0 : a.customer) != null && u.guest);
|
|
1207
1206
|
});
|
|
1208
1207
|
}
|
|
1209
1208
|
function gn(e) {
|
|
@@ -1228,7 +1227,7 @@ function gn(e) {
|
|
|
1228
1227
|
var d;
|
|
1229
1228
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
|
|
1230
1229
|
}
|
|
1231
|
-
),
|
|
1230
|
+
), i = c(
|
|
1232
1231
|
() => {
|
|
1233
1232
|
var d;
|
|
1234
1233
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
|
|
@@ -1238,7 +1237,7 @@ function gn(e) {
|
|
|
1238
1237
|
var d;
|
|
1239
1238
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
|
|
1240
1239
|
}
|
|
1241
|
-
),
|
|
1240
|
+
), P = c(
|
|
1242
1241
|
() => {
|
|
1243
1242
|
var d;
|
|
1244
1243
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddress) || null;
|
|
@@ -1251,9 +1250,9 @@ function gn(e) {
|
|
|
1251
1250
|
isCustomerSession: r,
|
|
1252
1251
|
isGuestSession: a,
|
|
1253
1252
|
defaultBillingAddressId: u,
|
|
1254
|
-
defaultShippingAddressId:
|
|
1253
|
+
defaultShippingAddressId: i,
|
|
1255
1254
|
userDefaultBillingAddress: f,
|
|
1256
|
-
userDefaultShippingAddress:
|
|
1255
|
+
userDefaultShippingAddress: P,
|
|
1257
1256
|
// Expose queries and mutations directly
|
|
1258
1257
|
customerQuery: s
|
|
1259
1258
|
};
|
|
@@ -1262,29 +1261,29 @@ export {
|
|
|
1262
1261
|
St as absolutizeSeoUrl,
|
|
1263
1262
|
F as addressKeys,
|
|
1264
1263
|
L as cartKeys,
|
|
1265
|
-
|
|
1266
|
-
|
|
1264
|
+
B as categoryKeys,
|
|
1265
|
+
A as contextKeys,
|
|
1267
1266
|
j as countryKeys,
|
|
1268
1267
|
I as customerKeys,
|
|
1269
1268
|
mt as getProductVariantForOptions,
|
|
1270
1269
|
ee as languageKey,
|
|
1271
1270
|
D as navigationKeys,
|
|
1272
1271
|
U as orderKeys,
|
|
1273
|
-
|
|
1272
|
+
b as paymentKeys,
|
|
1274
1273
|
K as productKeys,
|
|
1275
1274
|
je as readPaymentMethodOperation,
|
|
1276
1275
|
dt as readShippingMethodOperation,
|
|
1277
1276
|
V as relativizeSeoUrl,
|
|
1278
1277
|
E as salutationKeys,
|
|
1279
1278
|
T as seoUrlKeys,
|
|
1280
|
-
|
|
1279
|
+
N as shippingKeys,
|
|
1281
1280
|
_ as shopwareClientKey,
|
|
1282
1281
|
y as unrefOptions,
|
|
1283
|
-
|
|
1282
|
+
At as useAddLineItemMutation,
|
|
1284
1283
|
Dt as useChangeEmailMutation,
|
|
1285
1284
|
zt as useChangePasswordMutation,
|
|
1286
1285
|
bt as useChangeProfileMutation,
|
|
1287
|
-
|
|
1286
|
+
Qt as useCheckoutAddresses,
|
|
1288
1287
|
Ot as useCreateCustomerAddressMutation,
|
|
1289
1288
|
It as useCreateOrderMutation,
|
|
1290
1289
|
Tt as useDefaultBillingAddressMutation,
|
|
@@ -1300,7 +1299,7 @@ export {
|
|
|
1300
1299
|
kt as useLoginCustomerMutation,
|
|
1301
1300
|
Bt as useLogoutCustomerMutation,
|
|
1302
1301
|
Ct as useOptimistic,
|
|
1303
|
-
|
|
1302
|
+
Pt as useOrderDetails,
|
|
1304
1303
|
Mt as useOrderPayment,
|
|
1305
1304
|
Xt as useOrderSetPaymentMutation,
|
|
1306
1305
|
ln as usePagination,
|
|
@@ -1313,20 +1312,20 @@ export {
|
|
|
1313
1312
|
We as useReadCategoryListQueryOptions,
|
|
1314
1313
|
Zt as useReadCompactProductListingQuery,
|
|
1315
1314
|
Xe as useReadCompactProductListingQueryOptions,
|
|
1316
|
-
|
|
1315
|
+
k as useReadContextQuery,
|
|
1317
1316
|
ae as useReadContextQueryOptions,
|
|
1318
1317
|
Ut as useReadCountryQuery,
|
|
1319
|
-
|
|
1318
|
+
Qe as useReadCountryQueryOptions,
|
|
1320
1319
|
Ze as useReadCustomProductDetailOptions,
|
|
1321
1320
|
_t as useReadCustomProductDetailQuery,
|
|
1322
1321
|
Re as useReadCustomerQuery,
|
|
1323
|
-
|
|
1322
|
+
Ae as useReadCustomerQueryOptions,
|
|
1324
1323
|
xt as useReadLanguageQuery,
|
|
1325
1324
|
Se as useReadLanguageQueryOptions,
|
|
1326
1325
|
Wt as useReadNavigationQuery,
|
|
1327
1326
|
Ee as useReadNavigationQueryOptions,
|
|
1328
1327
|
ce as useReadOrderQuery,
|
|
1329
|
-
|
|
1328
|
+
oe as useReadOrderQueryOptions,
|
|
1330
1329
|
$e as useReadPaymentMethodQuery,
|
|
1331
1330
|
Ve as useReadPaymentMethodQueryOptions,
|
|
1332
1331
|
sn as useReadProductDetailQuery,
|
|
@@ -1334,7 +1333,7 @@ export {
|
|
|
1334
1333
|
nn as useReadProductQuery,
|
|
1335
1334
|
rt as useReadProductQueryOptions,
|
|
1336
1335
|
rn as useReadSalutationQuery,
|
|
1337
|
-
|
|
1336
|
+
ot as useReadSalutationQueryOptions,
|
|
1338
1337
|
an as useReadSeoUrlQuery,
|
|
1339
1338
|
lt as useReadSeoUrlQueryOptions,
|
|
1340
1339
|
pt as useReadShippingMethodQuery,
|
|
@@ -1352,7 +1351,7 @@ export {
|
|
|
1352
1351
|
on as useShippingMethods,
|
|
1353
1352
|
g as useShopwareQueryClient,
|
|
1354
1353
|
$ as useUpdateContextMutation,
|
|
1355
|
-
|
|
1354
|
+
wt as useUpdateCustomerAddressMutation,
|
|
1356
1355
|
Lt as useUpdateLineItemMutation,
|
|
1357
1356
|
gn as useUser
|
|
1358
1357
|
};
|
package/package.json
CHANGED
package/src/keys.ts
CHANGED
|
@@ -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 { cartKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, paymentKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const addCartItemOperation = 'addLineItem post /checkout/cart/line-item' satisfies OperationKey
|
|
@@ -39,6 +39,7 @@ export function useAddLineItemMutation(
|
|
|
39
39
|
},
|
|
40
40
|
onSuccess: async (newCart, variables, context) => {
|
|
41
41
|
queryClient.setQueryData(cartKeys.get(), newCart)
|
|
42
|
+
await queryClient.invalidateQueries({ queryKey: paymentKeys.lists() })
|
|
42
43
|
// queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
43
44
|
await unref(unref(mutationOptions)?.onSuccess)?.(newCart, variables, context)
|
|
44
45
|
},
|
|
@@ -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 { cartKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, paymentKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const removeCartItemOperation = 'removeLineItem post /checkout/cart/line-item/delete' satisfies OperationKey
|
|
@@ -26,6 +26,7 @@ export function useRemoveLineItemMutation(
|
|
|
26
26
|
},
|
|
27
27
|
onSuccess: async (newCart, variables, context) => {
|
|
28
28
|
queryClient.setQueryData(cartKeys.get(), newCart)
|
|
29
|
+
await queryClient.invalidateQueries({ queryKey: paymentKeys.lists() })
|
|
29
30
|
// queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
30
31
|
await unref(unref(mutationOptions)?.onSuccess)?.(newCart, variables, context)
|
|
31
32
|
},
|