@teamnovu/kit-shopware-composables 0.0.3 → 0.0.4

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.
Files changed (149) hide show
  1. package/api-types/storeApiSchema.localhost.http +1 -1
  2. package/dist/helpers/checkout/index.d.ts +5 -0
  3. package/dist/helpers/checkout/useAddresses.d.ts +210 -0
  4. package/dist/helpers/checkout/useOrderDetails.d.ts +186 -0
  5. package/dist/helpers/checkout/useOrderPayment.d.ts +73 -0
  6. package/dist/helpers/checkout/usePaymentMethods.d.ts +155 -0
  7. package/dist/helpers/checkout/useShippingMethods.d.ts +173 -0
  8. package/dist/helpers/general/index.d.ts +2 -0
  9. package/dist/{usePagination.d.ts → helpers/general/usePagination.d.ts} +1 -1
  10. package/dist/{general → helpers/general}/useSeoUrl.d.ts +1 -1
  11. package/dist/helpers/index.d.ts +4 -0
  12. package/dist/helpers/product/index.d.ts +2 -0
  13. package/dist/helpers/product/useProductPrice.d.ts +61 -0
  14. package/dist/{products → helpers/product}/useProductVariantForOptions.d.ts +1 -1
  15. package/dist/helpers/user/index.d.ts +2 -0
  16. package/dist/helpers/user/useIsLoggedIn.d.ts +2 -0
  17. package/dist/helpers/user/useUser.d.ts +167 -0
  18. package/dist/index.d.ts +3 -221
  19. package/dist/index.mjs +851 -222
  20. package/dist/inject.d.ts +2 -2
  21. package/dist/keys.d.ts +32 -0
  22. package/dist/query/address/index.d.ts +3 -0
  23. package/dist/query/address/useCreateCustomerAddressMutation.d.ts +166 -0
  24. package/dist/query/address/useDeleteCustomerAddressMutation.d.ts +5 -0
  25. package/dist/query/address/useListAddressQuery.d.ts +48 -0
  26. package/dist/query/cart/index.d.ts +4 -0
  27. package/dist/query/cart/useAddLineItemMutation.d.ts +131 -0
  28. package/dist/query/cart/useReadCartQuery.d.ts +108 -0
  29. package/dist/query/cart/useRemoveLineItemMutation.d.ts +136 -0
  30. package/dist/query/cart/useUpdateLineItemMutation.d.ts +131 -0
  31. package/dist/query/checkout/index.d.ts +2 -0
  32. package/dist/query/checkout/useCheckout.d.ts +1 -0
  33. package/dist/query/checkout/useCreateOrderMutation.d.ts +281 -0
  34. package/dist/query/context/index.d.ts +2 -0
  35. package/dist/query/context/useReadContextQuery.d.ts +153 -0
  36. package/dist/query/context/useUpdateContextMutation.d.ts +60 -0
  37. package/dist/query/customer/index.d.ts +6 -0
  38. package/dist/query/customer/useChangeEmailMutation.d.ts +15 -0
  39. package/dist/query/customer/useChangeProfileMutation.d.ts +15 -0
  40. package/dist/query/customer/useLoginCustomerMutation.d.ts +30 -0
  41. package/dist/query/customer/useLogoutCustomerMutation.d.ts +15 -0
  42. package/dist/query/customer/useReadCustomerQuery.d.ts +220 -0
  43. package/dist/query/customer/useRegisterCustomerMutation.d.ts +266 -0
  44. package/dist/query/index.d.ts +10 -0
  45. package/dist/query/order/index.d.ts +1 -0
  46. package/dist/query/order/useReadOrderQuery.d.ts +44 -0
  47. package/dist/query/payment/index.d.ts +3 -0
  48. package/dist/query/payment/useHandlePaymentMutation.d.ts +15 -0
  49. package/dist/query/payment/useOrderSetPaymentMutation.d.ts +15 -0
  50. package/dist/query/payment/useReadPaymentMethodQuery.d.ts +31 -0
  51. package/dist/query/products/index.d.ts +3 -0
  52. package/dist/query/products/useReadCategoryListQuery.d.ts +48 -0
  53. package/dist/query/products/useReadCompactProductListingQuery.d.ts +35 -0
  54. package/dist/query/products/useReadCustomProductDetailQuery.d.ts +67 -0
  55. package/dist/query/shipping/index.d.ts +1 -0
  56. package/dist/query/shipping/useReadShippingMethodQuery.d.ts +55 -0
  57. package/dist/query/types/index.d.ts +2 -0
  58. package/dist/query/types/operations.d.ts +5 -0
  59. package/dist/query/types/query.d.ts +17 -0
  60. package/dist/util/index.d.ts +3 -0
  61. package/dist/util/unrefOptions.d.ts +4 -0
  62. package/dist/util/useOptimistic.d.ts +12 -0
  63. package/docs/index.md +457 -0
  64. package/docs/info.json +3 -0
  65. package/package.json +5 -1
  66. package/src/helpers/checkout/index.ts +5 -0
  67. package/src/helpers/checkout/useAddresses.ts +57 -0
  68. package/src/helpers/checkout/useOrderDetails.ts +94 -0
  69. package/src/helpers/checkout/useOrderPayment.ts +28 -0
  70. package/src/helpers/checkout/usePaymentMethods.ts +35 -0
  71. package/src/helpers/checkout/useShippingMethods.ts +35 -0
  72. package/src/helpers/general/index.ts +2 -0
  73. package/src/helpers/index.ts +4 -0
  74. package/src/helpers/product/index.ts +2 -0
  75. package/src/{products → helpers/product}/useProductPrice.ts +1 -43
  76. package/src/helpers/user/index.ts +2 -0
  77. package/src/helpers/user/useIsLoggedIn.ts +10 -0
  78. package/src/helpers/user/useUser.ts +53 -0
  79. package/src/index.ts +4 -29
  80. package/src/inject.ts +3 -3
  81. package/src/keys.ts +57 -0
  82. package/src/query/address/index.ts +3 -0
  83. package/src/query/address/useCreateCustomerAddressMutation.ts +32 -0
  84. package/src/query/address/useDeleteCustomerAddressMutation.ts +32 -0
  85. package/src/query/address/useListAddressQuery.ts +29 -0
  86. package/src/query/cart/index.ts +4 -0
  87. package/src/query/cart/useAddLineItemMutation.ts +45 -0
  88. package/src/query/cart/useReadCartQuery.ts +28 -0
  89. package/src/query/cart/useRemoveLineItemMutation.ts +32 -0
  90. package/src/query/cart/useUpdateLineItemMutation.ts +45 -0
  91. package/src/query/checkout/index.ts +2 -0
  92. package/src/query/checkout/useCheckout.ts +2 -0
  93. package/src/query/checkout/useCreateOrderMutation.ts +35 -0
  94. package/src/query/context/index.ts +2 -0
  95. package/src/query/context/useReadContextQuery.ts +19 -0
  96. package/src/query/context/useUpdateContextMutation.ts +36 -0
  97. package/src/query/customer/index.ts +6 -0
  98. package/src/query/customer/useChangeEmailMutation.ts +32 -0
  99. package/src/query/customer/useChangeProfileMutation.ts +32 -0
  100. package/src/query/customer/useLoginCustomerMutation.ts +42 -0
  101. package/src/query/customer/useLogoutCustomerMutation.ts +32 -0
  102. package/src/query/customer/useReadCustomerQuery.ts +27 -0
  103. package/src/query/customer/useRegisterCustomerMutation.ts +32 -0
  104. package/src/query/index.ts +10 -0
  105. package/src/query/order/index.ts +1 -0
  106. package/src/query/order/useReadOrderQuery.ts +33 -0
  107. package/src/query/payment/index.ts +3 -0
  108. package/src/query/payment/useHandlePaymentMutation.ts +27 -0
  109. package/src/query/payment/useOrderSetPaymentMutation.ts +32 -0
  110. package/src/query/payment/useReadPaymentMethodQuery.ts +30 -0
  111. package/src/query/products/index.ts +3 -0
  112. package/src/query/products/useReadCategoryListQuery.ts +28 -0
  113. package/src/query/products/useReadCompactProductListingQuery.ts +41 -0
  114. package/src/query/products/useReadCustomProductDetailQuery.ts +41 -0
  115. package/src/query/shipping/index.ts +1 -0
  116. package/src/query/shipping/useReadShippingMethodQuery.ts +29 -0
  117. package/src/query/types/index.ts +2 -0
  118. package/src/query/types/operations.ts +6 -0
  119. package/src/query/types/query.ts +39 -0
  120. package/src/util/index.ts +3 -0
  121. package/src/util/unrefOptions.ts +19 -0
  122. package/src/util/useOptimistic.ts +49 -0
  123. package/tsconfig.json +5 -2
  124. package/dist/cart/useCartAddItemMutation.d.ts +0 -12
  125. package/dist/cart/useCartQueryOptions.d.ts +0 -9
  126. package/dist/cart/useCartRemoveItemMutation.d.ts +0 -7
  127. package/dist/cart/useCartUpdateItemMutation.d.ts +0 -12
  128. package/dist/context/useContextOptions.d.ts +0 -9
  129. package/dist/context/useContextUpdate.d.ts +0 -4
  130. package/dist/products/useCategoryQueryOptions.d.ts +0 -17
  131. package/dist/products/useProductListingQueryOptions.d.ts +0 -19
  132. package/dist/products/useProductListingQueryOptions.test.d.ts +0 -1
  133. package/dist/products/useProductPrice.d.ts +0 -49
  134. package/dist/products/useProductQueryOptions.d.ts +0 -19
  135. package/dist/types/query.d.ts +0 -7
  136. package/src/cart/useCartAddItemMutation.ts +0 -48
  137. package/src/cart/useCartQueryOptions.ts +0 -19
  138. package/src/cart/useCartRemoveItemMutation.ts +0 -32
  139. package/src/cart/useCartUpdateItemMutation.ts +0 -48
  140. package/src/context/useContextOptions.ts +0 -16
  141. package/src/context/useContextUpdate.ts +0 -16
  142. package/src/products/useCategoryQueryOptions.ts +0 -25
  143. package/src/products/useProductListingQueryOptions.test.ts +0 -24
  144. package/src/products/useProductListingQueryOptions.ts +0 -29
  145. package/src/products/useProductQueryOptions.ts +0 -29
  146. package/src/types/query.ts +0 -18
  147. /package/src/{usePagination.ts → helpers/general/usePagination.ts} +0 -0
  148. /package/src/{general → helpers/general}/useSeoUrl.ts +0 -0
  149. /package/src/{products → helpers/product}/useProductVariantForOptions.ts +0 -0
