@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/index89.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import n from "./index64.mjs";
|
|
2
|
+
const a = n.toObjectSet([
|
|
3
|
+
"age",
|
|
4
|
+
"authorization",
|
|
5
|
+
"content-length",
|
|
6
|
+
"content-type",
|
|
7
|
+
"etag",
|
|
8
|
+
"expires",
|
|
9
|
+
"from",
|
|
10
|
+
"host",
|
|
11
|
+
"if-modified-since",
|
|
12
|
+
"if-unmodified-since",
|
|
13
|
+
"last-modified",
|
|
14
|
+
"location",
|
|
15
|
+
"max-forwards",
|
|
16
|
+
"proxy-authorization",
|
|
17
|
+
"referer",
|
|
18
|
+
"retry-after",
|
|
19
|
+
"user-agent"
|
|
20
|
+
]), u = (s) => {
|
|
21
|
+
const t = {};
|
|
22
|
+
let e, r, i;
|
|
23
|
+
return s && s.split(`
|
|
24
|
+
`).forEach(function(o) {
|
|
25
|
+
i = o.indexOf(":"), e = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!e || t[e] && a[e]) && (e === "set-cookie" ? t[e] ? t[e].push(r) : t[e] = [r] : t[e] = t[e] ? t[e] + ", " + r : r);
|
|
26
|
+
}), t;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
u as default
|
|
30
|
+
};
|
package/dist/index9.mjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import { useCart as T } from "./index3.mjs";
|
|
4
|
+
import { Button as y } from "./index11.mjs";
|
|
5
|
+
import { Badge as k } from "./index13.mjs";
|
|
6
|
+
import { Tag as B, CheckCircle as b, X as E, AlertCircle as F } from "lucide-react";
|
|
7
|
+
import { cn as p } from "./index17.mjs";
|
|
8
|
+
function K({
|
|
9
|
+
onSuccess: i,
|
|
10
|
+
className: N,
|
|
11
|
+
placeholder: w = "Enter discount code",
|
|
12
|
+
inputClassName: C,
|
|
13
|
+
buttonClassName: A
|
|
14
|
+
}) {
|
|
15
|
+
var v;
|
|
16
|
+
const [n, g] = a(""), [u, o] = a(""), [l, f] = a(!1), [h, x] = a(!1), [d, c] = a(""), { applyDiscount: D, removeDiscount: I, cart: r } = T(), M = async (t) => {
|
|
17
|
+
if (t.preventDefault(), !!n.trim()) {
|
|
18
|
+
f(!0), c("");
|
|
19
|
+
try {
|
|
20
|
+
await D(n.trim()), o("Discount code applied!"), g(""), setTimeout(() => o(""), 3e3), i == null || i();
|
|
21
|
+
} catch (m) {
|
|
22
|
+
c((m == null ? void 0 : m.message) || "Invalid or expired discount code");
|
|
23
|
+
} finally {
|
|
24
|
+
f(!1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, R = async () => {
|
|
28
|
+
x(!0), c("");
|
|
29
|
+
try {
|
|
30
|
+
await I(), o("Discount code removed"), setTimeout(() => o(""), 3e3), i == null || i();
|
|
31
|
+
} catch (t) {
|
|
32
|
+
c((t == null ? void 0 : t.message) || "Failed to remove discount code");
|
|
33
|
+
} finally {
|
|
34
|
+
x(!1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ e("div", { className: p("", N), children: /* @__PURE__ */ e("div", { className: "pt-6", children: /* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
38
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
|
|
39
|
+
/* @__PURE__ */ e(B, { className: "h-4 w-4" }),
|
|
40
|
+
"Discount Code"
|
|
41
|
+
] }),
|
|
42
|
+
r && r.pricing.discount && /* @__PURE__ */ s("div", { className: "flex items-center justify-between rounded-md bg-green-50 p-3", children: [
|
|
43
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
44
|
+
/* @__PURE__ */ e(b, { className: "h-4 w-4 text-green-600" }),
|
|
45
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-green-900", children: "Code Applied:" }),
|
|
46
|
+
/* @__PURE__ */ e(k, { className: "bg-green-600 text-white", children: r.pricing.discount.code })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
y,
|
|
50
|
+
{
|
|
51
|
+
variant: "ghost",
|
|
52
|
+
size: "sm",
|
|
53
|
+
onClick: R,
|
|
54
|
+
disabled: h,
|
|
55
|
+
className: "h-8 px-2 text-green-700 hover:text-green-800",
|
|
56
|
+
children: h ? "Removing..." : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(E, { className: "h-4 w-4" }) })
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
!((v = r == null ? void 0 : r.pricing) != null && v.discount) && /* @__PURE__ */ s("form", { onSubmit: M, className: "flex gap-2", children: [
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
type: "text",
|
|
65
|
+
value: n,
|
|
66
|
+
onChange: (t) => g(t.target.value.toUpperCase()),
|
|
67
|
+
placeholder: w,
|
|
68
|
+
disabled: l,
|
|
69
|
+
className: p(
|
|
70
|
+
"flex-1 rounded-md border border-gray-300 px-3 py-2 text-sm",
|
|
71
|
+
"focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
|
|
72
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
73
|
+
d && "border-red-500 focus:border-red-500 focus:ring-red-500",
|
|
74
|
+
C
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
y,
|
|
80
|
+
{
|
|
81
|
+
type: "submit",
|
|
82
|
+
disabled: !n.trim() || l,
|
|
83
|
+
className: p("bg-accent-500 text-white hover:bg-accent-600", A),
|
|
84
|
+
children: l ? "Applying..." : "Apply"
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
d && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm text-red-600", children: [
|
|
89
|
+
/* @__PURE__ */ e(F, { className: "h-4 w-4" }),
|
|
90
|
+
d
|
|
91
|
+
] }),
|
|
92
|
+
u && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm text-green-600", children: [
|
|
93
|
+
/* @__PURE__ */ e(b, { className: "h-4 w-4" }),
|
|
94
|
+
u
|
|
95
|
+
] })
|
|
96
|
+
] }) }) });
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
K as DiscountCodeInput
|
|
100
|
+
};
|
package/dist/index90.mjs
ADDED
package/dist/index91.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import H from "./index64.mjs";
|
|
2
|
+
import D from "./index99.mjs";
|
|
3
|
+
import L from "./index86.mjs";
|
|
4
|
+
import n from "./index75.mjs";
|
|
5
|
+
import y from "./index70.mjs";
|
|
6
|
+
import O from "./index100.mjs";
|
|
7
|
+
import U from "./index88.mjs";
|
|
8
|
+
import q from "./index78.mjs";
|
|
9
|
+
import { progressEventReducer as A } from "./index101.mjs";
|
|
10
|
+
import v from "./index102.mjs";
|
|
11
|
+
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
|
12
|
+
return new Promise(function(C, i) {
|
|
13
|
+
const t = v(s);
|
|
14
|
+
let E = t.data;
|
|
15
|
+
const T = q.from(t.headers).normalize();
|
|
16
|
+
let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
|
|
17
|
+
function x() {
|
|
18
|
+
u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
|
|
19
|
+
}
|
|
20
|
+
let e = new XMLHttpRequest();
|
|
21
|
+
e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
|
|
22
|
+
function b() {
|
|
23
|
+
if (!e)
|
|
24
|
+
return;
|
|
25
|
+
const o = q.from(
|
|
26
|
+
"getAllResponseHeaders" in e && e.getAllResponseHeaders()
|
|
27
|
+
), a = {
|
|
28
|
+
data: !d || d === "text" || d === "json" ? e.responseText : e.response,
|
|
29
|
+
status: e.status,
|
|
30
|
+
statusText: e.statusText,
|
|
31
|
+
headers: o,
|
|
32
|
+
config: s,
|
|
33
|
+
request: e
|
|
34
|
+
};
|
|
35
|
+
D(function(c) {
|
|
36
|
+
C(c), x();
|
|
37
|
+
}, function(c) {
|
|
38
|
+
i(c), x();
|
|
39
|
+
}, a), e = null;
|
|
40
|
+
}
|
|
41
|
+
"onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
|
|
42
|
+
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
|
|
43
|
+
}, e.onabort = function() {
|
|
44
|
+
e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
|
|
45
|
+
}, e.onerror = function(r) {
|
|
46
|
+
const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
|
|
47
|
+
p.event = r || null, i(p), e = null;
|
|
48
|
+
}, e.ontimeout = function() {
|
|
49
|
+
let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
|
|
50
|
+
const a = t.transitional || L;
|
|
51
|
+
t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
|
|
52
|
+
r,
|
|
53
|
+
a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
|
|
54
|
+
s,
|
|
55
|
+
e
|
|
56
|
+
)), e = null;
|
|
57
|
+
}, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
|
|
58
|
+
e.setRequestHeader(a, r);
|
|
59
|
+
}), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
|
|
60
|
+
e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
|
|
61
|
+
}, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
|
|
62
|
+
const m = O(t.url);
|
|
63
|
+
if (m && U.protocols.indexOf(m) === -1) {
|
|
64
|
+
i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
e.send(E || null);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
Q as default
|
|
72
|
+
};
|
package/dist/index92.mjs
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import K from "./index88.mjs";
|
|
2
|
+
import t from "./index64.mjs";
|
|
3
|
+
import b from "./index75.mjs";
|
|
4
|
+
import ee from "./index103.mjs";
|
|
5
|
+
import { trackStream as z } from "./index104.mjs";
|
|
6
|
+
import te from "./index78.mjs";
|
|
7
|
+
import { progressEventDecorator as I, progressEventReducer as M, asyncDecorator as j } from "./index101.mjs";
|
|
8
|
+
import se from "./index102.mjs";
|
|
9
|
+
import re from "./index99.mjs";
|
|
10
|
+
const J = 64 * 1024, { isFunction: P } = t, ne = (({ Request: r, Response: n }) => ({
|
|
11
|
+
Request: r,
|
|
12
|
+
Response: n
|
|
13
|
+
}))(t.global), {
|
|
14
|
+
ReadableStream: V,
|
|
15
|
+
TextEncoder: W
|
|
16
|
+
} = t.global, Z = (r, ...n) => {
|
|
17
|
+
try {
|
|
18
|
+
return !!r(...n);
|
|
19
|
+
} catch {
|
|
20
|
+
return !1;
|
|
21
|
+
}
|
|
22
|
+
}, oe = (r) => {
|
|
23
|
+
r = t.merge.call({
|
|
24
|
+
skipUndefined: !0
|
|
25
|
+
}, ne, r);
|
|
26
|
+
const { fetch: n, Request: o, Response: y } = r, g = n ? P(n) : typeof fetch == "function", f = P(o), F = P(y);
|
|
27
|
+
if (!g)
|
|
28
|
+
return !1;
|
|
29
|
+
const w = g && P(V), R = g && (typeof W == "function" ? /* @__PURE__ */ ((e) => (s) => e.encode(s))(new W()) : async (e) => new Uint8Array(await new o(e).arrayBuffer())), d = f && w && Z(() => {
|
|
30
|
+
let e = !1;
|
|
31
|
+
const s = new o(K.origin, {
|
|
32
|
+
body: new V(),
|
|
33
|
+
method: "POST",
|
|
34
|
+
get duplex() {
|
|
35
|
+
return e = !0, "half";
|
|
36
|
+
}
|
|
37
|
+
}).headers.has("Content-Type");
|
|
38
|
+
return e && !s;
|
|
39
|
+
}), h = F && w && Z(() => t.isReadableStream(new y("").body)), x = {
|
|
40
|
+
stream: h && ((e) => e.body)
|
|
41
|
+
};
|
|
42
|
+
g && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
|
|
43
|
+
!x[e] && (x[e] = (s, i) => {
|
|
44
|
+
let c = s && s[e];
|
|
45
|
+
if (c)
|
|
46
|
+
return c.call(s);
|
|
47
|
+
throw new b(`Response type '${e}' is not supported`, b.ERR_NOT_SUPPORT, i);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const $ = async (e) => {
|
|
51
|
+
if (e == null)
|
|
52
|
+
return 0;
|
|
53
|
+
if (t.isBlob(e))
|
|
54
|
+
return e.size;
|
|
55
|
+
if (t.isSpecCompliantForm(e))
|
|
56
|
+
return (await new o(K.origin, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
body: e
|
|
59
|
+
}).arrayBuffer()).byteLength;
|
|
60
|
+
if (t.isArrayBufferView(e) || t.isArrayBuffer(e))
|
|
61
|
+
return e.byteLength;
|
|
62
|
+
if (t.isURLSearchParams(e) && (e = e + ""), t.isString(e))
|
|
63
|
+
return (await R(e)).byteLength;
|
|
64
|
+
}, G = async (e, s) => {
|
|
65
|
+
const i = t.toFiniteNumber(e.getContentLength());
|
|
66
|
+
return i ?? $(s);
|
|
67
|
+
};
|
|
68
|
+
return async (e) => {
|
|
69
|
+
let {
|
|
70
|
+
url: s,
|
|
71
|
+
method: i,
|
|
72
|
+
data: c,
|
|
73
|
+
signal: Q,
|
|
74
|
+
cancelToken: _,
|
|
75
|
+
timeout: X,
|
|
76
|
+
onDownloadProgress: O,
|
|
77
|
+
onUploadProgress: B,
|
|
78
|
+
responseType: l,
|
|
79
|
+
headers: q,
|
|
80
|
+
withCredentials: C = "same-origin",
|
|
81
|
+
fetchOptions: U
|
|
82
|
+
} = se(e), v = n || fetch;
|
|
83
|
+
l = l ? (l + "").toLowerCase() : "text";
|
|
84
|
+
let E = ee([Q, _ && _.toAbortSignal()], X), T = null;
|
|
85
|
+
const m = E && E.unsubscribe && (() => {
|
|
86
|
+
E.unsubscribe();
|
|
87
|
+
});
|
|
88
|
+
let D;
|
|
89
|
+
try {
|
|
90
|
+
if (B && d && i !== "get" && i !== "head" && (D = await G(q, c)) !== 0) {
|
|
91
|
+
let p = new o(s, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
body: c,
|
|
94
|
+
duplex: "half"
|
|
95
|
+
}), S;
|
|
96
|
+
if (t.isFormData(c) && (S = p.headers.get("content-type")) && q.setContentType(S), p.body) {
|
|
97
|
+
const [A, L] = I(
|
|
98
|
+
D,
|
|
99
|
+
M(j(B))
|
|
100
|
+
);
|
|
101
|
+
c = z(p.body, J, A, L);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
t.isString(C) || (C = C ? "include" : "omit");
|
|
105
|
+
const a = f && "credentials" in o.prototype, N = {
|
|
106
|
+
...U,
|
|
107
|
+
signal: E,
|
|
108
|
+
method: i.toUpperCase(),
|
|
109
|
+
headers: q.normalize().toJSON(),
|
|
110
|
+
body: c,
|
|
111
|
+
duplex: "half",
|
|
112
|
+
credentials: a ? C : void 0
|
|
113
|
+
};
|
|
114
|
+
T = f && new o(s, N);
|
|
115
|
+
let u = await (f ? v(T, U) : v(s, N));
|
|
116
|
+
const k = h && (l === "stream" || l === "response");
|
|
117
|
+
if (h && (O || k && m)) {
|
|
118
|
+
const p = {};
|
|
119
|
+
["status", "statusText", "headers"].forEach((H) => {
|
|
120
|
+
p[H] = u[H];
|
|
121
|
+
});
|
|
122
|
+
const S = t.toFiniteNumber(u.headers.get("content-length")), [A, L] = O && I(
|
|
123
|
+
S,
|
|
124
|
+
M(j(O), !0)
|
|
125
|
+
) || [];
|
|
126
|
+
u = new y(
|
|
127
|
+
z(u.body, J, A, () => {
|
|
128
|
+
L && L(), m && m();
|
|
129
|
+
}),
|
|
130
|
+
p
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
l = l || "text";
|
|
134
|
+
let Y = await x[t.findKey(x, l) || "text"](u, e);
|
|
135
|
+
return !k && m && m(), await new Promise((p, S) => {
|
|
136
|
+
re(p, S, {
|
|
137
|
+
data: Y,
|
|
138
|
+
headers: te.from(u.headers),
|
|
139
|
+
status: u.status,
|
|
140
|
+
statusText: u.statusText,
|
|
141
|
+
config: e,
|
|
142
|
+
request: T
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
} catch (a) {
|
|
146
|
+
throw m && m(), a && a.name === "TypeError" && /Load failed|fetch/i.test(a.message) ? Object.assign(
|
|
147
|
+
new b("Network Error", b.ERR_NETWORK, e, T),
|
|
148
|
+
{
|
|
149
|
+
cause: a.cause || a
|
|
150
|
+
}
|
|
151
|
+
) : b.from(a, a && a.code, e, T);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, ae = /* @__PURE__ */ new Map(), ie = (r) => {
|
|
155
|
+
let n = r ? r.env : {};
|
|
156
|
+
const { fetch: o, Request: y, Response: g } = n, f = [
|
|
157
|
+
y,
|
|
158
|
+
g,
|
|
159
|
+
o
|
|
160
|
+
];
|
|
161
|
+
let F = f.length, w = F, R, d, h = ae;
|
|
162
|
+
for (; w--; )
|
|
163
|
+
R = f[w], d = h.get(R), d === void 0 && h.set(R, d = w ? /* @__PURE__ */ new Map() : oe(n)), h = d;
|
|
164
|
+
return d;
|
|
165
|
+
};
|
|
166
|
+
ie();
|
|
167
|
+
export {
|
|
168
|
+
ie as getFetch
|
|
169
|
+
};
|
package/dist/index93.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import o from "./index105.mjs";
|
|
2
|
+
import r from "./index106.mjs";
|
|
3
|
+
import t from "./index107.mjs";
|
|
4
|
+
const l = {
|
|
5
|
+
isBrowser: !0,
|
|
6
|
+
classes: {
|
|
7
|
+
URLSearchParams: o,
|
|
8
|
+
FormData: r,
|
|
9
|
+
Blob: t
|
|
10
|
+
},
|
|
11
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
l as default
|
|
15
|
+
};
|
package/dist/index94.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e = typeof window < "u" && typeof document < "u", o = typeof navigator == "object" && navigator || void 0, n = e && (!o || ["ReactNative", "NativeScript", "NS"].indexOf(o.product) < 0), t = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
2
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", r = e && window.location.href || "http://localhost";
|
|
3
|
+
export {
|
|
4
|
+
e as hasBrowserEnv,
|
|
5
|
+
n as hasStandardBrowserEnv,
|
|
6
|
+
t as hasStandardBrowserWebWorkerEnv,
|
|
7
|
+
o as navigator,
|
|
8
|
+
r as origin
|
|
9
|
+
};
|
package/dist/index95.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import p from "./index74.mjs";
|
|
2
|
+
function i(n) {
|
|
3
|
+
const t = {
|
|
4
|
+
"!": "%21",
|
|
5
|
+
"'": "%27",
|
|
6
|
+
"(": "%28",
|
|
7
|
+
")": "%29",
|
|
8
|
+
"~": "%7E",
|
|
9
|
+
"%20": "+",
|
|
10
|
+
"%00": "\0"
|
|
11
|
+
};
|
|
12
|
+
return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
13
|
+
return t[r];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function a(n, t) {
|
|
17
|
+
this._pairs = [], n && p(n, this, t);
|
|
18
|
+
}
|
|
19
|
+
const c = a.prototype;
|
|
20
|
+
c.append = function(t, o) {
|
|
21
|
+
this._pairs.push([t, o]);
|
|
22
|
+
};
|
|
23
|
+
c.toString = function(t) {
|
|
24
|
+
const o = t ? function(r) {
|
|
25
|
+
return t.call(this, r, i);
|
|
26
|
+
} : i;
|
|
27
|
+
return this._pairs.map(function(e) {
|
|
28
|
+
return o(e[0]) + "=" + o(e[1]);
|
|
29
|
+
}, "").join("&");
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
a as default
|
|
33
|
+
};
|
package/dist/index96.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import i from "./index64.mjs";
|
|
2
|
+
import m from "./index68.mjs";
|
|
3
|
+
import s from "./index78.mjs";
|
|
4
|
+
function h(f, t) {
|
|
5
|
+
const o = this || m, r = t || o, n = s.from(r.headers);
|
|
6
|
+
let a = r.data;
|
|
7
|
+
return i.forEach(f, function(e) {
|
|
8
|
+
a = e.call(o, a, n.normalize(), t ? t.status : void 0);
|
|
9
|
+
}), n.normalize(), a;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
h as default
|
|
13
|
+
};
|
package/dist/index97.mjs
ADDED
package/dist/index98.mjs
ADDED
package/dist/index99.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import a from "./index75.mjs";
|
|
2
|
+
function E(i, f, t) {
|
|
3
|
+
const u = t.config.validateStatus;
|
|
4
|
+
!t.status || !u || u(t.status) ? i(t) : f(new a(
|
|
5
|
+
"Request failed with status code " + t.status,
|
|
6
|
+
[a.ERR_BAD_REQUEST, a.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
7
|
+
t.config,
|
|
8
|
+
t.request,
|
|
9
|
+
t
|
|
10
|
+
));
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
E as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue } from "clsx";
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export declare function formatCurrency(amount: number): string;
|
|
4
|
+
export declare function formatDate(date: string | Date): string;
|
|
5
|
+
export declare function formatDateTime(date: string | Date): string;
|
|
6
|
+
export declare function getStatusColor(status: string): string;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAS1D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrD"}
|