@instockng/storefront-ui 1.0.0
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 +394 -0
- package/dist/components/CartItem.d.ts +15 -0
- package/dist/components/CartItem.d.ts.map +1 -0
- package/dist/components/Checkout.d.ts +39 -0
- package/dist/components/Checkout.d.ts.map +1 -0
- package/dist/components/DiscountCodeInput.d.ts +20 -0
- package/dist/components/DiscountCodeInput.d.ts.map +1 -0
- package/dist/components/OrderConfirmation.d.ts +30 -0
- package/dist/components/OrderConfirmation.d.ts.map +1 -0
- package/dist/components/ProductCard.d.ts +42 -0
- package/dist/components/ProductCard.d.ts.map +1 -0
- package/dist/components/ProductGrid.d.ts +33 -0
- package/dist/components/ProductGrid.d.ts.map +1 -0
- package/dist/components/ShoppingCart.d.ts +28 -0
- package/dist/components/ShoppingCart.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/form-input.d.ts +20 -0
- package/dist/components/ui/form-input.d.ts.map +1 -0
- package/dist/components/ui/form-select.d.ts +18 -0
- package/dist/components/ui/form-select.d.ts.map +1 -0
- package/dist/components/ui/modal.d.ts +31 -0
- package/dist/components/ui/modal.d.ts.map +1 -0
- package/dist/contexts/CartContext.d.ts +60 -0
- package/dist/contexts/CartContext.d.ts.map +1 -0
- package/dist/hooks/usePaystackPayment.d.ts +46 -0
- package/dist/hooks/usePaystackPayment.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +99 -0
- package/dist/index10.mjs +644 -0
- package/dist/index100.mjs +7 -0
- package/dist/index101.mjs +35 -0
- package/dist/index102.mjs +33 -0
- package/dist/index103.mjs +30 -0
- package/dist/index104.mjs +63 -0
- package/dist/index105.mjs +5 -0
- package/dist/index106.mjs +4 -0
- package/dist/index107.mjs +4 -0
- package/dist/index108.mjs +19 -0
- package/dist/index109.mjs +15 -0
- package/dist/index11.mjs +62 -0
- package/dist/index110.mjs +8 -0
- package/dist/index111.mjs +32 -0
- package/dist/index12.mjs +64 -0
- package/dist/index13.mjs +26 -0
- package/dist/index14.mjs +117 -0
- package/dist/index15.mjs +44 -0
- package/dist/index16.mjs +44 -0
- package/dist/index17.mjs +44 -0
- package/dist/index18.mjs +43 -0
- package/dist/index19.mjs +11 -0
- package/dist/index2.mjs +24 -0
- package/dist/index20.mjs +29 -0
- package/dist/index21.mjs +34 -0
- package/dist/index22.mjs +22 -0
- package/dist/index23.mjs +90 -0
- package/dist/index24.mjs +22 -0
- package/dist/index25.mjs +13 -0
- package/dist/index26.mjs +99 -0
- package/dist/index27.mjs +20 -0
- package/dist/index28.mjs +67 -0
- package/dist/index29.mjs +98 -0
- package/dist/index3.mjs +121 -0
- package/dist/index30.mjs +21 -0
- package/dist/index31.mjs +21 -0
- package/dist/index32.mjs +13 -0
- package/dist/index33.mjs +6 -0
- package/dist/index34.mjs +1435 -0
- package/dist/index35.mjs +4 -0
- package/dist/index36.mjs +59 -0
- package/dist/index37.mjs +53 -0
- package/dist/index38.mjs +35 -0
- package/dist/index39.mjs +17 -0
- package/dist/index4.mjs +201 -0
- package/dist/index40.mjs +2265 -0
- package/dist/index41.mjs +25 -0
- package/dist/index42.mjs +38 -0
- package/dist/index43.mjs +46 -0
- package/dist/index44.mjs +101 -0
- package/dist/index45.mjs +114 -0
- package/dist/index46.mjs +78 -0
- package/dist/index47.mjs +89 -0
- package/dist/index48.mjs +106 -0
- package/dist/index49.mjs +87 -0
- package/dist/index5.mjs +112 -0
- package/dist/index50.mjs +76 -0
- package/dist/index51.mjs +20 -0
- package/dist/index52.mjs +19 -0
- package/dist/index53.mjs +64 -0
- package/dist/index54.mjs +131 -0
- package/dist/index55.mjs +135 -0
- package/dist/index56.mjs +77 -0
- package/dist/index57.mjs +17 -0
- package/dist/index58.mjs +65 -0
- package/dist/index59.mjs +6 -0
- package/dist/index6.mjs +82 -0
- package/dist/index60.mjs +4 -0
- package/dist/index61.mjs +7 -0
- package/dist/index62.mjs +36 -0
- package/dist/index63.mjs +45 -0
- package/dist/index64.mjs +237 -0
- package/dist/index65.mjs +8 -0
- package/dist/index66.mjs +136 -0
- package/dist/index67.mjs +70 -0
- package/dist/index68.mjs +89 -0
- package/dist/index69.mjs +31 -0
- package/dist/index7.mjs +100 -0
- package/dist/index70.mjs +11 -0
- package/dist/index71.mjs +77 -0
- package/dist/index72.mjs +6 -0
- package/dist/index73.mjs +4 -0
- package/dist/index74.mjs +85 -0
- package/dist/index75.mjs +56 -0
- package/dist/index76.mjs +8 -0
- package/dist/index77.mjs +7 -0
- package/dist/index78.mjs +181 -0
- package/dist/index79.mjs +55 -0
- package/dist/index8.mjs +165 -0
- package/dist/index80.mjs +71 -0
- package/dist/index81.mjs +23 -0
- package/dist/index82.mjs +58 -0
- package/dist/index83.mjs +31 -0
- package/dist/index84.mjs +9 -0
- package/dist/index85.mjs +54 -0
- package/dist/index86.mjs +8 -0
- package/dist/index87.mjs +14 -0
- package/dist/index88.mjs +9 -0
- package/dist/index89.mjs +30 -0
- package/dist/index9.mjs +100 -0
- package/dist/index90.mjs +4 -0
- package/dist/index91.mjs +72 -0
- package/dist/index92.mjs +169 -0
- package/dist/index93.mjs +15 -0
- package/dist/index94.mjs +9 -0
- package/dist/index95.mjs +33 -0
- package/dist/index96.mjs +13 -0
- package/dist/index97.mjs +6 -0
- package/dist/index98.mjs +6 -0
- package/dist/index99.mjs +14 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/mockServiceWorker.js +349 -0
- package/dist/providers/StorefrontProvider.d.ts +47 -0
- package/dist/providers/StorefrontProvider.d.ts.map +1 -0
- package/dist/test-utils/MockCartProvider.d.ts +21 -0
- package/dist/test-utils/MockCartProvider.d.ts.map +1 -0
- package/package.json +77 -0
package/dist/index41.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
function i(n, o) {
|
|
3
|
+
if (typeof n == "function")
|
|
4
|
+
return n(o);
|
|
5
|
+
n != null && (n.current = o);
|
|
6
|
+
}
|
|
7
|
+
function f(...n) {
|
|
8
|
+
return (o) => {
|
|
9
|
+
let u = !1;
|
|
10
|
+
const c = n.map((t) => {
|
|
11
|
+
const e = i(t, o);
|
|
12
|
+
return !u && typeof e == "function" && (u = !0), e;
|
|
13
|
+
});
|
|
14
|
+
if (u)
|
|
15
|
+
return () => {
|
|
16
|
+
for (let t = 0; t < c.length; t++) {
|
|
17
|
+
const e = c[t];
|
|
18
|
+
typeof e == "function" ? e() : i(n[t], null);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
f as composeRefs
|
|
25
|
+
};
|
package/dist/index42.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import o from "./index43.mjs";
|
|
2
|
+
const {
|
|
3
|
+
Axios: e,
|
|
4
|
+
AxiosError: a,
|
|
5
|
+
CanceledError: s,
|
|
6
|
+
isCancel: t,
|
|
7
|
+
CancelToken: i,
|
|
8
|
+
VERSION: l,
|
|
9
|
+
all: n,
|
|
10
|
+
Cancel: d,
|
|
11
|
+
isAxiosError: x,
|
|
12
|
+
spread: C,
|
|
13
|
+
toFormData: c,
|
|
14
|
+
AxiosHeaders: m,
|
|
15
|
+
HttpStatusCode: p,
|
|
16
|
+
formToJSON: A,
|
|
17
|
+
getAdapter: f,
|
|
18
|
+
mergeConfig: E
|
|
19
|
+
} = o;
|
|
20
|
+
export {
|
|
21
|
+
e as Axios,
|
|
22
|
+
a as AxiosError,
|
|
23
|
+
m as AxiosHeaders,
|
|
24
|
+
d as Cancel,
|
|
25
|
+
i as CancelToken,
|
|
26
|
+
s as CanceledError,
|
|
27
|
+
p as HttpStatusCode,
|
|
28
|
+
l as VERSION,
|
|
29
|
+
n as all,
|
|
30
|
+
o as default,
|
|
31
|
+
A as formToJSON,
|
|
32
|
+
f as getAdapter,
|
|
33
|
+
x as isAxiosError,
|
|
34
|
+
t as isCancel,
|
|
35
|
+
E as mergeConfig,
|
|
36
|
+
C as spread,
|
|
37
|
+
c as toFormData
|
|
38
|
+
};
|
package/dist/index43.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import a from "./index64.mjs";
|
|
2
|
+
import p from "./index65.mjs";
|
|
3
|
+
import m from "./index66.mjs";
|
|
4
|
+
import i from "./index67.mjs";
|
|
5
|
+
import f from "./index68.mjs";
|
|
6
|
+
import l from "./index69.mjs";
|
|
7
|
+
import c from "./index70.mjs";
|
|
8
|
+
import d from "./index71.mjs";
|
|
9
|
+
import u from "./index72.mjs";
|
|
10
|
+
import { VERSION as x } from "./index73.mjs";
|
|
11
|
+
import C from "./index74.mjs";
|
|
12
|
+
import A from "./index75.mjs";
|
|
13
|
+
import E from "./index76.mjs";
|
|
14
|
+
import O from "./index77.mjs";
|
|
15
|
+
import S from "./index78.mjs";
|
|
16
|
+
import H from "./index79.mjs";
|
|
17
|
+
import T from "./index80.mjs";
|
|
18
|
+
function n(o) {
|
|
19
|
+
const t = new m(o), e = p(m.prototype.request, t);
|
|
20
|
+
return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
|
|
21
|
+
return n(i(o, s));
|
|
22
|
+
}, e;
|
|
23
|
+
}
|
|
24
|
+
const r = n(f);
|
|
25
|
+
r.Axios = m;
|
|
26
|
+
r.CanceledError = c;
|
|
27
|
+
r.CancelToken = d;
|
|
28
|
+
r.isCancel = u;
|
|
29
|
+
r.VERSION = x;
|
|
30
|
+
r.toFormData = C;
|
|
31
|
+
r.AxiosError = A;
|
|
32
|
+
r.Cancel = r.CanceledError;
|
|
33
|
+
r.all = function(t) {
|
|
34
|
+
return Promise.all(t);
|
|
35
|
+
};
|
|
36
|
+
r.spread = E;
|
|
37
|
+
r.isAxiosError = O;
|
|
38
|
+
r.mergeConfig = i;
|
|
39
|
+
r.AxiosHeaders = S;
|
|
40
|
+
r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
|
|
41
|
+
r.getAdapter = H.getAdapter;
|
|
42
|
+
r.HttpStatusCode = T;
|
|
43
|
+
r.default = r;
|
|
44
|
+
export {
|
|
45
|
+
r as default
|
|
46
|
+
};
|
package/dist/index44.mjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var k = (r, e, i) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
|
|
3
|
+
var h = (r, e, i) => k(r, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { serialize as j } from "./index62.mjs";
|
|
5
|
+
import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index63.mjs";
|
|
6
|
+
var v = (r, e) => new Proxy(() => {
|
|
7
|
+
}, {
|
|
8
|
+
get(t, s) {
|
|
9
|
+
if (!(typeof s != "string" || s === "then"))
|
|
10
|
+
return v(r, [...e, s]);
|
|
11
|
+
},
|
|
12
|
+
apply(t, s, a) {
|
|
13
|
+
return r({
|
|
14
|
+
path: e,
|
|
15
|
+
args: a
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}), T = class {
|
|
19
|
+
constructor(r, e) {
|
|
20
|
+
h(this, "url");
|
|
21
|
+
h(this, "method");
|
|
22
|
+
h(this, "queryParams");
|
|
23
|
+
h(this, "pathParams", {});
|
|
24
|
+
h(this, "rBody");
|
|
25
|
+
h(this, "cType");
|
|
26
|
+
h(this, "fetch", async (r, e) => {
|
|
27
|
+
if (r) {
|
|
28
|
+
if (r.query && (this.queryParams = S(r.query)), r.form) {
|
|
29
|
+
const o = new FormData();
|
|
30
|
+
for (const [c, f] of Object.entries(r.form))
|
|
31
|
+
if (Array.isArray(f))
|
|
32
|
+
for (const l of f)
|
|
33
|
+
o.append(c, l);
|
|
34
|
+
else
|
|
35
|
+
o.append(c, f);
|
|
36
|
+
this.rBody = o;
|
|
37
|
+
}
|
|
38
|
+
r.json && (this.rBody = JSON.stringify(r.json), this.cType = "application/json"), r.param && (this.pathParams = r.param);
|
|
39
|
+
}
|
|
40
|
+
let i = this.method.toUpperCase();
|
|
41
|
+
const t = {
|
|
42
|
+
...r == null ? void 0 : r.header,
|
|
43
|
+
...typeof (e == null ? void 0 : e.headers) == "function" ? await e.headers() : e == null ? void 0 : e.headers
|
|
44
|
+
};
|
|
45
|
+
if (r != null && r.cookie) {
|
|
46
|
+
const o = [];
|
|
47
|
+
for (const [c, f] of Object.entries(r.cookie))
|
|
48
|
+
o.push(j(c, f, { path: "/" }));
|
|
49
|
+
t.Cookie = o.join(",");
|
|
50
|
+
}
|
|
51
|
+
this.cType && (t["Content-Type"] = this.cType);
|
|
52
|
+
const s = new Headers(t ?? void 0);
|
|
53
|
+
let a = this.url;
|
|
54
|
+
a = w(a), a = P(a, this.pathParams), this.queryParams && (a = a + "?" + this.queryParams.toString()), i = this.method.toUpperCase();
|
|
55
|
+
const u = !(i === "GET" || i === "HEAD");
|
|
56
|
+
return ((e == null ? void 0 : e.fetch) || fetch)(a, {
|
|
57
|
+
body: u ? this.rBody : void 0,
|
|
58
|
+
method: i,
|
|
59
|
+
headers: s,
|
|
60
|
+
...e == null ? void 0 : e.init
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
this.url = r, this.method = e;
|
|
64
|
+
}
|
|
65
|
+
}, E = (r, e) => v(function i(t) {
|
|
66
|
+
var l;
|
|
67
|
+
const s = [...t.path], a = s.slice(-3).reverse();
|
|
68
|
+
if (a[0] === "toString")
|
|
69
|
+
return a[1] === "name" ? a[2] || "" : i.toString();
|
|
70
|
+
if (a[0] === "valueOf")
|
|
71
|
+
return a[1] === "name" ? a[2] || "" : i;
|
|
72
|
+
let u = "";
|
|
73
|
+
if (/^\$/.test(a[0])) {
|
|
74
|
+
const n = s.pop();
|
|
75
|
+
n && (u = n.replace(/^\$/, ""));
|
|
76
|
+
}
|
|
77
|
+
const o = s.join("/"), c = U(r, o);
|
|
78
|
+
if (u === "url") {
|
|
79
|
+
let n = c;
|
|
80
|
+
return t.args[0] && (t.args[0].param && (n = P(c, t.args[0].param)), t.args[0].query && (n = n + "?" + S(t.args[0].query).toString())), n = w(n), new URL(n);
|
|
81
|
+
}
|
|
82
|
+
if (u === "ws") {
|
|
83
|
+
const n = x(
|
|
84
|
+
t.args[0] && t.args[0].param ? P(c, t.args[0].param) : c,
|
|
85
|
+
"ws"
|
|
86
|
+
), y = new URL(n), b = (l = t.args[0]) == null ? void 0 : l.query;
|
|
87
|
+
return b && Object.entries(b).forEach(([m, d]) => {
|
|
88
|
+
Array.isArray(d) ? d.forEach((q) => y.searchParams.append(m, q)) : y.searchParams.set(m, d);
|
|
89
|
+
}), ((...m) => (e == null ? void 0 : e.webSocket) !== void 0 && typeof e.webSocket == "function" ? e.webSocket(...m) : new WebSocket(...m))(y.toString());
|
|
90
|
+
}
|
|
91
|
+
const f = new T(c, u);
|
|
92
|
+
if (u) {
|
|
93
|
+
e ?? (e = {});
|
|
94
|
+
const n = C(e, { ...t.args[1] });
|
|
95
|
+
return f.fetch(t.args[0], n);
|
|
96
|
+
}
|
|
97
|
+
return f;
|
|
98
|
+
}, []);
|
|
99
|
+
export {
|
|
100
|
+
E as hc
|
|
101
|
+
};
|
package/dist/index45.mjs
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useQueryClient as y, useMutation as m } from "@tanstack/react-query";
|
|
2
|
+
import { useQueryUnwrapped as p } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as d, authHeaders as c } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as l } from "./index19.mjs";
|
|
6
|
+
function F(e) {
|
|
7
|
+
const { baseURL: r, authToken: n } = l();
|
|
8
|
+
return p({
|
|
9
|
+
queryKey: i.admin.orders.list(),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const t = await d(r).orders.index.$get({}, c(n));
|
|
12
|
+
if (!t.ok)
|
|
13
|
+
throw new Error(`Failed to fetch orders: ${t.statusText}`);
|
|
14
|
+
return t.json();
|
|
15
|
+
},
|
|
16
|
+
...e
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function T(e, r) {
|
|
20
|
+
const { baseURL: n, authToken: s } = l();
|
|
21
|
+
return p({
|
|
22
|
+
queryKey: i.admin.orders.detail(e),
|
|
23
|
+
queryFn: async () => {
|
|
24
|
+
const o = await d(n).orders[":id"].$get(
|
|
25
|
+
{ param: { id: e } },
|
|
26
|
+
c(s)
|
|
27
|
+
);
|
|
28
|
+
if (!o.ok)
|
|
29
|
+
throw new Error(`Failed to fetch order: ${o.statusText}`);
|
|
30
|
+
return o.json();
|
|
31
|
+
},
|
|
32
|
+
...r
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function $(e) {
|
|
36
|
+
const { baseURL: r, authToken: n } = l(), s = y();
|
|
37
|
+
return m({
|
|
38
|
+
mutationFn: async (t) => {
|
|
39
|
+
const a = await d(r).orders.index.$post(
|
|
40
|
+
{ json: t },
|
|
41
|
+
c(n)
|
|
42
|
+
);
|
|
43
|
+
if (!a.ok)
|
|
44
|
+
throw new Error(`Failed to create order: ${a.statusText}`);
|
|
45
|
+
return a.json();
|
|
46
|
+
},
|
|
47
|
+
onSuccess: () => {
|
|
48
|
+
s.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
49
|
+
},
|
|
50
|
+
...e
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function j(e, r) {
|
|
54
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
55
|
+
return m({
|
|
56
|
+
mutationFn: async (o) => {
|
|
57
|
+
const u = await d(n).orders[":id"].$patch(
|
|
58
|
+
{ param: { id: e }, json: o },
|
|
59
|
+
c(s)
|
|
60
|
+
);
|
|
61
|
+
if (!u.ok)
|
|
62
|
+
throw new Error(`Failed to update order: ${u.statusText}`);
|
|
63
|
+
return u.json();
|
|
64
|
+
},
|
|
65
|
+
onSuccess: () => {
|
|
66
|
+
t.invalidateQueries({ queryKey: i.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
67
|
+
},
|
|
68
|
+
...r
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function x(e, r) {
|
|
72
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
73
|
+
return m({
|
|
74
|
+
mutationFn: async (o) => {
|
|
75
|
+
const u = await d(n).orders[":id"].status.$patch(
|
|
76
|
+
{ param: { id: e }, json: o },
|
|
77
|
+
c(s)
|
|
78
|
+
);
|
|
79
|
+
if (!u.ok)
|
|
80
|
+
throw new Error(`Failed to update order status: ${u.statusText}`);
|
|
81
|
+
return u.json();
|
|
82
|
+
},
|
|
83
|
+
onSuccess: () => {
|
|
84
|
+
t.invalidateQueries({ queryKey: i.admin.orders.detail(e) }), t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
85
|
+
},
|
|
86
|
+
...r
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function K(e, r) {
|
|
90
|
+
const { baseURL: n, authToken: s } = l(), t = y();
|
|
91
|
+
return m({
|
|
92
|
+
mutationFn: async () => {
|
|
93
|
+
const a = await d(n).orders[":id"].$delete(
|
|
94
|
+
{ param: { id: e } },
|
|
95
|
+
c(s)
|
|
96
|
+
);
|
|
97
|
+
if (!a.ok)
|
|
98
|
+
throw new Error(`Failed to delete order: ${a.statusText}`);
|
|
99
|
+
return a.json();
|
|
100
|
+
},
|
|
101
|
+
onSuccess: () => {
|
|
102
|
+
t.invalidateQueries({ queryKey: i.admin.orders.all });
|
|
103
|
+
},
|
|
104
|
+
...r
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
$ as useCreateOrder,
|
|
109
|
+
K as useDeleteOrder,
|
|
110
|
+
T as useGetOrder,
|
|
111
|
+
F as useListOrders,
|
|
112
|
+
j as useUpdateOrder,
|
|
113
|
+
x as useUpdateOrderStatus
|
|
114
|
+
};
|
package/dist/index46.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useQueryClient as y, useMutation as m } from "@tanstack/react-query";
|
|
2
|
+
import { useQueryUnwrapped as b } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as o } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
6
|
+
function k(e) {
|
|
7
|
+
const { baseURL: t, authToken: r } = d();
|
|
8
|
+
return b({
|
|
9
|
+
queryKey: o.admin.brands.list(),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const n = await u(t).brands.index.$get({}, c(r));
|
|
12
|
+
if (!n.ok) throw new Error(`Failed to fetch brands: ${n.statusText}`);
|
|
13
|
+
return n.json();
|
|
14
|
+
},
|
|
15
|
+
...e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function F(e, t) {
|
|
19
|
+
const { baseURL: r, authToken: s } = d();
|
|
20
|
+
return b({
|
|
21
|
+
queryKey: o.admin.brands.detail(e),
|
|
22
|
+
queryFn: async () => {
|
|
23
|
+
const i = await u(r).brands[":id"].$get({ param: { id: e } }, c(s));
|
|
24
|
+
if (!i.ok) throw new Error(`Failed to fetch brand: ${i.statusText}`);
|
|
25
|
+
return i.json();
|
|
26
|
+
},
|
|
27
|
+
...t
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function T(e) {
|
|
31
|
+
const { baseURL: t, authToken: r } = d(), s = y();
|
|
32
|
+
return m({
|
|
33
|
+
mutationFn: async (n) => {
|
|
34
|
+
const a = await u(t).brands.index.$post({ json: n }, c(r));
|
|
35
|
+
if (!a.ok) throw new Error(`Failed to create brand: ${a.statusText}`);
|
|
36
|
+
return a.json();
|
|
37
|
+
},
|
|
38
|
+
onSuccess: () => {
|
|
39
|
+
s.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
40
|
+
},
|
|
41
|
+
...e
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function $(e, t) {
|
|
45
|
+
const { baseURL: r, authToken: s } = d(), n = y();
|
|
46
|
+
return m({
|
|
47
|
+
mutationFn: async (i) => {
|
|
48
|
+
const l = await u(r).brands[":id"].$patch({ json: i, param: { id: e } }, c(s));
|
|
49
|
+
if (!l.ok) throw new Error(`Failed to update brand: ${l.statusText}`);
|
|
50
|
+
return l.json();
|
|
51
|
+
},
|
|
52
|
+
onSuccess: () => {
|
|
53
|
+
n.invalidateQueries({ queryKey: o.admin.brands.detail(e) }), n.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
54
|
+
},
|
|
55
|
+
...t
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function x(e, t) {
|
|
59
|
+
const { baseURL: r, authToken: s } = d(), n = y();
|
|
60
|
+
return m({
|
|
61
|
+
mutationFn: async () => {
|
|
62
|
+
const a = await u(r).brands[":id"].$delete({ param: { id: e } }, c(s));
|
|
63
|
+
if (!a.ok) throw new Error(`Failed to delete brand: ${a.statusText}`);
|
|
64
|
+
return a.json();
|
|
65
|
+
},
|
|
66
|
+
onSuccess: () => {
|
|
67
|
+
n.invalidateQueries({ queryKey: o.admin.brands.all });
|
|
68
|
+
},
|
|
69
|
+
...t
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
T as useCreateBrand,
|
|
74
|
+
x as useDeleteBrand,
|
|
75
|
+
F as useGetBrand,
|
|
76
|
+
k as useListBrands,
|
|
77
|
+
$ as useUpdateBrand
|
|
78
|
+
};
|
package/dist/index47.mjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useQueryClient as p, useMutation as y } from "@tanstack/react-query";
|
|
2
|
+
import { useQueryUnwrapped as m } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as a, authHeaders as c } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
6
|
+
function F(t, n) {
|
|
7
|
+
const { baseURL: r, authToken: s } = d();
|
|
8
|
+
return m({
|
|
9
|
+
queryKey: i.admin.products.list(t),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const e = await a(r).products.index.$get(
|
|
12
|
+
t ? { query: { brandId: t } } : {},
|
|
13
|
+
c(s)
|
|
14
|
+
);
|
|
15
|
+
if (!e.ok) throw new Error(`Failed to fetch products: ${e.statusText}`);
|
|
16
|
+
return e.json();
|
|
17
|
+
},
|
|
18
|
+
...n
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function T(t, n) {
|
|
22
|
+
const { baseURL: r, authToken: s } = d();
|
|
23
|
+
return m({
|
|
24
|
+
queryKey: i.admin.products.detail(t),
|
|
25
|
+
queryFn: async () => {
|
|
26
|
+
const e = await a(r).products[":id"].$get(
|
|
27
|
+
{ param: { id: t } },
|
|
28
|
+
c(s)
|
|
29
|
+
);
|
|
30
|
+
if (!e.ok) throw new Error(`Failed to fetch product: ${e.statusText}`);
|
|
31
|
+
return e.json();
|
|
32
|
+
},
|
|
33
|
+
...n
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function $(t) {
|
|
37
|
+
const { baseURL: n, authToken: r } = d(), s = p();
|
|
38
|
+
return y({
|
|
39
|
+
mutationFn: async (o) => {
|
|
40
|
+
const u = await a(n).products.index.$post(
|
|
41
|
+
{ json: o },
|
|
42
|
+
c(r)
|
|
43
|
+
);
|
|
44
|
+
if (!u.ok) throw new Error(`Failed to create product: ${u.statusText}`);
|
|
45
|
+
return u.json();
|
|
46
|
+
},
|
|
47
|
+
onSuccess: () => s.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
48
|
+
...t
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function x(t, n) {
|
|
52
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
53
|
+
return y({
|
|
54
|
+
mutationFn: async (e) => {
|
|
55
|
+
const l = await a(r).products[":id"].$patch(
|
|
56
|
+
{ param: { id: t }, json: e },
|
|
57
|
+
c(s)
|
|
58
|
+
);
|
|
59
|
+
if (!l.ok) throw new Error(`Failed to update product: ${l.statusText}`);
|
|
60
|
+
return l.json();
|
|
61
|
+
},
|
|
62
|
+
onSuccess: () => {
|
|
63
|
+
o.invalidateQueries({ queryKey: i.admin.products.detail(t) }), o.invalidateQueries({ queryKey: i.admin.products.all });
|
|
64
|
+
},
|
|
65
|
+
...n
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function j(t, n) {
|
|
69
|
+
const { baseURL: r, authToken: s } = d(), o = p();
|
|
70
|
+
return y({
|
|
71
|
+
mutationFn: async () => {
|
|
72
|
+
const u = await a(r).products[":id"].$delete(
|
|
73
|
+
{ param: { id: t } },
|
|
74
|
+
c(s)
|
|
75
|
+
);
|
|
76
|
+
if (!u.ok) throw new Error(`Failed to delete product: ${u.statusText}`);
|
|
77
|
+
return u.json();
|
|
78
|
+
},
|
|
79
|
+
onSuccess: () => o.invalidateQueries({ queryKey: i.admin.products.all }),
|
|
80
|
+
...n
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
$ as useCreateProduct,
|
|
85
|
+
j as useDeleteProduct,
|
|
86
|
+
T as useGetProduct,
|
|
87
|
+
F as useListProducts,
|
|
88
|
+
x as useUpdateProduct
|
|
89
|
+
};
|
package/dist/index48.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useQueryClient as y, useMutation as v } from "@tanstack/react-query";
|
|
2
|
+
import { useQueryUnwrapped as m } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as i } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as d } from "./index19.mjs";
|
|
6
|
+
function k(t, n) {
|
|
7
|
+
const { baseURL: a, authToken: r } = d();
|
|
8
|
+
return m({
|
|
9
|
+
queryKey: i.admin.variants.search(t),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const e = await u(a).variants.index.$get({ query: t }, c(r));
|
|
12
|
+
if (!e.ok) throw new Error(`Failed to search variants: ${e.statusText}`);
|
|
13
|
+
return e.json();
|
|
14
|
+
},
|
|
15
|
+
...n
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function F(t, n) {
|
|
19
|
+
const { baseURL: a, authToken: r } = d();
|
|
20
|
+
return m({
|
|
21
|
+
queryKey: i.admin.variants.byProduct(t),
|
|
22
|
+
queryFn: async () => {
|
|
23
|
+
const e = await u(a).variants.products[":productId"].variants.$get(
|
|
24
|
+
{ param: { productId: t } },
|
|
25
|
+
c(r)
|
|
26
|
+
);
|
|
27
|
+
if (!e.ok) throw new Error(`Failed to fetch product variants: ${e.statusText}`);
|
|
28
|
+
return e.json();
|
|
29
|
+
},
|
|
30
|
+
...n
|
|
31
|
+
});
|
|
32
|
+
}
|
|
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(
|
|
38
|
+
{ json: e, param: { productId: t } },
|
|
39
|
+
c(r)
|
|
40
|
+
);
|
|
41
|
+
if (!o.ok) throw new Error(`Failed to create variant: ${o.statusText}`);
|
|
42
|
+
return o.json();
|
|
43
|
+
},
|
|
44
|
+
onSuccess: () => {
|
|
45
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all }), s.invalidateQueries({ queryKey: i.admin.products.detail(t) });
|
|
46
|
+
},
|
|
47
|
+
...n
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function $(t, n) {
|
|
51
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
52
|
+
return v({
|
|
53
|
+
mutationFn: async (e) => {
|
|
54
|
+
const o = await u(a).variants[":id"].$patch(
|
|
55
|
+
{ json: e, param: { id: t } },
|
|
56
|
+
c(r)
|
|
57
|
+
);
|
|
58
|
+
if (!o.ok) throw new Error(`Failed to update variant: ${o.statusText}`);
|
|
59
|
+
return o.json();
|
|
60
|
+
},
|
|
61
|
+
onSuccess: () => {
|
|
62
|
+
s.invalidateQueries({ queryKey: i.admin.variants.detail(t) }), s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
63
|
+
},
|
|
64
|
+
...n
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function K(t, n) {
|
|
68
|
+
const { baseURL: a, authToken: r } = d();
|
|
69
|
+
return m({
|
|
70
|
+
queryKey: i.admin.variants.inventory(t),
|
|
71
|
+
queryFn: async () => {
|
|
72
|
+
const e = await u(a).variants[":id"].inventory.$get(
|
|
73
|
+
{ param: { id: t } },
|
|
74
|
+
c(r)
|
|
75
|
+
);
|
|
76
|
+
if (!e.ok) throw new Error(`Failed to fetch variant inventory: ${e.statusText}`);
|
|
77
|
+
return e.json();
|
|
78
|
+
},
|
|
79
|
+
...n
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function j(t, n) {
|
|
83
|
+
const { baseURL: a, authToken: r } = d(), s = y();
|
|
84
|
+
return v({
|
|
85
|
+
mutationFn: async () => {
|
|
86
|
+
const l = await u(a).variants[":id"].$delete(
|
|
87
|
+
{ param: { id: t } },
|
|
88
|
+
c(r)
|
|
89
|
+
);
|
|
90
|
+
if (!l.ok) throw new Error(`Failed to delete variant: ${l.statusText}`);
|
|
91
|
+
return l.json();
|
|
92
|
+
},
|
|
93
|
+
onSuccess: () => {
|
|
94
|
+
s.invalidateQueries({ queryKey: i.admin.variants.all });
|
|
95
|
+
},
|
|
96
|
+
...n
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
T as useCreateVariant,
|
|
101
|
+
j as useDeleteVariant,
|
|
102
|
+
K as useGetVariantInventory,
|
|
103
|
+
F as useListProductVariants,
|
|
104
|
+
k as useSearchVariants,
|
|
105
|
+
$ as useUpdateVariant
|
|
106
|
+
};
|
package/dist/index49.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useQueryClient as w, useMutation as y } from "@tanstack/react-query";
|
|
2
|
+
import { useQueryUnwrapped as d } from "./index61.mjs";
|
|
3
|
+
import { createAdminRpcClients as i, authHeaders as c } from "./index21.mjs";
|
|
4
|
+
import { queryKeys as u } from "./index26.mjs";
|
|
5
|
+
import { useApiConfig as l } from "./index19.mjs";
|
|
6
|
+
function F(e) {
|
|
7
|
+
const { baseURL: s, authToken: n } = l();
|
|
8
|
+
return d({
|
|
9
|
+
queryKey: u.admin.warehouses.list(),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const t = await i(s).warehouses.index.$get({}, c(n));
|
|
12
|
+
if (!t.ok) throw new Error(`Failed to fetch warehouses: ${t.statusText}`);
|
|
13
|
+
return t.json();
|
|
14
|
+
},
|
|
15
|
+
...e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function T(e) {
|
|
19
|
+
const { baseURL: s, authToken: n } = l(), r = w();
|
|
20
|
+
return y({
|
|
21
|
+
mutationFn: async (t) => {
|
|
22
|
+
const o = await i(s).warehouses.index.$post({ json: t }, c(n));
|
|
23
|
+
if (!o.ok) throw new Error(`Failed to create warehouse: ${o.statusText}`);
|
|
24
|
+
return o.json();
|
|
25
|
+
},
|
|
26
|
+
onSuccess: () => {
|
|
27
|
+
r.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
28
|
+
},
|
|
29
|
+
...e
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function $(e, s) {
|
|
33
|
+
const { baseURL: n, authToken: r } = l(), t = w();
|
|
34
|
+
return y({
|
|
35
|
+
mutationFn: async (a) => {
|
|
36
|
+
const h = await i(n).warehouses[":id"].$patch(
|
|
37
|
+
{ json: a, param: { id: e } },
|
|
38
|
+
c(r)
|
|
39
|
+
);
|
|
40
|
+
if (!h.ok) throw new Error(`Failed to update warehouse: ${h.statusText}`);
|
|
41
|
+
return h.json();
|
|
42
|
+
},
|
|
43
|
+
onSuccess: () => {
|
|
44
|
+
t.invalidateQueries({ queryKey: u.admin.warehouses.detail(e) }), t.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
45
|
+
},
|
|
46
|
+
...s
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function v(e, s) {
|
|
50
|
+
const { baseURL: n, authToken: r } = l();
|
|
51
|
+
return d({
|
|
52
|
+
queryKey: u.admin.warehouses.inventory(e),
|
|
53
|
+
queryFn: async () => {
|
|
54
|
+
const a = await i(n).warehouses[":id"].inventory.$get(
|
|
55
|
+
{ param: { id: e } },
|
|
56
|
+
c(r)
|
|
57
|
+
);
|
|
58
|
+
if (!a.ok) throw new Error(`Failed to fetch warehouse inventory: ${a.statusText}`);
|
|
59
|
+
return a.json();
|
|
60
|
+
},
|
|
61
|
+
...s
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function x(e, s) {
|
|
65
|
+
const { baseURL: n, authToken: r } = l(), t = w();
|
|
66
|
+
return y({
|
|
67
|
+
mutationFn: async () => {
|
|
68
|
+
const o = await i(n).warehouses[":id"].$delete(
|
|
69
|
+
{ param: { id: e } },
|
|
70
|
+
c(r)
|
|
71
|
+
);
|
|
72
|
+
if (!o.ok) throw new Error(`Failed to delete warehouse: ${o.statusText}`);
|
|
73
|
+
return o.json();
|
|
74
|
+
},
|
|
75
|
+
onSuccess: () => {
|
|
76
|
+
t.invalidateQueries({ queryKey: u.admin.warehouses.all });
|
|
77
|
+
},
|
|
78
|
+
...s
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
T as useCreateWarehouse,
|
|
83
|
+
x as useDeleteWarehouse,
|
|
84
|
+
v as useGetWarehouseInventory,
|
|
85
|
+
F as useListWarehouses,
|
|
86
|
+
$ as useUpdateWarehouse
|
|
87
|
+
};
|