@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/index58.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as d } from "./index59.mjs";
|
|
2
|
+
import { __module as v } from "./index60.mjs";
|
|
3
|
+
v.exports = function(n) {
|
|
4
|
+
return g(m(n), n);
|
|
5
|
+
};
|
|
6
|
+
v.exports.array = g;
|
|
7
|
+
function g(n, r) {
|
|
8
|
+
var t = n.length, e = new Array(t), o = {}, u = t, c = y(r), f = E(n);
|
|
9
|
+
for (r.forEach(function(a) {
|
|
10
|
+
if (!f.has(a[0]) || !f.has(a[1]))
|
|
11
|
+
throw new Error("Unknown node. There is an unknown node in the supplied edges.");
|
|
12
|
+
}); u--; )
|
|
13
|
+
o[u] || l(n[u], u, /* @__PURE__ */ new Set());
|
|
14
|
+
return e;
|
|
15
|
+
function l(a, s, i) {
|
|
16
|
+
if (i.has(a)) {
|
|
17
|
+
var w;
|
|
18
|
+
try {
|
|
19
|
+
w = ", node was:" + JSON.stringify(a);
|
|
20
|
+
} catch {
|
|
21
|
+
w = "";
|
|
22
|
+
}
|
|
23
|
+
throw new Error("Cyclic dependency" + w);
|
|
24
|
+
}
|
|
25
|
+
if (!f.has(a))
|
|
26
|
+
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(a));
|
|
27
|
+
if (!o[s]) {
|
|
28
|
+
o[s] = !0;
|
|
29
|
+
var h = c.get(a) || /* @__PURE__ */ new Set();
|
|
30
|
+
if (h = Array.from(h), s = h.length) {
|
|
31
|
+
i.add(a);
|
|
32
|
+
do {
|
|
33
|
+
var p = h[--s];
|
|
34
|
+
l(p, f.get(p), i);
|
|
35
|
+
} while (s);
|
|
36
|
+
i.delete(a);
|
|
37
|
+
}
|
|
38
|
+
e[--t] = a;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function m(n) {
|
|
43
|
+
for (var r = /* @__PURE__ */ new Set(), t = 0, e = n.length; t < e; t++) {
|
|
44
|
+
var o = n[t];
|
|
45
|
+
r.add(o[0]), r.add(o[1]);
|
|
46
|
+
}
|
|
47
|
+
return Array.from(r);
|
|
48
|
+
}
|
|
49
|
+
function y(n) {
|
|
50
|
+
for (var r = /* @__PURE__ */ new Map(), t = 0, e = n.length; t < e; t++) {
|
|
51
|
+
var o = n[t];
|
|
52
|
+
r.has(o[0]) || r.set(o[0], /* @__PURE__ */ new Set()), r.has(o[1]) || r.set(o[1], /* @__PURE__ */ new Set()), r.get(o[0]).add(o[1]);
|
|
53
|
+
}
|
|
54
|
+
return r;
|
|
55
|
+
}
|
|
56
|
+
function E(n) {
|
|
57
|
+
for (var r = /* @__PURE__ */ new Map(), t = 0, e = n.length; t < e; t++)
|
|
58
|
+
r.set(n[t], t);
|
|
59
|
+
return r;
|
|
60
|
+
}
|
|
61
|
+
var k = v.exports;
|
|
62
|
+
const A = /* @__PURE__ */ d(k);
|
|
63
|
+
export {
|
|
64
|
+
A as default
|
|
65
|
+
};
|
package/dist/index59.mjs
ADDED
package/dist/index6.mjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import "./index18.mjs";
|
|
3
|
+
import "@tanstack/react-query";
|
|
4
|
+
import { useGetProducts as C } from "./index31.mjs";
|
|
5
|
+
import { ProductCard as k } from "./index5.mjs";
|
|
6
|
+
import { Loader2 as j, Package as d } from "lucide-react";
|
|
7
|
+
import { cn as P } from "./index17.mjs";
|
|
8
|
+
function q({
|
|
9
|
+
brandId: o,
|
|
10
|
+
onAddToCart: l,
|
|
11
|
+
onProductClick: t,
|
|
12
|
+
columns: n = 3,
|
|
13
|
+
showStock: m = !0,
|
|
14
|
+
className: g,
|
|
15
|
+
cardClassName: p,
|
|
16
|
+
showLoading: u = !0,
|
|
17
|
+
emptyMessage: x = "No products available at the moment.",
|
|
18
|
+
errorMessage: h = "Failed to load products. Please try again later.",
|
|
19
|
+
loadingVariantId: f
|
|
20
|
+
}) {
|
|
21
|
+
const { data: N, isLoading: v, error: y } = C(o);
|
|
22
|
+
if (v && u)
|
|
23
|
+
return /* @__PURE__ */ e("div", { className: "flex min-h-[400px] items-center justify-center", children: /* @__PURE__ */ s("div", { className: "text-center", children: [
|
|
24
|
+
/* @__PURE__ */ e(j, { className: "mx-auto mb-4 h-12 w-12 animate-spin text-blue-600" }),
|
|
25
|
+
/* @__PURE__ */ e("p", { className: "text-gray-600", children: "Loading products..." })
|
|
26
|
+
] }) });
|
|
27
|
+
if (y)
|
|
28
|
+
return /* @__PURE__ */ e("div", { className: "flex min-h-[400px] items-center justify-center", children: /* @__PURE__ */ s("div", { className: "text-center", children: [
|
|
29
|
+
/* @__PURE__ */ e(d, { className: "mx-auto mb-4 h-12 w-12 text-red-600" }),
|
|
30
|
+
/* @__PURE__ */ e("p", { className: "text-red-600", children: h })
|
|
31
|
+
] }) });
|
|
32
|
+
const a = N || [];
|
|
33
|
+
return a.length === 0 ? /* @__PURE__ */ e("div", { className: "flex min-h-[400px] items-center justify-center", children: /* @__PURE__ */ s("div", { className: "text-center", children: [
|
|
34
|
+
/* @__PURE__ */ e(d, { className: "mx-auto mb-4 h-12 w-12 text-gray-400" }),
|
|
35
|
+
/* @__PURE__ */ e("p", { className: "text-gray-600", children: x })
|
|
36
|
+
] }) }) : /* @__PURE__ */ e(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: P(
|
|
40
|
+
"grid gap-6",
|
|
41
|
+
{
|
|
42
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
43
|
+
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
44
|
+
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
|
45
|
+
}[n],
|
|
46
|
+
g
|
|
47
|
+
),
|
|
48
|
+
children: a.map((i) => {
|
|
49
|
+
const c = {
|
|
50
|
+
id: i.id,
|
|
51
|
+
name: i.name,
|
|
52
|
+
description: i.description || void 0,
|
|
53
|
+
imageUrl: i.thumbnailUrl || void 0,
|
|
54
|
+
brand: void 0,
|
|
55
|
+
// Brand info not included in product response
|
|
56
|
+
variants: i.variants.map((r) => ({
|
|
57
|
+
id: r.id,
|
|
58
|
+
name: r.name || r.sku,
|
|
59
|
+
price: typeof r.price == "string" ? parseFloat(r.price) : r.price,
|
|
60
|
+
sku: r.sku,
|
|
61
|
+
stock: r.stock || void 0
|
|
62
|
+
}))
|
|
63
|
+
}, b = i.variants.some((r) => r.id === f);
|
|
64
|
+
return /* @__PURE__ */ e(
|
|
65
|
+
k,
|
|
66
|
+
{
|
|
67
|
+
product: c,
|
|
68
|
+
onAddToCart: l,
|
|
69
|
+
onClick: t ? () => t(c) : void 0,
|
|
70
|
+
showStock: m,
|
|
71
|
+
className: p,
|
|
72
|
+
isAddingToCart: b
|
|
73
|
+
},
|
|
74
|
+
i.id
|
|
75
|
+
);
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
q as ProductGrid
|
|
82
|
+
};
|
package/dist/index60.mjs
ADDED
package/dist/index61.mjs
ADDED
package/dist/index62.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var a = (i, t, e = {}) => {
|
|
2
|
+
let r = `${i}=${t}`;
|
|
3
|
+
if (i.startsWith("__Secure-") && !e.secure)
|
|
4
|
+
throw new Error("__Secure- Cookie must have Secure attributes");
|
|
5
|
+
if (i.startsWith("__Host-")) {
|
|
6
|
+
if (!e.secure)
|
|
7
|
+
throw new Error("__Host- Cookie must have Secure attributes");
|
|
8
|
+
if (e.path !== "/")
|
|
9
|
+
throw new Error('__Host- Cookie must have Path attributes with "/"');
|
|
10
|
+
if (e.domain)
|
|
11
|
+
throw new Error("__Host- Cookie must not have Domain attributes");
|
|
12
|
+
}
|
|
13
|
+
if (e && typeof e.maxAge == "number" && e.maxAge >= 0) {
|
|
14
|
+
if (e.maxAge > 3456e4)
|
|
15
|
+
throw new Error(
|
|
16
|
+
"Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration."
|
|
17
|
+
);
|
|
18
|
+
r += `; Max-Age=${e.maxAge | 0}`;
|
|
19
|
+
}
|
|
20
|
+
if (e.domain && e.prefix !== "host" && (r += `; Domain=${e.domain}`), e.path && (r += `; Path=${e.path}`), e.expires) {
|
|
21
|
+
if (e.expires.getTime() - Date.now() > 3456e7)
|
|
22
|
+
throw new Error(
|
|
23
|
+
"Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future."
|
|
24
|
+
);
|
|
25
|
+
r += `; Expires=${e.expires.toUTCString()}`;
|
|
26
|
+
}
|
|
27
|
+
if (e.httpOnly && (r += "; HttpOnly"), e.secure && (r += "; Secure"), e.sameSite && (r += `; SameSite=${e.sameSite.charAt(0).toUpperCase() + e.sameSite.slice(1)}`), e.priority && (r += `; Priority=${e.priority.charAt(0).toUpperCase() + e.priority.slice(1)}`), e.partitioned) {
|
|
28
|
+
if (!e.secure)
|
|
29
|
+
throw new Error("Partitioned Cookie must have Secure attributes");
|
|
30
|
+
r += "; Partitioned";
|
|
31
|
+
}
|
|
32
|
+
return r;
|
|
33
|
+
}, s = (i, t, e) => (t = encodeURIComponent(t), a(i, t, e));
|
|
34
|
+
export {
|
|
35
|
+
s as serialize
|
|
36
|
+
};
|
package/dist/index63.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var s = (e, r) => (e = e.replace(/\/+$/, ""), e = e + "/", r = r.replace(/^\/+/, ""), e + r), p = (e, r) => {
|
|
2
|
+
for (const [n, t] of Object.entries(r)) {
|
|
3
|
+
const c = new RegExp("/:" + n + "(?:{[^/]+})?\\??");
|
|
4
|
+
e = e.replace(c, t ? `/${t}` : "");
|
|
5
|
+
}
|
|
6
|
+
return e;
|
|
7
|
+
}, f = (e) => {
|
|
8
|
+
const r = new URLSearchParams();
|
|
9
|
+
for (const [n, t] of Object.entries(e))
|
|
10
|
+
if (t !== void 0)
|
|
11
|
+
if (Array.isArray(t))
|
|
12
|
+
for (const c of t)
|
|
13
|
+
r.append(n, c);
|
|
14
|
+
else
|
|
15
|
+
r.set(n, t);
|
|
16
|
+
return r;
|
|
17
|
+
}, i = (e, r) => {
|
|
18
|
+
switch (r) {
|
|
19
|
+
case "ws":
|
|
20
|
+
return e.replace(/^http/, "ws");
|
|
21
|
+
case "http":
|
|
22
|
+
return e.replace(/^ws/, "http");
|
|
23
|
+
}
|
|
24
|
+
}, l = (e) => /^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e) ? e.replace(/\/index(?=\?|$)/, "/") : e.replace(/\/index(?=\?|$)/, "");
|
|
25
|
+
function a(e) {
|
|
26
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
27
|
+
}
|
|
28
|
+
function o(e, r) {
|
|
29
|
+
if (!a(e) && !a(r))
|
|
30
|
+
return r;
|
|
31
|
+
const n = { ...e };
|
|
32
|
+
for (const t in r) {
|
|
33
|
+
const c = r[t];
|
|
34
|
+
a(n[t]) && a(c) ? n[t] = o(n[t], c) : n[t] = c;
|
|
35
|
+
}
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
f as buildSearchParams,
|
|
40
|
+
o as deepMerge,
|
|
41
|
+
s as mergePath,
|
|
42
|
+
l as removeIndexString,
|
|
43
|
+
p as replaceUrlParam,
|
|
44
|
+
i as replaceUrlProtocol
|
|
45
|
+
};
|
package/dist/index64.mjs
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import R from "./index65.mjs";
|
|
2
|
+
const { toString: T } = Object.prototype, { getPrototypeOf: A } = Object, { iterator: g, toStringTag: S } = Symbol, F = /* @__PURE__ */ ((e) => (t) => {
|
|
3
|
+
const n = T.call(t);
|
|
4
|
+
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
5
|
+
})(/* @__PURE__ */ Object.create(null)), f = (e) => (e = e.toLowerCase(), (t) => F(t) === e), O = (e) => (t) => typeof t === e, { isArray: p } = Array, a = O("undefined");
|
|
6
|
+
function d(e) {
|
|
7
|
+
return e !== null && !a(e) && e.constructor !== null && !a(e.constructor) && c(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
8
|
+
}
|
|
9
|
+
const B = f("ArrayBuffer");
|
|
10
|
+
function M(e) {
|
|
11
|
+
let t;
|
|
12
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && B(e.buffer), t;
|
|
13
|
+
}
|
|
14
|
+
const k = O("string"), c = O("function"), E = O("number"), y = (e) => e !== null && typeof e == "object", N = (e) => e === !0 || e === !1, w = (e) => {
|
|
15
|
+
if (F(e) !== "object")
|
|
16
|
+
return !1;
|
|
17
|
+
const t = A(e);
|
|
18
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(S in e) && !(g in e);
|
|
19
|
+
}, U = (e) => {
|
|
20
|
+
if (!y(e) || d(e))
|
|
21
|
+
return !1;
|
|
22
|
+
try {
|
|
23
|
+
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
|
|
24
|
+
} catch {
|
|
25
|
+
return !1;
|
|
26
|
+
}
|
|
27
|
+
}, I = f("Date"), V = f("File"), _ = f("Blob"), q = f("FileList"), H = (e) => y(e) && c(e.pipe), z = (e) => {
|
|
28
|
+
let t;
|
|
29
|
+
return e && (typeof FormData == "function" && e instanceof FormData || c(e.append) && ((t = F(e)) === "formdata" || // detect form-data instance
|
|
30
|
+
t === "object" && c(e.toString) && e.toString() === "[object FormData]"));
|
|
31
|
+
}, J = f("URLSearchParams"), [K, $, W, G] = ["ReadableStream", "Request", "Response", "Headers"].map(f), Q = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
32
|
+
function m(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
33
|
+
if (e === null || typeof e > "u")
|
|
34
|
+
return;
|
|
35
|
+
let r, s;
|
|
36
|
+
if (typeof e != "object" && (e = [e]), p(e))
|
|
37
|
+
for (r = 0, s = e.length; r < s; r++)
|
|
38
|
+
t.call(null, e[r], r, e);
|
|
39
|
+
else {
|
|
40
|
+
if (d(e))
|
|
41
|
+
return;
|
|
42
|
+
const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
|
|
43
|
+
let l;
|
|
44
|
+
for (r = 0; r < i; r++)
|
|
45
|
+
l = o[r], t.call(null, e[l], l, e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function P(e, t) {
|
|
49
|
+
if (d(e))
|
|
50
|
+
return null;
|
|
51
|
+
t = t.toLowerCase();
|
|
52
|
+
const n = Object.keys(e);
|
|
53
|
+
let r = n.length, s;
|
|
54
|
+
for (; r-- > 0; )
|
|
55
|
+
if (s = n[r], t === s.toLowerCase())
|
|
56
|
+
return s;
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const u = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, L = (e) => !a(e) && e !== u;
|
|
60
|
+
function h() {
|
|
61
|
+
const { caseless: e, skipUndefined: t } = L(this) && this || {}, n = {}, r = (s, o) => {
|
|
62
|
+
const i = e && P(n, o) || o;
|
|
63
|
+
w(n[i]) && w(s) ? n[i] = h(n[i], s) : w(s) ? n[i] = h({}, s) : p(s) ? n[i] = s.slice() : (!t || !a(s)) && (n[i] = s);
|
|
64
|
+
};
|
|
65
|
+
for (let s = 0, o = arguments.length; s < o; s++)
|
|
66
|
+
arguments[s] && m(arguments[s], r);
|
|
67
|
+
return n;
|
|
68
|
+
}
|
|
69
|
+
const X = (e, t, n, { allOwnKeys: r } = {}) => (m(t, (s, o) => {
|
|
70
|
+
n && c(s) ? e[o] = R(s, n) : e[o] = s;
|
|
71
|
+
}, { allOwnKeys: r }), e), Y = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Z = (e, t, n, r) => {
|
|
72
|
+
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
73
|
+
value: t.prototype
|
|
74
|
+
}), n && Object.assign(e.prototype, n);
|
|
75
|
+
}, j = (e, t, n, r) => {
|
|
76
|
+
let s, o, i;
|
|
77
|
+
const l = {};
|
|
78
|
+
if (t = t || {}, e == null) return t;
|
|
79
|
+
do {
|
|
80
|
+
for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
|
|
81
|
+
i = s[o], (!r || r(i, e, t)) && !l[i] && (t[i] = e[i], l[i] = !0);
|
|
82
|
+
e = n !== !1 && A(e);
|
|
83
|
+
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
84
|
+
return t;
|
|
85
|
+
}, v = (e, t, n) => {
|
|
86
|
+
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
87
|
+
const r = e.indexOf(t, n);
|
|
88
|
+
return r !== -1 && r === n;
|
|
89
|
+
}, ee = (e) => {
|
|
90
|
+
if (!e) return null;
|
|
91
|
+
if (p(e)) return e;
|
|
92
|
+
let t = e.length;
|
|
93
|
+
if (!E(t)) return null;
|
|
94
|
+
const n = new Array(t);
|
|
95
|
+
for (; t-- > 0; )
|
|
96
|
+
n[t] = e[t];
|
|
97
|
+
return n;
|
|
98
|
+
}, te = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && A(Uint8Array)), ne = (e, t) => {
|
|
99
|
+
const r = (e && e[g]).call(e);
|
|
100
|
+
let s;
|
|
101
|
+
for (; (s = r.next()) && !s.done; ) {
|
|
102
|
+
const o = s.value;
|
|
103
|
+
t.call(e, o[0], o[1]);
|
|
104
|
+
}
|
|
105
|
+
}, re = (e, t) => {
|
|
106
|
+
let n;
|
|
107
|
+
const r = [];
|
|
108
|
+
for (; (n = e.exec(t)) !== null; )
|
|
109
|
+
r.push(n);
|
|
110
|
+
return r;
|
|
111
|
+
}, se = f("HTMLFormElement"), oe = (e) => e.toLowerCase().replace(
|
|
112
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
113
|
+
function(n, r, s) {
|
|
114
|
+
return r.toUpperCase() + s;
|
|
115
|
+
}
|
|
116
|
+
), x = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), ie = f("RegExp"), C = (e, t) => {
|
|
117
|
+
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
118
|
+
m(n, (s, o) => {
|
|
119
|
+
let i;
|
|
120
|
+
(i = t(s, o, e)) !== !1 && (r[o] = i || s);
|
|
121
|
+
}), Object.defineProperties(e, r);
|
|
122
|
+
}, ce = (e) => {
|
|
123
|
+
C(e, (t, n) => {
|
|
124
|
+
if (c(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
125
|
+
return !1;
|
|
126
|
+
const r = e[n];
|
|
127
|
+
if (c(r)) {
|
|
128
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
129
|
+
t.writable = !1;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
t.set || (t.set = () => {
|
|
133
|
+
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}, fe = (e, t) => {
|
|
138
|
+
const n = {}, r = (s) => {
|
|
139
|
+
s.forEach((o) => {
|
|
140
|
+
n[o] = !0;
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
return p(e) ? r(e) : r(String(e).split(t)), n;
|
|
144
|
+
}, le = () => {
|
|
145
|
+
}, ue = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
146
|
+
function ae(e) {
|
|
147
|
+
return !!(e && c(e.append) && e[S] === "FormData" && e[g]);
|
|
148
|
+
}
|
|
149
|
+
const pe = (e) => {
|
|
150
|
+
const t = new Array(10), n = (r, s) => {
|
|
151
|
+
if (y(r)) {
|
|
152
|
+
if (t.indexOf(r) >= 0)
|
|
153
|
+
return;
|
|
154
|
+
if (d(r))
|
|
155
|
+
return r;
|
|
156
|
+
if (!("toJSON" in r)) {
|
|
157
|
+
t[s] = r;
|
|
158
|
+
const o = p(r) ? [] : {};
|
|
159
|
+
return m(r, (i, l) => {
|
|
160
|
+
const b = n(i, s + 1);
|
|
161
|
+
!a(b) && (o[l] = b);
|
|
162
|
+
}), t[s] = void 0, o;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return r;
|
|
166
|
+
};
|
|
167
|
+
return n(e, 0);
|
|
168
|
+
}, de = f("AsyncFunction"), ye = (e) => e && (y(e) || c(e)) && c(e.then) && c(e.catch), D = ((e, t) => e ? setImmediate : t ? ((n, r) => (u.addEventListener("message", ({ source: s, data: o }) => {
|
|
169
|
+
s === u && o === n && r.length && r.shift()();
|
|
170
|
+
}, !1), (s) => {
|
|
171
|
+
r.push(s), u.postMessage(n, "*");
|
|
172
|
+
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
173
|
+
typeof setImmediate == "function",
|
|
174
|
+
c(u.postMessage)
|
|
175
|
+
), me = typeof queueMicrotask < "u" ? queueMicrotask.bind(u) : typeof process < "u" && process.nextTick || D, we = (e) => e != null && c(e[g]), Fe = {
|
|
176
|
+
isArray: p,
|
|
177
|
+
isArrayBuffer: B,
|
|
178
|
+
isBuffer: d,
|
|
179
|
+
isFormData: z,
|
|
180
|
+
isArrayBufferView: M,
|
|
181
|
+
isString: k,
|
|
182
|
+
isNumber: E,
|
|
183
|
+
isBoolean: N,
|
|
184
|
+
isObject: y,
|
|
185
|
+
isPlainObject: w,
|
|
186
|
+
isEmptyObject: U,
|
|
187
|
+
isReadableStream: K,
|
|
188
|
+
isRequest: $,
|
|
189
|
+
isResponse: W,
|
|
190
|
+
isHeaders: G,
|
|
191
|
+
isUndefined: a,
|
|
192
|
+
isDate: I,
|
|
193
|
+
isFile: V,
|
|
194
|
+
isBlob: _,
|
|
195
|
+
isRegExp: ie,
|
|
196
|
+
isFunction: c,
|
|
197
|
+
isStream: H,
|
|
198
|
+
isURLSearchParams: J,
|
|
199
|
+
isTypedArray: te,
|
|
200
|
+
isFileList: q,
|
|
201
|
+
forEach: m,
|
|
202
|
+
merge: h,
|
|
203
|
+
extend: X,
|
|
204
|
+
trim: Q,
|
|
205
|
+
stripBOM: Y,
|
|
206
|
+
inherits: Z,
|
|
207
|
+
toFlatObject: j,
|
|
208
|
+
kindOf: F,
|
|
209
|
+
kindOfTest: f,
|
|
210
|
+
endsWith: v,
|
|
211
|
+
toArray: ee,
|
|
212
|
+
forEachEntry: ne,
|
|
213
|
+
matchAll: re,
|
|
214
|
+
isHTMLForm: se,
|
|
215
|
+
hasOwnProperty: x,
|
|
216
|
+
hasOwnProp: x,
|
|
217
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
218
|
+
reduceDescriptors: C,
|
|
219
|
+
freezeMethods: ce,
|
|
220
|
+
toObjectSet: fe,
|
|
221
|
+
toCamelCase: oe,
|
|
222
|
+
noop: le,
|
|
223
|
+
toFiniteNumber: ue,
|
|
224
|
+
findKey: P,
|
|
225
|
+
global: u,
|
|
226
|
+
isContextDefined: L,
|
|
227
|
+
isSpecCompliantForm: ae,
|
|
228
|
+
toJSONObject: pe,
|
|
229
|
+
isAsyncFn: de,
|
|
230
|
+
isThenable: ye,
|
|
231
|
+
setImmediate: D,
|
|
232
|
+
asap: me,
|
|
233
|
+
isIterable: we
|
|
234
|
+
};
|
|
235
|
+
export {
|
|
236
|
+
Fe as default
|
|
237
|
+
};
|
package/dist/index65.mjs
ADDED
package/dist/index66.mjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import d from "./index64.mjs";
|
|
2
|
+
import U from "./index81.mjs";
|
|
3
|
+
import q from "./index82.mjs";
|
|
4
|
+
import R from "./index83.mjs";
|
|
5
|
+
import w from "./index67.mjs";
|
|
6
|
+
import A from "./index84.mjs";
|
|
7
|
+
import m from "./index85.mjs";
|
|
8
|
+
import T from "./index78.mjs";
|
|
9
|
+
const i = m.validators;
|
|
10
|
+
class k {
|
|
11
|
+
constructor(t) {
|
|
12
|
+
this.defaults = t || {}, this.interceptors = {
|
|
13
|
+
request: new q(),
|
|
14
|
+
response: new q()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Dispatch a request
|
|
19
|
+
*
|
|
20
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
21
|
+
* @param {?Object} config
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
24
|
+
*/
|
|
25
|
+
async request(t, e) {
|
|
26
|
+
try {
|
|
27
|
+
return await this._request(t, e);
|
|
28
|
+
} catch (r) {
|
|
29
|
+
if (r instanceof Error) {
|
|
30
|
+
let o = {};
|
|
31
|
+
Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
|
|
32
|
+
const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
|
|
33
|
+
try {
|
|
34
|
+
r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
35
|
+
` + s) : r.stack = s;
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw r;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_request(t, e) {
|
|
43
|
+
typeof t == "string" ? (e = e || {}, e.url = t) : e = t || {}, e = w(this.defaults, e);
|
|
44
|
+
const { transitional: r, paramsSerializer: o, headers: s } = e;
|
|
45
|
+
r !== void 0 && m.assertOptions(r, {
|
|
46
|
+
silentJSONParsing: i.transitional(i.boolean),
|
|
47
|
+
forcedJSONParsing: i.transitional(i.boolean),
|
|
48
|
+
clarifyTimeoutError: i.transitional(i.boolean)
|
|
49
|
+
}, !1), o != null && (d.isFunction(o) ? e.paramsSerializer = {
|
|
50
|
+
serialize: o
|
|
51
|
+
} : m.assertOptions(o, {
|
|
52
|
+
encode: i.function,
|
|
53
|
+
serialize: i.function
|
|
54
|
+
}, !0)), e.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? e.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : e.allowAbsoluteUrls = !0), m.assertOptions(e, {
|
|
55
|
+
baseUrl: i.spelling("baseURL"),
|
|
56
|
+
withXsrfToken: i.spelling("withXSRFToken")
|
|
57
|
+
}, !0), e.method = (e.method || this.defaults.method || "get").toLowerCase();
|
|
58
|
+
let f = s && d.merge(
|
|
59
|
+
s.common,
|
|
60
|
+
s[e.method]
|
|
61
|
+
);
|
|
62
|
+
s && d.forEach(
|
|
63
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
64
|
+
(a) => {
|
|
65
|
+
delete s[a];
|
|
66
|
+
}
|
|
67
|
+
), e.headers = T.concat(f, s);
|
|
68
|
+
const h = [];
|
|
69
|
+
let b = !0;
|
|
70
|
+
this.interceptors.request.forEach(function(n) {
|
|
71
|
+
typeof n.runWhen == "function" && n.runWhen(e) === !1 || (b = b && n.synchronous, h.unshift(n.fulfilled, n.rejected));
|
|
72
|
+
});
|
|
73
|
+
const c = [];
|
|
74
|
+
this.interceptors.response.forEach(function(n) {
|
|
75
|
+
c.push(n.fulfilled, n.rejected);
|
|
76
|
+
});
|
|
77
|
+
let u, l = 0, p;
|
|
78
|
+
if (!b) {
|
|
79
|
+
const a = [R.bind(this), void 0];
|
|
80
|
+
for (a.unshift(...h), a.push(...c), p = a.length, u = Promise.resolve(e); l < p; )
|
|
81
|
+
u = u.then(a[l++], a[l++]);
|
|
82
|
+
return u;
|
|
83
|
+
}
|
|
84
|
+
p = h.length;
|
|
85
|
+
let y = e;
|
|
86
|
+
for (; l < p; ) {
|
|
87
|
+
const a = h[l++], n = h[l++];
|
|
88
|
+
try {
|
|
89
|
+
y = a(y);
|
|
90
|
+
} catch (S) {
|
|
91
|
+
n.call(this, S);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
u = R.call(this, y);
|
|
97
|
+
} catch (a) {
|
|
98
|
+
return Promise.reject(a);
|
|
99
|
+
}
|
|
100
|
+
for (l = 0, p = c.length; l < p; )
|
|
101
|
+
u = u.then(c[l++], c[l++]);
|
|
102
|
+
return u;
|
|
103
|
+
}
|
|
104
|
+
getUri(t) {
|
|
105
|
+
t = w(this.defaults, t);
|
|
106
|
+
const e = A(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
107
|
+
return U(e, t.params, t.paramsSerializer);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
d.forEach(["delete", "get", "head", "options"], function(t) {
|
|
111
|
+
k.prototype[t] = function(e, r) {
|
|
112
|
+
return this.request(w(r || {}, {
|
|
113
|
+
method: t,
|
|
114
|
+
url: e,
|
|
115
|
+
data: (r || {}).data
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
d.forEach(["post", "put", "patch"], function(t) {
|
|
120
|
+
function e(r) {
|
|
121
|
+
return function(s, f, h) {
|
|
122
|
+
return this.request(w(h || {}, {
|
|
123
|
+
method: t,
|
|
124
|
+
headers: r ? {
|
|
125
|
+
"Content-Type": "multipart/form-data"
|
|
126
|
+
} : {},
|
|
127
|
+
url: s,
|
|
128
|
+
data: f
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
k.prototype[t] = e(), k.prototype[t + "Form"] = e(!0);
|
|
133
|
+
});
|
|
134
|
+
export {
|
|
135
|
+
k as default
|
|
136
|
+
};
|