@instockng/storefront-ui 1.0.44 → 1.0.46
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/RecommendedProducts.d.ts.map +1 -1
- package/dist/index100.mjs +26 -19
- package/dist/index101.mjs +11 -58
- package/dist/index102.mjs +210 -13
- package/dist/index103.mjs +173 -32
- package/dist/index104.mjs +13 -15
- package/dist/index105.mjs +16 -27
- package/dist/index106.mjs +26 -20
- package/dist/index107.mjs +151 -14
- package/dist/index108.mjs +13 -14
- package/dist/index109.mjs +23 -39
- package/dist/index110.mjs +76 -15
- package/dist/index111.mjs +33 -263
- package/dist/index112.mjs +138 -63
- package/dist/index113.mjs +54 -7
- package/dist/index114.mjs +23 -2
- package/dist/index115.mjs +27 -2
- package/dist/index116.mjs +19 -29
- package/dist/index117.mjs +25 -2
- package/dist/index118.mjs +18 -232
- package/dist/index119.mjs +21 -5
- package/dist/index120.mjs +17 -130
- package/dist/index121.mjs +64 -67
- package/dist/index122.mjs +16 -85
- package/dist/index123.mjs +38 -28
- package/dist/index124.mjs +23 -8
- package/dist/index125.mjs +31 -72
- package/dist/index126.mjs +26 -3
- package/dist/index127.mjs +19 -2
- package/dist/index128.mjs +19 -81
- package/dist/index129.mjs +46 -53
- package/dist/index13.mjs +1 -1
- package/dist/index130.mjs +22 -5
- package/dist/index131.mjs +267 -4
- package/dist/index132.mjs +62 -171
- package/dist/index133.mjs +8 -53
- package/dist/index134.mjs +2 -69
- package/dist/index135.mjs +2 -2
- package/dist/index136.mjs +33 -34
- package/dist/index137.mjs +2 -43
- package/dist/index138.mjs +21 -2
- package/dist/index139.mjs +56 -2
- package/dist/index140.mjs +29 -2
- package/dist/index141.mjs +7 -2
- package/dist/index142.mjs +50 -16
- package/dist/index143.mjs +6 -32
- package/dist/index144.mjs +11 -37
- package/dist/index145.mjs +7 -18
- package/dist/index146.mjs +28 -18
- package/dist/index147.mjs +2 -2
- package/dist/index148.mjs +70 -20
- package/dist/index149.mjs +163 -42
- package/dist/index150.mjs +2 -2
- package/dist/index151.mjs +2 -30
- package/dist/index152.mjs +2 -18
- package/dist/index153.mjs +18 -2
- package/dist/index154.mjs +32 -2
- package/dist/index155.mjs +38 -2
- package/dist/index156.mjs +18 -2
- package/dist/index157.mjs +13 -67
- package/dist/index158.mjs +2 -2
- package/dist/index159.mjs +15 -48
- package/dist/index160.mjs +46 -2
- package/dist/index161.mjs +2 -36
- package/dist/index162.mjs +20 -142
- package/dist/index163.mjs +18 -2
- package/dist/index164.mjs +2 -2
- package/dist/index165.mjs +2 -19
- package/dist/index167.mjs +2 -2
- package/dist/index168.mjs +64 -18
- package/dist/index169.mjs +2 -2
- package/dist/index170.mjs +53 -2
- package/dist/index171.mjs +2 -24
- package/dist/index172.mjs +28 -15
- package/dist/index173.mjs +152 -2
- package/dist/index174.mjs +2 -2
- package/dist/index175.mjs +2 -2
- package/dist/index176.mjs +10 -14
- package/dist/index177.mjs +2 -2
- package/dist/index178.mjs +2 -23
- package/dist/index179.mjs +26 -2
- package/dist/index180.mjs +2 -2
- package/dist/index181.mjs +2 -2
- package/dist/index182.mjs +17 -16
- package/dist/index183.mjs +23 -2
- package/dist/index184.mjs +2 -23
- package/dist/index185.mjs +2 -2
- package/dist/index186.mjs +2 -2
- package/dist/index187.mjs +23 -2
- package/dist/index188.mjs +2 -2
- package/dist/index189.mjs +23 -2
- package/dist/index190.mjs +2 -2
- package/dist/index191.mjs +2 -2
- package/dist/index192.mjs +2 -2
- package/dist/index193.mjs +20 -124
- package/dist/index194.mjs +2 -2
- package/dist/index195.mjs +20 -71
- package/dist/index196.mjs +2 -74
- package/dist/index197.mjs +2 -21
- package/dist/index198.mjs +2 -56
- package/dist/index199.mjs +2 -29
- package/dist/index200.mjs +2 -7
- package/dist/index201.mjs +2 -52
- package/dist/index202.mjs +2 -6
- package/dist/index203.mjs +2 -12
- package/dist/index204.mjs +127 -7
- package/dist/index205.mjs +2 -28
- package/dist/index206.mjs +74 -2
- package/dist/index207.mjs +73 -69
- package/dist/index208.mjs +2 -167
- package/dist/index209.mjs +31 -2
- package/dist/index210.mjs +11 -2
- package/dist/index211.mjs +4 -2
- package/dist/index212.mjs +4 -2
- package/dist/index213.mjs +13 -2
- package/dist/index214.mjs +7 -108
- package/dist/index215.mjs +2 -2
- package/dist/index216.mjs +2 -2
- package/dist/index217.mjs +2 -37
- package/dist/index218.mjs +2 -2
- package/dist/index219.mjs +2 -244
- package/dist/index221.mjs +2 -33
- package/dist/index222.mjs +2 -65
- package/dist/index223.mjs +103 -20
- package/dist/index224.mjs +2 -2
- package/dist/index225.mjs +2 -2
- package/dist/index226.mjs +37 -2
- package/dist/index227.mjs +2 -2
- package/dist/index228.mjs +2 -2
- package/dist/index229.mjs +244 -2
- package/dist/index230.mjs +2 -2
- package/dist/index231.mjs +33 -2
- package/dist/index232.mjs +65 -2
- package/dist/index233.mjs +25 -2
- package/dist/index235.mjs +2 -2
- package/dist/index236.mjs +2 -2
- package/dist/index237.mjs +2 -2
- package/dist/index238.mjs +2 -2
- package/dist/index239.mjs +12 -4
- package/dist/index240.mjs +4 -30
- package/dist/index241.mjs +33 -11
- package/dist/index242.mjs +31 -4
- package/dist/index243.mjs +28 -4
- package/dist/index244.mjs +60 -12
- package/dist/index245.mjs +2 -7
- package/dist/index246.mjs +2 -12
- package/dist/index247.mjs +2 -5
- package/dist/index248.mjs +4 -33
- package/dist/index249.mjs +2 -31
- package/dist/index250.mjs +2 -28
- package/dist/index251.mjs +2 -61
- package/dist/index262.mjs +1 -1
- package/dist/index267.mjs +1 -1
- package/dist/index268.mjs +2 -2
- package/dist/index38.mjs +1 -1
- package/dist/index40.mjs +1 -1
- package/dist/index41.mjs +53 -56
- package/dist/index46.mjs +1 -1
- package/dist/index51.mjs +17 -17
- package/dist/index52.mjs +2 -2
- package/dist/index65.mjs +2 -153
- package/dist/index66.mjs +23 -2
- package/dist/index67.mjs +149 -19
- package/dist/index70.mjs +1 -1
- package/dist/index74.mjs +35 -35
- package/dist/index75.mjs +1 -1
- package/dist/index76.mjs +2 -2
- package/dist/index77.mjs +2 -2
- package/dist/index79.mjs +2 -2
- package/dist/index80.mjs +232 -25
- package/dist/index81.mjs +5 -17
- package/dist/index82.mjs +125 -206
- package/dist/index83.mjs +67 -179
- package/dist/index84.mjs +85 -20
- package/dist/index85.mjs +28 -22
- package/dist/index86.mjs +8 -32
- package/dist/index87.mjs +71 -152
- package/dist/index88.mjs +3 -19
- package/dist/index89.mjs +2 -31
- package/dist/index90.mjs +81 -82
- package/dist/index91.mjs +53 -37
- package/dist/index92.mjs +5 -144
- package/dist/index93.mjs +4 -54
- package/dist/index94.mjs +177 -21
- package/dist/index95.mjs +52 -26
- package/dist/index96.mjs +69 -23
- package/dist/index97.mjs +34 -25
- package/dist/index98.mjs +42 -20
- package/dist/index99.mjs +2 -22
- package/package.json +1 -1
- package/src/components/Checkout.tsx +1 -1
- package/src/components/RecommendedProducts.tsx +17 -25
package/dist/index98.mjs
CHANGED
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
var s = (e, r) => (e = e.replace(/\/+$/, ""), e = e + "/", r = r.replace(/^\/+/, ""), e + r), p = (e, r) => {
|
|
3
|
+
for (const [n, t] of Object.entries(r)) {
|
|
4
|
+
const c = new RegExp("/:" + n + "(?:{[^/]+})?\\??");
|
|
5
|
+
e = e.replace(c, t ? `/${t}` : "");
|
|
6
|
+
}
|
|
7
|
+
return e;
|
|
8
|
+
}, f = (e) => {
|
|
9
|
+
const r = new URLSearchParams();
|
|
10
|
+
for (const [n, t] of Object.entries(e))
|
|
11
|
+
if (t !== void 0)
|
|
12
|
+
if (Array.isArray(t))
|
|
13
|
+
for (const c of t)
|
|
14
|
+
r.append(n, c);
|
|
15
|
+
else
|
|
16
|
+
r.set(n, t);
|
|
17
|
+
return r;
|
|
18
|
+
}, i = (e, r) => {
|
|
19
|
+
switch (r) {
|
|
20
|
+
case "ws":
|
|
21
|
+
return e.replace(/^http/, "ws");
|
|
22
|
+
case "http":
|
|
23
|
+
return e.replace(/^ws/, "http");
|
|
24
|
+
}
|
|
25
|
+
}, l = (e) => /^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e) ? e.replace(/\/index(?=\?|$)/, "/") : e.replace(/\/index(?=\?|$)/, "");
|
|
26
|
+
function a(e) {
|
|
27
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
28
|
+
}
|
|
29
|
+
function o(e, r) {
|
|
30
|
+
if (!a(e) && !a(r))
|
|
31
|
+
return r;
|
|
32
|
+
const n = { ...e };
|
|
33
|
+
for (const t in r) {
|
|
34
|
+
const c = r[t];
|
|
35
|
+
a(n[t]) && a(c) ? n[t] = o(n[t], c) : n[t] = c;
|
|
36
|
+
}
|
|
37
|
+
return n;
|
|
21
38
|
}
|
|
22
39
|
export {
|
|
23
|
-
|
|
40
|
+
f as buildSearchParams,
|
|
41
|
+
o as deepMerge,
|
|
42
|
+
s as mergePath,
|
|
43
|
+
l as removeIndexString,
|
|
44
|
+
p as replaceUrlParam,
|
|
45
|
+
i as replaceUrlProtocol
|
|
24
46
|
};
|
package/dist/index99.mjs
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import { __require as _ } from "./index176.mjs";
|
|
4
|
-
import { __require as l } from "./index171.mjs";
|
|
5
|
-
var t;
|
|
6
|
-
function h() {
|
|
7
|
-
return t ? a.exports : (t = 1, function(u, e) {
|
|
8
|
-
Object.defineProperty(e, "__esModule", {
|
|
9
|
-
value: !0
|
|
10
|
-
}), Object.defineProperty(e, "addBasePath", {
|
|
11
|
-
enumerable: !0,
|
|
12
|
-
get: function() {
|
|
13
|
-
return f;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const i = _(), d = l(), n = process.env.__NEXT_ROUTER_BASEPATH || "";
|
|
17
|
-
function f(r, o) {
|
|
18
|
-
return (0, d.normalizePathTrailingSlash)(process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !o ? r : (0, i.addPathPrefix)(r, n));
|
|
19
|
-
}
|
|
20
|
-
(typeof e.default == "function" || typeof e.default == "object" && e.default !== null) && typeof e.default.__esModule > "u" && (Object.defineProperty(e.default, "__esModule", { value: !0 }), Object.assign(e.default, e), u.exports = e.default);
|
|
21
|
-
}(a, a.exports), a.exports);
|
|
22
|
-
}
|
|
2
|
+
var r = {};
|
|
23
3
|
export {
|
|
24
|
-
|
|
4
|
+
r as __exports
|
|
25
5
|
};
|
package/package.json
CHANGED
|
@@ -28,16 +28,16 @@ export function RecommendedProducts({
|
|
|
28
28
|
}: RecommendedProductsProps) {
|
|
29
29
|
const { cart, addItem } = useCart();
|
|
30
30
|
const { data: recommendations, isLoading, error } = useGetCartRecommendations(cart?.id, limit);
|
|
31
|
-
const [addingProductIds, setAddingProductIds] = useState<
|
|
32
|
-
const [fadingProductIds, setFadingProductIds] = useState<
|
|
33
|
-
const [collapsingProductIds, setCollapsingProductIds] = useState<
|
|
34
|
-
const [hiddenProductIds, setHiddenProductIds] = useState<
|
|
31
|
+
const [addingProductIds, setAddingProductIds] = useState<string[]>([]);
|
|
32
|
+
const [fadingProductIds, setFadingProductIds] = useState<string[]>([]);
|
|
33
|
+
const [collapsingProductIds, setCollapsingProductIds] = useState<string[]>([]);
|
|
34
|
+
const [hiddenProductIds, setHiddenProductIds] = useState<string[]>([]);
|
|
35
35
|
|
|
36
36
|
// Reset hidden products when recommendations change (e.g., when cart items are removed)
|
|
37
37
|
useEffect(() => {
|
|
38
|
-
setHiddenProductIds(
|
|
39
|
-
setFadingProductIds(
|
|
40
|
-
setCollapsingProductIds(
|
|
38
|
+
setHiddenProductIds([]);
|
|
39
|
+
setFadingProductIds([]);
|
|
40
|
+
setCollapsingProductIds([]);
|
|
41
41
|
}, [recommendations]);
|
|
42
42
|
|
|
43
43
|
// Don't render if no cart
|
|
@@ -58,7 +58,7 @@ export function RecommendedProducts({
|
|
|
58
58
|
|
|
59
59
|
// Filter out hidden products
|
|
60
60
|
const visibleRecommendations = recommendations?.filter(
|
|
61
|
-
product => !hiddenProductIds.
|
|
61
|
+
product => !hiddenProductIds.includes(product.id)
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
// Don't render if error or no visible recommendations
|
|
@@ -67,27 +67,23 @@ export function RecommendedProducts({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const handleAddToCart = async (product: typeof visibleRecommendations[0], variant: typeof visibleRecommendations[0]['variants'][0]) => {
|
|
70
|
-
setAddingProductIds(prev =>
|
|
70
|
+
setAddingProductIds(prev => [...prev, product.id]);
|
|
71
71
|
try {
|
|
72
72
|
await addItem(product.slug, product.name, variant.price, variant.sku, 1);
|
|
73
73
|
// Start the fade-out and blur animation
|
|
74
|
-
setFadingProductIds(prev =>
|
|
74
|
+
setFadingProductIds(prev => [...prev, product.id]);
|
|
75
75
|
|
|
76
76
|
// After fade completes (500ms), start width collapse
|
|
77
77
|
setTimeout(() => {
|
|
78
|
-
setCollapsingProductIds(prev =>
|
|
78
|
+
setCollapsingProductIds(prev => [...prev, product.id]);
|
|
79
79
|
}, 500);
|
|
80
80
|
|
|
81
81
|
// Remove from DOM after collapse completes (1000ms total)
|
|
82
82
|
setTimeout(() => {
|
|
83
|
-
setHiddenProductIds(prev =>
|
|
83
|
+
setHiddenProductIds(prev => [...prev, product.id]);
|
|
84
84
|
}, 1000);
|
|
85
85
|
} finally {
|
|
86
|
-
setAddingProductIds(prev =>
|
|
87
|
-
const next = new Set(prev);
|
|
88
|
-
next.delete(product.id);
|
|
89
|
-
return next;
|
|
90
|
-
});
|
|
86
|
+
setAddingProductIds(prev => prev.filter(id => id !== product.id));
|
|
91
87
|
}
|
|
92
88
|
};
|
|
93
89
|
|
|
@@ -104,17 +100,13 @@ export function RecommendedProducts({
|
|
|
104
100
|
{/* Left spacer */}
|
|
105
101
|
<div className="flex-shrink-0 w-1" />
|
|
106
102
|
|
|
107
|
-
{
|
|
103
|
+
{visibleRecommendations?.map((product) => {
|
|
108
104
|
const firstVariant = product.variants[0];
|
|
109
105
|
if (!firstVariant) return null;
|
|
110
106
|
|
|
111
|
-
const isAdding = addingProductIds.
|
|
112
|
-
const isFading = fadingProductIds.
|
|
113
|
-
const isCollapsing = collapsingProductIds.
|
|
114
|
-
const isHidden = hiddenProductIds.has(product.id);
|
|
115
|
-
|
|
116
|
-
// Don't render hidden products
|
|
117
|
-
if (isHidden) return null;
|
|
107
|
+
const isAdding = addingProductIds.includes(product.id);
|
|
108
|
+
const isFading = fadingProductIds.includes(product.id);
|
|
109
|
+
const isCollapsing = collapsingProductIds.includes(product.id);
|
|
118
110
|
|
|
119
111
|
return (
|
|
120
112
|
<div
|