@instockng/storefront-ui 1.0.28 → 1.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.
- package/dist/components/Checkout.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index100.mjs +3 -3
- package/dist/index101.mjs +1 -1
- package/dist/index102.mjs +1 -1
- package/dist/index103.mjs +1 -1
- package/dist/index104.mjs +2 -2
- package/dist/index105.mjs +2 -2
- package/dist/index106.mjs +3 -3
- package/dist/index107.mjs +1 -1
- package/dist/index108.mjs +3 -3
- package/dist/index109.mjs +2 -2
- package/dist/index110.mjs +2 -2
- package/dist/index111.mjs +1 -1
- package/dist/index112.mjs +3 -3
- package/dist/index113.mjs +1 -1
- package/dist/index114.mjs +1 -1
- package/dist/index115.mjs +3 -3
- package/dist/index116.mjs +2 -2
- package/dist/index117.mjs +4 -4
- package/dist/index118.mjs +1 -1
- package/dist/index119.mjs +3 -3
- package/dist/index12.mjs +191 -183
- package/dist/index120.mjs +4 -4
- package/dist/index121.mjs +1 -1
- package/dist/index122.mjs +1 -1
- package/dist/index123.mjs +1 -1
- package/dist/index124.mjs +1 -1
- package/dist/index125.mjs +1 -1
- package/dist/index126.mjs +1 -1
- package/dist/index127.mjs +1 -1
- package/dist/index128.mjs +2 -2
- package/dist/index129.mjs +3 -3
- package/dist/index132.mjs +1 -1
- package/dist/index134.mjs +21 -2
- package/dist/index135.mjs +56 -2
- package/dist/index136.mjs +29 -2
- package/dist/index137.mjs +7 -2
- package/dist/index138.mjs +50 -16
- package/dist/index139.mjs +6 -32
- package/dist/index140.mjs +11 -37
- package/dist/index141.mjs +7 -18
- package/dist/index142.mjs +28 -18
- package/dist/index143.mjs +2 -2
- package/dist/index144.mjs +70 -20
- package/dist/index145.mjs +163 -42
- package/dist/index147.mjs +2 -30
- package/dist/index148.mjs +2 -18
- package/dist/index149.mjs +2 -2
- package/dist/index150.mjs +18 -2
- package/dist/index151.mjs +32 -2
- package/dist/index152.mjs +38 -2
- package/dist/index153.mjs +13 -67
- package/dist/index154.mjs +18 -2
- package/dist/index155.mjs +2 -53
- package/dist/index156.mjs +20 -2
- package/dist/index157.mjs +39 -29
- package/dist/index158.mjs +2 -152
- package/dist/index159.mjs +30 -2
- package/dist/index160.mjs +18 -2
- package/dist/index161.mjs +2 -19
- package/dist/index162.mjs +2 -2
- package/dist/index163.mjs +2 -2
- package/dist/index164.mjs +2 -26
- package/dist/index165.mjs +72 -2
- package/dist/index166.mjs +2 -2
- package/dist/index167.mjs +49 -20
- package/dist/index168.mjs +2 -23
- package/dist/index169.mjs +36 -2
- package/dist/index170.mjs +152 -2
- package/dist/index171.mjs +2 -2
- package/dist/index172.mjs +2 -23
- package/dist/index173.mjs +19 -2
- package/dist/index174.mjs +2 -23
- package/dist/index176.mjs +26 -2
- package/dist/index177.mjs +2 -2
- package/dist/index178.mjs +2 -23
- package/dist/index179.mjs +24 -2
- package/dist/index180.mjs +15 -15
- package/dist/index181.mjs +2 -2
- package/dist/index182.mjs +2 -2
- package/dist/index183.mjs +2 -2
- package/dist/index184.mjs +23 -2
- package/dist/index185.mjs +2 -2
- package/dist/index186.mjs +23 -2
- package/dist/index187.mjs +2 -2
- package/dist/index188.mjs +2 -2
- package/dist/index189.mjs +2 -127
- package/dist/index19.mjs +26 -13
- package/dist/index190.mjs +23 -2
- package/dist/index191.mjs +2 -74
- package/dist/index192.mjs +20 -71
- package/dist/index193.mjs +2 -21
- package/dist/index194.mjs +2 -56
- package/dist/index195.mjs +2 -29
- package/dist/index196.mjs +2 -7
- package/dist/index197.mjs +2 -52
- package/dist/index198.mjs +2 -6
- package/dist/index199.mjs +2 -12
- package/dist/index200.mjs +2 -7
- package/dist/index201.mjs +127 -28
- package/dist/index202.mjs +2 -2
- package/dist/index203.mjs +73 -69
- package/dist/index204.mjs +71 -164
- package/dist/index205.mjs +13 -2
- package/dist/index206.mjs +7 -2
- package/dist/index207.mjs +31 -2
- package/dist/index208.mjs +11 -2
- package/dist/index209.mjs +4 -2
- package/dist/index210.mjs +4 -2
- package/dist/index211.mjs +11 -36
- package/dist/index212.mjs +5 -2
- package/dist/index213.mjs +33 -2
- package/dist/index214.mjs +31 -2
- package/dist/index215.mjs +28 -2
- package/dist/index216.mjs +58 -241
- package/dist/index217.mjs +2 -2
- package/dist/index218.mjs +2 -33
- package/dist/index219.mjs +2 -65
- package/dist/index220.mjs +2 -25
- package/dist/index223.mjs +1 -1
- package/dist/index226.mjs +37 -2
- package/dist/index227.mjs +2 -2
- package/dist/index228.mjs +2 -2
- package/dist/index229.mjs +2 -2
- package/dist/index232.mjs +244 -2
- package/dist/index233.mjs +2 -4
- package/dist/index234.mjs +33 -2
- package/dist/index235.mjs +65 -2
- package/dist/index236.mjs +24 -30
- package/dist/index237.mjs +2 -11
- package/dist/index238.mjs +2 -4
- package/dist/index239.mjs +2 -4
- package/dist/index240.mjs +2 -13
- package/dist/index241.mjs +2 -7
- package/dist/index242.mjs +2 -12
- package/dist/index243.mjs +2 -5
- package/dist/index244.mjs +2 -33
- package/dist/index245.mjs +2 -31
- package/dist/index246.mjs +2 -28
- package/dist/index247.mjs +4 -61
- package/dist/index248.mjs +3 -2
- package/dist/index249.mjs +2 -18
- package/dist/index250.mjs +2 -47
- package/dist/index251.mjs +17 -2
- package/dist/index252.mjs +13 -2
- package/dist/index253.mjs +6 -2
- package/dist/index254.mjs +30 -2
- package/dist/index255.mjs +2 -91
- package/dist/index256.mjs +18 -2
- package/dist/index257.mjs +47 -2
- package/dist/index258.mjs +2 -3
- package/dist/index259.mjs +2 -2
- package/dist/index260.mjs +2 -2
- package/dist/index261.mjs +2 -17
- package/dist/index262.mjs +2 -13
- package/dist/index263.mjs +91 -6
- package/dist/index264.mjs +2 -30
- package/dist/index29.mjs +1 -1
- package/dist/index3.mjs +95 -105
- package/dist/index32.mjs +1 -1
- package/dist/index33.mjs +1 -1
- package/dist/index34.mjs +1 -1
- package/dist/index35.mjs +1 -1
- package/dist/index36.mjs +1 -1
- package/dist/index37.mjs +1 -1
- package/dist/index38.mjs +1 -1
- package/dist/index39.mjs +3 -3
- package/dist/index42.mjs +1 -1
- package/dist/index48.mjs +2 -2
- package/dist/index49.mjs +45 -45
- package/dist/index50.mjs +1 -1
- package/dist/index51.mjs +1 -1
- package/dist/index52.mjs +1 -1
- package/dist/index53.mjs +1 -1
- package/dist/index54.mjs +1 -1
- package/dist/index55.mjs +1 -1
- package/dist/index56.mjs +1 -1
- package/dist/index57.mjs +1 -1
- package/dist/index58.mjs +1 -1
- package/dist/index59.mjs +1 -1
- package/dist/index61.mjs +2 -153
- package/dist/index62.mjs +153 -2
- package/dist/index63.mjs +4 -22
- package/dist/index64.mjs +21 -73
- package/dist/index65.mjs +74 -14
- package/dist/index66.mjs +14 -62
- package/dist/index67.mjs +62 -4
- package/dist/index73.mjs +1 -1
- package/dist/index77.mjs +5 -5
- package/dist/index79.mjs +3 -3
- package/dist/index89.mjs +1 -1
- package/dist/index90.mjs +3 -3
- package/dist/index92.mjs +34 -2
- package/dist/index93.mjs +40 -31
- package/dist/index94.mjs +2 -43
- package/dist/index96.mjs +1 -1
- package/dist/index97.mjs +1 -1
- package/dist/index98.mjs +6 -6
- package/dist/index99.mjs +4 -4
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Checkout.tsx +18 -10
- package/src/contexts/CartContext.tsx +2 -20
- package/src/lib/utils.ts +20 -0
package/dist/index3.mjs
CHANGED
|
@@ -1,170 +1,160 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { createContext as
|
|
2
|
+
import { jsxs as ot, jsx as nt } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as ct, useState as A, useRef as M, useEffect as f, useCallback as o, useContext as st } from "react";
|
|
4
4
|
import "./index20.mjs";
|
|
5
|
-
import { useGetCart as
|
|
5
|
+
import { useGetCart as at, useCreateCart as ut, useAddCartItem as it, useUpdateCartItem as mt, useRemoveCartItem as ft, useApplyDiscount as dt, useRemoveDiscount as lt, useUpdateCart as Ct, useCheckoutCart as wt } from "./index32.mjs";
|
|
6
6
|
import "@tanstack/react-query";
|
|
7
7
|
import { ShoppingCart as It } from "./index10.mjs";
|
|
8
|
-
import { useMetaPixel as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
fbc: e("_fbc"),
|
|
20
|
-
fbp: e("_fbp")
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
d(() => {
|
|
24
|
-
O(!0);
|
|
25
|
-
}, []), d(() => {
|
|
26
|
-
if (p || _.current) return;
|
|
27
|
-
_.current = !0;
|
|
8
|
+
import { useMetaPixel as pt } from "./index4.mjs";
|
|
9
|
+
import { getFbCookies as ht } from "./index19.mjs";
|
|
10
|
+
const d = "oms_cart_id", b = ct(null);
|
|
11
|
+
function Et({ children: l, brandSlug: a, initialCartId: C, shoppingCartProps: L }) {
|
|
12
|
+
const [t, u] = A(C || null), [g, k] = A(!1), [$, j] = A(!1), E = M(!1), _ = M(!1), p = M(!1), { trackAddToCart: h, trackInitiateCheckout: x } = pt();
|
|
13
|
+
f(() => {
|
|
14
|
+
j(!0);
|
|
15
|
+
}, []), f(() => {
|
|
16
|
+
if (C || E.current) return;
|
|
17
|
+
E.current = !0;
|
|
28
18
|
const r = new URLSearchParams(window.location.search).get("cartId");
|
|
29
19
|
if (r) {
|
|
30
|
-
|
|
20
|
+
u(r);
|
|
31
21
|
return;
|
|
32
22
|
}
|
|
33
|
-
const c = localStorage.getItem(
|
|
34
|
-
c &&
|
|
35
|
-
}, [
|
|
36
|
-
const { data:
|
|
23
|
+
const c = localStorage.getItem(d);
|
|
24
|
+
c && u(c);
|
|
25
|
+
}, [C]);
|
|
26
|
+
const { data: i, isLoading: O, error: w, refetch: n } = at(t || "", {
|
|
37
27
|
enabled: !!t,
|
|
38
28
|
retry: !1
|
|
39
29
|
// Don't retry on failure - cart might be invalid/expired
|
|
40
|
-
}),
|
|
30
|
+
}), y = ut({
|
|
41
31
|
onSuccess: (e) => {
|
|
42
32
|
if ("error" in e) {
|
|
43
33
|
console.error("Failed to create cart:", e.error);
|
|
44
34
|
return;
|
|
45
35
|
}
|
|
46
|
-
|
|
36
|
+
u(e.id);
|
|
47
37
|
},
|
|
48
38
|
onError: (e) => {
|
|
49
39
|
console.error("Failed to create cart:", e);
|
|
50
40
|
},
|
|
51
41
|
retry: 10
|
|
52
42
|
});
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
43
|
+
f(() => {
|
|
44
|
+
if (_.current) return;
|
|
45
|
+
_.current = !0;
|
|
56
46
|
const e = setTimeout(() => {
|
|
57
|
-
!(typeof window < "u" ? localStorage.getItem(
|
|
47
|
+
!(typeof window < "u" ? localStorage.getItem(d) : null) && !C && y.mutate(a);
|
|
58
48
|
}, 150);
|
|
59
49
|
return () => clearTimeout(e);
|
|
60
|
-
}, []),
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
}, []), f(() => {
|
|
51
|
+
w && t && !p.current && (p.current = !0, console.warn("Cart fetch failed, creating new cart:", w), u(null), typeof window < "u" && localStorage.removeItem(d), setTimeout(() => {
|
|
52
|
+
y.mutate(a), p.current = !1;
|
|
63
53
|
}, 100));
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
onSuccess: () =>
|
|
67
|
-
}),
|
|
68
|
-
onSuccess: () =>
|
|
69
|
-
}),
|
|
70
|
-
onSuccess: () =>
|
|
54
|
+
}, [w, t, a]);
|
|
55
|
+
const G = it(t || "", {
|
|
56
|
+
onSuccess: () => n()
|
|
57
|
+
}), H = mt(t || "", {
|
|
58
|
+
onSuccess: () => n()
|
|
59
|
+
}), K = ft(t || "", {
|
|
60
|
+
onSuccess: () => n()
|
|
61
|
+
}), Y = dt(t || "", {
|
|
62
|
+
onSuccess: () => n()
|
|
71
63
|
}), z = lt(t || "", {
|
|
72
|
-
onSuccess: () =>
|
|
73
|
-
}), B =
|
|
74
|
-
onSuccess: () =>
|
|
75
|
-
}), J = Ct(t || "", {
|
|
76
|
-
onSuccess: () => a(),
|
|
64
|
+
onSuccess: () => n()
|
|
65
|
+
}), B = Ct(t || "", {
|
|
66
|
+
onSuccess: () => n(),
|
|
77
67
|
retry: 3
|
|
78
|
-
}),
|
|
68
|
+
}), J = wt(t || "", {
|
|
79
69
|
onSuccess: () => {
|
|
80
70
|
}
|
|
81
71
|
});
|
|
82
|
-
|
|
83
|
-
t && typeof window < "u" && localStorage.setItem(
|
|
72
|
+
f(() => {
|
|
73
|
+
t && typeof window < "u" && localStorage.setItem(d, t);
|
|
84
74
|
}, [t]);
|
|
85
|
-
const
|
|
86
|
-
async (e, r, c,
|
|
75
|
+
const Q = o(
|
|
76
|
+
async (e, r, c, m, s) => {
|
|
87
77
|
var F;
|
|
88
78
|
if (!t) throw new Error("No cart ID");
|
|
89
|
-
const { fbc:
|
|
79
|
+
const { fbc: v, fbp: D } = ht(), N = await G.mutateAsync({ sku: m, quantity: s, fbc: v, fbp: D });
|
|
90
80
|
if ("error" in N) return;
|
|
91
|
-
const
|
|
92
|
-
(
|
|
93
|
-
var
|
|
94
|
-
return ((
|
|
81
|
+
const I = (F = N.items) == null ? void 0 : F.filter(
|
|
82
|
+
(S) => {
|
|
83
|
+
var U;
|
|
84
|
+
return ((U = S.variant) == null ? void 0 : U.sku) === m;
|
|
95
85
|
}
|
|
96
|
-
), T =
|
|
86
|
+
), T = I == null ? void 0 : I[I.length - 1];
|
|
97
87
|
if (T) {
|
|
98
|
-
const
|
|
99
|
-
h(e, r, c,
|
|
88
|
+
const S = `cart_${t}_item_${T.id}`;
|
|
89
|
+
h(e, r, c, s, S);
|
|
100
90
|
} else
|
|
101
|
-
h(e, r, c,
|
|
91
|
+
h(e, r, c, s);
|
|
102
92
|
},
|
|
103
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
-
[t, h
|
|
105
|
-
),
|
|
94
|
+
[t, h]
|
|
95
|
+
), V = o(
|
|
106
96
|
async (e, r) => {
|
|
107
97
|
if (!t) throw new Error("No cart ID");
|
|
108
|
-
await
|
|
98
|
+
await H.mutateAsync({ itemId: e, quantity: r });
|
|
109
99
|
},
|
|
110
100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
101
|
[t]
|
|
112
|
-
),
|
|
102
|
+
), W = o(
|
|
113
103
|
async (e) => {
|
|
114
104
|
if (!t) throw new Error("No cart ID");
|
|
115
|
-
await
|
|
105
|
+
await K.mutateAsync(e);
|
|
116
106
|
},
|
|
117
107
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
108
|
[t]
|
|
119
|
-
),
|
|
109
|
+
), X = o(
|
|
120
110
|
async (e) => {
|
|
121
111
|
if (!t) throw new Error("No cart ID");
|
|
122
|
-
await
|
|
112
|
+
await Y.mutateAsync({ code: e });
|
|
123
113
|
},
|
|
124
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125
115
|
[t]
|
|
126
|
-
),
|
|
116
|
+
), Z = o(async () => {
|
|
127
117
|
if (!t) throw new Error("No cart ID");
|
|
128
|
-
await
|
|
118
|
+
await z.mutateAsync();
|
|
129
119
|
}, [t]), R = o(() => {
|
|
130
|
-
|
|
131
|
-
}, []),
|
|
132
|
-
R(),
|
|
133
|
-
}, [
|
|
134
|
-
|
|
120
|
+
u(null), typeof window < "u" && localStorage.removeItem(d);
|
|
121
|
+
}, []), q = o(() => {
|
|
122
|
+
R(), y.mutate(a);
|
|
123
|
+
}, [a]), tt = o(() => {
|
|
124
|
+
k(!0);
|
|
135
125
|
}, []), P = o(() => {
|
|
136
|
-
|
|
137
|
-
}, []),
|
|
138
|
-
var
|
|
139
|
-
if (!
|
|
140
|
-
const e = Number(((
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
cart:
|
|
126
|
+
k(!1);
|
|
127
|
+
}, []), et = o(() => {
|
|
128
|
+
var m, s;
|
|
129
|
+
if (!i || !t) return;
|
|
130
|
+
const e = Number(((m = i.pricing) == null ? void 0 : m.total) || 0), r = ((s = i.items) == null ? void 0 : s.reduce((v, D) => v + D.quantity, 0)) || 0, c = `cart_${t}_checkout`;
|
|
131
|
+
x(e, r, c);
|
|
132
|
+
}, [i, t, x]), rt = {
|
|
133
|
+
cart: i || null,
|
|
144
134
|
cartId: t,
|
|
145
|
-
isLoading:
|
|
146
|
-
error:
|
|
147
|
-
updateCartMutation:
|
|
148
|
-
checkoutMutation:
|
|
149
|
-
addItem:
|
|
150
|
-
updateItem:
|
|
151
|
-
removeItem:
|
|
152
|
-
applyDiscount:
|
|
153
|
-
removeDiscount:
|
|
154
|
-
trackCheckoutInitiated:
|
|
135
|
+
isLoading: O,
|
|
136
|
+
error: w,
|
|
137
|
+
updateCartMutation: B,
|
|
138
|
+
checkoutMutation: J,
|
|
139
|
+
addItem: Q,
|
|
140
|
+
updateItem: V,
|
|
141
|
+
removeItem: W,
|
|
142
|
+
applyDiscount: X,
|
|
143
|
+
removeDiscount: Z,
|
|
144
|
+
trackCheckoutInitiated: et,
|
|
155
145
|
clearCart: R,
|
|
156
|
-
clearAndCreateNewCart:
|
|
157
|
-
refetch:
|
|
158
|
-
isOpen:
|
|
159
|
-
open:
|
|
146
|
+
clearAndCreateNewCart: q,
|
|
147
|
+
refetch: n,
|
|
148
|
+
isOpen: g,
|
|
149
|
+
open: tt,
|
|
160
150
|
close: P
|
|
161
151
|
};
|
|
162
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ ot(b.Provider, { value: rt, children: [
|
|
163
153
|
l,
|
|
164
|
-
|
|
154
|
+
$ && /* @__PURE__ */ nt(
|
|
165
155
|
It,
|
|
166
156
|
{
|
|
167
|
-
isOpen:
|
|
157
|
+
isOpen: g,
|
|
168
158
|
onClose: P,
|
|
169
159
|
...L
|
|
170
160
|
}
|
|
@@ -172,13 +162,13 @@ function Mt({ children: l, brandSlug: u, initialCartId: p, shoppingCartProps: L
|
|
|
172
162
|
] });
|
|
173
163
|
}
|
|
174
164
|
function _t() {
|
|
175
|
-
const l =
|
|
165
|
+
const l = st(b);
|
|
176
166
|
if (!l)
|
|
177
167
|
throw new Error("useCart must be used within CartProvider");
|
|
178
168
|
return l;
|
|
179
169
|
}
|
|
180
170
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
171
|
+
b as CartContext,
|
|
172
|
+
Et as CartProvider,
|
|
183
173
|
_t as useCart
|
|
184
174
|
};
|
package/dist/index32.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as s, useMutation as i } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as a } from "./
|
|
3
|
+
import { useQueryUnwrapped as a } from "./index63.mjs";
|
|
4
4
|
import { queryKeys as r } from "./index29.mjs";
|
|
5
5
|
import { updateCart as c, createCart as l, applyDiscount as y, removeDiscount as m, addCartItem as p, updateCartItem as C, removeCartItem as q, checkoutCart as f, fetchCart as d } from "./index25.mjs";
|
|
6
6
|
function Q(e, t) {
|
package/dist/index33.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useMutation as t } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as u } from "./
|
|
3
|
+
import { useQueryUnwrapped as u } from "./index63.mjs";
|
|
4
4
|
import { queryKeys as n } from "./index29.mjs";
|
|
5
5
|
import { confirmOrder as i, fetchOrder as m } from "./index26.mjs";
|
|
6
6
|
function y(e, r, o) {
|
package/dist/index34.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryUnwrapped as u } from "./
|
|
2
|
+
import { useQueryUnwrapped as u } from "./index63.mjs";
|
|
3
3
|
import { queryKeys as t } from "./index29.mjs";
|
|
4
4
|
import { fetchProductsByBrand as o, fetchProductBySlug as c } from "./index24.mjs";
|
|
5
5
|
function n(r, e) {
|
package/dist/index35.mjs
CHANGED
package/dist/index36.mjs
CHANGED
package/dist/index37.mjs
CHANGED
package/dist/index38.mjs
CHANGED
package/dist/index39.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { p as S } from "./
|
|
3
|
-
import { t as U } from "./
|
|
4
|
-
import he from "./
|
|
2
|
+
import { p as S } from "./index65.mjs";
|
|
3
|
+
import { t as U } from "./index66.mjs";
|
|
4
|
+
import he from "./index67.mjs";
|
|
5
5
|
const fe = Object.prototype.toString, de = Error.prototype.toString, pe = RegExp.prototype.toString, me = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", ye = /^Symbol\((.*)\)(.*)$/;
|
|
6
6
|
function ge(n) {
|
|
7
7
|
return n != +n ? "NaN" : n === 0 && 1 / n < 0 ? "-0" : "" + n;
|
package/dist/index42.mjs
CHANGED
package/dist/index48.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
var p = Object.defineProperty;
|
|
3
3
|
var k = (r, e, i) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
|
|
4
4
|
var h = (r, e, i) => k(r, typeof e != "symbol" ? e + "" : e, i);
|
|
5
|
-
import { serialize as j } from "./
|
|
6
|
-
import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./
|
|
5
|
+
import { serialize as j } from "./index92.mjs";
|
|
6
|
+
import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index93.mjs";
|
|
7
7
|
var v = (r, e) => new Proxy(() => {
|
|
8
8
|
}, {
|
|
9
9
|
get(t, s) {
|
package/dist/index49.mjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as m, useMutation as w } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as
|
|
3
|
+
import { useQueryUnwrapped as f } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as d, authHeaders as l } from "./index23.mjs";
|
|
5
|
-
import { queryKeys as
|
|
5
|
+
import { queryKeys as c } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as y } from "./index21.mjs";
|
|
7
|
-
function
|
|
8
|
-
const { baseURL:
|
|
9
|
-
return
|
|
10
|
-
queryKey:
|
|
7
|
+
function $(e, n) {
|
|
8
|
+
const { baseURL: s, getAuthToken: o } = y();
|
|
9
|
+
return f({
|
|
10
|
+
queryKey: c.admin.orders.list(e),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
12
|
+
const t = await o(), a = d(s), i = e ? Object.fromEntries(Object.entries(e).filter(([u, p]) => p !== void 0)) : void 0, r = await a.orders.index.$get({ query: i }, l(t));
|
|
13
13
|
if (!r.ok)
|
|
14
14
|
throw new Error(`Failed to fetch orders: ${r.statusText}`);
|
|
15
15
|
return r.json();
|
|
16
16
|
},
|
|
17
|
-
...
|
|
17
|
+
...n
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function j(e, n) {
|
|
21
21
|
const { baseURL: s, getAuthToken: o } = y();
|
|
22
|
-
return
|
|
23
|
-
queryKey:
|
|
22
|
+
return f({
|
|
23
|
+
queryKey: c.admin.orders.detail(e),
|
|
24
24
|
queryFn: async () => {
|
|
25
|
-
const t = await o(),
|
|
26
|
-
if (!
|
|
27
|
-
throw new Error(`Failed to fetch order: ${
|
|
28
|
-
return
|
|
25
|
+
const t = await o(), i = await d(s).orders[":id"].$get({ param: { id: e } }, l(t));
|
|
26
|
+
if (!i.ok)
|
|
27
|
+
throw new Error(`Failed to fetch order: ${i.statusText}`);
|
|
28
|
+
return i.json();
|
|
29
29
|
},
|
|
30
30
|
...n
|
|
31
31
|
});
|
|
@@ -34,67 +34,67 @@ function g(e) {
|
|
|
34
34
|
const { baseURL: n, getAuthToken: s } = y(), o = m();
|
|
35
35
|
return w({
|
|
36
36
|
mutationFn: async (t) => {
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
-
throw new Error(`Failed to create order: ${
|
|
40
|
-
return
|
|
37
|
+
const a = await s(), r = await d(n).orders.index.$post({ json: t }, l(a));
|
|
38
|
+
if (!r.ok)
|
|
39
|
+
throw new Error(`Failed to create order: ${r.statusText}`);
|
|
40
|
+
return r.json();
|
|
41
41
|
},
|
|
42
42
|
onSuccess: () => {
|
|
43
|
-
o.invalidateQueries({ queryKey:
|
|
43
|
+
o.invalidateQueries({ queryKey: c.admin.orders.all });
|
|
44
44
|
},
|
|
45
45
|
...e
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function x(e, n) {
|
|
49
49
|
const { baseURL: s, getAuthToken: o } = y(), t = m();
|
|
50
50
|
return w({
|
|
51
|
-
mutationFn: async (
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
throw new Error(`Failed to update order: ${
|
|
55
|
-
return
|
|
51
|
+
mutationFn: async (a) => {
|
|
52
|
+
const i = await o(), u = await d(s).orders[":id"].$patch({ param: { id: e }, json: a }, l(i));
|
|
53
|
+
if (!u.ok)
|
|
54
|
+
throw new Error(`Failed to update order: ${u.statusText}`);
|
|
55
|
+
return u.json();
|
|
56
56
|
},
|
|
57
57
|
onSuccess: () => {
|
|
58
|
-
t.invalidateQueries({ queryKey:
|
|
58
|
+
t.invalidateQueries({ queryKey: c.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: c.admin.orders.all });
|
|
59
59
|
},
|
|
60
60
|
...n
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function K(e, n) {
|
|
64
64
|
const { baseURL: s, getAuthToken: o } = y(), t = m();
|
|
65
65
|
return w({
|
|
66
|
-
mutationFn: async (
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
69
|
-
throw new Error(`Failed to update order status: ${
|
|
70
|
-
return
|
|
66
|
+
mutationFn: async (a) => {
|
|
67
|
+
const i = await o(), u = await d(s).orders[":id"].status.$patch({ param: { id: e }, json: a }, l(i));
|
|
68
|
+
if (!u.ok)
|
|
69
|
+
throw new Error(`Failed to update order status: ${u.statusText}`);
|
|
70
|
+
return u.json();
|
|
71
71
|
},
|
|
72
72
|
onSuccess: () => {
|
|
73
|
-
t.invalidateQueries({ queryKey:
|
|
73
|
+
t.invalidateQueries({ queryKey: c.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: c.admin.orders.all });
|
|
74
74
|
},
|
|
75
75
|
...n
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function U(e, n) {
|
|
79
79
|
const { baseURL: s, getAuthToken: o } = y(), t = m();
|
|
80
80
|
return w({
|
|
81
81
|
mutationFn: async () => {
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
throw new Error(`Failed to delete order: ${
|
|
85
|
-
return
|
|
82
|
+
const a = await o(), r = await d(s).orders[":id"].$delete({ param: { id: e } }, l(a));
|
|
83
|
+
if (!r.ok)
|
|
84
|
+
throw new Error(`Failed to delete order: ${r.statusText}`);
|
|
85
|
+
return r.json();
|
|
86
86
|
},
|
|
87
87
|
onSuccess: () => {
|
|
88
|
-
t.invalidateQueries({ queryKey:
|
|
88
|
+
t.invalidateQueries({ queryKey: c.admin.orders.all });
|
|
89
89
|
},
|
|
90
90
|
...n
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
94
94
|
g as useCreateOrder,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
U as useDeleteOrder,
|
|
96
|
+
j as useGetOrder,
|
|
97
|
+
$ as useListOrders,
|
|
98
|
+
x as useUpdateOrder,
|
|
99
|
+
K as useUpdateOrderStatus
|
|
100
100
|
};
|
package/dist/index50.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as m, useMutation as w } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as b } from "./
|
|
3
|
+
import { useQueryUnwrapped as b } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as c, authHeaders as d } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as u } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as l } from "./index21.mjs";
|
package/dist/index51.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as y, useMutation as m } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as w } from "./
|
|
3
|
+
import { useQueryUnwrapped as w } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as c, authHeaders as d } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as a } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as l } from "./index21.mjs";
|
package/dist/index52.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as v, useMutation as m } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as w } from "./
|
|
3
|
+
import { useQueryUnwrapped as w } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as c, authHeaders as d } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as o } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as l } from "./index21.mjs";
|
package/dist/index53.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as y, useMutation as d } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as m } from "./
|
|
3
|
+
import { useQueryUnwrapped as m } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as c, authHeaders as l } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as u } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as w } from "./index21.mjs";
|
package/dist/index54.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as w, useMutation as v } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as d } from "./
|
|
3
|
+
import { useQueryUnwrapped as d } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as c, authHeaders as y } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as i } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as l } from "./index21.mjs";
|
package/dist/index55.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryUnwrapped as n } from "./
|
|
2
|
+
import { useQueryUnwrapped as n } from "./index63.mjs";
|
|
3
3
|
import { createAdminRpcClients as u, authHeaders as a } from "./index23.mjs";
|
|
4
4
|
import { queryKeys as c } from "./index29.mjs";
|
|
5
5
|
import { useApiConfig as m } from "./index21.mjs";
|
package/dist/index56.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryUnwrapped as i } from "./
|
|
2
|
+
import { useQueryUnwrapped as i } from "./index63.mjs";
|
|
3
3
|
import { createAdminRpcClients as u, authHeaders as c } from "./index23.mjs";
|
|
4
4
|
import { queryKeys as a } from "./index29.mjs";
|
|
5
5
|
import { useApiConfig as d } from "./index21.mjs";
|
package/dist/index57.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as y, useMutation as b } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as l } from "./
|
|
3
|
+
import { useQueryUnwrapped as l } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as r, authHeaders as i } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as u } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as d } from "./index21.mjs";
|
package/dist/index58.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as y, useMutation as w } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as C } from "./
|
|
3
|
+
import { useQueryUnwrapped as C } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as a, authHeaders as d } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as r } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as l } from "./index21.mjs";
|
package/dist/index59.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as v, useMutation as w } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as m } from "./
|
|
3
|
+
import { useQueryUnwrapped as m } from "./index63.mjs";
|
|
4
4
|
import { createAdminRpcClients as l, authHeaders as c } from "./index23.mjs";
|
|
5
5
|
import { queryKeys as a } from "./index29.mjs";
|
|
6
6
|
import { useApiConfig as d } from "./index21.mjs";
|