@instockng/storefront-ui 1.0.10 → 1.0.12
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/README.md +26 -0
- package/dist/components/Checkout.d.ts.map +1 -1
- package/dist/components/ShoppingCart.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index10.mjs +144 -141
- package/dist/index101.mjs +1 -1
- package/dist/index102.mjs +3 -3
- package/dist/index103.mjs +3 -3
- package/dist/index105.mjs +1 -1
- package/dist/index111.mjs +1 -1
- package/dist/index20.mjs +2 -2
- package/dist/index21.mjs +1 -1
- package/dist/index28.mjs +11 -11
- package/dist/index3.mjs +88 -78
- package/dist/index37.mjs +1 -1
- package/dist/index41.mjs +36 -23
- package/dist/index42.mjs +44 -36
- package/dist/index43.mjs +99 -44
- package/dist/index44.mjs +112 -99
- package/dist/index45.mjs +44 -80
- package/dist/index46.mjs +64 -53
- package/dist/index47.mjs +65 -48
- package/dist/index48.mjs +54 -73
- package/dist/index49.mjs +52 -63
- package/dist/index50.mjs +14 -70
- package/dist/index51.mjs +13 -14
- package/dist/index52.mjs +58 -13
- package/dist/index53.mjs +101 -34
- package/dist/index54.mjs +99 -95
- package/dist/index55.mjs +22 -132
- package/dist/index62.mjs +30 -231
- package/dist/index63.mjs +42 -5
- package/dist/index64.mjs +228 -127
- package/dist/index65.mjs +4 -66
- package/dist/index66.mjs +124 -77
- package/dist/index67.mjs +65 -26
- package/dist/index68.mjs +84 -6
- package/dist/index69.mjs +26 -72
- package/dist/index70.mjs +8 -3
- package/dist/index71.mjs +75 -2
- package/dist/index72.mjs +3 -82
- package/dist/index73.mjs +2 -54
- package/dist/index74.mjs +82 -5
- package/dist/index75.mjs +53 -4
- package/dist/index76.mjs +5 -178
- package/dist/index77.mjs +5 -53
- package/dist/index78.mjs +178 -68
- package/dist/index79.mjs +50 -31
- package/dist/index8.mjs +8 -7
- package/dist/index80.mjs +69 -43
- package/dist/index81.mjs +2 -2
- package/dist/index82.mjs +1 -1
- package/dist/index83.mjs +6 -6
- package/dist/index84.mjs +2 -2
- package/dist/index85.mjs +2 -2
- package/dist/index87.mjs +2 -2
- package/dist/index88.mjs +2 -2
- package/dist/index89.mjs +1 -1
- package/dist/index91.mjs +4 -4
- package/dist/index92.mjs +3 -3
- package/dist/index93.mjs +12 -30
- package/dist/index94.mjs +7 -11
- package/dist/index95.mjs +30 -3
- package/dist/index96.mjs +10 -3
- package/dist/index97.mjs +4 -13
- package/dist/index98.mjs +4 -7
- package/dist/index99.mjs +1 -1
- package/dist/styles.css +1 -0
- package/package.json +14 -13
- package/src/components/CartItem.stories.tsx +94 -0
- package/src/components/CartItem.tsx +141 -0
- package/src/components/Checkout.stories.tsx +380 -0
- package/src/components/Checkout.tsx +954 -0
- package/src/components/DiscountCodeInput.stories.tsx +76 -0
- package/src/components/DiscountCodeInput.tsx +162 -0
- package/src/components/OrderConfirmation.stories.tsx +142 -0
- package/src/components/OrderConfirmation.tsx +301 -0
- package/src/components/ProductCard.stories.tsx +112 -0
- package/src/components/ProductCard.tsx +195 -0
- package/src/components/ProductGrid.stories.tsx +137 -0
- package/src/components/ProductGrid.tsx +141 -0
- package/src/components/ShoppingCart.stories.tsx +459 -0
- package/src/components/ShoppingCart.tsx +263 -0
- package/src/components/ui/badge.tsx +37 -0
- package/src/components/ui/button.tsx +71 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/form-input.tsx +78 -0
- package/src/components/ui/form-select.tsx +73 -0
- package/src/components/ui/modal.tsx +181 -0
- package/src/contexts/CartContext.tsx +316 -0
- package/src/hooks/usePaystackPayment.ts +137 -0
- package/src/index.ts +51 -0
- package/src/lib/utils.ts +45 -0
- package/src/paystack.svg +67 -0
- package/src/providers/StorefrontProvider.tsx +70 -0
- package/src/styles.css +1 -0
- package/src/test-utils/MockCartProvider.tsx +424 -0
- package/src/vite-env.d.ts +12 -0
package/dist/index52.mjs
CHANGED
|
@@ -1,20 +1,65 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useQueryClient as l, useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as c } from "./index61.mjs";
|
|
4
|
+
import { createAdminRpcClients as s, authHeaders as o } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as u } from "./index19.mjs";
|
|
7
|
+
function m(e, n) {
|
|
8
|
+
const { baseURL: a, authToken: r } = u();
|
|
9
|
+
return c({
|
|
10
|
+
queryKey: i.admin.abandonedCarts.list(e),
|
|
10
11
|
queryFn: async () => {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
return
|
|
12
|
+
const t = await s(a).abandonedCarts.index.$get({ query: e }, o(r));
|
|
13
|
+
if (!t.ok) throw new Error(`Failed to fetch abandoned carts: ${t.statusText}`);
|
|
14
|
+
return t.json();
|
|
14
15
|
},
|
|
15
|
-
...
|
|
16
|
+
...n
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function p(e, n) {
|
|
20
|
+
const { baseURL: a, authToken: r } = u();
|
|
21
|
+
return c({
|
|
22
|
+
queryKey: i.admin.abandonedCarts.stats(e == null ? void 0 : e.brandId),
|
|
23
|
+
queryFn: async () => {
|
|
24
|
+
const t = await s(a).abandonedCarts.stats.$get({ query: e }, o(r));
|
|
25
|
+
if (!t.ok) throw new Error(`Failed to fetch abandoned cart stats: ${t.statusText}`);
|
|
26
|
+
return t.json();
|
|
27
|
+
},
|
|
28
|
+
...n
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function q(e, n) {
|
|
32
|
+
const { baseURL: a, authToken: r } = u();
|
|
33
|
+
return c({
|
|
34
|
+
queryKey: i.admin.abandonedCarts.detail(e),
|
|
35
|
+
queryFn: async () => {
|
|
36
|
+
const t = await s(a).abandonedCarts[":id"].$get(
|
|
37
|
+
{ param: { id: e } },
|
|
38
|
+
o(r)
|
|
39
|
+
);
|
|
40
|
+
if (!t.ok) throw new Error(`Failed to fetch abandoned cart: ${t.statusText}`);
|
|
41
|
+
return t.json();
|
|
42
|
+
},
|
|
43
|
+
...n
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function k(e) {
|
|
47
|
+
const { baseURL: n, authToken: a } = u(), r = l();
|
|
48
|
+
return y({
|
|
49
|
+
mutationFn: async () => {
|
|
50
|
+
const t = await s(n).abandonedCarts.cleanup.$post({}, o(a));
|
|
51
|
+
if (!t.ok) throw new Error(`Failed to cleanup expired carts: ${t.statusText}`);
|
|
52
|
+
return t.json();
|
|
53
|
+
},
|
|
54
|
+
onSuccess: () => {
|
|
55
|
+
r.invalidateQueries({ queryKey: i.admin.abandonedCarts.all });
|
|
56
|
+
},
|
|
57
|
+
...e
|
|
16
58
|
});
|
|
17
59
|
}
|
|
18
60
|
export {
|
|
19
|
-
|
|
61
|
+
k as useCleanupExpiredCarts,
|
|
62
|
+
q as useGetAbandonedCart,
|
|
63
|
+
p as useGetAbandonedCartStats,
|
|
64
|
+
m as useListAbandonedCarts
|
|
20
65
|
};
|
package/dist/index53.mjs
CHANGED
|
@@ -1,65 +1,132 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as l, useMutation as y } from "@tanstack/react-query";
|
|
3
|
-
import { useQueryUnwrapped as
|
|
4
|
-
import { createAdminRpcClients as
|
|
5
|
-
import { queryKeys as
|
|
6
|
-
import { useApiConfig as
|
|
7
|
-
function
|
|
8
|
-
const { baseURL:
|
|
9
|
-
return
|
|
10
|
-
queryKey:
|
|
3
|
+
import { useQueryUnwrapped as C } from "./index61.mjs";
|
|
4
|
+
import { createAdminRpcClients as c, authHeaders as a } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as r } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
7
|
+
function p(e, n) {
|
|
8
|
+
const { baseURL: s, authToken: i } = d();
|
|
9
|
+
return C({
|
|
10
|
+
queryKey: r.admin.discountCodes.list(e),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const t = await s
|
|
13
|
-
if (!t.ok) throw new Error(`Failed to fetch
|
|
12
|
+
const t = await c(s).discountCodes.index.$get({ query: e }, a(i));
|
|
13
|
+
if (!t.ok) throw new Error(`Failed to fetch discount codes: ${t.statusText}`);
|
|
14
14
|
return t.json();
|
|
15
15
|
},
|
|
16
16
|
...n
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const { baseURL:
|
|
21
|
-
return
|
|
22
|
-
queryKey:
|
|
19
|
+
function F(e, n) {
|
|
20
|
+
const { baseURL: s, authToken: i } = d();
|
|
21
|
+
return C({
|
|
22
|
+
queryKey: r.admin.discountCodes.detail(e),
|
|
23
23
|
queryFn: async () => {
|
|
24
|
-
const t = await s
|
|
25
|
-
|
|
24
|
+
const t = await c(s).discountCodes[":id"].$get(
|
|
25
|
+
{ param: { id: e } },
|
|
26
|
+
a(i)
|
|
27
|
+
);
|
|
28
|
+
if (!t.ok) throw new Error(`Failed to fetch discount code: ${t.statusText}`);
|
|
26
29
|
return t.json();
|
|
27
30
|
},
|
|
28
31
|
...n
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
const { baseURL:
|
|
33
|
-
return
|
|
34
|
-
|
|
34
|
+
function T(e) {
|
|
35
|
+
const { baseURL: n, authToken: s } = d(), i = l();
|
|
36
|
+
return y({
|
|
37
|
+
mutationFn: async (o) => {
|
|
38
|
+
const u = await c(n).discountCodes.index.$post({ json: o }, a(s));
|
|
39
|
+
if (!u.ok) throw new Error(`Failed to create discount code: ${u.statusText}`);
|
|
40
|
+
return u.json();
|
|
41
|
+
},
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
|
|
44
|
+
},
|
|
45
|
+
...e
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function $(e, n) {
|
|
49
|
+
const { baseURL: s, authToken: i } = d(), o = l();
|
|
50
|
+
return y({
|
|
51
|
+
mutationFn: async (t) => {
|
|
52
|
+
const w = await c(s).discountCodes[":id"].$patch(
|
|
53
|
+
{ json: t, param: { id: e } },
|
|
54
|
+
a(i)
|
|
55
|
+
);
|
|
56
|
+
if (!w.ok) throw new Error(`Failed to update discount code: ${w.statusText}`);
|
|
57
|
+
return w.json();
|
|
58
|
+
},
|
|
59
|
+
onSuccess: () => {
|
|
60
|
+
o.invalidateQueries({ queryKey: r.admin.discountCodes.detail(e) }), o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
|
|
61
|
+
},
|
|
62
|
+
...n
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function v(e, n) {
|
|
66
|
+
const { baseURL: s, authToken: i } = d(), o = l();
|
|
67
|
+
return y({
|
|
68
|
+
mutationFn: async () => {
|
|
69
|
+
const u = await c(s).discountCodes[":id"].$delete(
|
|
70
|
+
{ param: { id: e } },
|
|
71
|
+
a(i)
|
|
72
|
+
);
|
|
73
|
+
if (!u.ok) throw new Error(`Failed to delete discount code: ${u.statusText}`);
|
|
74
|
+
return u.json();
|
|
75
|
+
},
|
|
76
|
+
onSuccess: () => {
|
|
77
|
+
o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
|
|
78
|
+
},
|
|
79
|
+
...n
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function j(e, n) {
|
|
83
|
+
const { baseURL: s, authToken: i } = d();
|
|
84
|
+
return C({
|
|
85
|
+
queryKey: r.admin.discountCodes.analytics(e),
|
|
35
86
|
queryFn: async () => {
|
|
36
|
-
const t = await s
|
|
87
|
+
const t = await c(s).discountCodes[":id"].analytics.$get(
|
|
37
88
|
{ param: { id: e } },
|
|
38
|
-
|
|
89
|
+
a(i)
|
|
39
90
|
);
|
|
40
|
-
if (!t.ok) throw new Error(`Failed to fetch
|
|
91
|
+
if (!t.ok) throw new Error(`Failed to fetch discount code analytics: ${t.statusText}`);
|
|
41
92
|
return t.json();
|
|
42
93
|
},
|
|
43
94
|
...n
|
|
44
95
|
});
|
|
45
96
|
}
|
|
46
|
-
function
|
|
47
|
-
const { baseURL: n, authToken:
|
|
97
|
+
function x(e) {
|
|
98
|
+
const { baseURL: n, authToken: s } = d(), i = l();
|
|
48
99
|
return y({
|
|
49
|
-
mutationFn: async () => {
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
return
|
|
100
|
+
mutationFn: async (o) => {
|
|
101
|
+
const u = await c(n).discountCodes["bulk-generate"].$post({ json: o }, a(s));
|
|
102
|
+
if (!u.ok) throw new Error(`Failed to bulk generate discount codes: ${u.statusText}`);
|
|
103
|
+
return u.json();
|
|
53
104
|
},
|
|
54
105
|
onSuccess: () => {
|
|
55
|
-
|
|
106
|
+
i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
|
|
107
|
+
},
|
|
108
|
+
...e
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function b(e) {
|
|
112
|
+
const { baseURL: n, authToken: s } = d();
|
|
113
|
+
return C({
|
|
114
|
+
queryKey: r.admin.discountCodes.overviewStats(),
|
|
115
|
+
queryFn: async () => {
|
|
116
|
+
const o = await c(n).discountCodes.stats.overview.$get({}, a(s));
|
|
117
|
+
if (!o.ok) throw new Error(`Failed to fetch discount code overview stats: ${o.statusText}`);
|
|
118
|
+
return o.json();
|
|
56
119
|
},
|
|
57
120
|
...e
|
|
58
121
|
});
|
|
59
122
|
}
|
|
60
123
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
124
|
+
x as useBulkGenerateDiscountCodes,
|
|
125
|
+
T as useCreateDiscountCode,
|
|
126
|
+
v as useDeleteDiscountCode,
|
|
127
|
+
F as useGetDiscountCode,
|
|
128
|
+
j as useGetDiscountCodeAnalytics,
|
|
129
|
+
b as useGetDiscountCodeOverviewStats,
|
|
130
|
+
p as useListDiscountCodes,
|
|
131
|
+
$ as useUpdateDiscountCode
|
|
65
132
|
};
|
package/dist/index54.mjs
CHANGED
|
@@ -1,132 +1,136 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useQueryUnwrapped as
|
|
4
|
-
import { createAdminRpcClients as
|
|
5
|
-
import { queryKeys as
|
|
6
|
-
import { useApiConfig as
|
|
7
|
-
function p(
|
|
8
|
-
const { baseURL: s, authToken: i } =
|
|
9
|
-
return
|
|
10
|
-
queryKey:
|
|
2
|
+
import { useQueryClient as y, useMutation as v } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as m } from "./index61.mjs";
|
|
4
|
+
import { createAdminRpcClients as u, authHeaders as l } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as o } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as c } from "./index19.mjs";
|
|
7
|
+
function p(t) {
|
|
8
|
+
const { baseURL: s, authToken: i } = c();
|
|
9
|
+
return m({
|
|
10
|
+
queryKey: o.admin.deliveryZones.states.list(),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
12
|
+
const e = await u(s).deliveryZones.states.$get({}, l(i));
|
|
13
|
+
if (!e.ok) throw new Error(`Failed to fetch states: ${e.statusText}`);
|
|
14
|
+
return e.json();
|
|
15
15
|
},
|
|
16
|
-
...
|
|
16
|
+
...t
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const { baseURL: s, authToken: i } =
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
a(i)
|
|
27
|
-
);
|
|
28
|
-
if (!t.ok) throw new Error(`Failed to fetch discount code: ${t.statusText}`);
|
|
29
|
-
return t.json();
|
|
30
|
-
},
|
|
31
|
-
...n
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function T(e) {
|
|
35
|
-
const { baseURL: n, authToken: s } = d(), i = l();
|
|
36
|
-
return y({
|
|
37
|
-
mutationFn: async (o) => {
|
|
38
|
-
const u = await c(n).discountCodes.index.$post({ json: o }, a(s));
|
|
39
|
-
if (!u.ok) throw new Error(`Failed to create discount code: ${u.statusText}`);
|
|
40
|
-
return u.json();
|
|
19
|
+
function k(t) {
|
|
20
|
+
const { baseURL: s, authToken: i } = c(), r = y();
|
|
21
|
+
return v({
|
|
22
|
+
mutationFn: async (e) => {
|
|
23
|
+
const n = await u(s).deliveryZones.states.$post({ json: e }, l(i));
|
|
24
|
+
if (!n.ok) throw new Error(`Failed to create state: ${n.statusText}`);
|
|
25
|
+
return n.json();
|
|
41
26
|
},
|
|
42
27
|
onSuccess: () => {
|
|
43
|
-
|
|
28
|
+
r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
44
29
|
},
|
|
45
|
-
...
|
|
30
|
+
...t
|
|
46
31
|
});
|
|
47
32
|
}
|
|
48
|
-
function
|
|
49
|
-
const { baseURL:
|
|
50
|
-
return
|
|
51
|
-
mutationFn: async (
|
|
52
|
-
const
|
|
53
|
-
{ json:
|
|
54
|
-
|
|
33
|
+
function F(t, s) {
|
|
34
|
+
const { baseURL: i, authToken: r } = c(), e = y();
|
|
35
|
+
return v({
|
|
36
|
+
mutationFn: async (a) => {
|
|
37
|
+
const d = await u(i).deliveryZones.states[":id"].$patch(
|
|
38
|
+
{ json: a, param: { id: t } },
|
|
39
|
+
l(r)
|
|
55
40
|
);
|
|
56
|
-
if (!
|
|
57
|
-
return
|
|
41
|
+
if (!d.ok) throw new Error(`Failed to update state: ${d.statusText}`);
|
|
42
|
+
return d.json();
|
|
58
43
|
},
|
|
59
44
|
onSuccess: () => {
|
|
60
|
-
|
|
45
|
+
e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
61
46
|
},
|
|
62
|
-
...
|
|
47
|
+
...s
|
|
63
48
|
});
|
|
64
49
|
}
|
|
65
|
-
function
|
|
66
|
-
const { baseURL:
|
|
67
|
-
return
|
|
50
|
+
function T(t, s) {
|
|
51
|
+
const { baseURL: i, authToken: r } = c(), e = y();
|
|
52
|
+
return v({
|
|
68
53
|
mutationFn: async () => {
|
|
69
|
-
const
|
|
70
|
-
{ param: { id:
|
|
71
|
-
|
|
54
|
+
const n = await u(i).deliveryZones.states[":id"].$delete(
|
|
55
|
+
{ param: { id: t } },
|
|
56
|
+
l(r)
|
|
72
57
|
);
|
|
73
|
-
if (!
|
|
74
|
-
return
|
|
58
|
+
if (!n.ok) throw new Error(`Failed to delete state: ${n.statusText}`);
|
|
59
|
+
return n.json();
|
|
75
60
|
},
|
|
76
61
|
onSuccess: () => {
|
|
77
|
-
o.invalidateQueries({ queryKey:
|
|
62
|
+
e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
78
63
|
},
|
|
79
|
-
...
|
|
64
|
+
...s
|
|
80
65
|
});
|
|
81
66
|
}
|
|
82
|
-
function
|
|
83
|
-
const { baseURL:
|
|
84
|
-
return
|
|
85
|
-
queryKey:
|
|
67
|
+
function $(t, s) {
|
|
68
|
+
const { baseURL: i, authToken: r } = c();
|
|
69
|
+
return m({
|
|
70
|
+
queryKey: o.admin.deliveryZones.zones.list(t),
|
|
86
71
|
queryFn: async () => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
);
|
|
91
|
-
if (!t.ok) throw new Error(`Failed to fetch discount code analytics: ${t.statusText}`);
|
|
92
|
-
return t.json();
|
|
72
|
+
const a = await u(i).deliveryZones.zones.$get({ query: t }, l(r));
|
|
73
|
+
if (!a.ok) throw new Error(`Failed to fetch delivery zones: ${a.statusText}`);
|
|
74
|
+
return a.json();
|
|
93
75
|
},
|
|
94
|
-
...
|
|
76
|
+
...s
|
|
95
77
|
});
|
|
96
78
|
}
|
|
97
|
-
function
|
|
98
|
-
const { baseURL:
|
|
99
|
-
return
|
|
100
|
-
mutationFn: async (
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
return
|
|
79
|
+
function z(t) {
|
|
80
|
+
const { baseURL: s, authToken: i } = c(), r = y();
|
|
81
|
+
return v({
|
|
82
|
+
mutationFn: async (e) => {
|
|
83
|
+
const n = await u(s).deliveryZones.zones.$post({ json: e }, l(i));
|
|
84
|
+
if (!n.ok) throw new Error(`Failed to create delivery zone: ${n.statusText}`);
|
|
85
|
+
return n.json();
|
|
104
86
|
},
|
|
105
87
|
onSuccess: () => {
|
|
106
|
-
|
|
88
|
+
r.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all }), r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
107
89
|
},
|
|
108
|
-
...
|
|
90
|
+
...t
|
|
109
91
|
});
|
|
110
92
|
}
|
|
111
|
-
function
|
|
112
|
-
const { baseURL:
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
function K(t, s) {
|
|
94
|
+
const { baseURL: i, authToken: r } = c(), e = y();
|
|
95
|
+
return v({
|
|
96
|
+
mutationFn: async (a) => {
|
|
97
|
+
const d = await u(i).deliveryZones.zones[":id"].$patch(
|
|
98
|
+
{ json: a, param: { id: t } },
|
|
99
|
+
l(r)
|
|
100
|
+
);
|
|
101
|
+
if (!d.ok) throw new Error(`Failed to update delivery zone: ${d.statusText}`);
|
|
102
|
+
return d.json();
|
|
103
|
+
},
|
|
104
|
+
onSuccess: () => {
|
|
105
|
+
e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
106
|
+
},
|
|
107
|
+
...s
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function j(t, s) {
|
|
111
|
+
const { baseURL: i, authToken: r } = c(), e = y();
|
|
112
|
+
return v({
|
|
113
|
+
mutationFn: async () => {
|
|
114
|
+
const n = await u(i).deliveryZones.zones[":id"].$delete(
|
|
115
|
+
{ param: { id: t } },
|
|
116
|
+
l(r)
|
|
117
|
+
);
|
|
118
|
+
if (!n.ok) throw new Error(`Failed to delete delivery zone: ${n.statusText}`);
|
|
119
|
+
return n.json();
|
|
120
|
+
},
|
|
121
|
+
onSuccess: () => {
|
|
122
|
+
e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
119
123
|
},
|
|
120
|
-
...
|
|
124
|
+
...s
|
|
121
125
|
});
|
|
122
126
|
}
|
|
123
127
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
z as useCreateDeliveryZone,
|
|
129
|
+
k as useCreateState,
|
|
130
|
+
j as useDeleteDeliveryZone,
|
|
131
|
+
T as useDeleteState,
|
|
132
|
+
$ as useListDeliveryZones,
|
|
133
|
+
p as useListStates,
|
|
134
|
+
K as useUpdateDeliveryZone,
|
|
135
|
+
F as useUpdateState
|
|
132
136
|
};
|
package/dist/index55.mjs
CHANGED
|
@@ -1,136 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const e =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const n = await u(s).deliveryZones.states.$post({ json: e }, l(i));
|
|
24
|
-
if (!n.ok) throw new Error(`Failed to create state: ${n.statusText}`);
|
|
25
|
-
return n.json();
|
|
26
|
-
},
|
|
27
|
-
onSuccess: () => {
|
|
28
|
-
r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
29
|
-
},
|
|
30
|
-
...t
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function F(t, s) {
|
|
34
|
-
const { baseURL: i, authToken: r } = c(), e = y();
|
|
35
|
-
return v({
|
|
36
|
-
mutationFn: async (a) => {
|
|
37
|
-
const d = await u(i).deliveryZones.states[":id"].$patch(
|
|
38
|
-
{ json: a, param: { id: t } },
|
|
39
|
-
l(r)
|
|
40
|
-
);
|
|
41
|
-
if (!d.ok) throw new Error(`Failed to update state: ${d.statusText}`);
|
|
42
|
-
return d.json();
|
|
43
|
-
},
|
|
44
|
-
onSuccess: () => {
|
|
45
|
-
e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
46
|
-
},
|
|
47
|
-
...s
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function T(t, s) {
|
|
51
|
-
const { baseURL: i, authToken: r } = c(), e = y();
|
|
52
|
-
return v({
|
|
53
|
-
mutationFn: async () => {
|
|
54
|
-
const n = await u(i).deliveryZones.states[":id"].$delete(
|
|
55
|
-
{ param: { id: t } },
|
|
56
|
-
l(r)
|
|
57
|
-
);
|
|
58
|
-
if (!n.ok) throw new Error(`Failed to delete state: ${n.statusText}`);
|
|
59
|
-
return n.json();
|
|
60
|
-
},
|
|
61
|
-
onSuccess: () => {
|
|
62
|
-
e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
63
|
-
},
|
|
64
|
-
...s
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function $(t, s) {
|
|
68
|
-
const { baseURL: i, authToken: r } = c();
|
|
69
|
-
return m({
|
|
70
|
-
queryKey: o.admin.deliveryZones.zones.list(t),
|
|
71
|
-
queryFn: async () => {
|
|
72
|
-
const a = await u(i).deliveryZones.zones.$get({ query: t }, l(r));
|
|
73
|
-
if (!a.ok) throw new Error(`Failed to fetch delivery zones: ${a.statusText}`);
|
|
74
|
-
return a.json();
|
|
75
|
-
},
|
|
76
|
-
...s
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function z(t) {
|
|
80
|
-
const { baseURL: s, authToken: i } = c(), r = y();
|
|
81
|
-
return v({
|
|
82
|
-
mutationFn: async (e) => {
|
|
83
|
-
const n = await u(s).deliveryZones.zones.$post({ json: e }, l(i));
|
|
84
|
-
if (!n.ok) throw new Error(`Failed to create delivery zone: ${n.statusText}`);
|
|
85
|
-
return n.json();
|
|
86
|
-
},
|
|
87
|
-
onSuccess: () => {
|
|
88
|
-
r.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all }), r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
|
|
89
|
-
},
|
|
90
|
-
...t
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function K(t, s) {
|
|
94
|
-
const { baseURL: i, authToken: r } = c(), e = y();
|
|
95
|
-
return v({
|
|
96
|
-
mutationFn: async (a) => {
|
|
97
|
-
const d = await u(i).deliveryZones.zones[":id"].$patch(
|
|
98
|
-
{ json: a, param: { id: t } },
|
|
99
|
-
l(r)
|
|
100
|
-
);
|
|
101
|
-
if (!d.ok) throw new Error(`Failed to update delivery zone: ${d.statusText}`);
|
|
102
|
-
return d.json();
|
|
103
|
-
},
|
|
104
|
-
onSuccess: () => {
|
|
105
|
-
e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
106
|
-
},
|
|
107
|
-
...s
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function j(t, s) {
|
|
111
|
-
const { baseURL: i, authToken: r } = c(), e = y();
|
|
112
|
-
return v({
|
|
113
|
-
mutationFn: async () => {
|
|
114
|
-
const n = await u(i).deliveryZones.zones[":id"].$delete(
|
|
115
|
-
{ param: { id: t } },
|
|
116
|
-
l(r)
|
|
117
|
-
);
|
|
118
|
-
if (!n.ok) throw new Error(`Failed to delete delivery zone: ${n.statusText}`);
|
|
119
|
-
return n.json();
|
|
120
|
-
},
|
|
121
|
-
onSuccess: () => {
|
|
122
|
-
e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
|
|
123
|
-
},
|
|
124
|
-
...s
|
|
125
|
-
});
|
|
2
|
+
import "react";
|
|
3
|
+
function i(n, o) {
|
|
4
|
+
if (typeof n == "function")
|
|
5
|
+
return n(o);
|
|
6
|
+
n != null && (n.current = o);
|
|
7
|
+
}
|
|
8
|
+
function f(...n) {
|
|
9
|
+
return (o) => {
|
|
10
|
+
let u = !1;
|
|
11
|
+
const c = n.map((t) => {
|
|
12
|
+
const e = i(t, o);
|
|
13
|
+
return !u && typeof e == "function" && (u = !0), e;
|
|
14
|
+
});
|
|
15
|
+
if (u)
|
|
16
|
+
return () => {
|
|
17
|
+
for (let t = 0; t < c.length; t++) {
|
|
18
|
+
const e = c[t];
|
|
19
|
+
typeof e == "function" ? e() : i(n[t], null);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
126
23
|
}
|
|
127
24
|
export {
|
|
128
|
-
|
|
129
|
-
k as useCreateState,
|
|
130
|
-
j as useDeleteDeliveryZone,
|
|
131
|
-
T as useDeleteState,
|
|
132
|
-
$ as useListDeliveryZones,
|
|
133
|
-
p as useListStates,
|
|
134
|
-
K as useUpdateDeliveryZone,
|
|
135
|
-
F as useUpdateState
|
|
25
|
+
f as composeRefs
|
|
136
26
|
};
|