@instockng/storefront-ui 1.0.13 → 1.0.15
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/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/index101.mjs +1 -1
- package/dist/index102.mjs +3 -3
- package/dist/index103.mjs +3 -3
- package/dist/index105.mjs +1 -1
- package/dist/index111.mjs +1 -1
- package/dist/index42.mjs +17 -17
- package/dist/index43.mjs +2 -2
- package/dist/index62.mjs +30 -231
- package/dist/index63.mjs +42 -5
- package/dist/index64.mjs +228 -127
- package/dist/index65.mjs +4 -66
- package/dist/index66.mjs +124 -77
- package/dist/index67.mjs +65 -26
- package/dist/index68.mjs +84 -6
- package/dist/index69.mjs +26 -72
- package/dist/index70.mjs +8 -3
- package/dist/index71.mjs +75 -2
- package/dist/index72.mjs +3 -82
- package/dist/index73.mjs +2 -54
- package/dist/index74.mjs +82 -5
- package/dist/index75.mjs +53 -4
- package/dist/index76.mjs +5 -178
- package/dist/index77.mjs +5 -53
- package/dist/index78.mjs +178 -68
- package/dist/index79.mjs +50 -31
- package/dist/index80.mjs +69 -43
- package/dist/index81.mjs +2 -2
- package/dist/index82.mjs +1 -1
- package/dist/index83.mjs +6 -6
- package/dist/index84.mjs +2 -2
- package/dist/index85.mjs +2 -2
- package/dist/index87.mjs +2 -2
- package/dist/index88.mjs +2 -2
- package/dist/index89.mjs +1 -1
- package/dist/index91.mjs +4 -4
- package/dist/index92.mjs +3 -3
- package/dist/index93.mjs +30 -12
- package/dist/index94.mjs +11 -7
- package/dist/index95.mjs +3 -30
- package/dist/index96.mjs +3 -10
- package/dist/index97.mjs +13 -4
- package/dist/index98.mjs +7 -4
- package/dist/index99.mjs +1 -1
- package/dist/test-utils/MockCartProvider.d.ts +1 -1
- package/dist/test-utils/MockCartProvider.d.ts.map +1 -1
- package/package.json +5 -5
- 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 +1 -1
- 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/index80.mjs
CHANGED
|
@@ -1,46 +1,72 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
const e = {
|
|
3
|
+
Continue: 100,
|
|
4
|
+
SwitchingProtocols: 101,
|
|
5
|
+
Processing: 102,
|
|
6
|
+
EarlyHints: 103,
|
|
7
|
+
Ok: 200,
|
|
8
|
+
Created: 201,
|
|
9
|
+
Accepted: 202,
|
|
10
|
+
NonAuthoritativeInformation: 203,
|
|
11
|
+
NoContent: 204,
|
|
12
|
+
ResetContent: 205,
|
|
13
|
+
PartialContent: 206,
|
|
14
|
+
MultiStatus: 207,
|
|
15
|
+
AlreadyReported: 208,
|
|
16
|
+
ImUsed: 226,
|
|
17
|
+
MultipleChoices: 300,
|
|
18
|
+
MovedPermanently: 301,
|
|
19
|
+
Found: 302,
|
|
20
|
+
SeeOther: 303,
|
|
21
|
+
NotModified: 304,
|
|
22
|
+
UseProxy: 305,
|
|
23
|
+
Unused: 306,
|
|
24
|
+
TemporaryRedirect: 307,
|
|
25
|
+
PermanentRedirect: 308,
|
|
26
|
+
BadRequest: 400,
|
|
27
|
+
Unauthorized: 401,
|
|
28
|
+
PaymentRequired: 402,
|
|
29
|
+
Forbidden: 403,
|
|
30
|
+
NotFound: 404,
|
|
31
|
+
MethodNotAllowed: 405,
|
|
32
|
+
NotAcceptable: 406,
|
|
33
|
+
ProxyAuthenticationRequired: 407,
|
|
34
|
+
RequestTimeout: 408,
|
|
35
|
+
Conflict: 409,
|
|
36
|
+
Gone: 410,
|
|
37
|
+
LengthRequired: 411,
|
|
38
|
+
PreconditionFailed: 412,
|
|
39
|
+
PayloadTooLarge: 413,
|
|
40
|
+
UriTooLong: 414,
|
|
41
|
+
UnsupportedMediaType: 415,
|
|
42
|
+
RangeNotSatisfiable: 416,
|
|
43
|
+
ExpectationFailed: 417,
|
|
44
|
+
ImATeapot: 418,
|
|
45
|
+
MisdirectedRequest: 421,
|
|
46
|
+
UnprocessableEntity: 422,
|
|
47
|
+
Locked: 423,
|
|
48
|
+
FailedDependency: 424,
|
|
49
|
+
TooEarly: 425,
|
|
50
|
+
UpgradeRequired: 426,
|
|
51
|
+
PreconditionRequired: 428,
|
|
52
|
+
TooManyRequests: 429,
|
|
53
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
54
|
+
UnavailableForLegalReasons: 451,
|
|
55
|
+
InternalServerError: 500,
|
|
56
|
+
NotImplemented: 501,
|
|
57
|
+
BadGateway: 502,
|
|
58
|
+
ServiceUnavailable: 503,
|
|
59
|
+
GatewayTimeout: 504,
|
|
60
|
+
HttpVersionNotSupported: 505,
|
|
61
|
+
VariantAlsoNegotiates: 506,
|
|
62
|
+
InsufficientStorage: 507,
|
|
63
|
+
LoopDetected: 508,
|
|
64
|
+
NotExtended: 510,
|
|
65
|
+
NetworkAuthenticationRequired: 511
|
|
66
|
+
};
|
|
67
|
+
Object.entries(e).forEach(([t, o]) => {
|
|
68
|
+
e[o] = t;
|
|
69
|
+
});
|
|
39
70
|
export {
|
|
40
|
-
|
|
41
|
-
o as deepMerge,
|
|
42
|
-
s as mergePath,
|
|
43
|
-
l as removeIndexString,
|
|
44
|
-
p as replaceUrlParam,
|
|
45
|
-
i as replaceUrlProtocol
|
|
71
|
+
e as default
|
|
46
72
|
};
|
package/dist/index81.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import f from "./
|
|
3
|
-
import d from "./
|
|
2
|
+
import f from "./index64.mjs";
|
|
3
|
+
import d from "./index93.mjs";
|
|
4
4
|
function l(e) {
|
|
5
5
|
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
6
6
|
}
|
package/dist/index82.mjs
CHANGED
package/dist/index83.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import r from "./
|
|
3
|
-
import p from "./
|
|
4
|
-
import l from "./
|
|
5
|
-
import m from "./
|
|
6
|
-
import a from "./
|
|
7
|
-
import o from "./
|
|
2
|
+
import r from "./index94.mjs";
|
|
3
|
+
import p from "./index72.mjs";
|
|
4
|
+
import l from "./index68.mjs";
|
|
5
|
+
import m from "./index70.mjs";
|
|
6
|
+
import a from "./index78.mjs";
|
|
7
|
+
import o from "./index79.mjs";
|
|
8
8
|
function d(e) {
|
|
9
9
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
10
10
|
throw new m(null, e);
|
package/dist/index84.mjs
CHANGED
package/dist/index85.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { VERSION as w } from "./
|
|
3
|
-
import s from "./
|
|
2
|
+
import { VERSION as w } from "./index73.mjs";
|
|
3
|
+
import s from "./index75.mjs";
|
|
4
4
|
const l = {};
|
|
5
5
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((n, t) => {
|
|
6
6
|
l[n] = function(o) {
|
package/dist/index87.mjs
CHANGED
package/dist/index88.mjs
CHANGED
package/dist/index89.mjs
CHANGED
package/dist/index91.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import H from "./
|
|
2
|
+
import H from "./index64.mjs";
|
|
3
3
|
import D from "./index99.mjs";
|
|
4
4
|
import L from "./index86.mjs";
|
|
5
|
-
import n from "./
|
|
6
|
-
import y from "./
|
|
5
|
+
import n from "./index75.mjs";
|
|
6
|
+
import y from "./index70.mjs";
|
|
7
7
|
import O from "./index100.mjs";
|
|
8
8
|
import U from "./index88.mjs";
|
|
9
|
-
import q from "./
|
|
9
|
+
import q from "./index78.mjs";
|
|
10
10
|
import { progressEventReducer as A } from "./index101.mjs";
|
|
11
11
|
import v from "./index102.mjs";
|
|
12
12
|
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
package/dist/index92.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import K from "./index88.mjs";
|
|
3
|
-
import t from "./
|
|
4
|
-
import b from "./
|
|
3
|
+
import t from "./index64.mjs";
|
|
4
|
+
import b from "./index75.mjs";
|
|
5
5
|
import ee from "./index103.mjs";
|
|
6
6
|
import { trackStream as z } from "./index104.mjs";
|
|
7
|
-
import te from "./
|
|
7
|
+
import te from "./index78.mjs";
|
|
8
8
|
import { progressEventDecorator as I, progressEventReducer as M, asyncDecorator as j } from "./index101.mjs";
|
|
9
9
|
import se from "./index102.mjs";
|
|
10
10
|
import re from "./index99.mjs";
|
package/dist/index93.mjs
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import p from "./index74.mjs";
|
|
3
|
+
function i(n) {
|
|
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
|
+
});
|
|
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("&");
|
|
13
31
|
};
|
|
14
32
|
export {
|
|
15
|
-
|
|
33
|
+
a as default
|
|
16
34
|
};
|
package/dist/index94.mjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import i from "./index64.mjs";
|
|
3
|
+
import m from "./index68.mjs";
|
|
4
|
+
import s from "./index78.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
|
+
}
|
|
4
12
|
export {
|
|
5
|
-
|
|
6
|
-
n as hasStandardBrowserEnv,
|
|
7
|
-
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
-
o as navigator,
|
|
9
|
-
r as origin
|
|
13
|
+
h as default
|
|
10
14
|
};
|
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 e(t) {
|
|
3
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
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
|
+
e as default
|
|
34
7
|
};
|
package/dist/index96.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import s from "./index76.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;
|
|
2
|
+
function n(e, c) {
|
|
3
|
+
return c ? e.replace(/\/?\/$/, "") + "/" + c.replace(/^\/+/, "") : e;
|
|
11
4
|
}
|
|
12
5
|
export {
|
|
13
|
-
|
|
6
|
+
n as default
|
|
14
7
|
};
|
package/dist/index97.mjs
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import o from "./index105.mjs";
|
|
3
|
+
import r from "./index106.mjs";
|
|
4
|
+
import t from "./index107.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
|
+
};
|
|
5
14
|
export {
|
|
6
|
-
|
|
15
|
+
l as default
|
|
7
16
|
};
|
package/dist/index98.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
|
-
|
|
5
|
+
e as hasBrowserEnv,
|
|
6
|
+
n as hasStandardBrowserEnv,
|
|
7
|
+
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
+
o as navigator,
|
|
9
|
+
r as origin
|
|
7
10
|
};
|
package/dist/index99.mjs
CHANGED
|
@@ -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.15",
|
|
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,10 +34,12 @@
|
|
|
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",
|
|
40
|
-
"yup": "^1.7.1"
|
|
41
|
+
"yup": "^1.7.1",
|
|
42
|
+
"@oms/shared": "1.0.0"
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
43
45
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -65,9 +67,7 @@
|
|
|
65
67
|
"storybook": "^9.1.12",
|
|
66
68
|
"tailwindcss": "^4.1.14",
|
|
67
69
|
"typescript": "^5.3.3",
|
|
68
|
-
"vite": "^5.4.20"
|
|
69
|
-
"@oms/api-client": "1.0.0",
|
|
70
|
-
"@oms/shared": "1.0.0"
|
|
70
|
+
"vite": "^5.4.20"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"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,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useState } from 'react';
|
|
9
|
-
import { useGetOrder, useConfirmOrder } from '@
|
|
9
|
+
import { useGetOrder, useConfirmOrder } from '@instockng/api-client';
|
|
10
10
|
import { WHATSAPP_HELP_LINK, WHATSAPP_HELP_NUMBER_FORMATTED } from '@oms/shared';
|
|
11
11
|
import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
|
|
12
12
|
import { Button } from './ui/button';
|
|
@@ -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
|