@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.
Files changed (192) hide show
  1. package/dist/components/RecommendedProducts.d.ts.map +1 -1
  2. package/dist/index100.mjs +26 -19
  3. package/dist/index101.mjs +11 -58
  4. package/dist/index102.mjs +210 -13
  5. package/dist/index103.mjs +173 -32
  6. package/dist/index104.mjs +13 -15
  7. package/dist/index105.mjs +16 -27
  8. package/dist/index106.mjs +26 -20
  9. package/dist/index107.mjs +151 -14
  10. package/dist/index108.mjs +13 -14
  11. package/dist/index109.mjs +23 -39
  12. package/dist/index110.mjs +76 -15
  13. package/dist/index111.mjs +33 -263
  14. package/dist/index112.mjs +138 -63
  15. package/dist/index113.mjs +54 -7
  16. package/dist/index114.mjs +23 -2
  17. package/dist/index115.mjs +27 -2
  18. package/dist/index116.mjs +19 -29
  19. package/dist/index117.mjs +25 -2
  20. package/dist/index118.mjs +18 -232
  21. package/dist/index119.mjs +21 -5
  22. package/dist/index120.mjs +17 -130
  23. package/dist/index121.mjs +64 -67
  24. package/dist/index122.mjs +16 -85
  25. package/dist/index123.mjs +38 -28
  26. package/dist/index124.mjs +23 -8
  27. package/dist/index125.mjs +31 -72
  28. package/dist/index126.mjs +26 -3
  29. package/dist/index127.mjs +19 -2
  30. package/dist/index128.mjs +19 -81
  31. package/dist/index129.mjs +46 -53
  32. package/dist/index13.mjs +1 -1
  33. package/dist/index130.mjs +22 -5
  34. package/dist/index131.mjs +267 -4
  35. package/dist/index132.mjs +62 -171
  36. package/dist/index133.mjs +8 -53
  37. package/dist/index134.mjs +2 -69
  38. package/dist/index135.mjs +2 -2
  39. package/dist/index136.mjs +33 -34
  40. package/dist/index137.mjs +2 -43
  41. package/dist/index138.mjs +21 -2
  42. package/dist/index139.mjs +56 -2
  43. package/dist/index140.mjs +29 -2
  44. package/dist/index141.mjs +7 -2
  45. package/dist/index142.mjs +50 -16
  46. package/dist/index143.mjs +6 -32
  47. package/dist/index144.mjs +11 -37
  48. package/dist/index145.mjs +7 -18
  49. package/dist/index146.mjs +28 -18
  50. package/dist/index147.mjs +2 -2
  51. package/dist/index148.mjs +70 -20
  52. package/dist/index149.mjs +163 -42
  53. package/dist/index150.mjs +2 -2
  54. package/dist/index151.mjs +2 -30
  55. package/dist/index152.mjs +2 -18
  56. package/dist/index153.mjs +18 -2
  57. package/dist/index154.mjs +32 -2
  58. package/dist/index155.mjs +38 -2
  59. package/dist/index156.mjs +18 -2
  60. package/dist/index157.mjs +13 -67
  61. package/dist/index158.mjs +2 -2
  62. package/dist/index159.mjs +15 -48
  63. package/dist/index160.mjs +46 -2
  64. package/dist/index161.mjs +2 -36
  65. package/dist/index162.mjs +20 -142
  66. package/dist/index163.mjs +18 -2
  67. package/dist/index164.mjs +2 -2
  68. package/dist/index165.mjs +2 -19
  69. package/dist/index167.mjs +2 -2
  70. package/dist/index168.mjs +64 -18
  71. package/dist/index169.mjs +2 -2
  72. package/dist/index170.mjs +53 -2
  73. package/dist/index171.mjs +2 -24
  74. package/dist/index172.mjs +28 -15
  75. package/dist/index173.mjs +152 -2
  76. package/dist/index174.mjs +2 -2
  77. package/dist/index175.mjs +2 -2
  78. package/dist/index176.mjs +10 -14
  79. package/dist/index177.mjs +2 -2
  80. package/dist/index178.mjs +2 -23
  81. package/dist/index179.mjs +26 -2
  82. package/dist/index180.mjs +2 -2
  83. package/dist/index181.mjs +2 -2
  84. package/dist/index182.mjs +17 -16
  85. package/dist/index183.mjs +23 -2
  86. package/dist/index184.mjs +2 -23
  87. package/dist/index185.mjs +2 -2
  88. package/dist/index186.mjs +2 -2
  89. package/dist/index187.mjs +23 -2
  90. package/dist/index188.mjs +2 -2
  91. package/dist/index189.mjs +23 -2
  92. package/dist/index190.mjs +2 -2
  93. package/dist/index191.mjs +2 -2
  94. package/dist/index192.mjs +2 -2
  95. package/dist/index193.mjs +20 -124
  96. package/dist/index194.mjs +2 -2
  97. package/dist/index195.mjs +20 -71
  98. package/dist/index196.mjs +2 -74
  99. package/dist/index197.mjs +2 -21
  100. package/dist/index198.mjs +2 -56
  101. package/dist/index199.mjs +2 -29
  102. package/dist/index200.mjs +2 -7
  103. package/dist/index201.mjs +2 -52
  104. package/dist/index202.mjs +2 -6
  105. package/dist/index203.mjs +2 -12
  106. package/dist/index204.mjs +127 -7
  107. package/dist/index205.mjs +2 -28
  108. package/dist/index206.mjs +74 -2
  109. package/dist/index207.mjs +73 -69
  110. package/dist/index208.mjs +2 -167
  111. package/dist/index209.mjs +31 -2
  112. package/dist/index210.mjs +11 -2
  113. package/dist/index211.mjs +4 -2
  114. package/dist/index212.mjs +4 -2
  115. package/dist/index213.mjs +13 -2
  116. package/dist/index214.mjs +7 -108
  117. package/dist/index215.mjs +2 -2
  118. package/dist/index216.mjs +2 -2
  119. package/dist/index217.mjs +2 -37
  120. package/dist/index218.mjs +2 -2
  121. package/dist/index219.mjs +2 -244
  122. package/dist/index221.mjs +2 -33
  123. package/dist/index222.mjs +2 -65
  124. package/dist/index223.mjs +103 -20
  125. package/dist/index224.mjs +2 -2
  126. package/dist/index225.mjs +2 -2
  127. package/dist/index226.mjs +37 -2
  128. package/dist/index227.mjs +2 -2
  129. package/dist/index228.mjs +2 -2
  130. package/dist/index229.mjs +244 -2
  131. package/dist/index230.mjs +2 -2
  132. package/dist/index231.mjs +33 -2
  133. package/dist/index232.mjs +65 -2
  134. package/dist/index233.mjs +25 -2
  135. package/dist/index235.mjs +2 -2
  136. package/dist/index236.mjs +2 -2
  137. package/dist/index237.mjs +2 -2
  138. package/dist/index238.mjs +2 -2
  139. package/dist/index239.mjs +12 -4
  140. package/dist/index240.mjs +4 -30
  141. package/dist/index241.mjs +33 -11
  142. package/dist/index242.mjs +31 -4
  143. package/dist/index243.mjs +28 -4
  144. package/dist/index244.mjs +60 -12
  145. package/dist/index245.mjs +2 -7
  146. package/dist/index246.mjs +2 -12
  147. package/dist/index247.mjs +2 -5
  148. package/dist/index248.mjs +4 -33
  149. package/dist/index249.mjs +2 -31
  150. package/dist/index250.mjs +2 -28
  151. package/dist/index251.mjs +2 -61
  152. package/dist/index262.mjs +1 -1
  153. package/dist/index267.mjs +1 -1
  154. package/dist/index268.mjs +2 -2
  155. package/dist/index38.mjs +1 -1
  156. package/dist/index40.mjs +1 -1
  157. package/dist/index41.mjs +53 -56
  158. package/dist/index46.mjs +1 -1
  159. package/dist/index51.mjs +17 -17
  160. package/dist/index52.mjs +2 -2
  161. package/dist/index65.mjs +2 -153
  162. package/dist/index66.mjs +23 -2
  163. package/dist/index67.mjs +149 -19
  164. package/dist/index70.mjs +1 -1
  165. package/dist/index74.mjs +35 -35
  166. package/dist/index75.mjs +1 -1
  167. package/dist/index76.mjs +2 -2
  168. package/dist/index77.mjs +2 -2
  169. package/dist/index79.mjs +2 -2
  170. package/dist/index80.mjs +232 -25
  171. package/dist/index81.mjs +5 -17
  172. package/dist/index82.mjs +125 -206
  173. package/dist/index83.mjs +67 -179
  174. package/dist/index84.mjs +85 -20
  175. package/dist/index85.mjs +28 -22
  176. package/dist/index86.mjs +8 -32
  177. package/dist/index87.mjs +71 -152
  178. package/dist/index88.mjs +3 -19
  179. package/dist/index89.mjs +2 -31
  180. package/dist/index90.mjs +81 -82
  181. package/dist/index91.mjs +53 -37
  182. package/dist/index92.mjs +5 -144
  183. package/dist/index93.mjs +4 -54
  184. package/dist/index94.mjs +177 -21
  185. package/dist/index95.mjs +52 -26
  186. package/dist/index96.mjs +69 -23
  187. package/dist/index97.mjs +34 -25
  188. package/dist/index98.mjs +42 -20
  189. package/dist/index99.mjs +2 -22
  190. package/package.json +1 -1
  191. package/src/components/Checkout.tsx +1 -1
  192. package/src/components/RecommendedProducts.tsx +17 -25
