@instockng/storefront-ui 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CartItem.d.ts +1 -1
- package/dist/components/CartItem.d.ts.map +1 -1
- package/dist/components/OrderConfirmation.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts +2 -2
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index10.mjs +3 -3
- package/dist/index100.mjs +33 -5
- package/dist/index101.mjs +31 -33
- package/dist/index102.mjs +26 -29
- package/dist/index103.mjs +59 -26
- package/dist/index104.mjs +3 -61
- package/dist/index105.mjs +2 -3
- package/dist/index106.mjs +2 -2
- package/dist/index107.mjs +17 -2
- package/dist/index108.mjs +11 -15
- package/dist/index109.mjs +6 -13
- package/dist/index11.mjs +2 -2
- package/dist/index110.mjs +30 -6
- package/dist/index13.mjs +1 -1
- package/dist/index17.mjs +2 -2
- package/dist/index29.mjs +1 -1
- package/dist/index30.mjs +1 -1
- package/dist/index31.mjs +1 -1
- package/dist/index32.mjs +1 -1
- package/dist/index33.mjs +1433 -4
- package/dist/index34.mjs +2 -1433
- package/dist/index35.mjs +57 -2
- package/dist/index36.mjs +48 -54
- package/dist/index37.mjs +33 -51
- package/dist/index38.mjs +15 -33
- package/dist/index39.mjs +2260 -12
- package/dist/index4.mjs +37 -37
- package/dist/index40.mjs +19 -2259
- package/dist/index42.mjs +17 -17
- package/dist/index43.mjs +2 -2
- package/dist/index44.mjs +1 -1
- package/dist/index45.mjs +1 -1
- package/dist/index46.mjs +1 -1
- package/dist/index47.mjs +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.mjs +1 -1
- package/dist/index51.mjs +1 -1
- package/dist/index52.mjs +1 -1
- package/dist/index53.mjs +1 -1
- package/dist/index54.mjs +1 -1
- package/dist/index55.mjs +73 -21
- package/dist/index56.mjs +14 -74
- package/dist/index57.mjs +62 -14
- package/dist/index58.mjs +4 -62
- package/dist/index59.mjs +3 -4
- package/dist/index60.mjs +2 -4
- package/dist/index61.mjs +34 -2
- package/dist/index62.mjs +40 -31
- package/dist/index63.mjs +230 -38
- package/dist/index64.mjs +4 -233
- package/dist/index65.mjs +133 -5
- package/dist/index66.mjs +63 -129
- package/dist/index67.mjs +86 -67
- package/dist/index68.mjs +27 -85
- package/dist/index69.mjs +8 -28
- package/dist/index70.mjs +74 -8
- package/dist/index71.mjs +3 -74
- package/dist/index72.mjs +2 -4
- package/dist/index73.mjs +83 -2
- package/dist/index74.mjs +52 -81
- package/dist/index75.mjs +5 -53
- package/dist/index76.mjs +4 -5
- package/dist/index77.mjs +178 -4
- package/dist/index78.mjs +48 -174
- package/dist/index79.mjs +67 -51
- package/dist/index80.mjs +21 -69
- package/dist/index81.mjs +54 -19
- package/dist/index82.mjs +28 -55
- package/dist/index83.mjs +6 -28
- package/dist/index84.mjs +51 -6
- package/dist/index85.mjs +5 -51
- package/dist/index86.mjs +12 -6
- package/dist/index87.mjs +7 -12
- package/dist/index88.mjs +27 -6
- package/dist/index89.mjs +2 -28
- package/dist/index90.mjs +70 -2
- package/dist/index91.mjs +164 -67
- package/dist/index92.mjs +28 -164
- package/dist/index93.mjs +11 -13
- package/dist/index94.mjs +4 -7
- package/dist/index95.mjs +3 -30
- package/dist/index96.mjs +13 -11
- package/dist/index97.mjs +7 -4
- package/dist/index98.mjs +11 -3
- package/dist/index99.mjs +4 -11
- package/dist/test-utils/MockCartProvider.d.ts +1 -1
- package/dist/test-utils/MockCartProvider.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/components/CartItem.stories.tsx +1 -1
- package/src/components/CartItem.tsx +1 -1
- package/src/components/Checkout.stories.tsx +1 -1
- package/src/components/Checkout.tsx +2 -2
- package/src/components/OrderConfirmation.tsx +7 -2
- package/src/components/ProductGrid.tsx +1 -1
- package/src/components/ShoppingCart.stories.tsx +1 -1
- package/src/contexts/CartContext.tsx +2 -2
- package/src/index.ts +3 -2
- package/src/providers/StorefrontProvider.tsx +1 -1
- package/src/test-utils/MockCartProvider.tsx +1 -1
- package/dist/index111.mjs +0 -33
package/dist/index92.mjs
CHANGED
|
@@ -1,170 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Request: r,
|
|
13
|
-
Response: n
|
|
14
|
-
}))(t.global), {
|
|
15
|
-
ReadableStream: V,
|
|
16
|
-
TextEncoder: W
|
|
17
|
-
} = t.global, Z = (r, ...n) => {
|
|
18
|
-
try {
|
|
19
|
-
return !!r(...n);
|
|
20
|
-
} catch {
|
|
21
|
-
return !1;
|
|
22
|
-
}
|
|
23
|
-
}, oe = (r) => {
|
|
24
|
-
r = t.merge.call({
|
|
25
|
-
skipUndefined: !0
|
|
26
|
-
}, ne, r);
|
|
27
|
-
const { fetch: n, Request: o, Response: y } = r, g = n ? P(n) : typeof fetch == "function", f = P(o), F = P(y);
|
|
28
|
-
if (!g)
|
|
29
|
-
return !1;
|
|
30
|
-
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(() => {
|
|
31
|
-
let e = !1;
|
|
32
|
-
const s = new o(K.origin, {
|
|
33
|
-
body: new V(),
|
|
34
|
-
method: "POST",
|
|
35
|
-
get duplex() {
|
|
36
|
-
return e = !0, "half";
|
|
37
|
-
}
|
|
38
|
-
}).headers.has("Content-Type");
|
|
39
|
-
return e && !s;
|
|
40
|
-
}), h = F && w && Z(() => t.isReadableStream(new y("").body)), x = {
|
|
41
|
-
stream: h && ((e) => e.body)
|
|
2
|
+
import p from "./index73.mjs";
|
|
3
|
+
function i(n) {
|
|
4
|
+
const t = {
|
|
5
|
+
"!": "%21",
|
|
6
|
+
"'": "%27",
|
|
7
|
+
"(": "%28",
|
|
8
|
+
")": "%29",
|
|
9
|
+
"~": "%7E",
|
|
10
|
+
"%20": "+",
|
|
11
|
+
"%00": "\0"
|
|
42
12
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
let c = s && s[e];
|
|
46
|
-
if (c)
|
|
47
|
-
return c.call(s);
|
|
48
|
-
throw new b(`Response type '${e}' is not supported`, b.ERR_NOT_SUPPORT, i);
|
|
49
|
-
});
|
|
13
|
+
return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
14
|
+
return t[r];
|
|
50
15
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
const i = t.toFiniteNumber(e.getContentLength());
|
|
67
|
-
return i ?? $(s);
|
|
68
|
-
};
|
|
69
|
-
return async (e) => {
|
|
70
|
-
let {
|
|
71
|
-
url: s,
|
|
72
|
-
method: i,
|
|
73
|
-
data: c,
|
|
74
|
-
signal: Q,
|
|
75
|
-
cancelToken: _,
|
|
76
|
-
timeout: X,
|
|
77
|
-
onDownloadProgress: O,
|
|
78
|
-
onUploadProgress: B,
|
|
79
|
-
responseType: l,
|
|
80
|
-
headers: q,
|
|
81
|
-
withCredentials: C = "same-origin",
|
|
82
|
-
fetchOptions: U
|
|
83
|
-
} = se(e), v = n || fetch;
|
|
84
|
-
l = l ? (l + "").toLowerCase() : "text";
|
|
85
|
-
let E = ee([Q, _ && _.toAbortSignal()], X), T = null;
|
|
86
|
-
const m = E && E.unsubscribe && (() => {
|
|
87
|
-
E.unsubscribe();
|
|
88
|
-
});
|
|
89
|
-
let D;
|
|
90
|
-
try {
|
|
91
|
-
if (B && d && i !== "get" && i !== "head" && (D = await G(q, c)) !== 0) {
|
|
92
|
-
let p = new o(s, {
|
|
93
|
-
method: "POST",
|
|
94
|
-
body: c,
|
|
95
|
-
duplex: "half"
|
|
96
|
-
}), S;
|
|
97
|
-
if (t.isFormData(c) && (S = p.headers.get("content-type")) && q.setContentType(S), p.body) {
|
|
98
|
-
const [A, L] = I(
|
|
99
|
-
D,
|
|
100
|
-
M(j(B))
|
|
101
|
-
);
|
|
102
|
-
c = z(p.body, J, A, L);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
t.isString(C) || (C = C ? "include" : "omit");
|
|
106
|
-
const a = f && "credentials" in o.prototype, N = {
|
|
107
|
-
...U,
|
|
108
|
-
signal: E,
|
|
109
|
-
method: i.toUpperCase(),
|
|
110
|
-
headers: q.normalize().toJSON(),
|
|
111
|
-
body: c,
|
|
112
|
-
duplex: "half",
|
|
113
|
-
credentials: a ? C : void 0
|
|
114
|
-
};
|
|
115
|
-
T = f && new o(s, N);
|
|
116
|
-
let u = await (f ? v(T, U) : v(s, N));
|
|
117
|
-
const k = h && (l === "stream" || l === "response");
|
|
118
|
-
if (h && (O || k && m)) {
|
|
119
|
-
const p = {};
|
|
120
|
-
["status", "statusText", "headers"].forEach((H) => {
|
|
121
|
-
p[H] = u[H];
|
|
122
|
-
});
|
|
123
|
-
const S = t.toFiniteNumber(u.headers.get("content-length")), [A, L] = O && I(
|
|
124
|
-
S,
|
|
125
|
-
M(j(O), !0)
|
|
126
|
-
) || [];
|
|
127
|
-
u = new y(
|
|
128
|
-
z(u.body, J, A, () => {
|
|
129
|
-
L && L(), m && m();
|
|
130
|
-
}),
|
|
131
|
-
p
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
l = l || "text";
|
|
135
|
-
let Y = await x[t.findKey(x, l) || "text"](u, e);
|
|
136
|
-
return !k && m && m(), await new Promise((p, S) => {
|
|
137
|
-
re(p, S, {
|
|
138
|
-
data: Y,
|
|
139
|
-
headers: te.from(u.headers),
|
|
140
|
-
status: u.status,
|
|
141
|
-
statusText: u.statusText,
|
|
142
|
-
config: e,
|
|
143
|
-
request: T
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
} catch (a) {
|
|
147
|
-
throw m && m(), a && a.name === "TypeError" && /Load failed|fetch/i.test(a.message) ? Object.assign(
|
|
148
|
-
new b("Network Error", b.ERR_NETWORK, e, T),
|
|
149
|
-
{
|
|
150
|
-
cause: a.cause || a
|
|
151
|
-
}
|
|
152
|
-
) : b.from(a, a && a.code, e, T);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}, ae = /* @__PURE__ */ new Map(), ie = (r) => {
|
|
156
|
-
let n = r ? r.env : {};
|
|
157
|
-
const { fetch: o, Request: y, Response: g } = n, f = [
|
|
158
|
-
y,
|
|
159
|
-
g,
|
|
160
|
-
o
|
|
161
|
-
];
|
|
162
|
-
let F = f.length, w = F, R, d, h = ae;
|
|
163
|
-
for (; w--; )
|
|
164
|
-
R = f[w], d = h.get(R), d === void 0 && h.set(R, d = w ? /* @__PURE__ */ new Map() : oe(n)), h = d;
|
|
165
|
-
return d;
|
|
16
|
+
}
|
|
17
|
+
function a(n, t) {
|
|
18
|
+
this._pairs = [], n && p(n, this, t);
|
|
19
|
+
}
|
|
20
|
+
const c = a.prototype;
|
|
21
|
+
c.append = function(t, o) {
|
|
22
|
+
this._pairs.push([t, o]);
|
|
23
|
+
};
|
|
24
|
+
c.toString = function(t) {
|
|
25
|
+
const o = t ? function(r) {
|
|
26
|
+
return t.call(this, r, i);
|
|
27
|
+
} : i;
|
|
28
|
+
return this._pairs.map(function(e) {
|
|
29
|
+
return o(e[0]) + "=" + o(e[1]);
|
|
30
|
+
}, "").join("&");
|
|
166
31
|
};
|
|
167
|
-
ie();
|
|
168
32
|
export {
|
|
169
|
-
|
|
33
|
+
a as default
|
|
170
34
|
};
|
package/dist/index93.mjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
13
|
-
};
|
|
2
|
+
import i from "./index63.mjs";
|
|
3
|
+
import m from "./index67.mjs";
|
|
4
|
+
import s from "./index77.mjs";
|
|
5
|
+
function h(f, t) {
|
|
6
|
+
const o = this || m, r = t || o, n = s.from(r.headers);
|
|
7
|
+
let a = r.data;
|
|
8
|
+
return i.forEach(f, function(e) {
|
|
9
|
+
a = e.call(o, a, n.normalize(), t ? t.status : void 0);
|
|
10
|
+
}), n.normalize(), a;
|
|
11
|
+
}
|
|
14
12
|
export {
|
|
15
|
-
|
|
13
|
+
h as default
|
|
16
14
|
};
|
package/dist/index94.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
function e(t) {
|
|
3
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
4
|
+
}
|
|
4
5
|
export {
|
|
5
|
-
e as
|
|
6
|
-
n as hasStandardBrowserEnv,
|
|
7
|
-
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
-
o as navigator,
|
|
9
|
-
r as origin
|
|
6
|
+
e as default
|
|
10
7
|
};
|
package/dist/index95.mjs
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const t = {
|
|
5
|
-
"!": "%21",
|
|
6
|
-
"'": "%27",
|
|
7
|
-
"(": "%28",
|
|
8
|
-
")": "%29",
|
|
9
|
-
"~": "%7E",
|
|
10
|
-
"%20": "+",
|
|
11
|
-
"%00": "\0"
|
|
12
|
-
};
|
|
13
|
-
return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
14
|
-
return t[r];
|
|
15
|
-
});
|
|
2
|
+
function n(e, c) {
|
|
3
|
+
return c ? e.replace(/\/?\/$/, "") + "/" + c.replace(/^\/+/, "") : e;
|
|
16
4
|
}
|
|
17
|
-
function a(n, t) {
|
|
18
|
-
this._pairs = [], n && p(n, this, t);
|
|
19
|
-
}
|
|
20
|
-
const c = a.prototype;
|
|
21
|
-
c.append = function(t, o) {
|
|
22
|
-
this._pairs.push([t, o]);
|
|
23
|
-
};
|
|
24
|
-
c.toString = function(t) {
|
|
25
|
-
const o = t ? function(r) {
|
|
26
|
-
return t.call(this, r, i);
|
|
27
|
-
} : i;
|
|
28
|
-
return this._pairs.map(function(e) {
|
|
29
|
-
return o(e[0]) + "=" + o(e[1]);
|
|
30
|
-
}, "").join("&");
|
|
31
|
-
};
|
|
32
5
|
export {
|
|
33
|
-
|
|
6
|
+
n as default
|
|
34
7
|
};
|
package/dist/index96.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
2
|
+
import o from "./index104.mjs";
|
|
3
|
+
import r from "./index105.mjs";
|
|
4
|
+
import t from "./index106.mjs";
|
|
5
|
+
const l = {
|
|
6
|
+
isBrowser: !0,
|
|
7
|
+
classes: {
|
|
8
|
+
URLSearchParams: o,
|
|
9
|
+
FormData: r,
|
|
10
|
+
Blob: t
|
|
11
|
+
},
|
|
12
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
13
|
+
};
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
l as default
|
|
14
16
|
};
|
package/dist/index97.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
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
|
|
3
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", r = e && window.location.href || "http://localhost";
|
|
5
4
|
export {
|
|
6
|
-
e as
|
|
5
|
+
e as hasBrowserEnv,
|
|
6
|
+
n as hasStandardBrowserEnv,
|
|
7
|
+
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
+
o as navigator,
|
|
9
|
+
r as origin
|
|
7
10
|
};
|
package/dist/index98.mjs
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import a from "./index74.mjs";
|
|
3
|
+
function E(i, f, t) {
|
|
4
|
+
const u = t.config.validateStatus;
|
|
5
|
+
!t.status || !u || u(t.status) ? i(t) : f(new a(
|
|
6
|
+
"Request failed with status code " + t.status,
|
|
7
|
+
[a.ERR_BAD_REQUEST, a.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
8
|
+
t.config,
|
|
9
|
+
t.request,
|
|
10
|
+
t
|
|
11
|
+
));
|
|
4
12
|
}
|
|
5
13
|
export {
|
|
6
|
-
|
|
14
|
+
E as default
|
|
7
15
|
};
|
package/dist/index99.mjs
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
!t.status || !u || u(t.status) ? i(t) : f(new a(
|
|
6
|
-
"Request failed with status code " + t.status,
|
|
7
|
-
[a.ERR_BAD_REQUEST, a.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
8
|
-
t.config,
|
|
9
|
-
t.request,
|
|
10
|
-
t
|
|
11
|
-
));
|
|
2
|
+
function o(e) {
|
|
3
|
+
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
4
|
+
return t && t[1] || "";
|
|
12
5
|
}
|
|
13
6
|
export {
|
|
14
|
-
|
|
7
|
+
o as default
|
|
15
8
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides fake cart data for UI prototyping without needing a real backend.
|
|
5
5
|
*/
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
|
-
import type { Cart } from '@
|
|
7
|
+
import type { Cart } from '@instockng/api-client';
|
|
8
8
|
import type { ShoppingCartProps } from '../components/ShoppingCart';
|
|
9
9
|
interface MockCartProviderProps {
|
|
10
10
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockCartProvider.d.ts","sourceRoot":"","sources":["../../src/test-utils/MockCartProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,
|
|
1
|
+
{"version":3,"file":"MockCartProvider.d.ts","sourceRoot":"","sources":["../../src/test-utils/MockCartProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiHpE,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAClE,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EAAE,YAAY,EAClB,SAAiB,EACjB,KAAY,EACZ,iBAAiB,EACjB,UAAiB,GAClB,EAAE,qBAAqB,2CAkSvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instockng/storefront-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Pre-built UI components for OMS e-commerce sites",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"author": "Ola Wale",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@instockng/api-client": "^1.0.0",
|
|
37
38
|
"class-variance-authority": "^0.7.1",
|
|
38
39
|
"clsx": "^2.1.0",
|
|
39
40
|
"tailwind-merge": "^2.2.0",
|
|
@@ -65,9 +66,7 @@
|
|
|
65
66
|
"storybook": "^9.1.12",
|
|
66
67
|
"tailwindcss": "^4.1.14",
|
|
67
68
|
"typescript": "^5.3.3",
|
|
68
|
-
"vite": "^5.4.20"
|
|
69
|
-
"@oms/api-client": "1.0.0",
|
|
70
|
-
"@oms/shared": "1.0.0"
|
|
69
|
+
"vite": "^5.4.20"
|
|
71
70
|
},
|
|
72
71
|
"scripts": {
|
|
73
72
|
"type-check": "tsc --noEmit",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { CartItem } from './CartItem';
|
|
3
|
-
import type {CartItem as CartItemType} from '@
|
|
3
|
+
import type {CartItem as CartItemType} from '@instockng/api-client';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Components/CartItem',
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { Trash2, Package } from 'lucide-react';
|
|
8
8
|
import { formatCurrency, cn } from '../lib/utils';
|
|
9
|
-
import type { CartItem as CartItemType } from '@
|
|
9
|
+
import type { CartItem as CartItemType } from '@instockng/api-client';
|
|
10
10
|
import { useCart } from '@/contexts/CartContext';
|
|
11
11
|
import { useCallback, useState } from 'react';
|
|
12
12
|
|
|
@@ -11,7 +11,7 @@ import { Checkout, type CheckoutProps } from './Checkout';
|
|
|
11
11
|
import { Button } from './ui/button';
|
|
12
12
|
import { MockCartProvider } from '../test-utils/MockCartProvider';
|
|
13
13
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
14
|
-
import type { Cart } from '@
|
|
14
|
+
import type { Cart } from '@instockng/api-client';
|
|
15
15
|
|
|
16
16
|
// Mock delivery zones data
|
|
17
17
|
const mockDeliveryZones = [
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
11
11
|
import * as Yup from 'yup';
|
|
12
|
-
import { useGetDeliveryZones } from '@
|
|
13
|
-
import type { Order } from '@
|
|
12
|
+
import { useGetDeliveryZones } from '@instockng/api-client';
|
|
13
|
+
import type { Order } from '@instockng/api-client';
|
|
14
14
|
import { useCart } from '../contexts/CartContext';
|
|
15
15
|
import { Modal } from './ui/modal';
|
|
16
16
|
import { FormInput } from './ui/form-input';
|
|
@@ -6,14 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useState } from 'react';
|
|
9
|
-
import { useGetOrder, useConfirmOrder } from '@
|
|
10
|
-
import { WHATSAPP_HELP_LINK, WHATSAPP_HELP_NUMBER_FORMATTED } from '@oms/shared';
|
|
9
|
+
import { useGetOrder, useConfirmOrder } from '@instockng/api-client';
|
|
11
10
|
import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
|
|
12
11
|
import { Button } from './ui/button';
|
|
13
12
|
import { Badge } from './ui/badge';
|
|
14
13
|
import { CheckCircle, XCircle, Loader2, Package } from 'lucide-react';
|
|
15
14
|
import { formatCurrency, formatDateTime, cn } from '../lib/utils';
|
|
16
15
|
|
|
16
|
+
// WhatsApp support contact constants
|
|
17
|
+
const WHATSAPP_HELP_NUMBER = '2348125648668';
|
|
18
|
+
const localPart = '0' + WHATSAPP_HELP_NUMBER.slice(3);
|
|
19
|
+
const WHATSAPP_HELP_NUMBER_FORMATTED = `${localPart.slice(0, 4)} ${localPart.slice(4, 7)} ${localPart.slice(7)}`;
|
|
20
|
+
const WHATSAPP_HELP_LINK = `https://wa.me/${WHATSAPP_HELP_NUMBER}`;
|
|
21
|
+
|
|
17
22
|
export interface OrderConfirmationProps {
|
|
18
23
|
/** Order UUID */
|
|
19
24
|
orderId: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Handles loading, empty states, and integrates with useGetProducts hook.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { useGetProducts } from '@
|
|
8
|
+
import { useGetProducts } from '@instockng/api-client';
|
|
9
9
|
import { ProductCard, type ProductCardProduct } from './ProductCard';
|
|
10
10
|
import { Loader2, Package } from 'lucide-react';
|
|
11
11
|
import { cn } from '../lib/utils';
|
|
@@ -10,7 +10,7 @@ import { MockCartProvider } from '../test-utils/MockCartProvider';
|
|
|
10
10
|
import { fn } from '@storybook/test';
|
|
11
11
|
import { Button } from './ui/button';
|
|
12
12
|
import { ShoppingCart as ShoppingCartIcon } from 'lucide-react';
|
|
13
|
-
import type { Cart } from '@
|
|
13
|
+
import type { Cart } from '@instockng/api-client';
|
|
14
14
|
|
|
15
15
|
// Demo component showing how to use the cart context
|
|
16
16
|
const CartDemo = ({ title, description }: { title?: string; description?: string }) => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Cart Context Provider
|
|
5
5
|
*
|
|
6
6
|
* Manages cart state with localStorage persistence and auto-creation.
|
|
7
|
-
* Uses @
|
|
7
|
+
* Uses @instockng/api-client hooks for all cart operations.
|
|
8
8
|
* Includes built-in ShoppingCart modal that can be opened/closed from anywhere.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
useRemoveDiscount,
|
|
21
21
|
useCheckoutCart,
|
|
22
22
|
type Cart,
|
|
23
|
-
} from '@
|
|
23
|
+
} from '@instockng/api-client';
|
|
24
24
|
import { ShoppingCart } from '../components/ShoppingCart';
|
|
25
25
|
|
|
26
26
|
const CART_ID_KEY = 'oms_cart_id';
|
package/src/index.ts
CHANGED
|
@@ -47,5 +47,6 @@ export type { FormSelectProps } from './components/ui/form-select';
|
|
|
47
47
|
// Export utilities
|
|
48
48
|
export { cn, formatCurrency, formatDate, formatDateTime, getStatusColor } from './lib/utils';
|
|
49
49
|
|
|
50
|
-
// Re-export API client hooks for convenience
|
|
51
|
-
|
|
50
|
+
// Re-export API client hooks and fetchers for convenience
|
|
51
|
+
// This includes all hooks (useGetProducts, useGetCart, etc.) and fetchers (fetchProductsByBrand, fetchCartById, etc.)
|
|
52
|
+
export * from '@instockng/api-client';
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { ReactNode } from 'react';
|
|
29
|
-
import { ApiClientProvider } from '@
|
|
29
|
+
import { ApiClientProvider } from '@instockng/api-client';
|
|
30
30
|
import { CartProvider, CartProviderProps } from '../contexts/CartContext';
|
|
31
31
|
|
|
32
32
|
export interface StorefrontProviderProps {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { ReactNode, useState, useCallback } from 'react';
|
|
8
8
|
import { CartContext } from '../contexts/CartContext';
|
|
9
9
|
import { ShoppingCart } from '../components/ShoppingCart';
|
|
10
|
-
import type { Cart, PublicOrderResponse } from '@
|
|
10
|
+
import type { Cart, PublicOrderResponse } from '@instockng/api-client';
|
|
11
11
|
import type { ShoppingCartProps } from '../components/ShoppingCart';
|
|
12
12
|
|
|
13
13
|
// Use the proper type from the API client
|
package/dist/index111.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import r from "./index64.mjs";
|
|
3
|
-
import c from "./index88.mjs";
|
|
4
|
-
const p = c.hasStandardBrowserEnv ? (
|
|
5
|
-
// Standard browser envs support document.cookie
|
|
6
|
-
{
|
|
7
|
-
write(e, t, n, i, s, u) {
|
|
8
|
-
const o = [e + "=" + encodeURIComponent(t)];
|
|
9
|
-
r.isNumber(n) && o.push("expires=" + new Date(n).toGMTString()), r.isString(i) && o.push("path=" + i), r.isString(s) && o.push("domain=" + s), u === !0 && o.push("secure"), document.cookie = o.join("; ");
|
|
10
|
-
},
|
|
11
|
-
read(e) {
|
|
12
|
-
const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
|
|
13
|
-
return t ? decodeURIComponent(t[3]) : null;
|
|
14
|
-
},
|
|
15
|
-
remove(e) {
|
|
16
|
-
this.write(e, "", Date.now() - 864e5);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
) : (
|
|
20
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
21
|
-
{
|
|
22
|
-
write() {
|
|
23
|
-
},
|
|
24
|
-
read() {
|
|
25
|
-
return null;
|
|
26
|
-
},
|
|
27
|
-
remove() {
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
export {
|
|
32
|
-
p as default
|
|
33
|
-
};
|