@instockng/storefront-ui 1.0.16 → 1.0.17
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/ui/button.d.ts +1 -1
- package/dist/index100.mjs +1 -1
- package/dist/index101.mjs +3 -3
- package/dist/index102.mjs +3 -3
- package/dist/index110.mjs +1 -1
- package/dist/index18.mjs +12 -21
- package/dist/index20.mjs +4 -9
- package/dist/index21.mjs +1 -1
- package/dist/index28.mjs +11 -11
- package/dist/index29.mjs +1 -1
- package/dist/index30.mjs +1 -1
- package/dist/index31.mjs +1 -1
- package/dist/index32.mjs +1 -1
- package/dist/index33.mjs +3 -3
- package/dist/index36.mjs +1 -1
- package/dist/index40.mjs +36 -23
- package/dist/index41.mjs +44 -36
- package/dist/index42.mjs +99 -44
- package/dist/index43.mjs +97 -99
- package/dist/index44.mjs +47 -78
- package/dist/index45.mjs +54 -53
- package/dist/index46.mjs +63 -55
- package/dist/index47.mjs +56 -79
- package/dist/index48.mjs +57 -63
- package/dist/index49.mjs +15 -70
- package/dist/index50.mjs +14 -14
- package/dist/index51.mjs +59 -13
- package/dist/index52.mjs +99 -36
- package/dist/index53.mjs +97 -97
- package/dist/index54.mjs +4 -132
- package/dist/index55.mjs +21 -73
- package/dist/index56.mjs +74 -14
- package/dist/index57.mjs +14 -62
- package/dist/index58.mjs +62 -4
- package/dist/index59.mjs +234 -3
- package/dist/index60.mjs +6 -2
- package/dist/index61.mjs +130 -30
- package/dist/index62.mjs +64 -39
- package/dist/index63.mjs +80 -228
- package/dist/index64.mjs +28 -5
- package/dist/index65.mjs +7 -132
- package/dist/index66.mjs +69 -62
- package/dist/index67.mjs +3 -86
- package/dist/index68.mjs +2 -29
- package/dist/index69.mjs +81 -7
- package/dist/index70.mjs +51 -72
- package/dist/index71.mjs +5 -3
- package/dist/index72.mjs +5 -2
- package/dist/index73.mjs +169 -73
- package/dist/index74.mjs +50 -51
- package/dist/index75.mjs +69 -6
- package/dist/index76.mjs +34 -5
- package/dist/index77.mjs +41 -177
- package/dist/index78.mjs +4 -53
- package/dist/index79.mjs +2 -69
- package/dist/index80.mjs +1 -1
- package/dist/index81.mjs +1 -1
- package/dist/index82.mjs +5 -5
- package/dist/index84.mjs +2 -2
- package/dist/index86.mjs +2 -2
- package/dist/index88.mjs +1 -1
- package/dist/index90.mjs +4 -4
- package/dist/index91.mjs +3 -3
- package/dist/index92.mjs +1 -1
- package/dist/index93.mjs +3 -3
- package/dist/index98.mjs +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -9
- package/dist/test-utils/MockCartProvider.d.ts +0 -21
- package/dist/test-utils/MockCartProvider.d.ts.map +0 -1
package/dist/index43.mjs
CHANGED
|
@@ -1,102 +1,100 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (u) {
|
|
94
|
-
e ?? (e = {});
|
|
95
|
-
const n = C(e, { ...t.args[1] });
|
|
96
|
-
return f.fetch(t.args[0], n);
|
|
97
|
-
}
|
|
98
|
-
return f;
|
|
99
|
-
}, []);
|
|
2
|
+
import { useQueryClient as y, useMutation as m } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as p } from "./index54.mjs";
|
|
4
|
+
import { createAdminRpcClients as d, authHeaders as c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as l } from "./index19.mjs";
|
|
7
|
+
function F(e) {
|
|
8
|
+
const { baseURL: r, authToken: n } = l();
|
|
9
|
+
return p({
|
|
10
|
+
queryKey: i.admin.orders.list(),
|
|
11
|
+
queryFn: async () => {
|
|
12
|
+
const t = await d(r).orders.index.$get({}, c(n));
|
|
13
|
+
if (!t.ok)
|
|
14
|
+
throw new Error(`Failed to fetch orders: ${t.statusText}`);
|
|
15
|
+
return t.json();
|
|
16
|
+
},
|
|
17
|
+
...e
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function T(e, r) {
|
|
21
|
+
const { baseURL: n, authToken: s } = l();
|
|
22
|
+
return p({
|
|
23
|
+
queryKey: i.admin.orders.detail(e),
|
|
24
|
+
queryFn: async () => {
|
|
25
|
+
const o = await d(n).orders[":id"].$get({ param: { id: e } }, c(s));
|
|
26
|
+
if (!o.ok)
|
|
27
|
+
throw new Error(`Failed to fetch order: ${o.statusText}`);
|
|
28
|
+
return o.json();
|
|
29
|
+
},
|
|
30
|
+
...r
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function $(e) {
|
|
34
|
+
const { baseURL: r, authToken: n } = l(), s = y();
|
|
35
|
+
return m({
|
|
36
|
+
mutationFn: async (t) => {
|
|
37
|
+
const a = await d(r).orders.index.$post({ json: t }, c(n));
|
|
38
|
+
if (!a.ok)
|
|
39
|
+
throw new Error(`Failed to create order: ${a.statusText}`);
|
|
40
|
+
return a.json();
|
|
41
|
+
},
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
s.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
44
|
+
},
|
|
45
|
+
...e
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function j(e, r) {
|
|
49
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
50
|
+
return m({
|
|
51
|
+
mutationFn: async (o) => {
|
|
52
|
+
const u = await d(n).orders[":id"].$patch({ param: { id: e }, json: o }, c(s));
|
|
53
|
+
if (!u.ok)
|
|
54
|
+
throw new Error(`Failed to update order: ${u.statusText}`);
|
|
55
|
+
return u.json();
|
|
56
|
+
},
|
|
57
|
+
onSuccess: () => {
|
|
58
|
+
t.invalidateQueries({ queryKey: i.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
59
|
+
},
|
|
60
|
+
...r
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function x(e, r) {
|
|
64
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
65
|
+
return m({
|
|
66
|
+
mutationFn: async (o) => {
|
|
67
|
+
const u = await d(n).orders[":id"].status.$patch({ param: { id: e }, json: o }, c(s));
|
|
68
|
+
if (!u.ok)
|
|
69
|
+
throw new Error(`Failed to update order status: ${u.statusText}`);
|
|
70
|
+
return u.json();
|
|
71
|
+
},
|
|
72
|
+
onSuccess: () => {
|
|
73
|
+
t.invalidateQueries({ queryKey: i.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
74
|
+
},
|
|
75
|
+
...r
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function K(e, r) {
|
|
79
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
80
|
+
return m({
|
|
81
|
+
mutationFn: async () => {
|
|
82
|
+
const a = await d(n).orders[":id"].$delete({ param: { id: e } }, c(s));
|
|
83
|
+
if (!a.ok)
|
|
84
|
+
throw new Error(`Failed to delete order: ${a.statusText}`);
|
|
85
|
+
return a.json();
|
|
86
|
+
},
|
|
87
|
+
onSuccess: () => {
|
|
88
|
+
t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
89
|
+
},
|
|
90
|
+
...r
|
|
91
|
+
});
|
|
92
|
+
}
|
|
100
93
|
export {
|
|
101
|
-
|
|
94
|
+
$ as useCreateOrder,
|
|
95
|
+
K as useDeleteOrder,
|
|
96
|
+
T as useGetOrder,
|
|
97
|
+
F as useListOrders,
|
|
98
|
+
j as useUpdateOrder,
|
|
99
|
+
x as useUpdateOrderStatus
|
|
102
100
|
};
|
package/dist/index44.mjs
CHANGED
|
@@ -1,115 +1,84 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useQueryClient as y, useMutation as m } 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 b } from "./index54.mjs";
|
|
4
|
+
import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as o } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
7
|
+
function k(e) {
|
|
8
|
+
const { baseURL: t, authToken: r } = d();
|
|
9
|
+
return b({
|
|
10
|
+
queryKey: o.admin.brands.list(),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
throw new Error(`Failed to fetch
|
|
15
|
-
return
|
|
12
|
+
const n = await u(t).brands.index.$get({}, c(r));
|
|
13
|
+
if (!n.ok)
|
|
14
|
+
throw new Error(`Failed to fetch brands: ${n.statusText}`);
|
|
15
|
+
return n.json();
|
|
16
16
|
},
|
|
17
17
|
...e
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const { baseURL:
|
|
22
|
-
return
|
|
23
|
-
queryKey:
|
|
20
|
+
function F(e, t) {
|
|
21
|
+
const { baseURL: r, authToken: s } = d();
|
|
22
|
+
return b({
|
|
23
|
+
queryKey: o.admin.brands.detail(e),
|
|
24
24
|
queryFn: async () => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
);
|
|
29
|
-
if (!o.ok)
|
|
30
|
-
throw new Error(`Failed to fetch order: ${o.statusText}`);
|
|
31
|
-
return o.json();
|
|
25
|
+
const i = await u(r).brands[":id"].$get({ param: { id: e } }, c(s));
|
|
26
|
+
if (!i.ok)
|
|
27
|
+
throw new Error(`Failed to fetch brand: ${i.statusText}`);
|
|
28
|
+
return i.json();
|
|
32
29
|
},
|
|
33
|
-
...
|
|
30
|
+
...t
|
|
34
31
|
});
|
|
35
32
|
}
|
|
36
|
-
function
|
|
37
|
-
const { baseURL:
|
|
33
|
+
function T(e) {
|
|
34
|
+
const { baseURL: t, authToken: r } = d(), s = y();
|
|
38
35
|
return m({
|
|
39
|
-
mutationFn: async (
|
|
40
|
-
const a = await
|
|
41
|
-
{ json: t },
|
|
42
|
-
c(n)
|
|
43
|
-
);
|
|
36
|
+
mutationFn: async (n) => {
|
|
37
|
+
const a = await u(t).brands.index.$post({ json: n }, c(r));
|
|
44
38
|
if (!a.ok)
|
|
45
|
-
throw new Error(`Failed to create
|
|
39
|
+
throw new Error(`Failed to create brand: ${a.statusText}`);
|
|
46
40
|
return a.json();
|
|
47
41
|
},
|
|
48
42
|
onSuccess: () => {
|
|
49
|
-
s.invalidateQueries({ queryKey:
|
|
43
|
+
s.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
50
44
|
},
|
|
51
45
|
...e
|
|
52
46
|
});
|
|
53
47
|
}
|
|
54
|
-
function
|
|
55
|
-
const { baseURL:
|
|
48
|
+
function $(e, t) {
|
|
49
|
+
const { baseURL: r, authToken: s } = d(), n = y();
|
|
56
50
|
return m({
|
|
57
|
-
mutationFn: async (
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
if (!u.ok)
|
|
63
|
-
throw new Error(`Failed to update order: ${u.statusText}`);
|
|
64
|
-
return u.json();
|
|
51
|
+
mutationFn: async (i) => {
|
|
52
|
+
const l = await u(r).brands[":id"].$patch({ json: i, param: { id: e } }, c(s));
|
|
53
|
+
if (!l.ok)
|
|
54
|
+
throw new Error(`Failed to update brand: ${l.statusText}`);
|
|
55
|
+
return l.json();
|
|
65
56
|
},
|
|
66
57
|
onSuccess: () => {
|
|
67
|
-
|
|
58
|
+
n.invalidateQueries({ queryKey: o.admin.brands.detail(e) }), n.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
68
59
|
},
|
|
69
|
-
...
|
|
60
|
+
...t
|
|
70
61
|
});
|
|
71
62
|
}
|
|
72
|
-
function x(e,
|
|
73
|
-
const { baseURL:
|
|
74
|
-
return m({
|
|
75
|
-
mutationFn: async (o) => {
|
|
76
|
-
const u = await d(n).orders[":id"].status.$patch(
|
|
77
|
-
{ param: { id: e }, json: o },
|
|
78
|
-
c(s)
|
|
79
|
-
);
|
|
80
|
-
if (!u.ok)
|
|
81
|
-
throw new Error(`Failed to update order status: ${u.statusText}`);
|
|
82
|
-
return u.json();
|
|
83
|
-
},
|
|
84
|
-
onSuccess: () => {
|
|
85
|
-
t.invalidateQueries({ queryKey: i.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
86
|
-
},
|
|
87
|
-
...r
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function K(e, r) {
|
|
91
|
-
const { baseURL: n, authToken: s } = l(), t = y();
|
|
63
|
+
function x(e, t) {
|
|
64
|
+
const { baseURL: r, authToken: s } = d(), n = y();
|
|
92
65
|
return m({
|
|
93
66
|
mutationFn: async () => {
|
|
94
|
-
const a = await
|
|
95
|
-
{ param: { id: e } },
|
|
96
|
-
c(s)
|
|
97
|
-
);
|
|
67
|
+
const a = await u(r).brands[":id"].$delete({ param: { id: e } }, c(s));
|
|
98
68
|
if (!a.ok)
|
|
99
|
-
throw new Error(`Failed to delete
|
|
69
|
+
throw new Error(`Failed to delete brand: ${a.statusText}`);
|
|
100
70
|
return a.json();
|
|
101
71
|
},
|
|
102
72
|
onSuccess: () => {
|
|
103
|
-
|
|
73
|
+
n.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
104
74
|
},
|
|
105
|
-
...
|
|
75
|
+
...t
|
|
106
76
|
});
|
|
107
77
|
}
|
|
108
78
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
x as useUpdateOrderStatus
|
|
79
|
+
T as useCreateBrand,
|
|
80
|
+
x as useDeleteBrand,
|
|
81
|
+
F as useGetBrand,
|
|
82
|
+
k as useListBrands,
|
|
83
|
+
$ as useUpdateBrand
|
|
115
84
|
};
|
package/dist/index45.mjs
CHANGED
|
@@ -1,79 +1,80 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useQueryUnwrapped as
|
|
4
|
-
import { createAdminRpcClients as
|
|
5
|
-
import { queryKeys as
|
|
2
|
+
import { useQueryClient as p, useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as m } from "./index54.mjs";
|
|
4
|
+
import { createAdminRpcClients as a, authHeaders as c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
6
6
|
import { useApiConfig as d } from "./index19.mjs";
|
|
7
|
-
function
|
|
8
|
-
const { baseURL:
|
|
9
|
-
return
|
|
10
|
-
queryKey:
|
|
7
|
+
function F(t, n) {
|
|
8
|
+
const { baseURL: r, authToken: s } = d();
|
|
9
|
+
return m({
|
|
10
|
+
queryKey: i.admin.products.list(t),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
|
|
12
|
+
const e = await a(r).products.index.$get(t ? { query: { brandId: t } } : {}, c(s));
|
|
13
|
+
if (!e.ok)
|
|
14
|
+
throw new Error(`Failed to fetch products: ${e.statusText}`);
|
|
15
|
+
return e.json();
|
|
15
16
|
},
|
|
16
|
-
...
|
|
17
|
+
...n
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function T(t, n) {
|
|
20
21
|
const { baseURL: r, authToken: s } = d();
|
|
21
|
-
return
|
|
22
|
-
queryKey:
|
|
22
|
+
return m({
|
|
23
|
+
queryKey: i.admin.products.detail(t),
|
|
23
24
|
queryFn: async () => {
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
|
|
25
|
+
const e = await a(r).products[":id"].$get({ param: { id: t } }, c(s));
|
|
26
|
+
if (!e.ok)
|
|
27
|
+
throw new Error(`Failed to fetch product: ${e.statusText}`);
|
|
28
|
+
return e.json();
|
|
27
29
|
},
|
|
28
|
-
...
|
|
30
|
+
...n
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
|
-
function
|
|
32
|
-
const { baseURL:
|
|
33
|
-
return
|
|
34
|
-
mutationFn: async (
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onSuccess: () => {
|
|
40
|
-
s.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
33
|
+
function $(t) {
|
|
34
|
+
const { baseURL: n, authToken: r } = d(), s = p();
|
|
35
|
+
return y({
|
|
36
|
+
mutationFn: async (o) => {
|
|
37
|
+
const u = await a(n).products.index.$post({ json: o }, c(r));
|
|
38
|
+
if (!u.ok)
|
|
39
|
+
throw new Error(`Failed to create product: ${u.statusText}`);
|
|
40
|
+
return u.json();
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
onSuccess: () => s.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
43
|
+
...t
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
const { baseURL: r, authToken: s } = d(),
|
|
47
|
-
return
|
|
48
|
-
mutationFn: async (
|
|
49
|
-
const l = await
|
|
50
|
-
if (!l.ok)
|
|
46
|
+
function x(t, n) {
|
|
47
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
48
|
+
return y({
|
|
49
|
+
mutationFn: async (e) => {
|
|
50
|
+
const l = await a(r).products[":id"].$patch({ param: { id: t }, json: e }, c(s));
|
|
51
|
+
if (!l.ok)
|
|
52
|
+
throw new Error(`Failed to update product: ${l.statusText}`);
|
|
51
53
|
return l.json();
|
|
52
54
|
},
|
|
53
55
|
onSuccess: () => {
|
|
54
|
-
|
|
56
|
+
o.invalidateQueries({ queryKey: i.admin.products.detail(t) }), o.invalidateQueries({ queryKey: i.admin.products.all });
|
|
55
57
|
},
|
|
56
|
-
...
|
|
58
|
+
...n
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
function
|
|
60
|
-
const { baseURL: r, authToken: s } = d(),
|
|
61
|
-
return
|
|
61
|
+
function j(t, n) {
|
|
62
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
63
|
+
return y({
|
|
62
64
|
mutationFn: async () => {
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
|
|
65
|
+
const u = await a(r).products[":id"].$delete({ param: { id: t } }, c(s));
|
|
66
|
+
if (!u.ok)
|
|
67
|
+
throw new Error(`Failed to delete product: ${u.statusText}`);
|
|
68
|
+
return u.json();
|
|
66
69
|
},
|
|
67
|
-
onSuccess: () => {
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
...t
|
|
70
|
+
onSuccess: () => o.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
71
|
+
...n
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
$ as useCreateProduct,
|
|
76
|
+
j as useDeleteProduct,
|
|
77
|
+
T as useGetProduct,
|
|
78
|
+
F as useListProducts,
|
|
79
|
+
x as useUpdateProduct
|
|
79
80
|
};
|
package/dist/index46.mjs
CHANGED
|
@@ -1,90 +1,98 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useQueryUnwrapped as m } from "./
|
|
4
|
-
import { createAdminRpcClients as
|
|
2
|
+
import { useQueryClient as y, useMutation as v } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as m } from "./index54.mjs";
|
|
4
|
+
import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
|
|
5
5
|
import { queryKeys as i } from "./index26.mjs";
|
|
6
6
|
import { useApiConfig as d } from "./index19.mjs";
|
|
7
|
-
function
|
|
8
|
-
const { baseURL:
|
|
7
|
+
function k(t, n) {
|
|
8
|
+
const { baseURL: a, authToken: r } = d();
|
|
9
9
|
return m({
|
|
10
|
-
queryKey: i.admin.
|
|
10
|
+
queryKey: i.admin.variants.search(t),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const e = await a
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
16
|
-
if (!e.ok) throw new Error(`Failed to fetch products: ${e.statusText}`);
|
|
12
|
+
const e = await u(a).variants.index.$get({ query: t }, c(r));
|
|
13
|
+
if (!e.ok)
|
|
14
|
+
throw new Error(`Failed to search variants: ${e.statusText}`);
|
|
17
15
|
return e.json();
|
|
18
16
|
},
|
|
19
17
|
...n
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
const { baseURL:
|
|
20
|
+
function F(t, n) {
|
|
21
|
+
const { baseURL: a, authToken: r } = d();
|
|
24
22
|
return m({
|
|
25
|
-
queryKey: i.admin.
|
|
23
|
+
queryKey: i.admin.variants.byProduct(t),
|
|
26
24
|
queryFn: async () => {
|
|
27
|
-
const e = await a
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
if (!e.ok) throw new Error(`Failed to fetch product: ${e.statusText}`);
|
|
25
|
+
const e = await u(a).variants.products[":productId"].variants.$get({ param: { productId: t } }, c(r));
|
|
26
|
+
if (!e.ok)
|
|
27
|
+
throw new Error(`Failed to fetch product variants: ${e.statusText}`);
|
|
32
28
|
return e.json();
|
|
33
29
|
},
|
|
34
30
|
...n
|
|
35
31
|
});
|
|
36
32
|
}
|
|
37
|
-
function
|
|
38
|
-
const { baseURL:
|
|
39
|
-
return
|
|
40
|
-
mutationFn: async (
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
if (!u.ok) throw new Error(`Failed to create product: ${u.statusText}`);
|
|
46
|
-
return u.json();
|
|
33
|
+
function T(t, n) {
|
|
34
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
35
|
+
return v({
|
|
36
|
+
mutationFn: async (e) => {
|
|
37
|
+
const o = await u(a).variants.products[":productId"].variants.$post({ json: e, param: { productId: t } }, c(r));
|
|
38
|
+
if (!o.ok)
|
|
39
|
+
throw new Error(`Failed to create variant: ${o.statusText}`);
|
|
40
|
+
return o.json();
|
|
47
41
|
},
|
|
48
|
-
onSuccess: () =>
|
|
49
|
-
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all }), s.invalidateQueries({ queryKey: i.admin.products.detail(t) });
|
|
44
|
+
},
|
|
45
|
+
...n
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
|
-
function
|
|
53
|
-
const { baseURL:
|
|
54
|
-
return
|
|
48
|
+
function $(t, n) {
|
|
49
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
50
|
+
return v({
|
|
55
51
|
mutationFn: async (e) => {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
60
|
-
if (!l.ok) throw new Error(`Failed to update product: ${l.statusText}`);
|
|
61
|
-
return l.json();
|
|
52
|
+
const o = await u(a).variants[":id"].$patch({ json: e, param: { id: t } }, c(r));
|
|
53
|
+
if (!o.ok)
|
|
54
|
+
throw new Error(`Failed to update variant: ${o.statusText}`);
|
|
55
|
+
return o.json();
|
|
62
56
|
},
|
|
63
57
|
onSuccess: () => {
|
|
64
|
-
|
|
58
|
+
s.invalidateQueries({ queryKey: i.admin.variants.detail(t) }), s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
59
|
+
},
|
|
60
|
+
...n
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function K(t, n) {
|
|
64
|
+
const { baseURL: a, authToken: r } = d();
|
|
65
|
+
return m({
|
|
66
|
+
queryKey: i.admin.variants.inventory(t),
|
|
67
|
+
queryFn: async () => {
|
|
68
|
+
const e = await u(a).variants[":id"].inventory.$get({ param: { id: t } }, c(r));
|
|
69
|
+
if (!e.ok)
|
|
70
|
+
throw new Error(`Failed to fetch variant inventory: ${e.statusText}`);
|
|
71
|
+
return e.json();
|
|
65
72
|
},
|
|
66
73
|
...n
|
|
67
74
|
});
|
|
68
75
|
}
|
|
69
76
|
function j(t, n) {
|
|
70
|
-
const { baseURL:
|
|
71
|
-
return
|
|
77
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
78
|
+
return v({
|
|
72
79
|
mutationFn: async () => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
const l = await u(a).variants[":id"].$delete({ param: { id: t } }, c(r));
|
|
81
|
+
if (!l.ok)
|
|
82
|
+
throw new Error(`Failed to delete variant: ${l.statusText}`);
|
|
83
|
+
return l.json();
|
|
84
|
+
},
|
|
85
|
+
onSuccess: () => {
|
|
86
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
79
87
|
},
|
|
80
|
-
onSuccess: () => o.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
81
88
|
...n
|
|
82
89
|
});
|
|
83
90
|
}
|
|
84
91
|
export {
|
|
85
|
-
|
|
86
|
-
j as
|
|
87
|
-
|
|
88
|
-
F as
|
|
89
|
-
|
|
92
|
+
T as useCreateVariant,
|
|
93
|
+
j as useDeleteVariant,
|
|
94
|
+
K as useGetVariantInventory,
|
|
95
|
+
F as useListProductVariants,
|
|
96
|
+
k as useSearchVariants,
|
|
97
|
+
$ as useUpdateVariant
|
|
90
98
|
};
|