package/dist/index98.mjs CHANGED
@@ -1,24 +1,46 @@
1
1
  'use client';
2
- import { __module as r } from "./index174.mjs";
3
- import { __require as o } from "./index100.mjs";
4
- var a;
5
- function l() {
6
- return a ? r.exports : (a = 1, function(n, e) {
7
- Object.defineProperty(e, "__esModule", {
8
- value: !0
9
- }), Object.defineProperty(e, "removeBasePath", {
10
- enumerable: !0,
11
- get: function() {
12
- return i;
13
- }
14
- });
15
- const f = o(), u = process.env.__NEXT_ROUTER_BASEPATH || "";
16
- function i(t) {
17
- return process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !(0, f.hasBasePath)(t) || u.length === 0 || (t = t.slice(u.length), t.startsWith("/") || (t = "/" + t)), t;
18
- }
19
- (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), n.exports = e.default);
20
- }(r, r.exports), r.exports);
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
- l as __require
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
- import { __module as a } from "./index175.mjs";
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
- h as __require
4
+ r as __exports
25
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instockng/storefront-ui",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
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",
@@ -996,7 +996,7 @@ export function Checkout({
996
996
  <div>
997
997
  <div className="font-semibold text-gray-900">Pay on Delivery</div>
998
998
  <div className="text-sm text-gray-500 mt-1">
999
- Cash when item arrives
999
+ Pay when item arrives
1000
1000
  </div>
1001
1001
  </div>
1002
1002
  </div>
@@ -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<Set<string>>(new Set());
32
- const [fadingProductIds, setFadingProductIds] = useState<Set<string>>(new Set());
33
- const [collapsingProductIds, setCollapsingProductIds] = useState<Set<string>>(new Set());
34
- const [hiddenProductIds, setHiddenProductIds] = useState<Set<string>>(new Set());
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(new Set());
39
- setFadingProductIds(new Set());
40
- setCollapsingProductIds(new Set());
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.has(product.id)
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 => new Set(prev).add(product.id));
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 => new Set(prev).add(product.id));
74
+ setFadingProductIds(prev => [...prev, product.id]);
75
75
 
76
76
  // After fade completes (500ms), start width collapse
77
77
  setTimeout(() => {
78
- setCollapsingProductIds(prev => new Set(prev).add(product.id));
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 => new Set(prev).add(product.id));
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
- {recommendations?.map((product) => {
103
+ {visibleRecommendations?.map((product) => {
108
104
  const firstVariant = product.variants[0];
109
105
  if (!firstVariant) return null;
110
106
 
111
- const isAdding = addingProductIds.has(product.id);
112
- const isFading = fadingProductIds.has(product.id);
113
- const isCollapsing = collapsingProductIds.has(product.id);
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