@instockng/storefront-ui 1.0.69 → 1.0.71
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/contexts/CartContext.d.ts.map +1 -1
- package/dist/index.mjs +65 -63
- package/dist/index100.mjs +2 -69
- package/dist/index140.mjs +1 -1
- package/dist/index142.mjs +2 -21
- package/dist/index143.mjs +19 -54
- package/dist/index144.mjs +55 -28
- package/dist/index145.mjs +28 -6
- package/dist/index146.mjs +6 -51
- package/dist/index147.mjs +51 -5
- package/dist/index148.mjs +6 -12
- package/dist/index149.mjs +12 -7
- package/dist/index15.mjs +1 -1
- package/dist/index150.mjs +6 -27
- package/dist/index151.mjs +28 -2
- package/dist/index152.mjs +2 -70
- package/dist/index153.mjs +67 -164
- package/dist/index154.mjs +167 -2
- package/dist/index158.mjs +1 -1
- package/dist/index159.mjs +1 -1
- package/dist/index160.mjs +1 -1
- package/dist/index161.mjs +1 -1
- package/dist/index162.mjs +1 -1
- package/dist/index164.mjs +1 -1
- package/dist/index165.mjs +1 -1
- package/dist/index167.mjs +2 -2
- package/dist/index168.mjs +1 -1
- package/dist/index173.mjs +2 -2
- package/dist/index175.mjs +1 -1
- package/dist/index177.mjs +2 -2
- package/dist/index178.mjs +5 -5
- package/dist/index181.mjs +1 -1
- package/dist/index184.mjs +1 -1
- package/dist/index187.mjs +1 -1
- package/dist/index188.mjs +1 -1
- package/dist/index192.mjs +1 -1
- package/dist/index194.mjs +1 -1
- package/dist/index198.mjs +1 -1
- package/dist/index2.mjs +1 -1
- package/dist/index200.mjs +1 -1
- package/dist/index209.mjs +2 -2
- package/dist/index211.mjs +1 -1
- package/dist/index212.mjs +1 -1
- package/dist/index213.mjs +2 -31
- package/dist/index214.mjs +2 -11
- package/dist/index215.mjs +2 -4
- package/dist/index216.mjs +2 -4
- package/dist/index217.mjs +2 -13
- package/dist/index218.mjs +2 -7
- package/dist/index219.mjs +2 -12
- package/dist/index22.mjs +10 -6
- package/dist/index220.mjs +2 -5
- package/dist/index221.mjs +37 -33
- package/dist/index222.mjs +2 -31
- package/dist/index223.mjs +2 -28
- package/dist/index224.mjs +2 -61
- package/dist/index225.mjs +2 -2
- package/dist/index226.mjs +2 -2
- package/dist/index227.mjs +244 -2
- package/dist/index228.mjs +2 -2
- package/dist/index229.mjs +33 -2
- package/dist/index23.mjs +13 -14
- package/dist/index230.mjs +65 -2
- package/dist/index231.mjs +25 -2
- package/dist/index232.mjs +2 -2
- package/dist/index233.mjs +2 -108
- package/dist/index234.mjs +2 -2
- package/dist/index235.mjs +108 -2
- package/dist/index236.mjs +2 -2
- package/dist/index237.mjs +2 -37
- package/dist/index238.mjs +2 -2
- package/dist/index239.mjs +4 -2
- package/dist/index240.mjs +31 -2
- package/dist/index241.mjs +10 -243
- package/dist/index242.mjs +4 -2
- package/dist/index243.mjs +3 -32
- package/dist/index244.mjs +13 -65
- package/dist/index245.mjs +7 -25
- package/dist/index246.mjs +2 -2
- package/dist/index247.mjs +2 -2
- package/dist/index248.mjs +12 -2
- package/dist/index249.mjs +5 -2
- package/dist/index250.mjs +33 -2
- package/dist/index251.mjs +31 -2
- package/dist/index252.mjs +28 -2
- package/dist/index253.mjs +61 -4
- package/dist/index254.mjs +2 -2
- package/dist/index256.mjs +2 -3
- package/dist/index257.mjs +18 -2
- package/dist/index258.mjs +47 -2
- package/dist/index259.mjs +2 -17
- package/dist/index260.mjs +2 -13
- package/dist/index261.mjs +2 -6
- package/dist/index262.mjs +2 -30
- package/dist/index263.mjs +91 -2
- package/dist/index264.mjs +2 -2
- package/dist/index265.mjs +2 -18
- package/dist/index266.mjs +3 -47
- package/dist/index267.mjs +2 -2
- package/dist/index268.mjs +2 -2
- package/dist/index269.mjs +17 -2
- package/dist/index27.mjs +17 -17
- package/dist/index270.mjs +13 -2
- package/dist/index271.mjs +6 -91
- package/dist/index272.mjs +30 -2
- package/dist/index28.mjs +58 -47
- package/dist/index29.mjs +11 -11
- package/dist/index3.mjs +141 -123
- package/dist/index30.mjs +4 -4
- package/dist/index31.mjs +5 -5
- package/dist/index33.mjs +21 -20
- package/dist/index35.mjs +35 -28
- package/dist/index36.mjs +8 -25
- package/dist/index38.mjs +26 -9
- package/dist/index39.mjs +9 -9
- package/dist/index4.mjs +58 -46
- package/dist/index40.mjs +1 -1
- package/dist/index42.mjs +1 -1
- package/dist/index45.mjs +3 -3
- package/dist/index46.mjs +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index54.mjs +17 -17
- package/dist/index69.mjs +153 -2
- package/dist/index7.mjs +1 -1
- package/dist/index70.mjs +2 -75
- package/dist/index71.mjs +23 -15
- package/dist/index72.mjs +68 -56
- package/dist/index73.mjs +15 -23
- package/dist/index74.mjs +58 -148
- package/dist/index81.mjs +1 -1
- package/dist/index83.mjs +235 -2
- package/dist/index84.mjs +4 -233
- package/dist/index85.mjs +133 -5
- package/dist/index86.mjs +63 -129
- package/dist/index87.mjs +86 -67
- package/dist/index88.mjs +27 -85
- package/dist/index89.mjs +8 -28
- package/dist/index90.mjs +74 -8
- package/dist/index91.mjs +3 -74
- package/dist/index92.mjs +2 -4
- package/dist/index93.mjs +83 -2
- package/dist/index94.mjs +52 -81
- package/dist/index95.mjs +5 -53
- package/dist/index96.mjs +4 -5
- package/dist/index97.mjs +178 -4
- package/dist/index98.mjs +48 -174
- package/dist/index99.mjs +67 -51
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/providers/MetaPixelProvider.d.ts +2 -1
- package/dist/providers/MetaPixelProvider.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/contexts/CartContext.tsx +50 -22
- package/src/lib/utils.ts +11 -0
- package/src/providers/MetaPixelProvider.tsx +16 -3
package/dist/index3.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { createContext as
|
|
2
|
+
import { jsxs as dt, jsx as ft } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as lt, useState as x, useRef as P, useEffect as f, useCallback as a, useContext as Ct } from "react";
|
|
4
4
|
import "./index23.mjs";
|
|
5
|
-
import { queryKeys as
|
|
6
|
-
import { useGetCart as
|
|
7
|
-
import { useQueryClient as
|
|
8
|
-
import { ShoppingCart as
|
|
9
|
-
import { useMetaPixel as
|
|
10
|
-
import { useTikTokPixel as
|
|
11
|
-
import { getFbCookies as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const [t, m] =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, []),
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
m(
|
|
5
|
+
import { queryKeys as pt } from "./index32.mjs";
|
|
6
|
+
import { useGetCart as It, useCreateCart as kt, useAddCartItem as wt, useUpdateCartItem as ht, useRemoveCartItem as yt, useApplyDiscount as vt, useRemoveDiscount as Tt, useUpdateCart as gt, useCheckoutCart as At, useInitiateCheckout as Dt } from "./index35.mjs";
|
|
7
|
+
import { useQueryClient as Mt } from "@tanstack/react-query";
|
|
8
|
+
import { ShoppingCart as Et } from "./index13.mjs";
|
|
9
|
+
import { useMetaPixel as St } from "./index4.mjs";
|
|
10
|
+
import { useTikTokPixel as xt } from "./index5.mjs";
|
|
11
|
+
import { getFbCookies as j, getTikTokCookies as O, generateClientEventId as Pt } from "./index22.mjs";
|
|
12
|
+
const l = "oms_cart_id", Q = lt(null);
|
|
13
|
+
function Ot({ children: C, brandSlug: u, initialCartId: p, shoppingCartProps: $ }) {
|
|
14
|
+
const [t, m] = x(p || null), [I, y] = x(!1), [G, H] = x(!1), _ = P(!1), R = P(!1), v = P(!1), Y = Mt(), { trackAddToCart: T, trackInitiateCheckout: g } = St(), { trackAddToCart: A, trackInitiateCheckout: D } = xt();
|
|
15
|
+
f(() => {
|
|
16
|
+
H(!0);
|
|
17
|
+
}, []), f(() => {
|
|
18
|
+
if (p || _.current) return;
|
|
19
|
+
_.current = !0;
|
|
20
|
+
const o = new URLSearchParams(window.location.search).get("cartId");
|
|
21
|
+
if (o) {
|
|
22
|
+
m(o), y(!0);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const { data:
|
|
25
|
+
const c = localStorage.getItem(l);
|
|
26
|
+
c && m(c);
|
|
27
|
+
}, [p]);
|
|
28
|
+
const { data: n, isLoading: z, error: k, refetch: s } = It(t || "", {
|
|
29
29
|
enabled: !!t,
|
|
30
30
|
retry: !1
|
|
31
31
|
// Don't retry on failure - cart might be invalid/expired
|
|
32
|
-
}),
|
|
32
|
+
}), M = kt({
|
|
33
33
|
onSuccess: (e) => {
|
|
34
34
|
if ("error" in e) {
|
|
35
35
|
console.error("Failed to create cart:", e.error);
|
|
@@ -42,149 +42,167 @@ function Lt({ children: l, brandSlug: u, initialCartId: C, shoppingCartProps: q
|
|
|
42
42
|
},
|
|
43
43
|
retry: 10
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
f(() => {
|
|
46
46
|
if (R.current) return;
|
|
47
47
|
R.current = !0;
|
|
48
48
|
const e = setTimeout(() => {
|
|
49
|
-
!(typeof window < "u" ? localStorage.getItem(
|
|
49
|
+
!(typeof window < "u" ? localStorage.getItem(l) : null) && !p && M.mutate(u);
|
|
50
50
|
}, 150);
|
|
51
51
|
return () => clearTimeout(e);
|
|
52
|
-
}, []),
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
}, []), f(() => {
|
|
53
|
+
k && t && !v.current && (v.current = !0, console.warn("Cart fetch failed, creating new cart:", k), m(null), typeof window < "u" && localStorage.removeItem(l), setTimeout(() => {
|
|
54
|
+
M.mutate(u), v.current = !1;
|
|
55
55
|
}, 100));
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
58
|
-
onSuccess: () =>
|
|
59
|
-
}),
|
|
60
|
-
onSuccess: () =>
|
|
61
|
-
}),
|
|
56
|
+
}, [k, t, u]);
|
|
57
|
+
const B = wt(t || "", {
|
|
58
|
+
onSuccess: () => s()
|
|
59
|
+
}), J = ht(t || "", {
|
|
60
|
+
onSuccess: () => s()
|
|
61
|
+
}), V = yt(t || "", {
|
|
62
62
|
onSuccess: () => {
|
|
63
|
-
|
|
63
|
+
s(), t && Y.invalidateQueries({ queryKey: pt.public.carts.recommendations(t) });
|
|
64
64
|
}
|
|
65
|
-
}),
|
|
66
|
-
onSuccess: () =>
|
|
67
|
-
}),
|
|
68
|
-
onSuccess: () =>
|
|
69
|
-
}),
|
|
70
|
-
onSuccess: () =>
|
|
65
|
+
}), W = vt(t || "", {
|
|
66
|
+
onSuccess: () => s()
|
|
67
|
+
}), X = Tt(t || "", {
|
|
68
|
+
onSuccess: () => s()
|
|
69
|
+
}), Z = gt(t || "", {
|
|
70
|
+
onSuccess: () => s(),
|
|
71
71
|
retry: 3
|
|
72
|
-
}),
|
|
72
|
+
}), tt = At(t || "", {
|
|
73
73
|
onSuccess: () => {
|
|
74
74
|
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
t && typeof window < "u" && localStorage.setItem(
|
|
75
|
+
}), b = Dt(t || "");
|
|
76
|
+
f(() => {
|
|
77
|
+
t && typeof window < "u" && localStorage.setItem(l, t);
|
|
78
78
|
}, [t]);
|
|
79
|
-
const
|
|
80
|
-
async (e,
|
|
81
|
-
var
|
|
79
|
+
const et = a(
|
|
80
|
+
async (e, o, c, i, r) => {
|
|
81
|
+
var K;
|
|
82
82
|
if (!t) throw new Error("No cart ID");
|
|
83
|
-
const { fbc:
|
|
84
|
-
sku:
|
|
85
|
-
quantity:
|
|
86
|
-
fbc:
|
|
87
|
-
fbp:
|
|
88
|
-
ttp:
|
|
89
|
-
ttclid:
|
|
83
|
+
const { fbc: d, fbp: E } = j(), { ttp: S, ttclid: mt } = O(), N = await B.mutateAsync({
|
|
84
|
+
sku: i,
|
|
85
|
+
quantity: r,
|
|
86
|
+
fbc: d,
|
|
87
|
+
fbp: E,
|
|
88
|
+
ttp: S,
|
|
89
|
+
ttclid: mt,
|
|
90
90
|
refreshRecommendations: !I
|
|
91
91
|
});
|
|
92
|
-
if ("error" in
|
|
93
|
-
const
|
|
94
|
-
(
|
|
95
|
-
var
|
|
96
|
-
return ((
|
|
92
|
+
if ("error" in N) return;
|
|
93
|
+
const w = (K = N.items) == null ? void 0 : K.filter(
|
|
94
|
+
(h) => {
|
|
95
|
+
var L;
|
|
96
|
+
return ((L = h.variant) == null ? void 0 : L.sku) === i;
|
|
97
97
|
}
|
|
98
|
-
),
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
98
|
+
), U = w == null ? void 0 : w[w.length - 1];
|
|
99
|
+
if (U) {
|
|
100
|
+
const h = `cart_${t}_item_${U.id}`;
|
|
101
|
+
T(i, o, c, r, h), A(e, o, c, r, h);
|
|
102
102
|
} else
|
|
103
|
-
|
|
103
|
+
T(i, o, c, r), A(e, o, c, r);
|
|
104
104
|
},
|
|
105
105
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
-
[t, I,
|
|
107
|
-
),
|
|
108
|
-
async (e,
|
|
106
|
+
[t, I, T, A]
|
|
107
|
+
), rt = a(
|
|
108
|
+
async (e, o) => {
|
|
109
109
|
if (!t) throw new Error("No cart ID");
|
|
110
|
-
await
|
|
110
|
+
await J.mutateAsync({ itemId: e, quantity: o });
|
|
111
111
|
},
|
|
112
112
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
113
|
[t]
|
|
114
|
-
),
|
|
114
|
+
), ot = a(
|
|
115
115
|
async (e) => {
|
|
116
116
|
if (!t) throw new Error("No cart ID");
|
|
117
|
-
await
|
|
117
|
+
await V.mutateAsync(e);
|
|
118
118
|
},
|
|
119
119
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
120
|
[t]
|
|
121
|
-
),
|
|
121
|
+
), nt = a(
|
|
122
122
|
async (e) => {
|
|
123
123
|
if (!t) throw new Error("No cart ID");
|
|
124
|
-
await
|
|
124
|
+
await W.mutateAsync({ code: e });
|
|
125
125
|
},
|
|
126
126
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
127
|
[t]
|
|
128
|
-
),
|
|
128
|
+
), ct = a(async () => {
|
|
129
129
|
if (!t) throw new Error("No cart ID");
|
|
130
|
-
await
|
|
131
|
-
}, [t]), F =
|
|
132
|
-
m(null), typeof window < "u" && localStorage.removeItem(
|
|
133
|
-
}, []),
|
|
134
|
-
F(),
|
|
135
|
-
}, [u]),
|
|
136
|
-
|
|
137
|
-
}, []),
|
|
138
|
-
|
|
139
|
-
}, []),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
130
|
+
await X.mutateAsync();
|
|
131
|
+
}, [t]), F = a(() => {
|
|
132
|
+
m(null), typeof window < "u" && localStorage.removeItem(l);
|
|
133
|
+
}, []), at = a(() => {
|
|
134
|
+
F(), M.mutate(u);
|
|
135
|
+
}, [u]), st = a(() => {
|
|
136
|
+
y(!0);
|
|
137
|
+
}, []), q = a(() => {
|
|
138
|
+
y(!1);
|
|
139
|
+
}, []), it = a(async () => {
|
|
140
|
+
if (!(!n || !n.pricing))
|
|
141
|
+
try {
|
|
142
|
+
const e = Pt("cart", n.id, "checkout"), o = n.pricing.total, c = n.items.reduce((r, d) => r + d.quantity, 0), i = n.items.map((r) => ({
|
|
143
|
+
id: r.variant.sku,
|
|
144
|
+
quantity: r.quantity,
|
|
145
|
+
item_price: Number(r.variant.price)
|
|
146
|
+
}));
|
|
147
|
+
if (g && g(o, c, i, e), n.brand.metaPixelId || n.brand.tiktokPixelId) {
|
|
148
|
+
const { fbc: r, fbp: d } = j(), { ttp: E, ttclid: S } = O();
|
|
149
|
+
b.mutate({
|
|
150
|
+
email: n.customerEmail,
|
|
151
|
+
phone: n.customerPhone,
|
|
152
|
+
fbc: r,
|
|
153
|
+
fbp: d,
|
|
154
|
+
ttp: E,
|
|
155
|
+
ttclid: S
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
D && D(o, c, e, i.map((r) => ({
|
|
159
|
+
content_id: r.id,
|
|
160
|
+
quantity: r.quantity,
|
|
161
|
+
price: r.item_price
|
|
162
|
+
})));
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.error("Error tracking initiate checkout:", e);
|
|
165
|
+
}
|
|
166
|
+
}, [n, g, D, b]), ut = {
|
|
167
|
+
cart: n || null,
|
|
150
168
|
cartId: t,
|
|
151
|
-
isLoading:
|
|
152
|
-
error:
|
|
153
|
-
updateCartMutation:
|
|
154
|
-
checkoutMutation:
|
|
155
|
-
addItem:
|
|
156
|
-
updateItem:
|
|
157
|
-
removeItem:
|
|
158
|
-
applyDiscount:
|
|
159
|
-
removeDiscount:
|
|
160
|
-
trackCheckoutInitiated:
|
|
169
|
+
isLoading: z,
|
|
170
|
+
error: k,
|
|
171
|
+
updateCartMutation: Z,
|
|
172
|
+
checkoutMutation: tt,
|
|
173
|
+
addItem: et,
|
|
174
|
+
updateItem: rt,
|
|
175
|
+
removeItem: ot,
|
|
176
|
+
applyDiscount: nt,
|
|
177
|
+
removeDiscount: ct,
|
|
178
|
+
trackCheckoutInitiated: it,
|
|
161
179
|
clearCart: F,
|
|
162
|
-
clearAndCreateNewCart:
|
|
163
|
-
refetch:
|
|
180
|
+
clearAndCreateNewCart: at,
|
|
181
|
+
refetch: s,
|
|
164
182
|
isOpen: I,
|
|
165
|
-
open:
|
|
166
|
-
close:
|
|
183
|
+
open: st,
|
|
184
|
+
close: q
|
|
167
185
|
};
|
|
168
|
-
return /* @__PURE__ */
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
186
|
+
return /* @__PURE__ */ dt(Q.Provider, { value: ut, children: [
|
|
187
|
+
C,
|
|
188
|
+
G && /* @__PURE__ */ ft(
|
|
189
|
+
Et,
|
|
172
190
|
{
|
|
173
191
|
isOpen: I,
|
|
174
|
-
onClose:
|
|
175
|
-
|
|
192
|
+
onClose: q,
|
|
193
|
+
...$
|
|
176
194
|
}
|
|
177
195
|
)
|
|
178
196
|
] });
|
|
179
197
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
if (!
|
|
198
|
+
function Qt() {
|
|
199
|
+
const C = Ct(Q);
|
|
200
|
+
if (!C)
|
|
183
201
|
throw new Error("useCart must be used within CartProvider");
|
|
184
|
-
return
|
|
202
|
+
return C;
|
|
185
203
|
}
|
|
186
204
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
205
|
+
Q as CartContext,
|
|
206
|
+
Ot as CartProvider,
|
|
207
|
+
Qt as useCart
|
|
190
208
|
};
|
package/dist/index30.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { createRpcClients as o } from "./index26.mjs";
|
|
3
|
-
|
|
4
|
-
async function
|
|
5
|
-
const e = await o(
|
|
3
|
+
const n = "https://oms-api.instock.com.ng";
|
|
4
|
+
async function r(t) {
|
|
5
|
+
const e = await o(n).deliveryZones.index.$get({
|
|
6
6
|
query: t ? { brandId: t } : {}
|
|
7
7
|
});
|
|
8
8
|
if (!e.ok)
|
|
@@ -10,5 +10,5 @@ async function c(t) {
|
|
|
10
10
|
return e.json();
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
r as fetchDeliveryZones
|
|
14
14
|
};
|
package/dist/index31.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createRpcClients as
|
|
3
|
-
|
|
4
|
-
async function c(
|
|
5
|
-
const t = await
|
|
6
|
-
param: { slug:
|
|
2
|
+
import { createRpcClients as s } from "./index26.mjs";
|
|
3
|
+
const o = "https://oms-api.instock.com.ng";
|
|
4
|
+
async function c(n) {
|
|
5
|
+
const t = await s(o).brands[":slug"].$get({
|
|
6
|
+
param: { slug: n }
|
|
7
7
|
});
|
|
8
8
|
if (!t.ok)
|
|
9
9
|
throw new Error(`Failed to fetch brand: ${t.statusText}`);
|
package/dist/index33.mjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useAddCartItem as r, useApplyDiscount as s, useCheckoutCart as
|
|
3
|
-
import {
|
|
4
|
-
import { useGetProduct as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { useAddCartItem as r, useApplyDiscount as s, useCheckoutCart as u, useCreateCart as o, useGetCart as a, useGetCartRecommendations as d, useInitiateCheckout as m, useRemoveCartItem as C, useRemoveDiscount as n, useUpdateCart as c, useUpdateCartItem as p } from "./index35.mjs";
|
|
3
|
+
import { useGetBrand as i } from "./index36.mjs";
|
|
4
|
+
import { useGetProduct as x, useGetProductAddOns as I, useGetProducts as O } from "./index37.mjs";
|
|
5
|
+
import { useConfirmOrder as v, useGetOrder as A, useGetOrderRecommendations as D } from "./index38.mjs";
|
|
6
|
+
import { useGetDeliveryZones as h } from "./index39.mjs";
|
|
7
7
|
export {
|
|
8
8
|
r as useAddCartItem,
|
|
9
9
|
s as useApplyDiscount,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
C as
|
|
24
|
-
n as
|
|
10
|
+
u as useCheckoutCart,
|
|
11
|
+
v as useConfirmOrder,
|
|
12
|
+
o as useCreateCart,
|
|
13
|
+
i as useGetBrand,
|
|
14
|
+
a as useGetCart,
|
|
15
|
+
d as useGetCartRecommendations,
|
|
16
|
+
h as useGetDeliveryZones,
|
|
17
|
+
A as useGetOrder,
|
|
18
|
+
D as useGetOrderRecommendations,
|
|
19
|
+
x as useGetProduct,
|
|
20
|
+
I as useGetProductAddOns,
|
|
21
|
+
O as useGetProducts,
|
|
22
|
+
m as useInitiateCheckout,
|
|
23
|
+
C as useRemoveCartItem,
|
|
24
|
+
n as useRemoveDiscount,
|
|
25
|
+
c as useUpdateCart,
|
|
25
26
|
p as useUpdateCartItem
|
|
26
27
|
};
|
package/dist/index35.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryClient as
|
|
2
|
+
import { useQueryClient as o, useMutation as r } from "@tanstack/react-query";
|
|
3
3
|
import { useQueryUnwrapped as c } from "./index75.mjs";
|
|
4
4
|
import { queryKeys as i } from "./index32.mjs";
|
|
5
|
-
import { updateCart as a, createCart as l, applyDiscount as m, removeDiscount as y, addCartItem as p, updateCartItem as C, removeCartItem as q, checkoutCart as f,
|
|
5
|
+
import { updateCart as a, createCart as l, applyDiscount as m, removeDiscount as y, addCartItem as p, updateCartItem as C, removeCartItem as q, checkoutCart as f, initiateCheckout as d, fetchCart as b, fetchCartRecommendations as v } from "./index28.mjs";
|
|
6
6
|
function S(e, t) {
|
|
7
7
|
return c({
|
|
8
8
|
queryKey: i.public.carts.detail(e),
|
|
9
|
-
queryFn: () =>
|
|
9
|
+
queryFn: () => b(e),
|
|
10
10
|
...t
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const u =
|
|
13
|
+
function k(e, t) {
|
|
14
|
+
const u = o();
|
|
15
15
|
return r({
|
|
16
16
|
mutationFn: (n) => a(e, n),
|
|
17
17
|
onSuccess: () => {
|
|
@@ -27,7 +27,7 @@ function R(e) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function D(e, t) {
|
|
30
|
-
const u =
|
|
30
|
+
const u = o();
|
|
31
31
|
return r({
|
|
32
32
|
mutationFn: (n) => m(e, n.code),
|
|
33
33
|
onSuccess: () => {
|
|
@@ -36,8 +36,8 @@ function D(e, t) {
|
|
|
36
36
|
...t
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const u =
|
|
39
|
+
function U(e, t) {
|
|
40
|
+
const u = o();
|
|
41
41
|
return r({
|
|
42
42
|
mutationFn: () => y(e),
|
|
43
43
|
onSuccess: () => {
|
|
@@ -46,28 +46,28 @@ function k(e, t) {
|
|
|
46
46
|
...t
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const u =
|
|
49
|
+
function A(e, t) {
|
|
50
|
+
const u = o();
|
|
51
51
|
return r({
|
|
52
52
|
mutationFn: (n) => p(e, n.sku, n.quantity, n.fbc, n.fbp, n.ttp, n.ttclid),
|
|
53
|
-
onSuccess: (n,
|
|
54
|
-
u.invalidateQueries({ queryKey: i.public.carts.detail(e) }),
|
|
53
|
+
onSuccess: (n, s) => {
|
|
54
|
+
u.invalidateQueries({ queryKey: i.public.carts.detail(e) }), s.refreshRecommendations && u.invalidateQueries({ queryKey: i.public.carts.recommendations(e) });
|
|
55
55
|
},
|
|
56
56
|
...t
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
const u =
|
|
59
|
+
function G(e, t) {
|
|
60
|
+
const u = o();
|
|
61
61
|
return r({
|
|
62
|
-
mutationFn: ({ itemId: n, quantity:
|
|
62
|
+
mutationFn: ({ itemId: n, quantity: s }) => C(e, n, s),
|
|
63
63
|
onSuccess: () => {
|
|
64
64
|
u.invalidateQueries({ queryKey: i.public.carts.detail(e) });
|
|
65
65
|
},
|
|
66
66
|
...t
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const u =
|
|
69
|
+
function w(e, t) {
|
|
70
|
+
const u = o();
|
|
71
71
|
return r({
|
|
72
72
|
mutationFn: (n) => q(e, n),
|
|
73
73
|
onSuccess: () => {
|
|
@@ -76,8 +76,8 @@ function G(e, t) {
|
|
|
76
76
|
...t
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const u =
|
|
79
|
+
function x(e, t) {
|
|
80
|
+
const u = o();
|
|
81
81
|
return r({
|
|
82
82
|
mutationFn: (n) => f(e, n),
|
|
83
83
|
onSuccess: () => {
|
|
@@ -86,23 +86,30 @@ function w(e, t) {
|
|
|
86
86
|
...t
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function M(e, t) {
|
|
90
|
+
return r({
|
|
91
|
+
mutationFn: (u) => d(e, u),
|
|
92
|
+
...t
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function _(e, t, u) {
|
|
90
96
|
return c({
|
|
91
97
|
queryKey: e ? i.public.carts.recommendations(e, t) : ["public", "carts", "recommendations"],
|
|
92
|
-
queryFn: () =>
|
|
98
|
+
queryFn: () => v(e, t),
|
|
93
99
|
enabled: !!e,
|
|
94
100
|
...u
|
|
95
101
|
});
|
|
96
102
|
}
|
|
97
103
|
export {
|
|
98
|
-
|
|
104
|
+
A as useAddCartItem,
|
|
99
105
|
D as useApplyDiscount,
|
|
100
|
-
|
|
106
|
+
x as useCheckoutCart,
|
|
101
107
|
R as useCreateCart,
|
|
102
108
|
S as useGetCart,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
_ as useGetCartRecommendations,
|
|
110
|
+
M as useInitiateCheckout,
|
|
111
|
+
w as useRemoveCartItem,
|
|
112
|
+
U as useRemoveDiscount,
|
|
113
|
+
k as useUpdateCart,
|
|
114
|
+
G as useUpdateCartItem
|
|
108
115
|
};
|
package/dist/index36.mjs
CHANGED
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
queryFn: () => c(e, r),
|
|
10
|
-
...n
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function O(e) {
|
|
14
|
-
return m({
|
|
15
|
-
mutationFn: (r) => i(r.orderId, r.token),
|
|
2
|
+
import { useQueryUnwrapped as t } from "./index75.mjs";
|
|
3
|
+
import { queryKeys as u } from "./index32.mjs";
|
|
4
|
+
import { fetchBrandBySlug as n } from "./index31.mjs";
|
|
5
|
+
function i(r, e) {
|
|
6
|
+
return t({
|
|
7
|
+
queryKey: u.public.brands.detail(r),
|
|
8
|
+
queryFn: () => n(r),
|
|
16
9
|
...e
|
|
17
10
|
});
|
|
18
11
|
}
|
|
19
|
-
function q(e, r, n = 4, t) {
|
|
20
|
-
return u({
|
|
21
|
-
queryKey: o.public.orders.recommendations(e, r, n),
|
|
22
|
-
queryFn: () => f(e, r, n),
|
|
23
|
-
enabled: !!e && !!r,
|
|
24
|
-
...t
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
12
|
export {
|
|
28
|
-
|
|
29
|
-
a as useGetOrder,
|
|
30
|
-
q as useGetOrderRecommendations
|
|
13
|
+
i as useGetBrand
|
|
31
14
|
};
|
package/dist/index38.mjs
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useMutation as m } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as u } from "./index75.mjs";
|
|
4
|
+
import { queryKeys as o } from "./index32.mjs";
|
|
5
|
+
import { confirmOrder as i, fetchOrder as c, fetchOrderRecommendations as f } from "./index29.mjs";
|
|
6
|
+
function a(e, r, n) {
|
|
7
|
+
return u({
|
|
8
|
+
queryKey: o.public.orders.detail(e, r),
|
|
9
|
+
queryFn: () => c(e, r),
|
|
10
|
+
...n
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function O(e) {
|
|
14
|
+
return m({
|
|
15
|
+
mutationFn: (r) => i(r.orderId, r.token),
|
|
16
|
+
...e
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function q(e, r, n = 4, t) {
|
|
20
|
+
return u({
|
|
21
|
+
queryKey: o.public.orders.recommendations(e, r, n),
|
|
22
|
+
queryFn: () => f(e, r, n),
|
|
23
|
+
enabled: !!e && !!r,
|
|
24
|
+
...t
|
|
10
25
|
});
|
|
11
26
|
}
|
|
12
27
|
export {
|
|
13
|
-
|
|
28
|
+
O as useConfirmOrder,
|
|
29
|
+
a as useGetOrder,
|
|
30
|
+
q as useGetOrderRecommendations
|
|
14
31
|
};
|
package/dist/index39.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryUnwrapped as
|
|
3
|
-
import { queryKeys as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
queryKey:
|
|
8
|
-
queryFn: () =>
|
|
9
|
-
...
|
|
2
|
+
import { useQueryUnwrapped as o } from "./index75.mjs";
|
|
3
|
+
import { queryKeys as i } from "./index32.mjs";
|
|
4
|
+
import { fetchDeliveryZones as t } from "./index30.mjs";
|
|
5
|
+
function p(e, r) {
|
|
6
|
+
return o({
|
|
7
|
+
queryKey: i.public.deliveryZones.list(e),
|
|
8
|
+
queryFn: () => t(e),
|
|
9
|
+
...r
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
p as useGetDeliveryZones
|
|
14
14
|
};
|