package/dist/index.mjs CHANGED
@@ -1,304 +1,933 @@
1
- var R = Object.defineProperty;
2
- var V = (e, t, r) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var g = (e, t, r) => V(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { useQueryClient as M, useMutation as h, queryOptions as v } from "@tanstack/vue-query";
5
- import { inject as $, unref as l, computed as o, reactive as z, watch as K, toRef as b } from "vue";
6
- const A = Symbol("shopwareClient");
7
- function P() {
8
- const e = $(A);
1
+ import { inject as H, unref as l, computed as i, reactive as W, watch as $, toRef as z } from "vue";
2
+ import { until as w } from "@vueuse/core";
3
+ import { queryOptions as A, useQuery as O, useQueryClient as P, useMutation as S } from "@tanstack/vue-query";
4
+ const J = Symbol("shopwareClient");
5
+ function g() {
6
+ const e = H(J);
9
7
  if (!e)
10
8
  throw new Error("Shopware client not provided!");
11
9
  return e;
12
10
  }
13
- const j = {
11
+ const U = {
14
12
  all: () => ["context"]
15
- }, Q = {
13
+ }, B = {
16
14
  all: () => ["category"],
17
- lists: () => [...Q.all(), "list"],
15
+ lists: () => [...B.all(), "list"],
18
16
  list: (e) => [
19
- ...Q.all(),
17
+ ...B.all(),
20
18
  "list",
21
19
  {
22
20
  body: e
23
21
  }
24
22
  ]
25
- }, m = {
23
+ }, L = {
26
24
  all: () => ["product"],
27
- lists: () => [...m.all(), "list"],
28
- list: (e, t) => [
29
- ...m.all(),
25
+ lists: () => [...L.all(), "list"],
26
+ list: (e, s) => [
27
+ ...L.all(),
30
28
  "list",
31
29
  {
32
30
  url: e,
33
- body: t
31
+ body: s
34
32
  }
35
33
  ],
36
- details: () => [...m.all(), "detail"],
37
- detail: (e, t) => [
38
- ...m.all(),
34
+ details: () => [...L.all(), "detail"],
35
+ detail: (e, s) => [
36
+ ...L.all(),
39
37
  "detail",
40
38
  {
41
39
  url: e,
42
- body: t
40
+ body: s
43
41
  }
44
42
  ]
45
- }, q = {
43
+ }, R = {
46
44
  get: () => ["cart"]
47
- }, E = "addLineItem post /checkout/cart/line-item";
48
- function O(e) {
49
- const t = P(), r = M();
50
- return h({
45
+ }, I = {
46
+ get: () => ["customer"]
47
+ }, b = {
48
+ all: () => ["address"],
49
+ lists: () => [...b.all(), "list"],
50
+ list: (e) => [
51
+ ...b.all(),
52
+ "list",
53
+ {
54
+ body: e
55
+ }
56
+ ]
57
+ }, E = {
58
+ all: () => ["shippingMethod"],
59
+ lists: () => [...E.all(), "list"],
60
+ list: (e) => [
61
+ ...E.all(),
62
+ "list",
63
+ {
64
+ body: e
65
+ }
66
+ ]
67
+ }, D = {
68
+ all: () => ["paymentMethod"],
69
+ lists: () => [...D.all(), "list"],
70
+ list: (e) => [
71
+ ...D.all(),
72
+ "list",
73
+ {
74
+ body: e
75
+ }
76
+ ]
77
+ }, x = {
78
+ all: () => ["order"],
79
+ lists: () => [...x.all(), "list"],
80
+ details: () => [...x.all(), "detail"],
81
+ detail: (e) => [
82
+ ...x.all(),
83
+ "detail",
84
+ {
85
+ body: e
86
+ }
87
+ ]
88
+ };
89
+ function h(e) {
90
+ const s = l(e);
91
+ return Object.fromEntries(
92
+ Object.entries(s ?? {}).map(
93
+ ([n, t]) => [n, l(t)]
94
+ )
95
+ );
96
+ }
97
+ const X = "listAddress post /account/list-address";
98
+ function Y(e) {
99
+ const s = g(), n = b.list(i(() => {
100
+ var t;
101
+ return (t = h(e)) == null ? void 0 : t.body;
102
+ }));
103
+ return A({
104
+ queryKey: n,
105
+ queryFn: ({ signal: t }) => s.query(X, {
106
+ ...h(e),
107
+ signal: t
108
+ })
109
+ });
110
+ }
111
+ function Z(e) {
112
+ return O(Y(e));
113
+ }
114
+ const _ = "readContext get /context";
115
+ function ee() {
116
+ const e = g();
117
+ return A({
118
+ queryKey: U.all(),
119
+ queryFn: ({ signal: s }) => e.query(_, { signal: s })
120
+ });
121
+ }
122
+ function k() {
123
+ return O(ee());
124
+ }
125
+ const te = "updateContext patch /context";
126
+ function N(e) {
127
+ const s = g(), n = P();
128
+ return S({
51
129
  ...e,
52
- mutationFn: async (c) => t.query(E, {
53
- body: c
130
+ mutationFn: async (t) => (n.cancelQueries({ queryKey: U.all() }), s.query(te, {
131
+ body: t
132
+ })),
133
+ onSuccess: (t, r, u) => {
134
+ var o, a;
135
+ n.invalidateQueries({ queryKey: U.all() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
136
+ }
137
+ });
138
+ }
139
+ function Te() {
140
+ const e = N(), s = k(), n = Z(), t = i(() => s.isFetching.value || e.isPending.value), r = async (d) => {
141
+ await e.mutateAsync({
142
+ billingAddressId: d.id
143
+ }), await w(t).toBe(!1);
144
+ }, u = async (d) => {
145
+ await e.mutateAsync({
146
+ shippingAddressId: d.id
147
+ }), await w(t).toBe(!1);
148
+ }, o = i(() => {
149
+ var d, v;
150
+ return (v = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : v.activeBillingAddress;
151
+ }), a = i(() => {
152
+ var d, v;
153
+ return (v = (d = s.data.value) == null ? void 0 : d.customer) == null ? void 0 : v.activeShippingAddress;
154
+ }), p = i(() => {
155
+ var d;
156
+ return ((d = n.data.value) == null ? void 0 : d.elements.filter(
157
+ (v) => {
158
+ var f;
159
+ return v.id !== ((f = o.value) == null ? void 0 : f.id);
160
+ }
161
+ )) ?? [];
162
+ }), F = i(() => {
163
+ var d;
164
+ return ((d = n.data.value) == null ? void 0 : d.elements.filter(
165
+ (v) => {
166
+ var f;
167
+ return v.id !== ((f = o.value) == null ? void 0 : f.id);
168
+ }
169
+ )) ?? [];
170
+ });
171
+ return {
172
+ contextUpdateMutation: e,
173
+ contextQuery: s,
174
+ addressListQuery: n,
175
+ setBillingAddress: r,
176
+ setShippingAddress: u,
177
+ isSaving: t,
178
+ activeBillingAddress: o,
179
+ activeShippingAddress: a,
180
+ inactiveBillingAddresses: p,
181
+ inactiveShippingAddresses: F
182
+ };
183
+ }
184
+ const ne = "readOrder post /order";
185
+ function se(e) {
186
+ const s = g(), n = x.detail(e);
187
+ return A({
188
+ queryKey: n,
189
+ queryFn: async ({ signal: t }) => {
190
+ const r = h(e);
191
+ return s.query(ne, {
192
+ ...r,
193
+ signal: t
194
+ });
195
+ },
196
+ enabled: !!e
197
+ });
198
+ }
199
+ function re(e) {
200
+ return O(se(e));
201
+ }
202
+ function je(e, s) {
203
+ const n = i(() => {
204
+ const c = l(e);
205
+ if (c)
206
+ return {
207
+ body: {
208
+ filter: [
209
+ {
210
+ type: "equals",
211
+ field: "id",
212
+ value: c
213
+ }
214
+ ],
215
+ ...s,
216
+ checkPromotion: !0
217
+ }
218
+ };
219
+ }), t = re(n.value), r = i(() => {
220
+ var c, y, q, K;
221
+ return (K = (q = (y = (c = t.data) == null ? void 0 : c.value) == null ? void 0 : y.orders) == null ? void 0 : q.elements) == null ? void 0 : K[0];
222
+ }), u = i(() => {
223
+ var c, y;
224
+ return ((y = (c = t.data) == null ? void 0 : c.value) == null ? void 0 : y.paymentChangeable) || {};
225
+ }), o = i(() => {
226
+ var c, y, q;
227
+ return (q = (y = (c = r.value) == null ? void 0 : c.stateMachineState) == null ? void 0 : y.translated) == null ? void 0 : q.name;
228
+ }), a = i(() => {
229
+ var c, y;
230
+ return (y = (c = r.value) == null ? void 0 : c.stateMachineState) == null ? void 0 : y.technicalName;
231
+ }), p = i(() => {
232
+ var c, y;
233
+ return (y = (c = r.value) == null ? void 0 : c.price) == null ? void 0 : y.totalPrice;
234
+ }), F = i(() => {
235
+ var c, y;
236
+ return (y = (c = r.value) == null ? void 0 : c.price) == null ? void 0 : y.positionPrice;
237
+ }), d = i(() => {
238
+ var c;
239
+ return (c = r.value) == null ? void 0 : c.shippingTotal;
240
+ }), v = i(() => {
241
+ var c, y, q, K, j, V;
242
+ return {
243
+ email: (y = (c = r.value) == null ? void 0 : c.orderCustomer) == null ? void 0 : y.email,
244
+ firstName: (K = (q = r.value) == null ? void 0 : q.orderCustomer) == null ? void 0 : K.firstName,
245
+ lastName: (V = (j = r.value) == null ? void 0 : j.orderCustomer) == null ? void 0 : V.lastName
246
+ };
247
+ }), f = i(() => {
248
+ var c, y;
249
+ return (y = (c = r.value) == null ? void 0 : c.addresses) == null ? void 0 : y.find(
250
+ ({ id: q }) => {
251
+ var K;
252
+ return q === ((K = r.value) == null ? void 0 : K.billingAddressId);
253
+ }
254
+ );
255
+ }), m = i(
256
+ () => {
257
+ var c, y, q;
258
+ return (q = (y = (c = r.value) == null ? void 0 : c.deliveries) == null ? void 0 : y[0]) == null ? void 0 : q.shippingOrderAddress;
259
+ }
260
+ ), C = i(() => {
261
+ var y, q;
262
+ const c = (y = r.value) == null ? void 0 : y.transactions;
263
+ if (c != null && c.length)
264
+ return (q = c.at(-1)) == null ? void 0 : q.paymentMethod;
265
+ }), M = i(() => {
266
+ var y, q;
267
+ const c = (y = r.value) == null ? void 0 : y.deliveries;
268
+ if (c != null && c.length)
269
+ return (q = c.at(-1)) == null ? void 0 : q.shippingMethod;
270
+ }), Q = i(() => {
271
+ var y;
272
+ const c = l(e);
273
+ return ((y = u.value) == null ? void 0 : y[c]) ?? !1;
274
+ });
275
+ return {
276
+ order: r,
277
+ status: o,
278
+ statusTechnicalName: a,
279
+ total: p,
280
+ subtotal: F,
281
+ shippingCosts: d,
282
+ shippingAddress: m,
283
+ billingAddress: f,
284
+ personalDetails: v,
285
+ shippingMethod: M,
286
+ paymentMethod: C,
287
+ paymentChangeable: Q,
288
+ orderQuery: t,
289
+ orderSetPaymentMutation
290
+ };
291
+ }
292
+ function Ve(e) {
293
+ const s = i(() => {
294
+ var u, o;
295
+ return (o = (u = l(e)) == null ? void 0 : u.transactions) == null ? void 0 : o.find((a) => {
296
+ var p;
297
+ return ((p = a.paymentMethod) == null ? void 0 : p.active) === !0;
298
+ });
299
+ }), n = i(() => {
300
+ var u;
301
+ return (u = s.value) == null ? void 0 : u.paymentMethod;
302
+ }), t = i(() => {
303
+ var u;
304
+ return (u = s.value) == null ? void 0 : u.stateMachineState;
305
+ });
306
+ return {
307
+ isAsynchronous: i(
308
+ () => {
309
+ var u, o, a, p;
310
+ return (
311
+ // @ts-expect-error - This property does not seem to be declared in the typescript types
312
+ ((o = (u = s.value) == null ? void 0 : u.paymentMethod) == null ? void 0 : o.asynchronous) && ((p = (a = s.value) == null ? void 0 : a.paymentMethod) == null ? void 0 : p.afterOrderEnabled)
313
+ );
314
+ }
315
+ ),
316
+ activeTransaction: s,
317
+ state: t,
318
+ paymentMethod: n
319
+ };
320
+ }
321
+ const ue = "createCustomerAddress post /account/address";
322
+ function $e(e) {
323
+ const s = g(), n = P();
324
+ return S({
325
+ ...e,
326
+ mutationFn: async (t) => s.query(ue, h(t)),
327
+ onSuccess: (t, r, u) => {
328
+ var o, a;
329
+ n.invalidateQueries({ queryKey: b.lists() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
330
+ }
331
+ });
332
+ }
333
+ const oe = "deleteCustomerAddress delete /account/address/{addressId}";
334
+ function ze(e) {
335
+ const s = g(), n = P();
336
+ return S({
337
+ ...e,
338
+ mutationFn: async (t) => s.query(oe, h(t)),
339
+ onSuccess: (t, r, u) => {
340
+ var o, a;
341
+ n.invalidateQueries({ queryKey: b.lists() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
342
+ }
343
+ });
344
+ }
345
+ const ae = "addLineItem post /checkout/cart/line-item";
346
+ function we(e) {
347
+ const s = g(), n = P();
348
+ return S({
349
+ ...e,
350
+ mutationFn: async (t) => s.query(ae, {
351
+ body: t
54
352
  }),
55
- onSuccess: (c, n, u) => {
56
- var a;
57
- r.setQueryData(q.get(), c), (a = e.onSuccess) == null || a.call(e, c, n, u);
353
+ onSuccess: (t, r, u) => {
354
+ var o;
355
+ n.setQueryData(R.get(), t), (o = l(l(e).onSuccess)) == null || o(t, r, u);
58
356
  }
59
357
  });
60
358
  }
61
- const T = "readCart get /checkout/cart";
62
- function W() {
63
- const e = P(), t = q.get();
64
- return v({
65
- queryKey: t,
66
- queryFn: async () => e.query(T)
359
+ const T = (e) => {
360
+ const s = e.replace(/\/?$/, "");
361
+ return s.startsWith("/") ? s.slice(1) : s;
362
+ }, Ge = (e) => `/${T(e)}`;
363
+ function He(e, s, n) {
364
+ const t = P();
365
+ return {
366
+ onMutate: async (r) => {
367
+ await t.cancelQueries({ queryKey: e });
368
+ const u = t.getQueryData(e);
369
+ if (t.setQueryData(e, (o) => s(r, o)), n) {
370
+ const o = l(n), a = l(o.onMutate);
371
+ a == null || a(r);
372
+ }
373
+ return { previousValue: u };
374
+ },
375
+ onError: (r, u, o) => {
376
+ if (o && t.setQueryData(e, o.previousValue), n) {
377
+ const a = l(n), p = l(a.onError);
378
+ p == null || p(r, u, o);
379
+ }
380
+ },
381
+ onSettled: (...r) => {
382
+ if (t.invalidateQueries({ queryKey: e }), n) {
383
+ const u = l(n), o = l(u.onSettled);
384
+ o == null || o(...r);
385
+ }
386
+ }
387
+ };
388
+ }
389
+ const ie = "readCart get /checkout/cart";
390
+ function ce(e) {
391
+ const s = g(), n = R.get();
392
+ return A({
393
+ queryKey: n,
394
+ queryFn: async ({ signal: t }) => s.query(ie, {
395
+ ...h(e),
396
+ signal: t
397
+ })
67
398
  });
68
399
  }
69
- const B = "removeLineItem post /checkout/cart/line-item/delete";
70
- function G(e) {
71
- const t = P(), r = M();
72
- return h({
400
+ function We() {
401
+ return O(ce());
402
+ }
403
+ const le = "removeLineItem post /checkout/cart/line-item/delete";
404
+ function Je(e) {
405
+ const s = g(), n = P();
406
+ return S({
73
407
  ...e,
74
- mutationFn: async (c) => t.query(B, {
75
- body: c
408
+ mutationFn: async (t) => s.query(le, {
409
+ body: t
76
410
  }),
77
- onSuccess: (c, n, u) => {
78
- var a;
79
- r.setQueryData(q.get(), c), (a = e == null ? void 0 : e.onSuccess) == null || a.call(e, c, n, u);
411
+ onSuccess: (t, r, u) => {
412
+ var o, a;
413
+ n.setQueryData(R.get(), t), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
80
414
  }
81
415
  });
82
416
  }
83
- const H = "updateLineItem patch /checkout/cart/line-item";
84
- function J(e) {
85
- const t = P(), r = M();
86
- return h({
417
+ const de = "updateLineItem patch /checkout/cart/line-item";
418
+ function Xe(e) {
419
+ const s = g(), n = P();
420
+ return S({
87
421
  ...e,
88
- mutationFn: async (c) => t.query(H, {
89
- body: c
422
+ mutationFn: async (t) => s.query(de, {
423
+ body: t
90
424
  }),
91
- onSuccess: (c, n, u) => {
92
- var a;
93
- r.setQueryData(q.get(), c), (a = e == null ? void 0 : e.onSuccess) == null || a.call(e, c, n, u);
425
+ onSuccess: (t, r, u) => {
426
+ var o, a;
427
+ n.setQueryData(R.get(), t), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
94
428
  }
95
429
  });
96
430
  }
97
- const N = "readContext get /context";
98
- function X() {
99
- const e = P();
100
- return v({
101
- queryKey: j.all(),
102
- queryFn: () => e.query(N)
431
+ const Ye = () => {
432
+ }, ye = "createOrder post /checkout/order";
433
+ function Ze(e) {
434
+ const s = g(), n = P();
435
+ return S({
436
+ ...e,
437
+ mutationFn: async (t) => s.query(ye, h(t)),
438
+ onSuccess: (t, r, u) => {
439
+ var o, a;
440
+ n.invalidateQueries({ queryKey: R.get() }), n.invalidateQueries({ queryKey: x.lists() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
441
+ }
103
442
  });
104
443
  }
105
- const Y = "updateContext patch /context";
106
- function Z() {
107
- const e = P();
108
- return h({
109
- mutationFn: async () => e.query(Y)
444
+ const pe = "changeEmail post /account/change-email";
445
+ function _e(e) {
446
+ const s = g(), n = P();
447
+ return S({
448
+ ...e,
449
+ mutationFn: async (t) => s.query(pe, h(t)),
450
+ onSuccess: (t, r, u) => {
451
+ var o, a;
452
+ n.invalidateQueries({ queryKey: I.get() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
453
+ }
454
+ });
455
+ }
456
+ const me = "changeProfile post /account/change-profile";
457
+ function et(e) {
458
+ const s = g(), n = P();
459
+ return S({
460
+ ...e,
461
+ mutationFn: async (t) => s.query(me, h(t)),
462
+ onSuccess: (t, r, u) => {
463
+ var o, a;
464
+ n.invalidateQueries({ queryKey: I.get() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
465
+ }
110
466
  });
111
467
  }
112
- const D = "readCategoryList post /category";
113
- function w(e) {
114
- const t = P(), r = Q.list(e);
115
- return v({
116
- queryKey: r,
117
- queryFn: async () => t.query(D, {
118
- body: l(e)
468
+ const ge = "loginCustomer post /account/login";
469
+ function tt(e) {
470
+ const s = g(), n = P();
471
+ return S({
472
+ ...e,
473
+ mutationFn: async (t) => {
474
+ const r = await s.queryRaw(ge, {
475
+ body: t
476
+ }), u = r.headers.get("sw-context-token");
477
+ return u && s.setContextToken(u), r.json();
478
+ },
479
+ onSuccess: (t, r, u) => {
480
+ var o, a;
481
+ n.invalidateQueries({ queryKey: U.all() }), n.invalidateQueries({ queryKey: R.get() }), n.invalidateQueries({ queryKey: I.get() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
482
+ }
483
+ });
484
+ }
485
+ const he = "logoutCustomer post /account/logout";
486
+ function nt(e) {
487
+ const s = g(), n = P();
488
+ return S({
489
+ ...e,
490
+ mutationFn: async (t) => s.query(he, h(t)),
491
+ onSuccess: (t, r, u) => {
492
+ var o, a;
493
+ n.removeQueries({ queryKey: I.get() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
494
+ }
495
+ });
496
+ }
497
+ const ve = "readCustomer post /account/customer";
498
+ function fe(e) {
499
+ const s = g(), n = I.get();
500
+ return A({
501
+ queryKey: n,
502
+ queryFn: async () => s.query(ve, h(e))
503
+ });
504
+ }
505
+ function Ce(e) {
506
+ return O(fe(e));
507
+ }
508
+ const qe = "register post /account/register";
509
+ function st(e) {
510
+ const s = g(), n = P();
511
+ return S({
512
+ ...e,
513
+ mutationFn: async (t) => s.query(qe, h(t)),
514
+ onSuccess: (t, r, u) => {
515
+ var o, a;
516
+ n.invalidateQueries({ queryKey: I.get() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
517
+ }
518
+ });
519
+ }
520
+ const Pe = "readPaymentMethod post /payment-method";
521
+ function Se(e) {
522
+ const s = g(), n = D.list(i(() => {
523
+ var t;
524
+ return (t = h(e)) == null ? void 0 : t.body;
525
+ }));
526
+ return A({
527
+ queryKey: n,
528
+ queryFn: ({ signal: t }) => s.query(Pe, {
529
+ ...h(e),
530
+ signal: t
119
531
  })
120
532
  });
121
533
  }
122
- const L = (e) => {
123
- const t = e.replace(/\/?$/, "");
124
- return t.startsWith("/") ? t.slice(1) : t;
125
- }, ie = (e) => `/${L(e)}`, _ = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
126
- function ee(e, t) {
127
- const r = P(), c = m.list(e, t);
128
- return v({
129
- queryKey: c,
130
- queryFn: async () => r.query(_, {
131
- params: { seoUrl: L(l(e)) },
132
- body: l(t)
534
+ function Me(e) {
535
+ return O(Se(e));
536
+ }
537
+ const Qe = "handlePaymentMethod post /handle-payment";
538
+ function rt(e) {
539
+ const s = g();
540
+ return S({
541
+ ...e,
542
+ mutationFn: async (n) => s.query(Qe, h(n)),
543
+ onSuccess: (n, t, r) => {
544
+ var u, o;
545
+ (o = l((u = l(e)) == null ? void 0 : u.onSuccess)) == null || o(n, t, r);
546
+ }
547
+ });
548
+ }
549
+ const Ae = "orderSetPayment post /order/payment";
550
+ function ut(e) {
551
+ const s = g(), n = P();
552
+ return S({
553
+ ...e,
554
+ mutationFn: async (t) => s.query(Ae, h(t)),
555
+ onSuccess: (t, r, u) => {
556
+ var o, a;
557
+ n.invalidateQueries({ queryKey: x.all() }), (a = l((o = l(e)) == null ? void 0 : o.onSuccess)) == null || a(t, r, u);
558
+ }
559
+ });
560
+ }
561
+ const Oe = "readCategoryList post /category", Fe = function(s) {
562
+ const n = g(), t = B.list(s);
563
+ return A({
564
+ queryKey: t,
565
+ queryFn: async ({ signal: r }) => n.query(Oe, {
566
+ ...h(s),
567
+ signal: r
133
568
  })
134
569
  });
570
+ };
571
+ function ot(e) {
572
+ return O(Fe(e));
573
+ }
574
+ const Ke = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
575
+ function Le(e, s) {
576
+ const n = g(), t = L.list(e, s);
577
+ return A({
578
+ queryKey: t,
579
+ queryFn: async ({ signal: r }) => {
580
+ const u = h(s);
581
+ return n.query(Ke, {
582
+ ...u,
583
+ params: {
584
+ ...u.params,
585
+ seoUrl: T(l(e))
586
+ },
587
+ signal: r
588
+ });
589
+ }
590
+ });
591
+ }
592
+ function at(e, s) {
593
+ return O(Le(e, s));
594
+ }
595
+ const xe = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
596
+ function Re(e, s) {
597
+ const n = g(), t = L.detail(e, s);
598
+ return A({
599
+ queryKey: t,
600
+ queryFn: async ({ signal: r }) => {
601
+ const u = h(s);
602
+ return n.query(xe, {
603
+ ...u,
604
+ params: {
605
+ ...u.params,
606
+ seoUrl: T(l(e))
607
+ },
608
+ signal: r
609
+ });
610
+ }
611
+ });
135
612
  }
136
- const te = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
137
- function re(e, t) {
138
- const r = P(), c = m.detail(e, t);
139
- return v({
140
- queryKey: c,
141
- queryFn: async () => r.query(te, {
142
- params: { seoUrl: L(l(e)) },
143
- body: l(t)
613
+ function it(e, s) {
614
+ return O(Re(e, s));
615
+ }
616
+ const Ie = "readShippingMethod post /shipping-method";
617
+ function be(e) {
618
+ const s = g(), n = E.list(i(() => {
619
+ var t;
620
+ return (t = h(e)) == null ? void 0 : t.body;
621
+ }));
622
+ return A({
623
+ queryKey: n,
624
+ queryFn: ({ signal: t }) => s.query(Ie, {
625
+ ...h(e),
626
+ signal: t
144
627
  })
145
628
  });
146
629
  }
147
- function ne(e, t) {
148
- var c;
149
- const r = (c = e.extensions) == null ? void 0 : c.variants;
150
- return t.length === 0 ? (r == null ? void 0 : r.find((n) => {
151
- var u;
152
- return ((u = n.optionIds) == null ? void 0 : u.length) === 0;
153
- })) ?? (r == null ? void 0 : r[0]) : r == null ? void 0 : r.find((n) => {
154
- var u;
155
- return (u = n.optionIds) == null ? void 0 : u.every((a) => t.includes(a));
630
+ function Ue(e) {
631
+ return O(be(e));
632
+ }
633
+ function ct() {
634
+ const e = k(), s = N(), n = Me({
635
+ query: {
636
+ onlyActive: !0
637
+ }
638
+ }), t = i(() => s.isPending.value), r = async (a) => s.mutateAsync({
639
+ paymentMethodId: a
640
+ }), u = i(() => {
641
+ var a, p;
642
+ return (p = (a = e.data) == null ? void 0 : a.value) == null ? void 0 : p.paymentMethod;
643
+ }), o = i(() => {
644
+ var a, p;
645
+ return (p = (a = n.data) == null ? void 0 : a.value) == null ? void 0 : p.elements;
646
+ });
647
+ return {
648
+ contextUpdateMutation: s,
649
+ contextQuery: e,
650
+ paymentMethodsQuery: n,
651
+ activePaymentMethod: u,
652
+ setPaymentMethod: r,
653
+ isSaving: t,
654
+ paymentMethods: o
655
+ };
656
+ }
657
+ function lt() {
658
+ const e = k(), s = N(), n = Ue({
659
+ query: {
660
+ onlyActive: !0
661
+ }
662
+ }), t = i(() => s.isPending.value), r = async (a) => s.mutateAsync({
663
+ shippingMethodId: a
664
+ }), u = i(() => {
665
+ var a, p;
666
+ return (p = (a = e.data) == null ? void 0 : a.value) == null ? void 0 : p.shippingMethod;
667
+ }), o = i(() => {
668
+ var a, p;
669
+ return (p = (a = n.data) == null ? void 0 : a.value) == null ? void 0 : p.elements;
156
670
  });
671
+ return {
672
+ contextUpdateMutation: s,
673
+ contextQuery: e,
674
+ shippingMethodsQuery: n,
675
+ activeShippingMethod: u,
676
+ setShippingMethod: r,
677
+ isSaving: t,
678
+ shippingMethods: o
679
+ };
157
680
  }
158
- function ce(e, t) {
159
- return o(() => ne(l(e), l(t)));
681
+ const ke = (e, s) => {
682
+ var t;
683
+ const n = (t = e.extensions) == null ? void 0 : t.novuSeoUrls;
684
+ return (n == null ? void 0 : n[s]) ?? "";
685
+ }, dt = (e, s) => i(() => ke(l(e), l(s)));
686
+ function yt(e) {
687
+ const { total: s, limit: n, page: t } = e ?? {}, r = W({
688
+ page: t ?? 1,
689
+ total: s ?? 0,
690
+ limit: n
691
+ }), u = i(() => r.limit === void 0 ? 1 : Math.max(1, Math.ceil(r.total / r.limit))), o = i({
692
+ get() {
693
+ return r.page;
694
+ },
695
+ set(v) {
696
+ r.page = Math.max(1, Math.min(l(u), v));
697
+ }
698
+ });
699
+ $(
700
+ [() => l(u), () => r],
701
+ ([v, f]) => {
702
+ r.page = Math.min(v, r.page), r.total = f.total ?? 0, r.limit = f.limit;
703
+ }
704
+ );
705
+ const a = i(() => r.page === l(u)), p = i(() => r.page === 1), F = i(() => ({
706
+ p: r.page,
707
+ limit: r.limit
708
+ })), d = (v) => {
709
+ $(() => l(v), (f) => {
710
+ r.total = (f == null ? void 0 : f.total) ?? 0, r.limit = (f == null ? void 0 : f.limit) ?? 0;
711
+ });
712
+ };
713
+ return {
714
+ page: l(o),
715
+ total: z(r, "total"),
716
+ limit: z(r, "limit"),
717
+ pageCount: u,
718
+ isLastPage: a,
719
+ isFirstPage: p,
720
+ usePaginationSync: d,
721
+ // This can be used to pass the pagination options directly to the query options
722
+ queryOptions: F
723
+ };
160
724
  }
161
- const se = (e, t) => {
162
- var c;
163
- const r = (c = e.extensions) == null ? void 0 : c.novuSeoUrls;
164
- return (r == null ? void 0 : r[t]) ?? "";
165
- }, le = (e, t) => o(() => se(l(e), l(t)));
166
- function k(e) {
167
- var r;
168
- if (!e || !((r = e.calculatedPrices) != null && r.length))
725
+ function G(e) {
726
+ var n;
727
+ if (!e || !((n = e.calculatedPrices) != null && n.length))
169
728
  return [];
170
- const t = e.calculatedPrices.length;
171
- return e.calculatedPrices.map(({ unitPrice: c, quantity: n }, u) => ({
172
- label: u === t - 1 ? `from ${n}` : `to ${n}`,
173
- quantity: n,
174
- unitPrice: c
729
+ const s = e.calculatedPrices.length;
730
+ return e.calculatedPrices.map(({ unitPrice: t, quantity: r }, u) => ({
731
+ label: u === s - 1 ? `from ${r}` : `to ${r}`,
732
+ quantity: r,
733
+ unitPrice: t
175
734
  }));
176
735
  }
177
- function ye(e) {
178
- const t = o(() => {
179
- var s;
180
- return (s = e.value) == null ? void 0 : s.calculatedCheapestPrice;
181
- }), r = o(
736
+ function pt(e) {
737
+ const s = i(() => {
738
+ var m;
739
+ return (m = e.value) == null ? void 0 : m.calculatedCheapestPrice;
740
+ }), n = i(
182
741
  () => {
183
- var s, i, d, p, f;
184
- return (((i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.length) ?? 0) > 0 ? (p = (d = e.value) == null ? void 0 : d.calculatedPrices) == null ? void 0 : p[0] : (f = e.value) == null ? void 0 : f.calculatedPrice;
185
- }
186
- ), c = o(() => {
187
- var s;
188
- return (s = r == null ? void 0 : r.value) == null ? void 0 : s.referencePrice;
189
- }), n = o(() => {
190
- var s, i;
191
- return (((i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.length) ?? 0) > 1;
192
- }), u = o(
742
+ var m, C, M, Q, c;
743
+ return (((C = (m = e.value) == null ? void 0 : m.calculatedPrices) == null ? void 0 : C.length) ?? 0) > 0 ? (Q = (M = e.value) == null ? void 0 : M.calculatedPrices) == null ? void 0 : Q[0] : (c = e.value) == null ? void 0 : c.calculatedPrice;
744
+ }
745
+ ), t = i(() => {
746
+ var m;
747
+ return (m = n == null ? void 0 : n.value) == null ? void 0 : m.referencePrice;
748
+ }), r = i(() => {
749
+ var m, C;
750
+ return (((C = (m = e.value) == null ? void 0 : m.calculatedPrices) == null ? void 0 : C.length) ?? 0) > 1;
751
+ }), u = i(
193
752
  () => {
194
- var s, i, d, p, f, U;
195
- return !!((s = e.value) != null && s.parentId) && ((d = (i = e.value) == null ? void 0 : i.calculatedCheapestPrice) == null ? void 0 : d.hasRange) && ((p = r == null ? void 0 : r.value) == null ? void 0 : p.unitPrice) !== ((f = t == null ? void 0 : t.value) == null ? void 0 : f.unitPrice) && ((U = t == null ? void 0 : t.value) == null ? void 0 : U.unitPrice);
753
+ var m, C, M, Q, c, y;
754
+ return !!((m = e.value) != null && m.parentId) && ((M = (C = e.value) == null ? void 0 : C.calculatedCheapestPrice) == null ? void 0 : M.hasRange) && ((Q = n == null ? void 0 : n.value) == null ? void 0 : Q.unitPrice) !== ((c = s == null ? void 0 : s.value) == null ? void 0 : c.unitPrice) && ((y = s == null ? void 0 : s.value) == null ? void 0 : y.unitPrice);
196
755
  }
197
- ), a = o(
756
+ ), o = i(
198
757
  () => {
199
- var s, i;
200
- return n.value && k(e.value).length > 1 ? (i = (s = e.value) == null ? void 0 : s.calculatedPrices) == null ? void 0 : i.reduce((d, p) => p.unitPrice < d.unitPrice ? p : d) : r.value;
758
+ var m, C;
759
+ return r.value && G(e.value).length > 1 ? (C = (m = e.value) == null ? void 0 : m.calculatedPrices) == null ? void 0 : C.reduce((M, Q) => Q.unitPrice < M.unitPrice ? Q : M) : n.value;
201
760
  }
202
- ), x = o(
761
+ ), a = i(
203
762
  () => {
204
- var s;
205
- return (s = a.value) == null ? void 0 : s.unitPrice;
763
+ var m;
764
+ return (m = o.value) == null ? void 0 : m.unitPrice;
206
765
  }
207
- ), F = o(
766
+ ), p = i(
208
767
  () => {
209
- var s;
210
- return (s = a.value) == null ? void 0 : s.totalPrice;
211
- }
212
- ), S = o(
213
- () => a.value
214
- ), I = o(() => {
215
- var s, i;
216
- return !!((i = (s = a.value) == null ? void 0 : s.listPrice) != null && i.percentage);
217
- }), C = o(
768
+ var m;
769
+ return (m = o.value) == null ? void 0 : m.totalPrice;
770
+ }
771
+ ), F = i(
772
+ () => o.value
773
+ ), d = i(() => {
774
+ var m, C;
775
+ return !!((C = (m = o.value) == null ? void 0 : m.listPrice) != null && C.percentage);
776
+ }), v = i(
218
777
  () => {
219
- var s, i, d;
220
- return (d = (i = (s = e.value) == null ? void 0 : s.calculatedPrice) == null ? void 0 : i.regulationPrice) == null ? void 0 : d.price;
778
+ var m, C, M;
779
+ return (M = (C = (m = e.value) == null ? void 0 : m.calculatedPrice) == null ? void 0 : C.regulationPrice) == null ? void 0 : M.price;
221
780
  }
222
- ), y = o(() => k(e.value));
781
+ ), f = i(() => G(e.value));
223
782
  return {
224
- price: S,
225
- totalPrice: F,
226
- unitPrice: x,
783
+ price: F,
784
+ totalPrice: p,
785
+ unitPrice: a,
227
786
  displayFromVariants: u,
228
- displayFrom: n,
229
- tierPrices: y,
230
- referencePrice: c,
231
- isListPrice: I,
232
- regulationPrice: C
787
+ displayFrom: r,
788
+ tierPrices: f,
789
+ referencePrice: t,
790
+ isListPrice: d,
791
+ regulationPrice: v
233
792
  };
234
793
  }
235
- function de(e) {
236
- const { total: t, limit: r, page: c } = e ?? {}, n = z({
237
- page: c ?? 1,
238
- total: t ?? 0,
239
- limit: r
240
- }), u = o(() => n.limit === void 0 ? 1 : Math.max(1, Math.ceil(n.total / n.limit))), a = o({
241
- get() {
242
- return n.page;
243
- },
244
- set(C) {
245
- n.page = Math.max(1, Math.min(l(u), C));
246
- }
794
+ function Be(e, s) {
795
+ var t;
796
+ const n = (t = e.extensions) == null ? void 0 : t.variants;
797
+ return s.length === 0 ? (n == null ? void 0 : n.find((r) => {
798
+ var u;
799
+ return ((u = r.optionIds) == null ? void 0 : u.length) === 0;
800
+ })) ?? (n == null ? void 0 : n[0]) : n == null ? void 0 : n.find((r) => {
801
+ var u;
802
+ return (u = r.optionIds) == null ? void 0 : u.every((o) => s.includes(o));
803
+ });
804
+ }
805
+ function mt(e, s) {
806
+ return i(() => Be(l(e), l(s)));
807
+ }
808
+ function gt() {
809
+ const { data: e } = k();
810
+ return i(() => {
811
+ var s, n, t, r, u, o;
812
+ return !!((n = (s = e.value) == null ? void 0 : s.customer) != null && n.id) && !!((r = (t = e.value) == null ? void 0 : t.customer) != null && r.active) && !((o = (u = e.value) == null ? void 0 : u.customer) != null && o.guest);
247
813
  });
248
- K(
249
- [() => l(u), () => n],
250
- ([C, y]) => {
251
- n.page = Math.min(C, n.page), n.total = y.total ?? 0, n.limit = y.limit;
814
+ }
815
+ function ht(e) {
816
+ const s = Ce(e ? { body: e } : void 0), n = i(() => {
817
+ var d;
818
+ return (d = s.data) == null ? void 0 : d.value;
819
+ }), t = i(
820
+ () => {
821
+ var d;
822
+ return !!((d = n.value) != null && d.id) && !!n.value.active && !n.value.guest;
823
+ }
824
+ ), r = i(
825
+ () => {
826
+ var d;
827
+ return !!((d = n.value) != null && d.id) && !n.value.guest;
828
+ }
829
+ ), u = i(() => {
830
+ var d;
831
+ return !!((d = n.value) != null && d.guest);
832
+ }), o = i(
833
+ () => {
834
+ var d;
835
+ return ((d = n.value) == null ? void 0 : d.defaultBillingAddressId) || null;
836
+ }
837
+ ), a = i(
838
+ () => {
839
+ var d;
840
+ return ((d = n.value) == null ? void 0 : d.defaultShippingAddressId) || null;
841
+ }
842
+ ), p = i(
843
+ () => {
844
+ var d;
845
+ return ((d = n.value) == null ? void 0 : d.defaultBillingAddress) || null;
846
+ }
847
+ ), F = i(
848
+ () => {
849
+ var d;
850
+ return ((d = n.value) == null ? void 0 : d.defaultShippingAddress) || null;
252
851
  }
253
852
  );
254
- const x = o(() => n.page === l(u)), F = o(() => n.page === 1), S = o(() => ({
255
- p: n.page,
256
- limit: n.limit
257
- })), I = (C) => {
258
- K(() => l(C), (y) => {
259
- n.total = (y == null ? void 0 : y.total) ?? 0, n.limit = (y == null ? void 0 : y.limit) ?? 0;
260
- });
261
- };
262
853
  return {
263
- page: l(a),
264
- total: b(n, "total"),
265
- limit: b(n, "limit"),
266
- pageCount: u,
267
- isLastPage: x,
268
- isFirstPage: F,
269
- usePaginationSync: I,
270
- // This can be used to pass the pagination options directly to the query options
271
- queryOptions: S
854
+ // Computed properties
855
+ user: n,
856
+ isLoggedIn: t,
857
+ isCustomerSession: r,
858
+ isGuestSession: u,
859
+ defaultBillingAddressId: o,
860
+ defaultShippingAddressId: a,
861
+ userDefaultBillingAddress: p,
862
+ userDefaultShippingAddress: F,
863
+ // Expose queries and mutations directly
864
+ customerQuery: s
272
865
  };
273
866
  }
274
- class ge {
275
- constructor() {
276
- g(this, "useProductListingQueryOptions", ee);
277
- g(this, "useCategoryQueryOptions", w);
278
- g(this, "useContextOptions", X);
279
- g(this, "useContextUpdate", Z);
280
- g(this, "useProductQueryOptions", re);
281
- g(this, "useProductVariantForOptions", ce);
282
- g(this, "useCartQueryOptions", W);
283
- g(this, "useCartUpdateItemMutation", J);
284
- g(this, "useCartRemoveItemMutation", G);
285
- g(this, "useCartAddItemMutation", O);
286
- }
287
- }
288
867
  export {
289
- ie as absolutizeSeoUrl,
290
- q as cartKeys,
291
- Q as categoryKeys,
292
- j as contextKeys,
293
- ge as default,
294
- ne as getProductVariantForOptions,
295
- se as getSeoUrl,
296
- m as productKeys,
297
- L as relativizeSeoUrl,
298
- A as shopwareClientKey,
299
- de as usePagination,
300
- ye as useProductPrice,
301
- ce as useProductVariantForOptions,
302
- le as useSeoUrl,
303
- P as useShopwareQueryClient
868
+ Ge as absolutizeSeoUrl,
869
+ b as addressKeys,
870
+ R as cartKeys,
871
+ B as categoryKeys,
872
+ U as contextKeys,
873
+ I as customerKeys,
874
+ Be as getProductVariantForOptions,
875
+ ke as getSeoUrl,
876
+ x as orderKeys,
877
+ D as paymentKeys,
878
+ L as productKeys,
879
+ Pe as readPaymentMethodOperation,
880
+ Ie as readShippingMethodOperation,
881
+ T as relativizeSeoUrl,
882
+ E as shippingKeys,
883
+ J as shopwareClientKey,
884
+ h as unrefOptions,
885
+ we as useAddLineItemMutation,
886
+ _e as useChangeEmailMutation,
887
+ et as useChangeProfileMutation,
888
+ Ye as useCheckout,
889
+ Te as useCheckoutAddresses,
890
+ $e as useCreateCustomerAddressMutation,
891
+ Ze as useCreateOrderMutation,
892
+ ze as useDeleteCustomerAddressMutation,
893
+ rt as useHandlePaymentMutation,
894
+ gt as useIsLoggedIn,
895
+ Z as useListAddressQuery,
896
+ Y as useListAddressQueryOptions,
897
+ tt as useLoginCustomerMutation,
898
+ nt as useLogoutCustomerMutation,
899
+ He as useOptimistic,
900
+ je as useOrderDetails,
901
+ Ve as useOrderPayment,
902
+ ut as useOrderSetPaymentMutation,
903
+ yt as usePagination,
904
+ ct as usePaymentMethods,
905
+ pt as useProductPrice,
906
+ mt as useProductVariantForOptions,
907
+ We as useReadCartQuery,
908
+ ce as useReadCartQueryOptions,
909
+ ot as useReadCategoryListQuery,
910
+ Fe as useReadCategoryListQueryOptions,
911
+ at as useReadCompactProductListingQuery,
912
+ Le as useReadCompactProductListingQueryOptions,
913
+ ee as useReadContext,
914
+ k as useReadContextQuery,
915
+ Re as useReadCustomProductDetailOptions,
916
+ it as useReadCustomProductDetailQuery,
917
+ Ce as useReadCustomerQuery,
918
+ fe as useReadCustomerQueryOptions,
919
+ re as useReadOrderQuery,
920
+ se as useReadOrderQueryOptions,
921
+ Me as useReadPaymentMethodQuery,
922
+ Se as useReadPaymentMethodQueryOptions,
923
+ Ue as useReadShippingMethodQuery,
924
+ be as useReadShippingMethodQueryOptions,
925
+ st as useRegisterCustomerMutation,
926
+ Je as useRemoveLineItemMutation,
927
+ dt as useSeoUrl,
928
+ lt as useShippingMethods,
929
+ g as useShopwareQueryClient,
930
+ N as useUpdateContextMutation,
931
+ Xe as useUpdateLineItemMutation,
932
+ ht as useUser
304
933
  };