@teamnovu/kit-shopware-composables 0.0.28 → 0.0.30
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,9 +1,11 @@
|
|
|
1
1
|
import { MaybeRef, ComputedRef } from 'vue';
|
|
2
|
+
import { OperationOptions } from '../../query';
|
|
2
3
|
import { BrandedSchema } from '../types/schema';
|
|
3
4
|
import { UseQueryReturnType } from '@tanstack/vue-query';
|
|
4
5
|
import { BrandedResponse } from '@teamnovu/kit-shopware-api-client';
|
|
5
6
|
import { Operations } from '../..';
|
|
6
|
-
|
|
7
|
+
type Criteria = OperationOptions<'readOrder post /order'>;
|
|
8
|
+
export declare function useOrderDetails(orderId: MaybeRef<string>, criteria?: Criteria): {
|
|
7
9
|
order: ComputedRef<BrandedSchema<"Order"> | undefined>;
|
|
8
10
|
status: ComputedRef<string | undefined>;
|
|
9
11
|
statusTechnicalName: ComputedRef<string | undefined>;
|
|
@@ -22,3 +24,4 @@ export declare function useOrderDetails(orderId: MaybeRef<string>, criteria?: Br
|
|
|
22
24
|
paymentChangeable: ComputedRef<boolean>;
|
|
23
25
|
orderQuery: UseQueryReturnType<BrandedResponse<Operations, "readOrder post /order">, Error>;
|
|
24
26
|
};
|
|
27
|
+
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject as Y, unref as i, computed as c, reactive as Z, watch as H, toRef as W } from "vue";
|
|
2
2
|
import { until as J } from "@vueuse/core";
|
|
3
|
-
import { queryOptions as 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() {
|
|
@@ -13,11 +13,11 @@ const w = {
|
|
|
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
|
}
|
|
@@ -200,7 +199,7 @@ 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 });
|
|
@@ -236,12 +235,12 @@ function ae(e) {
|
|
|
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
246
|
mutationFn: async (n) => (t.cancelQueries({ queryKey: w.all() }), s.query(ue, {
|
|
@@ -256,8 +255,8 @@ function $(e) {
|
|
|
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);
|
|
@@ -279,7 +278,7 @@ 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) => {
|
|
@@ -298,7 +297,7 @@ function Pt() {
|
|
|
298
297
|
activeBillingAddress: u,
|
|
299
298
|
activeShippingAddress: o,
|
|
300
299
|
inactiveBillingAddresses: f,
|
|
301
|
-
inactiveShippingAddresses:
|
|
300
|
+
inactiveShippingAddresses: P
|
|
302
301
|
};
|
|
303
302
|
}
|
|
304
303
|
const oe = "readOrder post /order";
|
|
@@ -318,7 +317,7 @@ function ie(e) {
|
|
|
318
317
|
function ce(e) {
|
|
319
318
|
return q(ie(e));
|
|
320
319
|
}
|
|
321
|
-
function
|
|
320
|
+
function Pt(e, s) {
|
|
322
321
|
const t = c(() => {
|
|
323
322
|
const l = i(e);
|
|
324
323
|
if (l)
|
|
@@ -350,7 +349,7 @@ function Qt(e, s) {
|
|
|
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(() => {
|
|
@@ -396,7 +395,7 @@ function Qt(e, s) {
|
|
|
396
395
|
status: u,
|
|
397
396
|
statusTechnicalName: o,
|
|
398
397
|
total: f,
|
|
399
|
-
subtotal:
|
|
398
|
+
subtotal: P,
|
|
400
399
|
shippingCosts: d,
|
|
401
400
|
shippingAddress: p,
|
|
402
401
|
billingAddress: O,
|
|
@@ -429,7 +428,7 @@ 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)),
|
|
@@ -441,7 +440,7 @@ function Ot(e) {
|
|
|
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)),
|
|
@@ -453,7 +452,7 @@ function Kt(e) {
|
|
|
453
452
|
}
|
|
454
453
|
const ye = "updateCustomerAddress patch /account/address/{addressId}";
|
|
455
454
|
function At(e) {
|
|
456
|
-
const s = g(), t =
|
|
455
|
+
const s = g(), t = Q();
|
|
457
456
|
return h({
|
|
458
457
|
...e,
|
|
459
458
|
mutationFn: async (n) => s.query(ye, y(n)),
|
|
@@ -464,7 +463,7 @@ function At(e) {
|
|
|
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
468
|
]), await ((f = i((o = i(e)) == null ? void 0 : o.onSuccess)) == null ? void 0 : f(n, r, a));
|
|
470
469
|
}
|
|
@@ -472,7 +471,7 @@ function At(e) {
|
|
|
472
471
|
}
|
|
473
472
|
const pe = "addLineItem post /checkout/cart/line-item";
|
|
474
473
|
function wt(e) {
|
|
475
|
-
const s = g(), t =
|
|
474
|
+
const s = g(), t = Q();
|
|
476
475
|
return h({
|
|
477
476
|
...e,
|
|
478
477
|
mutationFn: async (n) => s.query(pe, {
|
|
@@ -480,7 +479,7 @@ function wt(e) {
|
|
|
480
479
|
}),
|
|
481
480
|
onSuccess: async (n, r, a) => {
|
|
482
481
|
var u, o;
|
|
483
|
-
t.setQueryData(L.get(), n), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
482
|
+
t.setQueryData(L.get(), n), await t.invalidateQueries({ queryKey: b.lists() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
484
483
|
}
|
|
485
484
|
});
|
|
486
485
|
}
|
|
@@ -500,7 +499,7 @@ 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, {
|
|
@@ -514,7 +513,7 @@ function Ft(e) {
|
|
|
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, {
|
|
@@ -528,7 +527,7 @@ function Lt(e) {
|
|
|
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)),
|
|
@@ -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,14 +570,14 @@ 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
582
|
var u, o;
|
|
584
583
|
await t.invalidateQueries({ queryKey: I.all() }), await t.invalidateQueries({ queryKey: w.all() }), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
|
@@ -587,7 +586,7 @@ function Dt(e) {
|
|
|
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)),
|
|
@@ -602,7 +601,7 @@ function bt(e) {
|
|
|
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) => {
|
|
@@ -623,7 +622,7 @@ function kt(e) {
|
|
|
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)),
|
|
@@ -650,7 +649,7 @@ function Re(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)),
|
|
@@ -665,7 +664,7 @@ function Nt(e) {
|
|
|
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)),
|
|
@@ -680,7 +679,7 @@ function Tt(e) {
|
|
|
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)),
|
|
@@ -695,7 +694,7 @@ function Et(e) {
|
|
|
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)),
|
|
@@ -778,9 +777,9 @@ 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 o = i(s), f = i(t),
|
|
780
|
+
const o = i(s), f = i(t), P = y(n);
|
|
782
781
|
return r.query(Te, {
|
|
783
|
-
...
|
|
782
|
+
...P,
|
|
784
783
|
params: {
|
|
785
784
|
activeId: o,
|
|
786
785
|
rootId: f
|
|
@@ -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,7 +811,7 @@ 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)),
|
|
@@ -824,7 +823,7 @@ function Jt(e) {
|
|
|
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)),
|
|
@@ -835,7 +834,7 @@ function Xt(e) {
|
|
|
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, {
|
|
@@ -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,7 +1010,7 @@ 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
|
}
|
|
@@ -1021,8 +1020,8 @@ function un() {
|
|
|
1021
1020
|
var o, f;
|
|
1022
1021
|
return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.paymentMethod;
|
|
1023
1022
|
}), u = c(() => {
|
|
1024
|
-
var o, f,
|
|
1025
|
-
return ((
|
|
1023
|
+
var o, f, P;
|
|
1024
|
+
return ((P = (f = (o = t.data) == null ? void 0 : o.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,7 +1034,7 @@ 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
|
}
|
|
@@ -1046,7 +1045,7 @@ function on() {
|
|
|
1046
1045
|
return (f = (o = e.data) == null ? void 0 : o.value) == null ? void 0 : f.shippingMethod;
|
|
1047
1046
|
}), u = c(() => {
|
|
1048
1047
|
var o, f;
|
|
1049
|
-
return ((f = (o = t.data) == null ? void 0 : o.value) == null ? void 0 : f.elements.sort((
|
|
1048
|
+
return ((f = (o = t.data) == null ? void 0 : o.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,7 +1066,7 @@ 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
|
});
|
|
@@ -1096,7 +1095,7 @@ function ln(e) {
|
|
|
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 === i(u)),
|
|
1098
|
+
const f = c(() => a.page === i(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"
|
|
@@ -1111,7 +1110,7 @@ function ln(e) {
|
|
|
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
|
|
@@ -1163,7 +1162,7 @@ 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;
|
|
@@ -1175,7 +1174,7 @@ function dn(e) {
|
|
|
1175
1174
|
}
|
|
1176
1175
|
), O = c(() => X(e.value));
|
|
1177
1176
|
return {
|
|
1178
|
-
price:
|
|
1177
|
+
price: P,
|
|
1179
1178
|
totalPrice: f,
|
|
1180
1179
|
unitPrice: o,
|
|
1181
1180
|
displayFromVariants: a,
|
|
@@ -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;
|
|
@@ -1253,7 +1252,7 @@ function gn(e) {
|
|
|
1253
1252
|
defaultBillingAddressId: u,
|
|
1254
1253
|
defaultShippingAddressId: o,
|
|
1255
1254
|
userDefaultBillingAddress: f,
|
|
1256
|
-
userDefaultShippingAddress:
|
|
1255
|
+
userDefaultShippingAddress: P,
|
|
1257
1256
|
// Expose queries and mutations directly
|
|
1258
1257
|
customerQuery: s
|
|
1259
1258
|
};
|
|
@@ -1262,7 +1261,7 @@ export {
|
|
|
1262
1261
|
St as absolutizeSeoUrl,
|
|
1263
1262
|
F as addressKeys,
|
|
1264
1263
|
L as cartKeys,
|
|
1265
|
-
|
|
1264
|
+
B as categoryKeys,
|
|
1266
1265
|
w as contextKeys,
|
|
1267
1266
|
j as countryKeys,
|
|
1268
1267
|
I as customerKeys,
|
|
@@ -1270,21 +1269,21 @@ export {
|
|
|
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
|
wt 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,10 +1312,10 @@ 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,
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { MaybeRef } from 'vue'
|
|
2
2
|
import { computed, unref } from 'vue'
|
|
3
|
+
import type { OperationOptions } from '../../query'
|
|
3
4
|
import { useReadOrderQuery } from '../../query/order'
|
|
4
5
|
import type { BrandedSchema } from '../types/schema'
|
|
5
6
|
|
|
7
|
+
type Criteria = OperationOptions<'readOrder post /order'>
|
|
8
|
+
|
|
6
9
|
export function useOrderDetails(
|
|
7
10
|
orderId: MaybeRef<string>,
|
|
8
|
-
criteria?:
|
|
11
|
+
criteria?: Criteria,
|
|
9
12
|
) {
|
|
10
13
|
// Create reactive order query options
|
|
11
14
|
const orderQueryOptions = computed(() => {
|
|
@@ -23,8 +26,8 @@ export function useOrderDetails(
|
|
|
23
26
|
],
|
|
24
27
|
...criteria,
|
|
25
28
|
checkPromotion: true,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
29
|
+
},
|
|
30
|
+
} as Criteria
|
|
28
31
|
})
|
|
29
32
|
|
|
30
33
|
// Create order query
|
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, contextKeys, 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
|
},
|