@teamnovu/kit-shopware-composables 0.0.20 → 0.0.22
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
|
|
3
|
+
import { queryOptions as P, useQuery as Q, useQueryClient as C, useMutation as v } from "@tanstack/vue-query";
|
|
4
4
|
import "@teamnovu/kit-shopware-api-client";
|
|
5
5
|
const _ = Symbol("shopwareClient");
|
|
6
6
|
function g() {
|
|
@@ -76,9 +76,9 @@ const F = {
|
|
|
76
76
|
body: e
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
|
-
}, x = {
|
|
80
|
-
get: () => ["cart"]
|
|
81
79
|
}, L = {
|
|
80
|
+
get: () => ["cart"]
|
|
81
|
+
}, I = {
|
|
82
82
|
all: () => ["customer"],
|
|
83
83
|
detail: (e) => ["customer", { body: e }],
|
|
84
84
|
imitateLogin: (e) => ["customer", "imitateLogin", { body: e }]
|
|
@@ -157,10 +157,10 @@ const F = {
|
|
|
157
157
|
]
|
|
158
158
|
};
|
|
159
159
|
function p(e) {
|
|
160
|
-
const s =
|
|
160
|
+
const s = o(e);
|
|
161
161
|
return Object.fromEntries(
|
|
162
162
|
Object.entries(s ?? {}).map(
|
|
163
|
-
([t, n]) => [t,
|
|
163
|
+
([t, n]) => [t, o(n)]
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
@@ -170,7 +170,7 @@ function ne(e) {
|
|
|
170
170
|
var n;
|
|
171
171
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
172
172
|
}));
|
|
173
|
-
return
|
|
173
|
+
return P({
|
|
174
174
|
queryKey: t,
|
|
175
175
|
queryFn: ({ signal: n }) => s.query(te, {
|
|
176
176
|
...p(e),
|
|
@@ -179,33 +179,33 @@ function ne(e) {
|
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
function se(e) {
|
|
182
|
-
return
|
|
182
|
+
return Q(ne(e));
|
|
183
183
|
}
|
|
184
184
|
const V = (e) => {
|
|
185
185
|
const s = e.replace(/\/?$/, "");
|
|
186
186
|
return s.startsWith("/") ? s.slice(1) : s;
|
|
187
187
|
}, ft = (e) => `/${V(e)}`;
|
|
188
|
-
function
|
|
189
|
-
const n =
|
|
188
|
+
function vt(e, s, t) {
|
|
189
|
+
const n = C();
|
|
190
190
|
return {
|
|
191
191
|
onMutate: async (r) => {
|
|
192
192
|
await n.cancelQueries({ queryKey: e });
|
|
193
193
|
const a = n.getQueryData(e);
|
|
194
194
|
if (n.setQueryData(e, (u) => s(r, u)), t) {
|
|
195
|
-
const u =
|
|
196
|
-
|
|
195
|
+
const u = o(t), i = o(u.onMutate);
|
|
196
|
+
i == null || i(r);
|
|
197
197
|
}
|
|
198
198
|
return { previousValue: a };
|
|
199
199
|
},
|
|
200
200
|
onError: (r, a, u) => {
|
|
201
201
|
if (u && n.setQueryData(e, u.previousValue), t) {
|
|
202
|
-
const
|
|
202
|
+
const i = o(t), f = o(i.onError);
|
|
203
203
|
f == null || f(r, a, u);
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
onSettled: (...r) => {
|
|
207
207
|
if (n.invalidateQueries({ queryKey: e }), t) {
|
|
208
|
-
const a =
|
|
208
|
+
const a = o(t), u = o(a.onSettled);
|
|
209
209
|
u == null || u(...r);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -214,7 +214,7 @@ function ht(e, s, t) {
|
|
|
214
214
|
const re = "readContext get /context";
|
|
215
215
|
function ae(e) {
|
|
216
216
|
const s = g();
|
|
217
|
-
return
|
|
217
|
+
return P({
|
|
218
218
|
queryKey: F.all(),
|
|
219
219
|
queryFn: ({ signal: t }) => s.query(re, {
|
|
220
220
|
...p(e),
|
|
@@ -223,23 +223,26 @@ function ae(e) {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
function k(e) {
|
|
226
|
-
return
|
|
226
|
+
return Q(ae(e));
|
|
227
227
|
}
|
|
228
228
|
const ue = "updateContext patch /context";
|
|
229
229
|
function $(e) {
|
|
230
|
-
const s = g(), t =
|
|
231
|
-
return
|
|
230
|
+
const s = g(), t = C();
|
|
231
|
+
return v({
|
|
232
232
|
...e,
|
|
233
233
|
mutationFn: async (n) => (t.cancelQueries({ queryKey: F.all() }), s.query(ue, {
|
|
234
234
|
body: n
|
|
235
235
|
})),
|
|
236
236
|
onSuccess: async (n, r, a) => {
|
|
237
|
-
var u,
|
|
238
|
-
await
|
|
237
|
+
var u, i;
|
|
238
|
+
await Promise.all([
|
|
239
|
+
t.invalidateQueries({ queryKey: F.all() }),
|
|
240
|
+
t.invalidateQueries({ queryKey: L.get() })
|
|
241
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
239
242
|
}
|
|
240
243
|
});
|
|
241
244
|
}
|
|
242
|
-
function
|
|
245
|
+
function ht() {
|
|
243
246
|
const e = $(), s = k(), t = se(), n = c(() => s.isFetching.value || e.isPending.value), r = async (d) => {
|
|
244
247
|
await e.mutateAsync({
|
|
245
248
|
billingAddressId: d.id
|
|
@@ -251,7 +254,7 @@ function vt() {
|
|
|
251
254
|
}, u = c(() => {
|
|
252
255
|
var d, M;
|
|
253
256
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeBillingAddress;
|
|
254
|
-
}),
|
|
257
|
+
}), i = c(() => {
|
|
255
258
|
var d, M;
|
|
256
259
|
return (M = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : M.activeShippingAddress;
|
|
257
260
|
}), f = c(() => {
|
|
@@ -262,12 +265,12 @@ function vt() {
|
|
|
262
265
|
return M.id !== ((O = u.value) == null ? void 0 : O.id);
|
|
263
266
|
}
|
|
264
267
|
)) ?? [];
|
|
265
|
-
}),
|
|
268
|
+
}), S = c(() => {
|
|
266
269
|
var d;
|
|
267
270
|
return ((d = t.data.value) == null ? void 0 : d.elements.filter(
|
|
268
271
|
(M) => {
|
|
269
272
|
var O;
|
|
270
|
-
return M.id !== ((O =
|
|
273
|
+
return M.id !== ((O = i.value) == null ? void 0 : O.id);
|
|
271
274
|
}
|
|
272
275
|
)) ?? [];
|
|
273
276
|
});
|
|
@@ -279,19 +282,19 @@ function vt() {
|
|
|
279
282
|
setShippingAddress: a,
|
|
280
283
|
isSaving: n,
|
|
281
284
|
activeBillingAddress: u,
|
|
282
|
-
activeShippingAddress:
|
|
285
|
+
activeShippingAddress: i,
|
|
283
286
|
inactiveBillingAddresses: f,
|
|
284
|
-
inactiveShippingAddresses:
|
|
287
|
+
inactiveShippingAddresses: S
|
|
285
288
|
};
|
|
286
289
|
}
|
|
287
|
-
const
|
|
288
|
-
function
|
|
290
|
+
const ie = "readOrder post /order";
|
|
291
|
+
function oe(e) {
|
|
289
292
|
const s = g(), t = U.detail(e);
|
|
290
|
-
return
|
|
293
|
+
return P({
|
|
291
294
|
queryKey: t,
|
|
292
295
|
queryFn: async ({ signal: n }) => {
|
|
293
296
|
const r = p(e);
|
|
294
|
-
return s.query(
|
|
297
|
+
return s.query(ie, {
|
|
295
298
|
...r,
|
|
296
299
|
signal: n
|
|
297
300
|
});
|
|
@@ -299,11 +302,11 @@ function ie(e) {
|
|
|
299
302
|
});
|
|
300
303
|
}
|
|
301
304
|
function ce(e) {
|
|
302
|
-
return
|
|
305
|
+
return Q(oe(e));
|
|
303
306
|
}
|
|
304
307
|
function qt(e, s) {
|
|
305
308
|
const t = c(() => {
|
|
306
|
-
const l =
|
|
309
|
+
const l = o(e);
|
|
307
310
|
if (l)
|
|
308
311
|
return {
|
|
309
312
|
body: {
|
|
@@ -319,39 +322,39 @@ function qt(e, s) {
|
|
|
319
322
|
}
|
|
320
323
|
};
|
|
321
324
|
}), n = ce(t.value), r = c(() => {
|
|
322
|
-
var l, m, q,
|
|
323
|
-
return (
|
|
325
|
+
var l, m, q, x;
|
|
326
|
+
return (x = (q = (m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.orders) == null ? void 0 : q.elements) == null ? void 0 : x[0];
|
|
324
327
|
}), a = c(() => {
|
|
325
328
|
var l, m;
|
|
326
329
|
return ((m = (l = n.data) == null ? void 0 : l.value) == null ? void 0 : m.paymentChangeable) || {};
|
|
327
330
|
}), u = c(() => {
|
|
328
331
|
var l, m, q;
|
|
329
332
|
return (q = (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.translated) == null ? void 0 : q.name;
|
|
330
|
-
}),
|
|
333
|
+
}), i = c(() => {
|
|
331
334
|
var l, m;
|
|
332
335
|
return (m = (l = r.value) == null ? void 0 : l.stateMachineState) == null ? void 0 : m.technicalName;
|
|
333
336
|
}), f = c(() => {
|
|
334
337
|
var l, m;
|
|
335
338
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.totalPrice;
|
|
336
|
-
}),
|
|
339
|
+
}), S = c(() => {
|
|
337
340
|
var l, m;
|
|
338
341
|
return (m = (l = r.value) == null ? void 0 : l.price) == null ? void 0 : m.positionPrice;
|
|
339
342
|
}), d = c(() => {
|
|
340
343
|
var l;
|
|
341
344
|
return (l = r.value) == null ? void 0 : l.shippingTotal;
|
|
342
345
|
}), M = c(() => {
|
|
343
|
-
var l, m, q,
|
|
346
|
+
var l, m, q, x, z, G;
|
|
344
347
|
return {
|
|
345
348
|
email: (m = (l = r.value) == null ? void 0 : l.orderCustomer) == null ? void 0 : m.email,
|
|
346
|
-
firstName: (
|
|
349
|
+
firstName: (x = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : x.firstName,
|
|
347
350
|
lastName: (G = (z = r.value) == null ? void 0 : z.orderCustomer) == null ? void 0 : G.lastName
|
|
348
351
|
};
|
|
349
352
|
}), O = c(() => {
|
|
350
353
|
var l, m;
|
|
351
354
|
return (m = (l = r.value) == null ? void 0 : l.addresses) == null ? void 0 : m.find(
|
|
352
355
|
({ id: q }) => {
|
|
353
|
-
var
|
|
354
|
-
return q === ((
|
|
356
|
+
var x;
|
|
357
|
+
return q === ((x = r.value) == null ? void 0 : x.billingAddressId);
|
|
355
358
|
}
|
|
356
359
|
);
|
|
357
360
|
}), y = c(
|
|
@@ -359,7 +362,7 @@ function qt(e, s) {
|
|
|
359
362
|
var l, m, q;
|
|
360
363
|
return (q = (m = (l = r.value) == null ? void 0 : l.deliveries) == null ? void 0 : m[0]) == null ? void 0 : q.shippingOrderAddress;
|
|
361
364
|
}
|
|
362
|
-
),
|
|
365
|
+
), h = c(() => {
|
|
363
366
|
var m, q;
|
|
364
367
|
const l = (m = r.value) == null ? void 0 : m.transactions;
|
|
365
368
|
if (l != null && l.length)
|
|
@@ -371,21 +374,21 @@ function qt(e, s) {
|
|
|
371
374
|
return (q = l.at(-1)) == null ? void 0 : q.shippingMethod;
|
|
372
375
|
}), A = c(() => {
|
|
373
376
|
var m;
|
|
374
|
-
const l =
|
|
377
|
+
const l = o(e);
|
|
375
378
|
return ((m = a.value) == null ? void 0 : m[l]) ?? !1;
|
|
376
379
|
});
|
|
377
380
|
return {
|
|
378
381
|
order: r,
|
|
379
382
|
status: u,
|
|
380
|
-
statusTechnicalName:
|
|
383
|
+
statusTechnicalName: i,
|
|
381
384
|
total: f,
|
|
382
|
-
subtotal:
|
|
385
|
+
subtotal: S,
|
|
383
386
|
shippingCosts: d,
|
|
384
387
|
shippingAddress: y,
|
|
385
388
|
billingAddress: O,
|
|
386
389
|
personalDetails: M,
|
|
387
390
|
shippingMethod: K,
|
|
388
|
-
paymentMethod:
|
|
391
|
+
paymentMethod: h,
|
|
389
392
|
paymentChangeable: A,
|
|
390
393
|
orderQuery: n
|
|
391
394
|
};
|
|
@@ -393,9 +396,9 @@ function qt(e, s) {
|
|
|
393
396
|
function Ct(e) {
|
|
394
397
|
const s = c(() => {
|
|
395
398
|
var r, a;
|
|
396
|
-
return (a = (r =
|
|
397
|
-
var
|
|
398
|
-
return ((
|
|
399
|
+
return (a = (r = o(e)) == null ? void 0 : r.transactions) == null ? void 0 : a.find((u) => {
|
|
400
|
+
var i;
|
|
401
|
+
return ((i = u.paymentMethod) == null ? void 0 : i.active) === !0;
|
|
399
402
|
});
|
|
400
403
|
}), t = c(() => {
|
|
401
404
|
var r;
|
|
@@ -412,65 +415,65 @@ function Ct(e) {
|
|
|
412
415
|
}
|
|
413
416
|
const le = "createCustomerAddress post /account/address";
|
|
414
417
|
function St(e) {
|
|
415
|
-
const s = g(), t =
|
|
416
|
-
return
|
|
418
|
+
const s = g(), t = C();
|
|
419
|
+
return v({
|
|
417
420
|
...e,
|
|
418
421
|
mutationFn: async (n) => s.query(le, p(n)),
|
|
419
422
|
onSuccess: async (n, r, a) => {
|
|
420
|
-
var u,
|
|
421
|
-
await t.invalidateQueries({ queryKey: R.lists() }), await ((
|
|
423
|
+
var u, i;
|
|
424
|
+
await t.invalidateQueries({ queryKey: R.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
422
425
|
}
|
|
423
426
|
});
|
|
424
427
|
}
|
|
425
428
|
const de = "deleteCustomerAddress delete /account/address/{addressId}";
|
|
426
429
|
function Pt(e) {
|
|
427
|
-
const s = g(), t =
|
|
428
|
-
return
|
|
430
|
+
const s = g(), t = C();
|
|
431
|
+
return v({
|
|
429
432
|
...e,
|
|
430
433
|
mutationFn: async (n) => s.query(de, p(n)),
|
|
431
434
|
onSuccess: async (n, r, a) => {
|
|
432
|
-
var u,
|
|
433
|
-
await t.invalidateQueries({ queryKey: R.lists() }), await ((
|
|
435
|
+
var u, i;
|
|
436
|
+
await t.invalidateQueries({ queryKey: R.lists() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
434
437
|
}
|
|
435
438
|
});
|
|
436
439
|
}
|
|
437
440
|
const ye = "updateCustomerAddress patch /account/address/{addressId}";
|
|
438
441
|
function Qt(e) {
|
|
439
|
-
const s = g(), t =
|
|
440
|
-
return
|
|
442
|
+
const s = g(), t = C();
|
|
443
|
+
return v({
|
|
441
444
|
...e,
|
|
442
445
|
mutationFn: async (n) => s.query(ye, p(n)),
|
|
443
446
|
onSuccess: async (n, r, a) => {
|
|
444
|
-
var
|
|
447
|
+
var i, f;
|
|
445
448
|
const { addressId: u } = p(r).params;
|
|
446
449
|
t.setQueryData(R.detail(u), n), await Promise.all([
|
|
447
450
|
t.invalidateQueries({ queryKey: R.lists() }),
|
|
448
451
|
t.invalidateQueries({
|
|
449
452
|
queryKey: R.detail(p(r).params.addressId),
|
|
450
|
-
predicate: (
|
|
453
|
+
predicate: (S) => S.queryKey.at(-1) !== u
|
|
451
454
|
})
|
|
452
|
-
]), await ((f =
|
|
455
|
+
]), await ((f = o((i = o(e)) == null ? void 0 : i.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
453
456
|
}
|
|
454
457
|
});
|
|
455
458
|
}
|
|
456
459
|
const pe = "addLineItem post /checkout/cart/line-item";
|
|
457
460
|
function Mt(e) {
|
|
458
|
-
const s = g(), t =
|
|
459
|
-
return
|
|
461
|
+
const s = g(), t = C();
|
|
462
|
+
return v({
|
|
460
463
|
...e,
|
|
461
464
|
mutationFn: async (n) => s.query(pe, {
|
|
462
465
|
body: n
|
|
463
466
|
}),
|
|
464
467
|
onSuccess: async (n, r, a) => {
|
|
465
|
-
var u,
|
|
466
|
-
t.setQueryData(
|
|
468
|
+
var u, i;
|
|
469
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
467
470
|
}
|
|
468
471
|
});
|
|
469
472
|
}
|
|
470
473
|
const ge = "readCart get /checkout/cart";
|
|
471
474
|
function me(e) {
|
|
472
|
-
const s = g(), t =
|
|
473
|
-
return
|
|
475
|
+
const s = g(), t = L.get();
|
|
476
|
+
return P({
|
|
474
477
|
queryKey: t,
|
|
475
478
|
queryFn: async ({ signal: n }) => s.query(ge, {
|
|
476
479
|
...p(e),
|
|
@@ -479,57 +482,57 @@ function me(e) {
|
|
|
479
482
|
});
|
|
480
483
|
}
|
|
481
484
|
function Ot() {
|
|
482
|
-
return
|
|
485
|
+
return Q(me());
|
|
483
486
|
}
|
|
484
487
|
const fe = "removeLineItem post /checkout/cart/line-item/delete";
|
|
485
488
|
function Kt(e) {
|
|
486
|
-
const s = g(), t =
|
|
487
|
-
return
|
|
489
|
+
const s = g(), t = C();
|
|
490
|
+
return v({
|
|
488
491
|
...e,
|
|
489
492
|
mutationFn: async (n) => s.query(fe, {
|
|
490
493
|
body: n
|
|
491
494
|
}),
|
|
492
495
|
onSuccess: async (n, r, a) => {
|
|
493
|
-
var u,
|
|
494
|
-
t.setQueryData(
|
|
496
|
+
var u, i;
|
|
497
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
495
498
|
}
|
|
496
499
|
});
|
|
497
500
|
}
|
|
498
|
-
const
|
|
501
|
+
const ve = "updateLineItem patch /checkout/cart/line-item";
|
|
499
502
|
function At(e) {
|
|
500
|
-
const s = g(), t =
|
|
501
|
-
return
|
|
503
|
+
const s = g(), t = C();
|
|
504
|
+
return v({
|
|
502
505
|
...e,
|
|
503
|
-
mutationFn: async (n) => s.query(
|
|
506
|
+
mutationFn: async (n) => s.query(ve, {
|
|
504
507
|
body: n
|
|
505
508
|
}),
|
|
506
509
|
onSuccess: async (n, r, a) => {
|
|
507
|
-
var u,
|
|
508
|
-
t.setQueryData(
|
|
510
|
+
var u, i;
|
|
511
|
+
t.setQueryData(L.get(), n), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
509
512
|
}
|
|
510
513
|
});
|
|
511
514
|
}
|
|
512
|
-
const
|
|
515
|
+
const he = "createOrder post /checkout/order";
|
|
513
516
|
function wt(e) {
|
|
514
|
-
const s = g(), t =
|
|
515
|
-
return
|
|
517
|
+
const s = g(), t = C();
|
|
518
|
+
return v({
|
|
516
519
|
...e,
|
|
517
|
-
mutationFn: async (n) => s.query(
|
|
520
|
+
mutationFn: async (n) => s.query(he, p(n)),
|
|
518
521
|
onSuccess: async (n, r, a) => {
|
|
519
|
-
var u,
|
|
522
|
+
var u, i;
|
|
520
523
|
await Promise.all([
|
|
521
524
|
// Clear cart after successful order creation
|
|
522
|
-
t.invalidateQueries({ queryKey:
|
|
525
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
523
526
|
// Invalidate order list to refetch data
|
|
524
527
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
525
|
-
]), await ((
|
|
528
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
526
529
|
}
|
|
527
530
|
});
|
|
528
531
|
}
|
|
529
532
|
const qe = "readLanguages post /language";
|
|
530
533
|
function Ce(e) {
|
|
531
534
|
const s = g();
|
|
532
|
-
return
|
|
535
|
+
return P({
|
|
533
536
|
queryKey: ee.all(),
|
|
534
537
|
queryFn: ({ signal: t }) => s.query(qe, {
|
|
535
538
|
...p(e),
|
|
@@ -538,11 +541,11 @@ function Ce(e) {
|
|
|
538
541
|
});
|
|
539
542
|
}
|
|
540
543
|
function Rt(e) {
|
|
541
|
-
return
|
|
544
|
+
return Q(Ce(e));
|
|
542
545
|
}
|
|
543
546
|
const Se = "readCountry post /country", Pe = function(s) {
|
|
544
547
|
const t = g(), n = j.list(s);
|
|
545
|
-
return
|
|
548
|
+
return P({
|
|
546
549
|
queryKey: n,
|
|
547
550
|
queryFn: async ({ signal: r }) => {
|
|
548
551
|
const a = p(s);
|
|
@@ -554,39 +557,39 @@ const Se = "readCountry post /country", Pe = function(s) {
|
|
|
554
557
|
});
|
|
555
558
|
};
|
|
556
559
|
function Ft(e) {
|
|
557
|
-
return
|
|
560
|
+
return Q(Pe(e));
|
|
558
561
|
}
|
|
559
562
|
const Qe = "changeEmail post /account/change-email";
|
|
560
563
|
function Lt(e) {
|
|
561
|
-
const s = g(), t =
|
|
562
|
-
return
|
|
564
|
+
const s = g(), t = C();
|
|
565
|
+
return v({
|
|
563
566
|
...e,
|
|
564
567
|
mutationFn: async (n) => s.query(Qe, p(n)),
|
|
565
568
|
onSuccess: async (n, r, a) => {
|
|
566
|
-
var u,
|
|
567
|
-
await t.invalidateQueries({ queryKey:
|
|
569
|
+
var u, i;
|
|
570
|
+
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: F.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
568
571
|
}
|
|
569
572
|
});
|
|
570
573
|
}
|
|
571
574
|
const Me = "changeProfile post /account/change-profile";
|
|
572
575
|
function It(e) {
|
|
573
|
-
const s = g(), t =
|
|
574
|
-
return
|
|
576
|
+
const s = g(), t = C();
|
|
577
|
+
return v({
|
|
575
578
|
...e,
|
|
576
579
|
mutationFn: async (n) => s.query(Me, p(n)),
|
|
577
580
|
onSuccess: async (n, r, a) => {
|
|
578
|
-
var u,
|
|
581
|
+
var u, i;
|
|
579
582
|
await Promise.all([
|
|
580
|
-
t.invalidateQueries({ queryKey:
|
|
583
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
581
584
|
t.invalidateQueries({ queryKey: F.all() })
|
|
582
|
-
]), await ((
|
|
585
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
583
586
|
}
|
|
584
587
|
});
|
|
585
588
|
}
|
|
586
589
|
const Oe = "loginCustomer post /account/login";
|
|
587
590
|
function xt(e) {
|
|
588
|
-
const s = g(), t =
|
|
589
|
-
return
|
|
591
|
+
const s = g(), t = C();
|
|
592
|
+
return v({
|
|
590
593
|
...e,
|
|
591
594
|
mutationFn: async (n) => {
|
|
592
595
|
const r = await s.queryRaw(Oe, {
|
|
@@ -595,104 +598,104 @@ function xt(e) {
|
|
|
595
598
|
return a && (s.contextToken = a), r.json();
|
|
596
599
|
},
|
|
597
600
|
onSuccess: async (n, r, a) => {
|
|
598
|
-
var u,
|
|
601
|
+
var u, i;
|
|
599
602
|
await Promise.all([
|
|
600
603
|
t.resetQueries({ queryKey: F.all() }),
|
|
601
|
-
t.invalidateQueries({ queryKey:
|
|
602
|
-
t.invalidateQueries({ queryKey:
|
|
603
|
-
]), await ((
|
|
604
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
605
|
+
t.invalidateQueries({ queryKey: I.all() })
|
|
606
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
604
607
|
}
|
|
605
608
|
});
|
|
606
609
|
}
|
|
607
610
|
const Ke = "logoutCustomer post /account/logout";
|
|
608
611
|
function Ut(e) {
|
|
609
|
-
const s = g(), t =
|
|
610
|
-
return
|
|
612
|
+
const s = g(), t = C();
|
|
613
|
+
return v({
|
|
611
614
|
...e,
|
|
612
615
|
mutationFn: async (n) => s.query(Ke, p(n)),
|
|
613
616
|
onSuccess: async (n, r, a) => {
|
|
614
|
-
var u,
|
|
617
|
+
var u, i;
|
|
615
618
|
await Promise.all([
|
|
616
619
|
t.resetQueries({ queryKey: F.all() }),
|
|
617
|
-
t.invalidateQueries({ queryKey:
|
|
618
|
-
t.invalidateQueries({ queryKey:
|
|
619
|
-
]), await ((
|
|
620
|
+
t.invalidateQueries({ queryKey: L.get() }),
|
|
621
|
+
t.invalidateQueries({ queryKey: I.all() })
|
|
622
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
620
623
|
}
|
|
621
624
|
});
|
|
622
625
|
}
|
|
623
626
|
const Ae = "readCustomer post /account/customer";
|
|
624
627
|
function we(e) {
|
|
625
|
-
const s = g(), t =
|
|
626
|
-
return
|
|
628
|
+
const s = g(), t = I.detail(c(() => p(e).body ?? {}));
|
|
629
|
+
return P({
|
|
627
630
|
queryKey: t,
|
|
628
631
|
queryFn: async () => s.query(Ae, p(e))
|
|
629
632
|
});
|
|
630
633
|
}
|
|
631
634
|
function Re(e) {
|
|
632
|
-
return
|
|
635
|
+
return Q(we(e));
|
|
633
636
|
}
|
|
634
637
|
const Fe = "register post /account/register";
|
|
635
638
|
function bt(e) {
|
|
636
|
-
const s = g(), t =
|
|
637
|
-
return
|
|
639
|
+
const s = g(), t = C();
|
|
640
|
+
return v({
|
|
638
641
|
...e,
|
|
639
642
|
mutationFn: async (n) => s.query(Fe, p(n)),
|
|
640
643
|
onSuccess: async (n, r, a) => {
|
|
641
|
-
var u,
|
|
642
|
-
await t.invalidateQueries({ queryKey:
|
|
644
|
+
var u, i;
|
|
645
|
+
await t.invalidateQueries({ queryKey: I.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
643
646
|
}
|
|
644
647
|
});
|
|
645
648
|
}
|
|
646
649
|
const Le = "defaultBillingAddress patch /account/address/default-billing/{addressId}";
|
|
647
650
|
function kt(e) {
|
|
648
|
-
const s = g(), t =
|
|
649
|
-
return
|
|
651
|
+
const s = g(), t = C();
|
|
652
|
+
return v({
|
|
650
653
|
...e,
|
|
651
654
|
mutationFn: async (n) => s.query(Le, p(n)),
|
|
652
655
|
onSuccess: async (n, r, a) => {
|
|
653
|
-
var u,
|
|
656
|
+
var u, i;
|
|
654
657
|
await Promise.all([
|
|
655
|
-
t.invalidateQueries({ queryKey:
|
|
658
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
656
659
|
t.invalidateQueries({ queryKey: F.all() })
|
|
657
|
-
]), await ((
|
|
660
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
658
661
|
}
|
|
659
662
|
});
|
|
660
663
|
}
|
|
661
664
|
const Ie = "defaultShippingAddress patch /account/address/default-shipping/{addressId}";
|
|
662
665
|
function Bt(e) {
|
|
663
|
-
const s = g(), t =
|
|
664
|
-
return
|
|
666
|
+
const s = g(), t = C();
|
|
667
|
+
return v({
|
|
665
668
|
...e,
|
|
666
669
|
mutationFn: async (n) => s.query(Ie, p(n)),
|
|
667
670
|
onSuccess: async (n, r, a) => {
|
|
668
|
-
var u,
|
|
671
|
+
var u, i;
|
|
669
672
|
await Promise.all([
|
|
670
|
-
t.invalidateQueries({ queryKey:
|
|
673
|
+
t.invalidateQueries({ queryKey: I.all() }),
|
|
671
674
|
t.invalidateQueries({ queryKey: F.all() })
|
|
672
|
-
]), await ((
|
|
675
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
673
676
|
}
|
|
674
677
|
});
|
|
675
678
|
}
|
|
676
679
|
const xe = "deleteCustomer delete /account/customer";
|
|
677
680
|
function Dt(e) {
|
|
678
|
-
const s = g(), t =
|
|
679
|
-
return
|
|
681
|
+
const s = g(), t = C();
|
|
682
|
+
return v({
|
|
680
683
|
...e,
|
|
681
684
|
mutationFn: async (n) => s.query(xe, p(n)),
|
|
682
685
|
onSuccess: async (n, r, a) => {
|
|
683
|
-
var u,
|
|
686
|
+
var u, i;
|
|
684
687
|
await Promise.all([
|
|
685
|
-
t.resetQueries({ queryKey:
|
|
688
|
+
t.resetQueries({ queryKey: I.all() }),
|
|
686
689
|
t.resetQueries({ queryKey: F.all() }),
|
|
687
|
-
t.resetQueries({ queryKey:
|
|
688
|
-
]), await ((
|
|
690
|
+
t.resetQueries({ queryKey: L.get() })
|
|
691
|
+
]), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
689
692
|
}
|
|
690
693
|
});
|
|
691
694
|
}
|
|
692
695
|
const Ue = "registerConfirm post /account/register-confirm";
|
|
693
696
|
function Nt(e) {
|
|
694
697
|
const s = g();
|
|
695
|
-
return
|
|
698
|
+
return v({
|
|
696
699
|
...e,
|
|
697
700
|
mutationFn: async (t) => {
|
|
698
701
|
const n = await s.queryRaw(Ue, {
|
|
@@ -702,67 +705,67 @@ function Nt(e) {
|
|
|
702
705
|
},
|
|
703
706
|
onSuccess: async (t, n, r) => {
|
|
704
707
|
var a, u;
|
|
705
|
-
await ((u =
|
|
708
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
706
709
|
}
|
|
707
710
|
});
|
|
708
711
|
}
|
|
709
712
|
const be = "sendRecoveryMail post /account/recovery-password";
|
|
710
713
|
function Tt(e) {
|
|
711
714
|
const s = g();
|
|
712
|
-
return
|
|
715
|
+
return v({
|
|
713
716
|
...e,
|
|
714
717
|
mutationFn: async (t) => s.query(be, p(t)),
|
|
715
718
|
onSuccess: async (t, n, r) => {
|
|
716
719
|
var a, u;
|
|
717
|
-
await ((u =
|
|
720
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
718
721
|
}
|
|
719
722
|
});
|
|
720
723
|
}
|
|
721
724
|
const ke = "changePassword post /account/change-password";
|
|
722
725
|
function Et(e) {
|
|
723
726
|
const s = g();
|
|
724
|
-
return
|
|
727
|
+
return v({
|
|
725
728
|
...e,
|
|
726
729
|
mutationFn: async (t) => s.query(ke, p(t)),
|
|
727
730
|
onSuccess: async (t, n, r) => {
|
|
728
731
|
var a, u;
|
|
729
|
-
await ((u =
|
|
732
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
730
733
|
}
|
|
731
734
|
});
|
|
732
735
|
}
|
|
733
736
|
const Be = "imitateCustomerLogin post /account/login/imitate-customer";
|
|
734
737
|
function De(e) {
|
|
735
|
-
const s = g(), t =
|
|
736
|
-
return
|
|
738
|
+
const s = g(), t = I.imitateLogin(c(() => p(e).body ?? {}));
|
|
739
|
+
return P({
|
|
737
740
|
queryKey: t,
|
|
738
741
|
queryFn: async () => s.query(Be, p(e))
|
|
739
742
|
});
|
|
740
743
|
}
|
|
741
744
|
function jt(e) {
|
|
742
|
-
return
|
|
745
|
+
return Q(De(e));
|
|
743
746
|
}
|
|
744
747
|
const Ne = "recoveryPassword post /account/recovery-password-confirm";
|
|
745
748
|
function Vt(e) {
|
|
746
749
|
const s = g();
|
|
747
|
-
return
|
|
750
|
+
return v({
|
|
748
751
|
...e,
|
|
749
752
|
mutationFn: async (t) => s.query(Ne, p(t)),
|
|
750
753
|
onSuccess: async (t, n, r) => {
|
|
751
754
|
var a, u;
|
|
752
|
-
await ((u =
|
|
755
|
+
await ((u = o((a = o(e)) == null ? void 0 : a.onSuccess)) == null ? void 0 : u(t, n, r));
|
|
753
756
|
}
|
|
754
757
|
});
|
|
755
758
|
}
|
|
756
759
|
const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(s, t, n) {
|
|
757
760
|
const r = g(), a = b.detail(s, t, n);
|
|
758
|
-
return
|
|
761
|
+
return P({
|
|
759
762
|
queryKey: a,
|
|
760
763
|
queryFn: async ({ signal: u }) => {
|
|
761
|
-
const
|
|
764
|
+
const i = o(s), f = o(t), S = p(n);
|
|
762
765
|
return r.query(Te, {
|
|
763
|
-
...
|
|
766
|
+
...S,
|
|
764
767
|
params: {
|
|
765
|
-
activeId:
|
|
768
|
+
activeId: i,
|
|
766
769
|
rootId: f
|
|
767
770
|
},
|
|
768
771
|
signal: u
|
|
@@ -771,7 +774,7 @@ const Te = "readNavigation post /navigation/{activeId}/{rootId}", Ee = function(
|
|
|
771
774
|
});
|
|
772
775
|
};
|
|
773
776
|
function $t(e, s, t) {
|
|
774
|
-
return
|
|
777
|
+
return Q(Ee(e, s, t));
|
|
775
778
|
}
|
|
776
779
|
const je = "readPaymentMethod post /payment-method";
|
|
777
780
|
function Ve(e) {
|
|
@@ -779,7 +782,7 @@ function Ve(e) {
|
|
|
779
782
|
var n;
|
|
780
783
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
781
784
|
}));
|
|
782
|
-
return
|
|
785
|
+
return P({
|
|
783
786
|
queryKey: t,
|
|
784
787
|
queryFn: ({ signal: n }) => s.query(je, {
|
|
785
788
|
...p(e),
|
|
@@ -788,35 +791,35 @@ function Ve(e) {
|
|
|
788
791
|
});
|
|
789
792
|
}
|
|
790
793
|
function $e(e) {
|
|
791
|
-
return
|
|
794
|
+
return Q(Ve(e));
|
|
792
795
|
}
|
|
793
796
|
const ze = "handlePaymentMethod post /handle-payment";
|
|
794
797
|
function zt(e) {
|
|
795
|
-
const s = g();
|
|
796
|
-
return
|
|
798
|
+
const s = g(), t = C();
|
|
799
|
+
return v({
|
|
797
800
|
...e,
|
|
798
|
-
mutationFn: async (
|
|
799
|
-
onSuccess: async (
|
|
800
|
-
var
|
|
801
|
-
await ((
|
|
801
|
+
mutationFn: async (n) => s.query(ze, p(n)),
|
|
802
|
+
onSuccess: async (n, r, a) => {
|
|
803
|
+
var u, i;
|
|
804
|
+
await t.invalidateQueries({ queryKey: L.get() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
802
805
|
}
|
|
803
806
|
});
|
|
804
807
|
}
|
|
805
808
|
const Ge = "orderSetPayment post /order/payment";
|
|
806
809
|
function Gt(e) {
|
|
807
|
-
const s = g(), t =
|
|
808
|
-
return
|
|
810
|
+
const s = g(), t = C();
|
|
811
|
+
return v({
|
|
809
812
|
...e,
|
|
810
813
|
mutationFn: async (n) => s.query(Ge, p(n)),
|
|
811
814
|
onSuccess: async (n, r, a) => {
|
|
812
|
-
var u,
|
|
813
|
-
await t.invalidateQueries({ queryKey: U.all() }), await ((
|
|
815
|
+
var u, i;
|
|
816
|
+
await t.invalidateQueries({ queryKey: U.all() }), await ((i = o((u = o(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : i(n, r, a));
|
|
814
817
|
}
|
|
815
818
|
});
|
|
816
819
|
}
|
|
817
820
|
const He = "readCategoryList post /category", We = function(s) {
|
|
818
821
|
const t = g(), n = B.list(s);
|
|
819
|
-
return
|
|
822
|
+
return P({
|
|
820
823
|
queryKey: n,
|
|
821
824
|
queryFn: async ({ signal: r }) => t.query(He, {
|
|
822
825
|
...p(s),
|
|
@@ -825,12 +828,12 @@ const He = "readCategoryList post /category", We = function(s) {
|
|
|
825
828
|
});
|
|
826
829
|
};
|
|
827
830
|
function Ht(e) {
|
|
828
|
-
return
|
|
831
|
+
return Q(We(e));
|
|
829
832
|
}
|
|
830
833
|
const Je = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
831
834
|
function Xe(e, s) {
|
|
832
835
|
const t = g(), n = w.list(e, s);
|
|
833
|
-
return
|
|
836
|
+
return P({
|
|
834
837
|
queryKey: n,
|
|
835
838
|
queryFn: async ({ signal: r }) => {
|
|
836
839
|
const a = p(s);
|
|
@@ -838,7 +841,7 @@ function Xe(e, s) {
|
|
|
838
841
|
...a,
|
|
839
842
|
params: {
|
|
840
843
|
...a.params,
|
|
841
|
-
seoUrl: V(
|
|
844
|
+
seoUrl: V(o(e))
|
|
842
845
|
},
|
|
843
846
|
signal: r
|
|
844
847
|
});
|
|
@@ -846,12 +849,12 @@ function Xe(e, s) {
|
|
|
846
849
|
});
|
|
847
850
|
}
|
|
848
851
|
function Wt(e, s) {
|
|
849
|
-
return
|
|
852
|
+
return Q(Xe(e, s));
|
|
850
853
|
}
|
|
851
854
|
const Ye = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
852
855
|
function Ze(e, s) {
|
|
853
856
|
const t = g(), n = w.customDetail(e, s);
|
|
854
|
-
return
|
|
857
|
+
return P({
|
|
855
858
|
queryKey: n,
|
|
856
859
|
queryFn: async ({ signal: r }) => {
|
|
857
860
|
const a = p(s);
|
|
@@ -859,7 +862,7 @@ function Ze(e, s) {
|
|
|
859
862
|
...a,
|
|
860
863
|
params: {
|
|
861
864
|
...a.params,
|
|
862
|
-
seoUrl: V(
|
|
865
|
+
seoUrl: V(o(e))
|
|
863
866
|
},
|
|
864
867
|
signal: r
|
|
865
868
|
});
|
|
@@ -867,12 +870,12 @@ function Ze(e, s) {
|
|
|
867
870
|
});
|
|
868
871
|
}
|
|
869
872
|
function Jt(e, s) {
|
|
870
|
-
return
|
|
873
|
+
return Q(Ze(e, s));
|
|
871
874
|
}
|
|
872
875
|
const _e = "searchPage post /search";
|
|
873
876
|
function et(e) {
|
|
874
877
|
const s = g(), t = w.search(e);
|
|
875
|
-
return
|
|
878
|
+
return P({
|
|
876
879
|
queryKey: t,
|
|
877
880
|
queryFn: async ({ signal: n }) => {
|
|
878
881
|
const r = p(e);
|
|
@@ -884,12 +887,12 @@ function et(e) {
|
|
|
884
887
|
});
|
|
885
888
|
}
|
|
886
889
|
function Xt(e) {
|
|
887
|
-
return
|
|
890
|
+
return Q(et(e));
|
|
888
891
|
}
|
|
889
892
|
const tt = "readProduct post /product";
|
|
890
893
|
function nt(e) {
|
|
891
894
|
const s = g(), t = w.detail(e);
|
|
892
|
-
return
|
|
895
|
+
return P({
|
|
893
896
|
queryKey: t,
|
|
894
897
|
queryFn: async ({ signal: n }) => {
|
|
895
898
|
const r = p(e);
|
|
@@ -901,11 +904,11 @@ function nt(e) {
|
|
|
901
904
|
});
|
|
902
905
|
}
|
|
903
906
|
function Yt(e) {
|
|
904
|
-
return
|
|
907
|
+
return Q(nt(e));
|
|
905
908
|
}
|
|
906
909
|
const st = "readSalutation post /salutation", rt = function(s) {
|
|
907
910
|
const t = g(), n = E.list(s);
|
|
908
|
-
return
|
|
911
|
+
return P({
|
|
909
912
|
queryKey: n,
|
|
910
913
|
queryFn: async ({ signal: r }) => {
|
|
911
914
|
const a = p(s);
|
|
@@ -917,11 +920,11 @@ const st = "readSalutation post /salutation", rt = function(s) {
|
|
|
917
920
|
});
|
|
918
921
|
};
|
|
919
922
|
function Zt(e) {
|
|
920
|
-
return
|
|
923
|
+
return Q(rt(e));
|
|
921
924
|
}
|
|
922
925
|
const at = "readSeoUrl post /seo-url", ut = function(s) {
|
|
923
926
|
const t = g(), n = T.list(s);
|
|
924
|
-
return
|
|
927
|
+
return P({
|
|
925
928
|
queryKey: n,
|
|
926
929
|
queryFn: async ({ signal: r }) => {
|
|
927
930
|
const a = p(s);
|
|
@@ -933,38 +936,38 @@ const at = "readSeoUrl post /seo-url", ut = function(s) {
|
|
|
933
936
|
});
|
|
934
937
|
};
|
|
935
938
|
function _t(e) {
|
|
936
|
-
return
|
|
939
|
+
return Q(ut(e));
|
|
937
940
|
}
|
|
938
|
-
const
|
|
939
|
-
function
|
|
941
|
+
const it = "readShippingMethod post /shipping-method";
|
|
942
|
+
function ot(e) {
|
|
940
943
|
const s = g(), t = D.list(c(() => {
|
|
941
944
|
var n;
|
|
942
945
|
return (n = p(e)) == null ? void 0 : n.body;
|
|
943
946
|
}));
|
|
944
|
-
return
|
|
947
|
+
return P({
|
|
945
948
|
queryKey: t,
|
|
946
|
-
queryFn: ({ signal: n }) => s.query(
|
|
949
|
+
queryFn: ({ signal: n }) => s.query(it, {
|
|
947
950
|
...p(e),
|
|
948
951
|
signal: n
|
|
949
952
|
})
|
|
950
953
|
});
|
|
951
954
|
}
|
|
952
955
|
function ct(e) {
|
|
953
|
-
return
|
|
956
|
+
return Q(ot(e));
|
|
954
957
|
}
|
|
955
958
|
function en() {
|
|
956
959
|
const e = k(), s = $(), t = $e({
|
|
957
960
|
query: {
|
|
958
961
|
onlyAvailable: !0
|
|
959
962
|
}
|
|
960
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
961
|
-
paymentMethodId:
|
|
963
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
964
|
+
paymentMethodId: i
|
|
962
965
|
}), a = c(() => {
|
|
963
|
-
var
|
|
964
|
-
return (f = (
|
|
966
|
+
var i, f;
|
|
967
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.paymentMethod;
|
|
965
968
|
}), u = c(() => {
|
|
966
|
-
var
|
|
967
|
-
return ((
|
|
969
|
+
var i, f, S;
|
|
970
|
+
return ((S = (f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements) == null ? void 0 : S.sort((d, M) => (d.position ?? 0) - (M.position ?? 0))) ?? [];
|
|
968
971
|
});
|
|
969
972
|
return {
|
|
970
973
|
contextUpdateMutation: s,
|
|
@@ -981,14 +984,14 @@ function tn() {
|
|
|
981
984
|
query: {
|
|
982
985
|
onlyAvailable: !0
|
|
983
986
|
}
|
|
984
|
-
}), n = c(() => s.isPending.value), r = async (
|
|
985
|
-
shippingMethodId:
|
|
987
|
+
}), n = c(() => s.isPending.value), r = async (i) => s.mutateAsync({
|
|
988
|
+
shippingMethodId: i
|
|
986
989
|
}), a = c(() => {
|
|
987
|
-
var
|
|
988
|
-
return (f = (
|
|
990
|
+
var i, f;
|
|
991
|
+
return (f = (i = e.data) == null ? void 0 : i.value) == null ? void 0 : f.shippingMethod;
|
|
989
992
|
}), u = c(() => {
|
|
990
|
-
var
|
|
991
|
-
return ((f = (
|
|
993
|
+
var i, f;
|
|
994
|
+
return ((f = (i = t.data) == null ? void 0 : i.value) == null ? void 0 : f.elements.sort((S, d) => (S.position ?? 0) - (d.position ?? 0))) ?? [];
|
|
992
995
|
});
|
|
993
996
|
return {
|
|
994
997
|
contextUpdateMutation: s,
|
|
@@ -1015,7 +1018,7 @@ const lt = (e, s) => {
|
|
|
1015
1018
|
});
|
|
1016
1019
|
return (t, n) => {
|
|
1017
1020
|
const r = [n, ...s.value];
|
|
1018
|
-
return lt(
|
|
1021
|
+
return lt(o(t), o(r));
|
|
1019
1022
|
};
|
|
1020
1023
|
};
|
|
1021
1024
|
function sn(e) {
|
|
@@ -1024,36 +1027,36 @@ function sn(e) {
|
|
|
1024
1027
|
total: s ?? 0,
|
|
1025
1028
|
limit: t,
|
|
1026
1029
|
totalCountMode: r
|
|
1027
|
-
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))),
|
|
1030
|
+
}), u = c(() => a.limit === void 0 ? 1 : Math.max(1, Math.ceil(a.total / a.limit))), i = c({
|
|
1028
1031
|
get() {
|
|
1029
1032
|
return a.page;
|
|
1030
1033
|
},
|
|
1031
1034
|
set(O) {
|
|
1032
|
-
a.page = Math.max(1, Math.min(
|
|
1035
|
+
a.page = Math.max(1, Math.min(o(u), O));
|
|
1033
1036
|
}
|
|
1034
1037
|
});
|
|
1035
1038
|
H(
|
|
1036
|
-
[() =>
|
|
1039
|
+
[() => o(u), () => a],
|
|
1037
1040
|
([O, y]) => {
|
|
1038
1041
|
a.page = Math.min(O, a.page), a.total = y.total ?? 0, a.limit = y.limit;
|
|
1039
1042
|
}
|
|
1040
1043
|
);
|
|
1041
|
-
const f = c(() => a.page ===
|
|
1044
|
+
const f = c(() => a.page === o(u)), S = c(() => a.page === 1), d = c(() => ({
|
|
1042
1045
|
p: a.page,
|
|
1043
1046
|
limit: a.limit,
|
|
1044
1047
|
"total-count-mode": a.totalCountMode ?? "none"
|
|
1045
1048
|
})), M = (O) => {
|
|
1046
|
-
H(() =>
|
|
1049
|
+
H(() => o(O), (y) => {
|
|
1047
1050
|
y && (a.total = (y == null ? void 0 : y.total) ?? 0, a.limit = (y == null ? void 0 : y.limit) ?? 0);
|
|
1048
1051
|
});
|
|
1049
1052
|
};
|
|
1050
1053
|
return {
|
|
1051
|
-
page: i
|
|
1054
|
+
page: o(i),
|
|
1052
1055
|
total: W(a, "total"),
|
|
1053
1056
|
limit: W(a, "limit"),
|
|
1054
1057
|
pageCount: u,
|
|
1055
1058
|
isLastPage: f,
|
|
1056
|
-
isFirstPage:
|
|
1059
|
+
isFirstPage: S,
|
|
1057
1060
|
usePaginationSync: M,
|
|
1058
1061
|
// This can be used to pass the pagination options directly to the query options
|
|
1059
1062
|
queryOptions: d
|
|
@@ -1076,26 +1079,26 @@ function rn(e) {
|
|
|
1076
1079
|
return (y = e.value) == null ? void 0 : y.calculatedCheapestPrice;
|
|
1077
1080
|
}), t = c(
|
|
1078
1081
|
() => {
|
|
1079
|
-
var y,
|
|
1080
|
-
return (((
|
|
1082
|
+
var y, h, K, A, l;
|
|
1083
|
+
return (((h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.length) ?? 0) > 0 ? (A = (K = e.value) == null ? void 0 : K.calculatedPrices) == null ? void 0 : A[0] : (l = e.value) == null ? void 0 : l.calculatedPrice;
|
|
1081
1084
|
}
|
|
1082
1085
|
), n = c(() => {
|
|
1083
1086
|
var y;
|
|
1084
1087
|
return (y = t == null ? void 0 : t.value) == null ? void 0 : y.referencePrice;
|
|
1085
1088
|
}), r = c(() => {
|
|
1086
|
-
var y,
|
|
1087
|
-
return (((
|
|
1089
|
+
var y, h;
|
|
1090
|
+
return (((h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.length) ?? 0) > 1;
|
|
1088
1091
|
}), a = c(
|
|
1089
1092
|
() => {
|
|
1090
|
-
var y,
|
|
1091
|
-
return !!((y = e.value) != null && y.parentId) && ((K = (
|
|
1093
|
+
var y, h, K, A, l, m;
|
|
1094
|
+
return !!((y = e.value) != null && y.parentId) && ((K = (h = e.value) == null ? void 0 : h.calculatedCheapestPrice) == null ? void 0 : K.hasRange) && ((A = t == null ? void 0 : t.value) == null ? void 0 : A.unitPrice) !== ((l = s == null ? void 0 : s.value) == null ? void 0 : l.unitPrice) && ((m = s == null ? void 0 : s.value) == null ? void 0 : m.unitPrice);
|
|
1092
1095
|
}
|
|
1093
1096
|
), u = c(
|
|
1094
1097
|
() => {
|
|
1095
|
-
var y,
|
|
1096
|
-
return r.value && X(e.value).length > 1 ? (
|
|
1098
|
+
var y, h;
|
|
1099
|
+
return r.value && X(e.value).length > 1 ? (h = (y = e.value) == null ? void 0 : y.calculatedPrices) == null ? void 0 : h.reduce((K, A) => A.unitPrice < K.unitPrice ? A : K) : t.value;
|
|
1097
1100
|
}
|
|
1098
|
-
),
|
|
1101
|
+
), i = c(
|
|
1099
1102
|
() => {
|
|
1100
1103
|
var y;
|
|
1101
1104
|
return (y = u.value) == null ? void 0 : y.unitPrice;
|
|
@@ -1105,21 +1108,21 @@ function rn(e) {
|
|
|
1105
1108
|
var y;
|
|
1106
1109
|
return (y = u.value) == null ? void 0 : y.totalPrice;
|
|
1107
1110
|
}
|
|
1108
|
-
),
|
|
1111
|
+
), S = c(
|
|
1109
1112
|
() => u.value
|
|
1110
1113
|
), d = c(() => {
|
|
1111
|
-
var y,
|
|
1112
|
-
return !!((
|
|
1114
|
+
var y, h;
|
|
1115
|
+
return !!((h = (y = u.value) == null ? void 0 : y.listPrice) != null && h.percentage);
|
|
1113
1116
|
}), M = c(
|
|
1114
1117
|
() => {
|
|
1115
|
-
var y,
|
|
1116
|
-
return (K = (
|
|
1118
|
+
var y, h, K;
|
|
1119
|
+
return (K = (h = (y = e.value) == null ? void 0 : y.calculatedPrice) == null ? void 0 : h.regulationPrice) == null ? void 0 : K.price;
|
|
1117
1120
|
}
|
|
1118
1121
|
), O = c(() => X(e.value));
|
|
1119
1122
|
return {
|
|
1120
|
-
price:
|
|
1123
|
+
price: S,
|
|
1121
1124
|
totalPrice: f,
|
|
1122
|
-
unitPrice:
|
|
1125
|
+
unitPrice: i,
|
|
1123
1126
|
displayFromVariants: a,
|
|
1124
1127
|
displayFrom: r,
|
|
1125
1128
|
tierPrices: O,
|
|
@@ -1140,12 +1143,12 @@ function dt(e, s) {
|
|
|
1140
1143
|
});
|
|
1141
1144
|
}
|
|
1142
1145
|
function an(e, s) {
|
|
1143
|
-
return c(() => dt(
|
|
1146
|
+
return c(() => dt(o(e), o(s)));
|
|
1144
1147
|
}
|
|
1145
1148
|
function un(e) {
|
|
1146
1149
|
return c(() => {
|
|
1147
1150
|
var s, t, n, r, a, u;
|
|
1148
|
-
return !!((t = (s =
|
|
1151
|
+
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);
|
|
1149
1152
|
});
|
|
1150
1153
|
}
|
|
1151
1154
|
function on(e) {
|
|
@@ -1170,7 +1173,7 @@ function on(e) {
|
|
|
1170
1173
|
var d;
|
|
1171
1174
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddressId) || null;
|
|
1172
1175
|
}
|
|
1173
|
-
),
|
|
1176
|
+
), i = c(
|
|
1174
1177
|
() => {
|
|
1175
1178
|
var d;
|
|
1176
1179
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddressId) || null;
|
|
@@ -1180,7 +1183,7 @@ function on(e) {
|
|
|
1180
1183
|
var d;
|
|
1181
1184
|
return ((d = t.value) == null ? void 0 : d.defaultBillingAddress) || null;
|
|
1182
1185
|
}
|
|
1183
|
-
),
|
|
1186
|
+
), S = c(
|
|
1184
1187
|
() => {
|
|
1185
1188
|
var d;
|
|
1186
1189
|
return ((d = t.value) == null ? void 0 : d.defaultShippingAddress) || null;
|
|
@@ -1193,9 +1196,9 @@ function on(e) {
|
|
|
1193
1196
|
isCustomerSession: r,
|
|
1194
1197
|
isGuestSession: a,
|
|
1195
1198
|
defaultBillingAddressId: u,
|
|
1196
|
-
defaultShippingAddressId:
|
|
1199
|
+
defaultShippingAddressId: i,
|
|
1197
1200
|
userDefaultBillingAddress: f,
|
|
1198
|
-
userDefaultShippingAddress:
|
|
1201
|
+
userDefaultShippingAddress: S,
|
|
1199
1202
|
// Expose queries and mutations directly
|
|
1200
1203
|
customerQuery: s
|
|
1201
1204
|
};
|
|
@@ -1203,11 +1206,11 @@ function on(e) {
|
|
|
1203
1206
|
export {
|
|
1204
1207
|
ft as absolutizeSeoUrl,
|
|
1205
1208
|
R as addressKeys,
|
|
1206
|
-
|
|
1209
|
+
L as cartKeys,
|
|
1207
1210
|
B as categoryKeys,
|
|
1208
1211
|
F as contextKeys,
|
|
1209
1212
|
j as countryKeys,
|
|
1210
|
-
|
|
1213
|
+
I as customerKeys,
|
|
1211
1214
|
dt as getProductVariantForOptions,
|
|
1212
1215
|
ee as languageKey,
|
|
1213
1216
|
b as navigationKeys,
|
|
@@ -1215,7 +1218,7 @@ export {
|
|
|
1215
1218
|
N as paymentKeys,
|
|
1216
1219
|
w as productKeys,
|
|
1217
1220
|
je as readPaymentMethodOperation,
|
|
1218
|
-
|
|
1221
|
+
it as readShippingMethodOperation,
|
|
1219
1222
|
V as relativizeSeoUrl,
|
|
1220
1223
|
E as salutationKeys,
|
|
1221
1224
|
T as seoUrlKeys,
|
|
@@ -1226,7 +1229,7 @@ export {
|
|
|
1226
1229
|
Lt as useChangeEmailMutation,
|
|
1227
1230
|
Et as useChangePasswordMutation,
|
|
1228
1231
|
It as useChangeProfileMutation,
|
|
1229
|
-
|
|
1232
|
+
ht as useCheckoutAddresses,
|
|
1230
1233
|
St as useCreateCustomerAddressMutation,
|
|
1231
1234
|
wt as useCreateOrderMutation,
|
|
1232
1235
|
kt as useDefaultBillingAddressMutation,
|
|
@@ -1241,7 +1244,7 @@ export {
|
|
|
1241
1244
|
ne as useListAddressQueryOptions,
|
|
1242
1245
|
xt as useLoginCustomerMutation,
|
|
1243
1246
|
Ut as useLogoutCustomerMutation,
|
|
1244
|
-
|
|
1247
|
+
vt as useOptimistic,
|
|
1245
1248
|
qt as useOrderDetails,
|
|
1246
1249
|
Ct as useOrderPayment,
|
|
1247
1250
|
Gt as useOrderSetPaymentMutation,
|
|
@@ -1268,7 +1271,7 @@ export {
|
|
|
1268
1271
|
$t as useReadNavigationQuery,
|
|
1269
1272
|
Ee as useReadNavigationQueryOptions,
|
|
1270
1273
|
ce as useReadOrderQuery,
|
|
1271
|
-
|
|
1274
|
+
oe as useReadOrderQueryOptions,
|
|
1272
1275
|
$e as useReadPaymentMethodQuery,
|
|
1273
1276
|
Ve as useReadPaymentMethodQueryOptions,
|
|
1274
1277
|
Yt as useReadProductQuery,
|
|
@@ -1278,7 +1281,7 @@ export {
|
|
|
1278
1281
|
_t as useReadSeoUrlQuery,
|
|
1279
1282
|
ut as useReadSeoUrlQueryOptions,
|
|
1280
1283
|
ct as useReadShippingMethodQuery,
|
|
1281
|
-
|
|
1284
|
+
ot as useReadShippingMethodQueryOptions,
|
|
1282
1285
|
Vt as useRecoveryPasswordMutation,
|
|
1283
1286
|
Nt as useRegisterConfirmMutation,
|
|
1284
1287
|
bt as useRegisterCustomerMutation,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
2
1
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
|
|
2
|
+
import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
|
|
3
3
|
import { OperationOptions, OperationResponse } from '../types/query';
|
|
4
4
|
declare const handlePaymentOperation = "handlePaymentMethod post /handle-payment";
|
|
5
5
|
export declare function useHandlePaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof handlePaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof handlePaymentOperation>>): UseMutationReturnType<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset">>;
|
package/package.json
CHANGED
|
@@ -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 { contextKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, contextKeys } from '../../keys'
|
|
6
6
|
import type { OperationBody, OperationKey, OperationResponse } from '../types/query'
|
|
7
7
|
|
|
8
8
|
const updateContextOperation = 'updateContext patch /context' satisfies OperationKey
|
|
@@ -29,7 +29,10 @@ export function useUpdateContextMutation(
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
onSuccess: async (newContext, variables, context) => {
|
|
32
|
-
await
|
|
32
|
+
await Promise.all([
|
|
33
|
+
queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
|
|
34
|
+
queryClient.invalidateQueries({ queryKey: cartKeys.get() }),
|
|
35
|
+
])
|
|
33
36
|
|
|
34
37
|
await unref(unref(mutationOptions)?.onSuccess)?.(newContext, variables, context)
|
|
35
38
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useMutation, type UseMutationOptions } from '@tanstack/vue-query'
|
|
2
1
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
2
|
+
import { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/vue-query'
|
|
3
3
|
import { unref } from 'vue'
|
|
4
|
+
import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
|
|
4
5
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
6
|
import { unrefOptions } from '../../util/unrefOptions'
|
|
6
|
-
import
|
|
7
|
+
import { cartKeys } from '../../keys'
|
|
7
8
|
|
|
8
9
|
const handlePaymentOperation = 'handlePaymentMethod post /handle-payment' satisfies OperationKey
|
|
9
10
|
|
|
@@ -15,6 +16,7 @@ export function useHandlePaymentMutation(
|
|
|
15
16
|
>,
|
|
16
17
|
) {
|
|
17
18
|
const client = useShopwareQueryClient()
|
|
19
|
+
const queryClient = useQueryClient()
|
|
18
20
|
|
|
19
21
|
return useMutation({
|
|
20
22
|
...mutationOptions,
|
|
@@ -22,6 +24,8 @@ export function useHandlePaymentMutation(
|
|
|
22
24
|
return client.query(handlePaymentOperation, unrefOptions(options))
|
|
23
25
|
},
|
|
24
26
|
onSuccess: async (data, variables, context) => {
|
|
27
|
+
await queryClient.invalidateQueries({ queryKey: cartKeys.get() })
|
|
28
|
+
|
|
25
29
|
await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
|
|
26
30
|
},
|
|
27
31
|
})
|