@instockng/storefront-ui 1.0.5 → 1.0.7
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/index20.mjs +2 -2
- package/dist/index21.mjs +1 -1
- package/dist/index28.mjs +11 -11
- package/dist/index3.mjs +75 -68
- package/dist/index37.mjs +1 -1
- package/dist/index41.mjs +23 -36
- package/dist/index42.mjs +36 -44
- package/dist/index43.mjs +44 -99
- package/dist/index44.mjs +99 -112
- package/dist/index45.mjs +80 -44
- package/dist/index46.mjs +53 -64
- package/dist/index47.mjs +48 -65
- package/dist/index48.mjs +73 -54
- package/dist/index49.mjs +63 -52
- package/dist/index50.mjs +70 -14
- package/dist/index51.mjs +14 -13
- package/dist/index52.mjs +13 -58
- package/dist/index53.mjs +34 -101
- package/dist/index54.mjs +95 -99
- package/dist/index55.mjs +132 -22
- package/package.json +1 -1
package/dist/index47.mjs
CHANGED
|
@@ -1,107 +1,90 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryClient as
|
|
2
|
+
import { useQueryClient as p, useMutation as y } from "@tanstack/react-query";
|
|
3
3
|
import { useQueryUnwrapped as m } from "./index61.mjs";
|
|
4
|
-
import { createAdminRpcClients as
|
|
4
|
+
import { createAdminRpcClients as a, 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 F(t, n) {
|
|
8
|
+
const { baseURL: r, authToken: s } = d();
|
|
9
9
|
return m({
|
|
10
|
-
queryKey: i.admin.
|
|
10
|
+
queryKey: i.admin.products.list(t),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const e = await
|
|
13
|
-
|
|
12
|
+
const e = await a(r).products.index.$get(
|
|
13
|
+
t ? { query: { brandId: t } } : {},
|
|
14
|
+
c(s)
|
|
15
|
+
);
|
|
16
|
+
if (!e.ok) throw new Error(`Failed to fetch products: ${e.statusText}`);
|
|
14
17
|
return e.json();
|
|
15
18
|
},
|
|
16
19
|
...n
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
const { baseURL:
|
|
22
|
+
function T(t, n) {
|
|
23
|
+
const { baseURL: r, authToken: s } = d();
|
|
21
24
|
return m({
|
|
22
|
-
queryKey: i.admin.
|
|
25
|
+
queryKey: i.admin.products.detail(t),
|
|
23
26
|
queryFn: async () => {
|
|
24
|
-
const e = await
|
|
25
|
-
{ param: {
|
|
26
|
-
c(
|
|
27
|
+
const e = await a(r).products[":id"].$get(
|
|
28
|
+
{ param: { id: t } },
|
|
29
|
+
c(s)
|
|
27
30
|
);
|
|
28
|
-
if (!e.ok) throw new Error(`Failed to fetch product
|
|
31
|
+
if (!e.ok) throw new Error(`Failed to fetch product: ${e.statusText}`);
|
|
29
32
|
return e.json();
|
|
30
33
|
},
|
|
31
34
|
...n
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
const { baseURL:
|
|
36
|
-
return
|
|
37
|
-
mutationFn: async (
|
|
38
|
-
const
|
|
39
|
-
{ json:
|
|
37
|
+
function $(t) {
|
|
38
|
+
const { baseURL: n, authToken: r } = d(), s = p();
|
|
39
|
+
return y({
|
|
40
|
+
mutationFn: async (o) => {
|
|
41
|
+
const u = await a(n).products.index.$post(
|
|
42
|
+
{ json: o },
|
|
40
43
|
c(r)
|
|
41
44
|
);
|
|
42
|
-
if (!
|
|
43
|
-
return
|
|
44
|
-
},
|
|
45
|
-
onSuccess: () => {
|
|
46
|
-
s.invalidateQueries({ queryKey: i.admin.variants.all }), s.invalidateQueries({ queryKey: i.admin.products.detail(t) });
|
|
45
|
+
if (!u.ok) throw new Error(`Failed to create product: ${u.statusText}`);
|
|
46
|
+
return u.json();
|
|
47
47
|
},
|
|
48
|
-
|
|
48
|
+
onSuccess: () => s.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
49
|
+
...t
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
const { baseURL:
|
|
53
|
-
return
|
|
52
|
+
function x(t, n) {
|
|
53
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
54
|
+
return y({
|
|
54
55
|
mutationFn: async (e) => {
|
|
55
|
-
const
|
|
56
|
-
{
|
|
57
|
-
c(
|
|
56
|
+
const l = await a(r).products[":id"].$patch(
|
|
57
|
+
{ param: { id: t }, json: e },
|
|
58
|
+
c(s)
|
|
58
59
|
);
|
|
59
|
-
if (!
|
|
60
|
-
return
|
|
60
|
+
if (!l.ok) throw new Error(`Failed to update product: ${l.statusText}`);
|
|
61
|
+
return l.json();
|
|
61
62
|
},
|
|
62
63
|
onSuccess: () => {
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
...n
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function K(t, n) {
|
|
69
|
-
const { baseURL: a, authToken: r } = d();
|
|
70
|
-
return m({
|
|
71
|
-
queryKey: i.admin.variants.inventory(t),
|
|
72
|
-
queryFn: async () => {
|
|
73
|
-
const e = await u(a).variants[":id"].inventory.$get(
|
|
74
|
-
{ param: { id: t } },
|
|
75
|
-
c(r)
|
|
76
|
-
);
|
|
77
|
-
if (!e.ok) throw new Error(`Failed to fetch variant inventory: ${e.statusText}`);
|
|
78
|
-
return e.json();
|
|
64
|
+
o.invalidateQueries({ queryKey: i.admin.products.detail(t) }), o.invalidateQueries({ queryKey: i.admin.products.all });
|
|
79
65
|
},
|
|
80
66
|
...n
|
|
81
67
|
});
|
|
82
68
|
}
|
|
83
69
|
function j(t, n) {
|
|
84
|
-
const { baseURL:
|
|
85
|
-
return
|
|
70
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
71
|
+
return y({
|
|
86
72
|
mutationFn: async () => {
|
|
87
|
-
const
|
|
73
|
+
const u = await a(r).products[":id"].$delete(
|
|
88
74
|
{ param: { id: t } },
|
|
89
|
-
c(
|
|
75
|
+
c(s)
|
|
90
76
|
);
|
|
91
|
-
if (!
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
onSuccess: () => {
|
|
95
|
-
s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
77
|
+
if (!u.ok) throw new Error(`Failed to delete product: ${u.statusText}`);
|
|
78
|
+
return u.json();
|
|
96
79
|
},
|
|
80
|
+
onSuccess: () => o.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
97
81
|
...n
|
|
98
82
|
});
|
|
99
83
|
}
|
|
100
84
|
export {
|
|
101
|
-
|
|
102
|
-
j as
|
|
103
|
-
|
|
104
|
-
F as
|
|
105
|
-
|
|
106
|
-
$ as useUpdateVariant
|
|
85
|
+
$ as useCreateProduct,
|
|
86
|
+
j as useDeleteProduct,
|
|
87
|
+
T as useGetProduct,
|
|
88
|
+
F as useListProducts,
|
|
89
|
+
x as useUpdateProduct
|
|
107
90
|
};
|
package/dist/index48.mjs
CHANGED
|
@@ -1,88 +1,107 @@
|
|
|
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
|
|
8
|
-
const { baseURL:
|
|
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 c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
7
|
+
function k(t, n) {
|
|
8
|
+
const { baseURL: a, authToken: r } = d();
|
|
9
|
+
return m({
|
|
10
|
+
queryKey: i.admin.variants.search(t),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
12
|
+
const e = await u(a).variants.index.$get({ query: t }, c(r));
|
|
13
|
+
if (!e.ok) throw new Error(`Failed to search variants: ${e.statusText}`);
|
|
14
|
+
return e.json();
|
|
15
15
|
},
|
|
16
|
-
...
|
|
16
|
+
...n
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const { baseURL:
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
function F(t, n) {
|
|
20
|
+
const { baseURL: a, authToken: r } = d();
|
|
21
|
+
return m({
|
|
22
|
+
queryKey: i.admin.variants.byProduct(t),
|
|
23
|
+
queryFn: async () => {
|
|
24
|
+
const e = await u(a).variants.products[":productId"].variants.$get(
|
|
25
|
+
{ param: { productId: t } },
|
|
26
|
+
c(r)
|
|
27
|
+
);
|
|
28
|
+
if (!e.ok) throw new Error(`Failed to fetch product variants: ${e.statusText}`);
|
|
29
|
+
return e.json();
|
|
30
|
+
},
|
|
31
|
+
...n
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function T(t, n) {
|
|
35
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
36
|
+
return v({
|
|
37
|
+
mutationFn: async (e) => {
|
|
38
|
+
const o = await u(a).variants.products[":productId"].variants.$post(
|
|
39
|
+
{ json: e, param: { productId: t } },
|
|
40
|
+
c(r)
|
|
41
|
+
);
|
|
42
|
+
if (!o.ok) throw new Error(`Failed to create variant: ${o.statusText}`);
|
|
25
43
|
return o.json();
|
|
26
44
|
},
|
|
27
45
|
onSuccess: () => {
|
|
28
|
-
|
|
46
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all }), s.invalidateQueries({ queryKey: i.admin.products.detail(t) });
|
|
29
47
|
},
|
|
30
|
-
...
|
|
48
|
+
...n
|
|
31
49
|
});
|
|
32
50
|
}
|
|
33
|
-
function $(
|
|
34
|
-
const { baseURL:
|
|
35
|
-
return
|
|
36
|
-
mutationFn: async (
|
|
37
|
-
const
|
|
38
|
-
{ json:
|
|
51
|
+
function $(t, n) {
|
|
52
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
53
|
+
return v({
|
|
54
|
+
mutationFn: async (e) => {
|
|
55
|
+
const o = await u(a).variants[":id"].$patch(
|
|
56
|
+
{ json: e, param: { id: t } },
|
|
39
57
|
c(r)
|
|
40
58
|
);
|
|
41
|
-
if (!
|
|
42
|
-
return
|
|
59
|
+
if (!o.ok) throw new Error(`Failed to update variant: ${o.statusText}`);
|
|
60
|
+
return o.json();
|
|
43
61
|
},
|
|
44
62
|
onSuccess: () => {
|
|
45
|
-
|
|
63
|
+
s.invalidateQueries({ queryKey: i.admin.variants.detail(t) }), s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
46
64
|
},
|
|
47
|
-
...
|
|
65
|
+
...n
|
|
48
66
|
});
|
|
49
67
|
}
|
|
50
|
-
function
|
|
51
|
-
const { baseURL:
|
|
52
|
-
return
|
|
53
|
-
queryKey:
|
|
68
|
+
function K(t, n) {
|
|
69
|
+
const { baseURL: a, authToken: r } = d();
|
|
70
|
+
return m({
|
|
71
|
+
queryKey: i.admin.variants.inventory(t),
|
|
54
72
|
queryFn: async () => {
|
|
55
|
-
const
|
|
56
|
-
{ param: { id:
|
|
73
|
+
const e = await u(a).variants[":id"].inventory.$get(
|
|
74
|
+
{ param: { id: t } },
|
|
57
75
|
c(r)
|
|
58
76
|
);
|
|
59
|
-
if (!
|
|
60
|
-
return
|
|
77
|
+
if (!e.ok) throw new Error(`Failed to fetch variant inventory: ${e.statusText}`);
|
|
78
|
+
return e.json();
|
|
61
79
|
},
|
|
62
|
-
...
|
|
80
|
+
...n
|
|
63
81
|
});
|
|
64
82
|
}
|
|
65
|
-
function
|
|
66
|
-
const { baseURL:
|
|
67
|
-
return
|
|
83
|
+
function j(t, n) {
|
|
84
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
85
|
+
return v({
|
|
68
86
|
mutationFn: async () => {
|
|
69
|
-
const
|
|
70
|
-
{ param: { id:
|
|
87
|
+
const l = await u(a).variants[":id"].$delete(
|
|
88
|
+
{ param: { id: t } },
|
|
71
89
|
c(r)
|
|
72
90
|
);
|
|
73
|
-
if (!
|
|
74
|
-
return
|
|
91
|
+
if (!l.ok) throw new Error(`Failed to delete variant: ${l.statusText}`);
|
|
92
|
+
return l.json();
|
|
75
93
|
},
|
|
76
94
|
onSuccess: () => {
|
|
77
|
-
|
|
95
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
78
96
|
},
|
|
79
|
-
...
|
|
97
|
+
...n
|
|
80
98
|
});
|
|
81
99
|
}
|
|
82
100
|
export {
|
|
83
|
-
T as
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
F as
|
|
87
|
-
|
|
101
|
+
T as useCreateVariant,
|
|
102
|
+
j as useDeleteVariant,
|
|
103
|
+
K as useGetVariantInventory,
|
|
104
|
+
F as useListProductVariants,
|
|
105
|
+
k as useSearchVariants,
|
|
106
|
+
$ as useUpdateVariant
|
|
88
107
|
};
|
package/dist/index49.mjs
CHANGED
|
@@ -1,77 +1,88 @@
|
|
|
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
|
|
8
|
-
const { baseURL:
|
|
9
|
-
return
|
|
10
|
-
queryKey:
|
|
2
|
+
import { useQueryClient as w, useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as d } from "./index61.mjs";
|
|
4
|
+
import { createAdminRpcClients as i, authHeaders as c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as u } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as l } from "./index19.mjs";
|
|
7
|
+
function F(e) {
|
|
8
|
+
const { baseURL: s, authToken: n } = l();
|
|
9
|
+
return d({
|
|
10
|
+
queryKey: u.admin.warehouses.list(),
|
|
11
11
|
queryFn: async () => {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
12
|
+
const t = await i(s).warehouses.index.$get({}, c(n));
|
|
13
|
+
if (!t.ok) throw new Error(`Failed to fetch warehouses: ${t.statusText}`);
|
|
14
|
+
return t.json();
|
|
15
15
|
},
|
|
16
|
-
...
|
|
16
|
+
...e
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function T(
|
|
20
|
-
const { baseURL:
|
|
21
|
-
return
|
|
22
|
-
mutationFn: async (
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
return
|
|
19
|
+
function T(e) {
|
|
20
|
+
const { baseURL: s, authToken: n } = l(), r = w();
|
|
21
|
+
return y({
|
|
22
|
+
mutationFn: async (t) => {
|
|
23
|
+
const o = await i(s).warehouses.index.$post({ json: t }, c(n));
|
|
24
|
+
if (!o.ok) throw new Error(`Failed to create warehouse: ${o.statusText}`);
|
|
25
|
+
return o.json();
|
|
26
26
|
},
|
|
27
27
|
onSuccess: () => {
|
|
28
|
-
|
|
28
|
+
r.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
29
29
|
},
|
|
30
|
-
...
|
|
30
|
+
...e
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const { baseURL:
|
|
35
|
-
return
|
|
33
|
+
function $(e, s) {
|
|
34
|
+
const { baseURL: n, authToken: r } = l(), t = w();
|
|
35
|
+
return y({
|
|
36
36
|
mutationFn: async (a) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const h = await i(n).warehouses[":id"].$patch(
|
|
38
|
+
{ json: a, param: { id: e } },
|
|
39
|
+
c(r)
|
|
40
|
+
);
|
|
41
|
+
if (!h.ok) throw new Error(`Failed to update warehouse: ${h.statusText}`);
|
|
42
|
+
return h.json();
|
|
40
43
|
},
|
|
41
44
|
onSuccess: () => {
|
|
42
|
-
t.invalidateQueries({ queryKey:
|
|
45
|
+
t.invalidateQueries({ queryKey: u.admin.warehouses.detail(e) }), t.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
43
46
|
},
|
|
44
|
-
...
|
|
47
|
+
...s
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
|
-
function
|
|
48
|
-
const { baseURL:
|
|
49
|
-
return
|
|
50
|
-
queryKey:
|
|
50
|
+
function v(e, s) {
|
|
51
|
+
const { baseURL: n, authToken: r } = l();
|
|
52
|
+
return d({
|
|
53
|
+
queryKey: u.admin.warehouses.inventory(e),
|
|
51
54
|
queryFn: async () => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
const a = await i(n).warehouses[":id"].inventory.$get(
|
|
56
|
+
{ param: { id: e } },
|
|
57
|
+
c(r)
|
|
58
|
+
);
|
|
59
|
+
if (!a.ok) throw new Error(`Failed to fetch warehouse inventory: ${a.statusText}`);
|
|
60
|
+
return a.json();
|
|
55
61
|
},
|
|
56
|
-
...
|
|
62
|
+
...s
|
|
57
63
|
});
|
|
58
64
|
}
|
|
59
|
-
function
|
|
60
|
-
const { baseURL:
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
function x(e, s) {
|
|
66
|
+
const { baseURL: n, authToken: r } = l(), t = w();
|
|
67
|
+
return y({
|
|
68
|
+
mutationFn: async () => {
|
|
69
|
+
const o = await i(n).warehouses[":id"].$delete(
|
|
70
|
+
{ param: { id: e } },
|
|
71
|
+
c(r)
|
|
72
|
+
);
|
|
73
|
+
if (!o.ok) throw new Error(`Failed to delete warehouse: ${o.statusText}`);
|
|
74
|
+
return o.json();
|
|
75
|
+
},
|
|
76
|
+
onSuccess: () => {
|
|
77
|
+
t.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
67
78
|
},
|
|
68
|
-
...
|
|
79
|
+
...s
|
|
69
80
|
});
|
|
70
81
|
}
|
|
71
82
|
export {
|
|
72
|
-
T as
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
T as useCreateWarehouse,
|
|
84
|
+
x as useDeleteWarehouse,
|
|
85
|
+
v as useGetWarehouseInventory,
|
|
86
|
+
F as useListWarehouses,
|
|
87
|
+
$ as useUpdateWarehouse
|
|
77
88
|
};
|
package/dist/index50.mjs
CHANGED
|
@@ -1,21 +1,77 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useQueryClient as d, useMutation as v } from "@tanstack/react-query";
|
|
3
|
+
import { useQueryUnwrapped as l } from "./index61.mjs";
|
|
4
|
+
import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
|
|
5
|
+
import { queryKeys as s } from "./index26.mjs";
|
|
6
|
+
import { useApiConfig as y } from "./index19.mjs";
|
|
7
|
+
function m(n, r) {
|
|
8
|
+
const { baseURL: o, authToken: t } = y();
|
|
9
|
+
return l({
|
|
10
|
+
queryKey: s.admin.inventory.list(n),
|
|
10
11
|
queryFn: async () => {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
return
|
|
12
|
+
const e = await u(o).inventory.index.$get({ query: n }, c(t));
|
|
13
|
+
if (!e.ok) throw new Error(`Failed to fetch inventory: ${e.statusText}`);
|
|
14
|
+
return e.json();
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
...r
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function T(n) {
|
|
20
|
+
const { baseURL: r, authToken: o } = y(), t = d();
|
|
21
|
+
return v({
|
|
22
|
+
mutationFn: async (a) => {
|
|
23
|
+
const i = await u(r).inventory.adjust.$post({ json: a }, c(o));
|
|
24
|
+
if (!i.ok) throw new Error(`Failed to adjust inventory: ${i.statusText}`);
|
|
25
|
+
return i.json();
|
|
26
|
+
},
|
|
27
|
+
onSuccess: () => {
|
|
28
|
+
t.invalidateQueries({ queryKey: s.admin.inventory.all }), t.invalidateQueries({ queryKey: s.admin.variants.all }), t.invalidateQueries({ queryKey: s.admin.warehouses.all });
|
|
29
|
+
},
|
|
30
|
+
...n
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function j(n) {
|
|
34
|
+
const { baseURL: r, authToken: o } = y(), t = d();
|
|
35
|
+
return v({
|
|
36
|
+
mutationFn: async (a) => {
|
|
37
|
+
const i = await u(r).inventory.transfer.$post({ json: a }, c(o));
|
|
38
|
+
if (!i.ok) throw new Error(`Failed to transfer inventory: ${i.statusText}`);
|
|
39
|
+
return i.json();
|
|
40
|
+
},
|
|
41
|
+
onSuccess: () => {
|
|
42
|
+
t.invalidateQueries({ queryKey: s.admin.inventory.all }), t.invalidateQueries({ queryKey: s.admin.warehouses.all });
|
|
43
|
+
},
|
|
44
|
+
...n
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function F(n, r) {
|
|
48
|
+
const { baseURL: o, authToken: t } = y();
|
|
49
|
+
return l({
|
|
50
|
+
queryKey: s.admin.inventory.transactions(n),
|
|
51
|
+
queryFn: async () => {
|
|
52
|
+
const e = await u(o).inventory.transactions.$get({ query: n }, c(t));
|
|
53
|
+
if (!e.ok) throw new Error(`Failed to fetch inventory transactions: ${e.statusText}`);
|
|
54
|
+
return e.json();
|
|
55
|
+
},
|
|
56
|
+
...r
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function $(n, r) {
|
|
60
|
+
const { baseURL: o, authToken: t } = y();
|
|
61
|
+
return l({
|
|
62
|
+
queryKey: s.admin.inventory.lowStock(n == null ? void 0 : n.brandId),
|
|
63
|
+
queryFn: async () => {
|
|
64
|
+
const e = await u(o).inventory["low-stock"].$get({ query: n }, c(t));
|
|
65
|
+
if (!e.ok) throw new Error(`Failed to fetch low stock alerts: ${e.statusText}`);
|
|
66
|
+
return e.json();
|
|
67
|
+
},
|
|
68
|
+
...r
|
|
17
69
|
});
|
|
18
70
|
}
|
|
19
71
|
export {
|
|
20
|
-
|
|
72
|
+
T as useAdjustInventory,
|
|
73
|
+
F as useGetInventoryTransactions,
|
|
74
|
+
$ as useGetLowStockVariants,
|
|
75
|
+
m as useListInventory,
|
|
76
|
+
j as useTransferInventory
|
|
21
77
|
};
|
package/dist/index51.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useQueryUnwrapped as
|
|
3
|
-
import { createAdminRpcClients as
|
|
4
|
-
import { queryKeys as
|
|
5
|
-
import { useApiConfig as
|
|
6
|
-
function h(
|
|
7
|
-
const { baseURL:
|
|
8
|
-
return
|
|
9
|
-
queryKey:
|
|
2
|
+
import { useQueryUnwrapped as i } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as n, authHeaders as u } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as m } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as a } from "./index19.mjs";
|
|
6
|
+
function h(e, t) {
|
|
7
|
+
const { baseURL: s, authToken: o } = a();
|
|
8
|
+
return i({
|
|
9
|
+
queryKey: m.admin.customers.history(e),
|
|
10
10
|
queryFn: async () => {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
return
|
|
11
|
+
const r = await n(s).customers.history.$get({ query: { phone: e } }, u(o));
|
|
12
|
+
if (!r.ok) throw new Error(`Failed to fetch customer history: ${r.statusText}`);
|
|
13
|
+
return r.json();
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
enabled: !!e,
|
|
16
|
+
...t
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
|
-
h as
|
|
20
|
+
h as useGetCustomerHistory
|
|
20
21
|
};
|