@instockng/storefront-ui 1.0.17 → 1.0.19

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 (292) hide show
  1. package/dist/components/OrderConfirmation.d.ts +1 -1
  2. package/dist/components/OrderConfirmation.d.ts.map +1 -1
  3. package/dist/components/ShoppingCart.d.ts.map +1 -1
  4. package/dist/contexts/CartContext.d.ts +2 -2
  5. package/dist/contexts/CartContext.d.ts.map +1 -1
  6. package/dist/fetchers.d.ts +19 -0
  7. package/dist/fetchers.d.ts.map +1 -0
  8. package/dist/hooks/usePageTracking.d.ts +40 -0
  9. package/dist/hooks/usePageTracking.d.ts.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.mjs +101 -92
  13. package/dist/index10.mjs +149 -624
  14. package/dist/index100.mjs +22 -33
  15. package/dist/index101.mjs +22 -30
  16. package/dist/index102.mjs +32 -27
  17. package/dist/index103.mjs +152 -57
  18. package/dist/index104.mjs +20 -3
  19. package/dist/index105.mjs +31 -2
  20. package/dist/index106.mjs +84 -2
  21. package/dist/index107.mjs +37 -16
  22. package/dist/index108.mjs +144 -12
  23. package/dist/index109.mjs +55 -6
  24. package/dist/index11.mjs +94 -56
  25. package/dist/index110.mjs +23 -30
  26. package/dist/index111.mjs +30 -0
  27. package/dist/index112.mjs +26 -0
  28. package/dist/index113.mjs +28 -0
  29. package/dist/index114.mjs +24 -0
  30. package/dist/index115.mjs +25 -0
  31. package/dist/index116.mjs +24 -0
  32. package/dist/index117.mjs +68 -0
  33. package/dist/index118.mjs +21 -0
  34. package/dist/index119.mjs +42 -0
  35. package/dist/index12.mjs +645 -62
  36. package/dist/index120.mjs +27 -0
  37. package/dist/index121.mjs +37 -0
  38. package/dist/index122.mjs +30 -0
  39. package/dist/index123.mjs +22 -0
  40. package/dist/index124.mjs +24 -0
  41. package/dist/index125.mjs +50 -0
  42. package/dist/index126.mjs +26 -0
  43. package/dist/index127.mjs +271 -0
  44. package/dist/index128.mjs +73 -0
  45. package/dist/index129.mjs +11 -0
  46. package/dist/index13.mjs +50 -14
  47. package/dist/index130.mjs +5 -0
  48. package/dist/index131.mjs +5 -0
  49. package/dist/index132.mjs +36 -0
  50. package/dist/index133.mjs +5 -0
  51. package/dist/index134.mjs +24 -0
  52. package/dist/index135.mjs +59 -0
  53. package/dist/index136.mjs +32 -0
  54. package/dist/index137.mjs +10 -0
  55. package/dist/index138.mjs +55 -0
  56. package/dist/index139.mjs +9 -0
  57. package/dist/index14.mjs +62 -115
  58. package/dist/index140.mjs +15 -0
  59. package/dist/index141.mjs +10 -0
  60. package/dist/index142.mjs +31 -0
  61. package/dist/index143.mjs +5 -0
  62. package/dist/index144.mjs +73 -0
  63. package/dist/index145.mjs +170 -0
  64. package/dist/index146.mjs +5 -0
  65. package/dist/index147.mjs +5 -0
  66. package/dist/index148.mjs +5 -0
  67. package/dist/index149.mjs +21 -0
  68. package/dist/index15.mjs +23 -41
  69. package/dist/index150.mjs +35 -0
  70. package/dist/index151.mjs +41 -0
  71. package/dist/index152.mjs +21 -0
  72. package/dist/index153.mjs +21 -0
  73. package/dist/index154.mjs +5 -0
  74. package/dist/index155.mjs +23 -0
  75. package/dist/index156.mjs +49 -0
  76. package/dist/index157.mjs +5 -0
  77. package/dist/index158.mjs +33 -0
  78. package/dist/index159.mjs +21 -0
  79. package/dist/index16.mjs +115 -42
  80. package/dist/index160.mjs +5 -0
  81. package/dist/index161.mjs +5 -0
  82. package/dist/index162.mjs +5 -0
  83. package/dist/index163.mjs +5 -0
  84. package/dist/index164.mjs +75 -0
  85. package/dist/index165.mjs +5 -0
  86. package/dist/index166.mjs +56 -0
  87. package/dist/index167.mjs +5 -0
  88. package/dist/index168.mjs +39 -0
  89. package/dist/index169.mjs +155 -0
  90. package/dist/index17.mjs +42 -42
  91. package/dist/index170.mjs +5 -0
  92. package/dist/index171.mjs +5 -0
  93. package/dist/index172.mjs +22 -0
  94. package/dist/index173.mjs +5 -0
  95. package/dist/index174.mjs +5 -0
  96. package/dist/index175.mjs +29 -0
  97. package/dist/index176.mjs +5 -0
  98. package/dist/index177.mjs +5 -0
  99. package/dist/index178.mjs +27 -0
  100. package/dist/index179.mjs +26 -0
  101. package/dist/index18.mjs +41 -31
  102. package/dist/index180.mjs +5 -0
  103. package/dist/index181.mjs +5 -0
  104. package/dist/index182.mjs +5 -0
  105. package/dist/index183.mjs +26 -0
  106. package/dist/index184.mjs +5 -0
  107. package/dist/index185.mjs +26 -0
  108. package/dist/index186.mjs +5 -0
  109. package/dist/index187.mjs +5 -0
  110. package/dist/index188.mjs +5 -0
  111. package/dist/index189.mjs +26 -0
  112. package/dist/index19.mjs +40 -7
  113. package/dist/index190.mjs +5 -0
  114. package/dist/index191.mjs +26 -0
  115. package/dist/index192.mjs +5 -0
  116. package/dist/index193.mjs +5 -0
  117. package/dist/index194.mjs +5 -0
  118. package/dist/index195.mjs +5 -0
  119. package/dist/index196.mjs +5 -0
  120. package/dist/index197.mjs +5 -0
  121. package/dist/index198.mjs +5 -0
  122. package/dist/index199.mjs +5 -0
  123. package/dist/index2.mjs +31 -12
  124. package/dist/index20.mjs +27 -17
  125. package/dist/index200.mjs +130 -0
  126. package/dist/index201.mjs +5 -0
  127. package/dist/index202.mjs +77 -0
  128. package/dist/index203.mjs +77 -0
  129. package/dist/index204.mjs +5 -0
  130. package/dist/index205.mjs +5 -0
  131. package/dist/index206.mjs +111 -0
  132. package/dist/index207.mjs +5 -0
  133. package/dist/index208.mjs +5 -0
  134. package/dist/index209.mjs +5 -0
  135. package/dist/index21.mjs +6 -29
  136. package/dist/index210.mjs +5 -0
  137. package/dist/index211.mjs +5 -0
  138. package/dist/index212.mjs +5 -0
  139. package/dist/index213.mjs +5 -0
  140. package/dist/index214.mjs +5 -0
  141. package/dist/index215.mjs +5 -0
  142. package/dist/index216.mjs +40 -0
  143. package/dist/index217.mjs +5 -0
  144. package/dist/index218.mjs +5 -0
  145. package/dist/index219.mjs +5 -0
  146. package/dist/index22.mjs +20 -18
  147. package/dist/index220.mjs +247 -0
  148. package/dist/index221.mjs +5 -0
  149. package/dist/index222.mjs +36 -0
  150. package/dist/index223.mjs +68 -0
  151. package/dist/index224.mjs +28 -0
  152. package/dist/index225.mjs +5 -0
  153. package/dist/index226.mjs +5 -0
  154. package/dist/index227.mjs +5 -0
  155. package/dist/index228.mjs +5 -0
  156. package/dist/index229.mjs +5 -0
  157. package/dist/index23.mjs +32 -87
  158. package/dist/index230.mjs +5 -0
  159. package/dist/index231.mjs +5 -0
  160. package/dist/index232.mjs +5 -0
  161. package/dist/index233.mjs +7 -0
  162. package/dist/index234.mjs +5 -0
  163. package/dist/index235.mjs +5 -0
  164. package/dist/index236.mjs +34 -0
  165. package/dist/index237.mjs +14 -0
  166. package/dist/index238.mjs +7 -0
  167. package/dist/index239.mjs +7 -0
  168. package/dist/index24.mjs +12 -12
  169. package/dist/index240.mjs +16 -0
  170. package/dist/index241.mjs +10 -0
  171. package/dist/index242.mjs +15 -0
  172. package/dist/index243.mjs +8 -0
  173. package/dist/index244.mjs +36 -0
  174. package/dist/index245.mjs +34 -0
  175. package/dist/index246.mjs +31 -0
  176. package/dist/index247.mjs +64 -0
  177. package/dist/index248.mjs +5 -0
  178. package/dist/index249.mjs +5 -0
  179. package/dist/index25.mjs +85 -8
  180. package/dist/index250.mjs +21 -0
  181. package/dist/index251.mjs +50 -0
  182. package/dist/index252.mjs +5 -0
  183. package/dist/index253.mjs +5 -0
  184. package/dist/index254.mjs +5 -0
  185. package/dist/index255.mjs +5 -0
  186. package/dist/index256.mjs +94 -0
  187. package/dist/index257.mjs +5 -0
  188. package/dist/index258.mjs +6 -0
  189. package/dist/index259.mjs +5 -0
  190. package/dist/index26.mjs +20 -97
  191. package/dist/index260.mjs +5 -0
  192. package/dist/index261.mjs +20 -0
  193. package/dist/index262.mjs +16 -0
  194. package/dist/index263.mjs +9 -0
  195. package/dist/index264.mjs +33 -0
  196. package/dist/index265.mjs +5 -0
  197. package/dist/index266.mjs +5 -0
  198. package/dist/index267.mjs +5 -0
  199. package/dist/index27.mjs +11 -18
  200. package/dist/index28.mjs +11 -65
  201. package/dist/index29.mjs +94 -89
  202. package/dist/index3.mjs +117 -97
  203. package/dist/index30.mjs +20 -19
  204. package/dist/index31.mjs +65 -19
  205. package/dist/index32.mjs +93 -8
  206. package/dist/index33.mjs +18 -1432
  207. package/dist/index34.mjs +19 -2
  208. package/dist/index35.mjs +10 -56
  209. package/dist/index36.mjs +9 -49
  210. package/dist/index37.mjs +103 -33
  211. package/dist/index38.mjs +24 -14
  212. package/dist/index39.mjs +1411 -2241
  213. package/dist/index4.mjs +82 -197
  214. package/dist/index40.mjs +2 -36
  215. package/dist/index41.mjs +56 -43
  216. package/dist/index42.mjs +50 -98
  217. package/dist/index43.mjs +33 -97
  218. package/dist/index44.mjs +13 -79
  219. package/dist/index45.mjs +2255 -69
  220. package/dist/index46.mjs +36 -95
  221. package/dist/index47.mjs +43 -80
  222. package/dist/index48.mjs +99 -79
  223. package/dist/index49.mjs +93 -15
  224. package/dist/index5.mjs +15 -108
  225. package/dist/index50.mjs +77 -14
  226. package/dist/index51.mjs +58 -44
  227. package/dist/index52.mjs +63 -93
  228. package/dist/index53.mjs +51 -99
  229. package/dist/index54.mjs +78 -4
  230. package/dist/index55.mjs +18 -22
  231. package/dist/index56.mjs +17 -74
  232. package/dist/index57.mjs +63 -15
  233. package/dist/index58.mjs +121 -59
  234. package/dist/index59.mjs +122 -228
  235. package/dist/index6.mjs +190 -73
  236. package/dist/index60.mjs +23 -5
  237. package/dist/index61.mjs +145 -126
  238. package/dist/index62.mjs +2 -68
  239. package/dist/index63.mjs +22 -86
  240. package/dist/index64.mjs +73 -27
  241. package/dist/index65.mjs +15 -9
  242. package/dist/index66.mjs +58 -70
  243. package/dist/index67.mjs +4 -3
  244. package/dist/index68.mjs +2 -2
  245. package/dist/index69.mjs +5 -82
  246. package/dist/index7.mjs +97 -85
  247. package/dist/index70.mjs +1133 -53
  248. package/dist/index71.mjs +19 -5
  249. package/dist/index72.mjs +54 -4
  250. package/dist/index73.mjs +28 -174
  251. package/dist/index74.mjs +2 -53
  252. package/dist/index75.mjs +2 -69
  253. package/dist/index76.mjs +231 -30
  254. package/dist/index77.mjs +5 -42
  255. package/dist/index78.mjs +133 -3
  256. package/dist/index79.mjs +68 -2
  257. package/dist/index8.mjs +78 -162
  258. package/dist/index80.mjs +85 -19
  259. package/dist/index81.mjs +26 -53
  260. package/dist/index82.mjs +8 -28
  261. package/dist/index83.mjs +74 -6
  262. package/dist/index84.mjs +3 -51
  263. package/dist/index85.mjs +2 -6
  264. package/dist/index86.mjs +81 -10
  265. package/dist/index87.mjs +53 -6
  266. package/dist/index88.mjs +5 -27
  267. package/dist/index89.mjs +5 -2
  268. package/dist/index9.mjs +90 -90
  269. package/dist/index90.mjs +175 -66
  270. package/dist/index91.mjs +49 -163
  271. package/dist/index92.mjs +68 -30
  272. package/dist/index93.mjs +34 -11
  273. package/dist/index94.mjs +42 -3
  274. package/dist/index95.mjs +2 -4
  275. package/dist/index96.mjs +28 -13
  276. package/dist/index97.mjs +18 -7
  277. package/dist/index98.mjs +214 -11
  278. package/dist/index99.mjs +179 -4
  279. package/dist/providers/MetaPixelProvider.d.ts +98 -0
  280. package/dist/providers/MetaPixelProvider.d.ts.map +1 -0
  281. package/dist/providers/StorefrontProvider.d.ts +1 -0
  282. package/dist/providers/StorefrontProvider.d.ts.map +1 -1
  283. package/dist/styles.css +1 -1
  284. package/package.json +8 -3
  285. package/src/components/OrderConfirmation.tsx +0 -2
  286. package/src/components/ShoppingCart.tsx +12 -1
  287. package/src/contexts/CartContext.tsx +30 -5
  288. package/src/fetchers.ts +33 -0
  289. package/src/hooks/usePageTracking.ts +72 -0
  290. package/src/index.ts +5 -0
  291. package/src/providers/MetaPixelProvider.tsx +236 -0
  292. package/src/providers/StorefrontProvider.tsx +29 -3
package/dist/index108.mjs CHANGED
@@ -1,16 +1,148 @@
1
1
  'use client';
2
- function h(r, a) {
3
- let s = 0, u = 1e3 / a, e, t;
4
- const n = (l, o = Date.now()) => {
5
- s = o, e = null, t && (clearTimeout(t), t = null), r(...l);
6
- };
7
- return [(...l) => {
8
- const o = Date.now(), i = o - s;
9
- i >= u ? n(l, o) : (e = l, t || (t = setTimeout(() => {
10
- t = null, n(e);
11
- }, u - i)));
12
- }, () => e && n(e)];
2
+ import { __exports as p } from "./index171.mjs";
3
+ import { __require as I } from "./index127.mjs";
4
+ import { __require as q } from "./index164.mjs";
5
+ import { __require as v } from "./index172.mjs";
6
+ import { __require as O } from "./index97.mjs";
7
+ var N;
8
+ function w() {
9
+ return N ? p : (N = 1, function(d) {
10
+ Object.defineProperty(d, "__esModule", {
11
+ value: !0
12
+ });
13
+ function T(e, t) {
14
+ for (var r in t) Object.defineProperty(e, r, {
15
+ enumerable: !0,
16
+ get: t[r]
17
+ });
18
+ }
19
+ T(d, {
20
+ getNamedMiddlewareRegex: function() {
21
+ return A;
22
+ },
23
+ getNamedRouteRegex: function() {
24
+ return k;
25
+ },
26
+ getRouteRegex: function() {
27
+ return E;
28
+ },
29
+ parseParameter: function() {
30
+ return S;
31
+ }
32
+ });
33
+ const m = I(), _ = q(), l = v(), h = O(), x = /\[((?:\[.*\])|.+)\]/;
34
+ function S(e) {
35
+ const t = e.match(x);
36
+ return R(t ? t[1] : e);
37
+ }
38
+ function R(e) {
39
+ const t = e.startsWith("[") && e.endsWith("]");
40
+ t && (e = e.slice(1, -1));
41
+ const r = e.startsWith("...");
42
+ return r && (e = e.slice(3)), {
43
+ key: e,
44
+ repeat: r,
45
+ optional: t
46
+ };
47
+ }
48
+ function P(e) {
49
+ const t = (0, h.removeTrailingSlash)(e).slice(1).split("/"), r = {};
50
+ let u = 1;
51
+ return {
52
+ parameterizedRoute: t.map((s) => {
53
+ const o = _.INTERCEPTION_ROUTE_MARKERS.find((i) => s.startsWith(i)), a = s.match(x);
54
+ if (o && a) {
55
+ const { key: i, optional: c, repeat: n } = R(a[1]);
56
+ return r[i] = {
57
+ pos: u++,
58
+ repeat: n,
59
+ optional: c
60
+ }, "/" + (0, l.escapeStringRegexp)(o) + "([^/]+?)";
61
+ } else if (a) {
62
+ const { key: i, repeat: c, optional: n } = R(a[1]);
63
+ return r[i] = {
64
+ pos: u++,
65
+ repeat: c,
66
+ optional: n
67
+ }, c ? n ? "(?:/(.+?))?" : "/(.+?)" : "/([^/]+?)";
68
+ } else
69
+ return "/" + (0, l.escapeStringRegexp)(s);
70
+ }).join(""),
71
+ groups: r
72
+ };
73
+ }
74
+ function E(e) {
75
+ const { parameterizedRoute: t, groups: r } = P(e);
76
+ return {
77
+ re: new RegExp("^" + t + "(?:/)?$"),
78
+ groups: r
79
+ };
80
+ }
81
+ function K() {
82
+ let e = 0;
83
+ return () => {
84
+ let t = "", r = ++e;
85
+ for (; r > 0; )
86
+ t += String.fromCharCode(97 + (r - 1) % 26), r = Math.floor((r - 1) / 26);
87
+ return t;
88
+ };
89
+ }
90
+ function y(e) {
91
+ let { interceptionMarker: t, getSafeRouteKey: r, segment: u, routeKeys: s, keyPrefix: o } = e;
92
+ const { key: a, optional: i, repeat: c } = R(u);
93
+ let n = a.replace(/\W/g, "");
94
+ o && (n = "" + o + n);
95
+ let f = !1;
96
+ (n.length === 0 || n.length > 30) && (f = !0), isNaN(parseInt(n.slice(0, 1))) || (f = !0), f && (n = r()), o ? s[n] = "" + o + a : s[n] = a;
97
+ const g = t ? (0, l.escapeStringRegexp)(t) : "";
98
+ return c ? i ? "(?:/" + g + "(?<" + n + ">.+?))?" : "/" + g + "(?<" + n + ">.+?)" : "/" + g + "(?<" + n + ">[^/]+?)";
99
+ }
100
+ function M(e, t) {
101
+ const r = (0, h.removeTrailingSlash)(e).slice(1).split("/"), u = K(), s = {};
102
+ return {
103
+ namedParameterizedRoute: r.map((o) => {
104
+ const a = _.INTERCEPTION_ROUTE_MARKERS.some((c) => o.startsWith(c)), i = o.match(/\[((?:\[.*\])|.+)\]/);
105
+ if (a && i) {
106
+ const [c] = o.split(i[0]);
107
+ return y({
108
+ getSafeRouteKey: u,
109
+ interceptionMarker: c,
110
+ segment: i[1],
111
+ routeKeys: s,
112
+ keyPrefix: t ? m.NEXT_INTERCEPTION_MARKER_PREFIX : void 0
113
+ });
114
+ } else return i ? y({
115
+ getSafeRouteKey: u,
116
+ segment: i[1],
117
+ routeKeys: s,
118
+ keyPrefix: t ? m.NEXT_QUERY_PARAM_PREFIX : void 0
119
+ }) : "/" + (0, l.escapeStringRegexp)(o);
120
+ }).join(""),
121
+ routeKeys: s
122
+ };
123
+ }
124
+ function k(e, t) {
125
+ const r = M(e, t);
126
+ return {
127
+ ...E(e),
128
+ namedRegex: "^" + r.namedParameterizedRoute + "(?:/)?$",
129
+ routeKeys: r.routeKeys
130
+ };
131
+ }
132
+ function A(e, t) {
133
+ const { parameterizedRoute: r } = P(e), { catchAll: u = !0 } = t;
134
+ if (r === "/")
135
+ return {
136
+ namedRegex: "^/" + (u ? ".*" : "") + "$"
137
+ };
138
+ const { namedParameterizedRoute: s } = M(e, !1);
139
+ let o = u ? "(?:(/.*)?)" : "";
140
+ return {
141
+ namedRegex: "^" + s + o + "$"
142
+ };
143
+ }
144
+ }(p), p);
13
145
  }
14
146
  export {
15
- h as default
147
+ w as __require
16
148
  };
package/dist/index109.mjs CHANGED
@@ -1,9 +1,58 @@
1
1
  'use client';
2
- import o from "./index87.mjs";
3
- const n = o.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, e) => (t) => (t = new URL(t, o.origin), r.protocol === t.protocol && r.host === t.host && (e || r.port === t.port)))(
4
- new URL(o.origin),
5
- o.navigator && /(msie|trident)/i.test(o.navigator.userAgent)
6
- ) : () => !0;
2
+ import { __exports as c } from "./index173.mjs";
3
+ import { __require as y } from "./index96.mjs";
4
+ import { __require as U } from "./index166.mjs";
5
+ var l;
6
+ function x() {
7
+ return l ? c : (l = 1, function(h) {
8
+ Object.defineProperty(h, "__esModule", {
9
+ value: !0
10
+ });
11
+ function m(e, t) {
12
+ for (var o in t) Object.defineProperty(e, o, {
13
+ enumerable: !0,
14
+ get: t[o]
15
+ });
16
+ }
17
+ m(h, {
18
+ formatUrl: function() {
19
+ return p;
20
+ },
21
+ formatWithValidation: function() {
22
+ return q;
23
+ },
24
+ urlObjectKeys: function() {
25
+ return u;
26
+ }
27
+ });
28
+ const _ = /* @__PURE__ */ y()._(U()), d = /https?|ftp|gopher|file/;
29
+ function p(e) {
30
+ let { auth: t, hostname: o } = e, a = e.protocol || "", n = e.pathname || "", f = e.hash || "", s = e.query || "", r = !1;
31
+ t = t ? encodeURIComponent(t).replace(/%3A/i, ":") + "@" : "", e.host ? r = t + e.host : o && (r = t + (~o.indexOf(":") ? "[" + o + "]" : o), e.port && (r += ":" + e.port)), s && typeof s == "object" && (s = String(_.urlQueryToSearchParams(s)));
32
+ let i = e.search || s && "?" + s || "";
33
+ return a && !a.endsWith(":") && (a += ":"), e.slashes || (!a || d.test(a)) && r !== !1 ? (r = "//" + (r || ""), n && n[0] !== "/" && (n = "/" + n)) : r || (r = ""), f && f[0] !== "#" && (f = "#" + f), i && i[0] !== "?" && (i = "?" + i), n = n.replace(/[?#]/g, encodeURIComponent), i = i.replace("#", "%23"), "" + a + r + n + i + f;
34
+ }
35
+ const u = [
36
+ "auth",
37
+ "hash",
38
+ "host",
39
+ "hostname",
40
+ "href",
41
+ "path",
42
+ "pathname",
43
+ "port",
44
+ "protocol",
45
+ "query",
46
+ "search",
47
+ "slashes"
48
+ ];
49
+ function q(e) {
50
+ return process.env.NODE_ENV === "development" && e !== null && typeof e == "object" && Object.keys(e).forEach((t) => {
51
+ u.includes(t) || console.warn("Unknown key passed via urlObject into url.format: " + t);
52
+ }), p(e);
53
+ }
54
+ }(c), c);
55
+ }
7
56
  export {
8
- n as default
57
+ x as __require
9
58
  };
package/dist/index11.mjs CHANGED
@@ -1,63 +1,101 @@
1
1
  'use client';
2
- import { jsxs as c, jsx as u } from "react/jsx-runtime";
3
- import { Root as v } from "./index36.mjs";
4
- import { cva as g } from "./index37.mjs";
5
- import { Loader2 as l } from "lucide-react";
6
- import { cn as p } from "./index17.mjs";
7
- const b = g(
8
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
14
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
15
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
16
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
17
- link: "text-primary underline-offset-4 hover:underline"
18
- },
19
- size: {
20
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
21
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
22
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
23
- icon: "size-9",
24
- "icon-sm": "size-8",
25
- "icon-lg": "size-10"
2
+ import { jsx as e, jsxs as s, Fragment as j } from "react/jsx-runtime";
3
+ import { useState as a } from "react";
4
+ import { useCart as T } from "./index3.mjs";
5
+ import { Button as y } from "./index13.mjs";
6
+ import { Badge as k } from "./index15.mjs";
7
+ import { Tag as B, CheckCircle as b, X as E, AlertCircle as F } from "lucide-react";
8
+ import { cn as p } from "./index19.mjs";
9
+ function K({
10
+ onSuccess: i,
11
+ className: N,
12
+ placeholder: w = "Enter discount code",
13
+ inputClassName: C,
14
+ buttonClassName: A
15
+ }) {
16
+ var v;
17
+ const [n, g] = a(""), [u, o] = a(""), [l, f] = a(!1), [h, x] = a(!1), [d, c] = a(""), { applyDiscount: D, removeDiscount: I, cart: r } = T(), M = async (t) => {
18
+ if (t.preventDefault(), !!n.trim()) {
19
+ f(!0), c("");
20
+ try {
21
+ await D(n.trim()), o("Discount code applied!"), g(""), setTimeout(() => o(""), 3e3), i == null || i();
22
+ } catch (m) {
23
+ c((m == null ? void 0 : m.message) || "Invalid or expired discount code");
24
+ } finally {
25
+ f(!1);
26
26
  }
27
- },
28
- defaultVariants: {
29
- variant: "default",
30
- size: "default"
31
27
  }
32
- }
33
- );
34
- function z({
35
- className: r,
36
- variant: t,
37
- size: i,
38
- asChild: n = !1,
39
- loading: e = !1,
40
- children: o,
41
- disabled: s,
42
- type: a,
43
- ...d
44
- }) {
45
- return /* @__PURE__ */ c(
46
- n ? v : "button",
47
- {
48
- "data-slot": "button",
49
- className: p(b({ variant: t, size: i, className: r })),
50
- disabled: s || e,
51
- type: a ?? "button",
52
- ...d,
53
- children: [
54
- e && /* @__PURE__ */ u(l, { className: "size-4 animate-spin" }),
55
- o
56
- ]
28
+ }, R = async () => {
29
+ x(!0), c("");
30
+ try {
31
+ await I(), o("Discount code removed"), setTimeout(() => o(""), 3e3), i == null || i();
32
+ } catch (t) {
33
+ c((t == null ? void 0 : t.message) || "Failed to remove discount code");
34
+ } finally {
35
+ x(!1);
57
36
  }
58
- );
37
+ };
38
+ return /* @__PURE__ */ e("div", { className: p("", N), children: /* @__PURE__ */ e("div", { className: "pt-6", children: /* @__PURE__ */ s("div", { className: "space-y-3", children: [
39
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
40
+ /* @__PURE__ */ e(B, { className: "h-4 w-4" }),
41
+ "Discount Code"
42
+ ] }),
43
+ r && r.pricing.discount && /* @__PURE__ */ s("div", { className: "flex items-center justify-between rounded-md bg-green-50 p-3", children: [
44
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
45
+ /* @__PURE__ */ e(b, { className: "h-4 w-4 text-green-600" }),
46
+ /* @__PURE__ */ e("span", { className: "text-sm font-medium text-green-900", children: "Code Applied:" }),
47
+ /* @__PURE__ */ e(k, { className: "bg-green-600 text-white", children: r.pricing.discount.code })
48
+ ] }),
49
+ /* @__PURE__ */ e(
50
+ y,
51
+ {
52
+ variant: "ghost",
53
+ size: "sm",
54
+ onClick: R,
55
+ disabled: h,
56
+ className: "h-8 px-2 text-green-700 hover:text-green-800",
57
+ children: h ? "Removing..." : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(E, { className: "h-4 w-4" }) })
58
+ }
59
+ )
60
+ ] }),
61
+ !((v = r == null ? void 0 : r.pricing) != null && v.discount) && /* @__PURE__ */ s("form", { onSubmit: M, className: "flex gap-2", children: [
62
+ /* @__PURE__ */ e(
63
+ "input",
64
+ {
65
+ type: "text",
66
+ value: n,
67
+ onChange: (t) => g(t.target.value.toUpperCase()),
68
+ placeholder: w,
69
+ disabled: l,
70
+ className: p(
71
+ "flex-1 rounded-md border border-gray-300 px-3 py-2 text-sm",
72
+ "focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
73
+ "disabled:cursor-not-allowed disabled:opacity-50",
74
+ d && "border-red-500 focus:border-red-500 focus:ring-red-500",
75
+ C
76
+ )
77
+ }
78
+ ),
79
+ /* @__PURE__ */ e(
80
+ y,
81
+ {
82
+ type: "submit",
83
+ disabled: !n.trim() || l,
84
+ className: p("bg-accent-500 text-white hover:bg-accent-600", A),
85
+ children: l ? "Applying..." : "Apply"
86
+ }
87
+ )
88
+ ] }),
89
+ d && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm text-red-600", children: [
90
+ /* @__PURE__ */ e(F, { className: "h-4 w-4" }),
91
+ d
92
+ ] }),
93
+ u && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-sm text-green-600", children: [
94
+ /* @__PURE__ */ e(b, { className: "h-4 w-4" }),
95
+ u
96
+ ] })
97
+ ] }) }) });
59
98
  }
60
99
  export {
61
- z as Button,
62
- b as buttonVariants
100
+ K as DiscountCodeInput
63
101
  };
package/dist/index110.mjs CHANGED
@@ -1,33 +1,26 @@
1
1
  'use client';
2
- import r from "./index59.mjs";
3
- import c from "./index87.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
- );
2
+ import { __module as u } from "./index174.mjs";
3
+ import { __require as c } from "./index175.mjs";
4
+ var a;
5
+ function d() {
6
+ return a ? u.exports : (a = 1, function(o, e) {
7
+ Object.defineProperty(e, "__esModule", {
8
+ value: !0
9
+ }), Object.defineProperty(e, "detectDomainLocale", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return i;
13
+ }
14
+ });
15
+ const i = function() {
16
+ for (var n = arguments.length, r = new Array(n), t = 0; t < n; t++)
17
+ r[t] = arguments[t];
18
+ if (process.env.__NEXT_I18N_SUPPORT)
19
+ return c().detectDomainLocale(...r);
20
+ };
21
+ (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), o.exports = e.default);
22
+ }(u, u.exports), u.exports);
23
+ }
31
24
  export {
32
- p as default
25
+ d as __require
33
26
  };
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { __exports as u } from "./index176.mjs";
3
+ var a;
4
+ function f() {
5
+ return a ? u : (a = 1, function(s) {
6
+ Object.defineProperty(s, "__esModule", {
7
+ value: !0
8
+ }), Object.defineProperty(s, "parsePath", {
9
+ enumerable: !0,
10
+ get: function() {
11
+ return i;
12
+ }
13
+ });
14
+ function i(r) {
15
+ const e = r.indexOf("#"), n = r.indexOf("?"), t = n > -1 && (e < 0 || n < e);
16
+ return t || e > -1 ? {
17
+ pathname: r.substring(0, t ? n : e),
18
+ query: t ? r.substring(n, e > -1 ? e : void 0) : "",
19
+ hash: e > -1 ? r.slice(e) : ""
20
+ } : {
21
+ pathname: r,
22
+ query: "",
23
+ hash: ""
24
+ };
25
+ }
26
+ }(u), u);
27
+ }
28
+ export {
29
+ f as __require
30
+ };
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import { __module as a } from "./index177.mjs";
3
+ import { __require as f } from "./index178.mjs";
4
+ import { __require as c } from "./index179.mjs";
5
+ var i;
6
+ function g() {
7
+ return i ? a.exports : (i = 1, function(o, e) {
8
+ Object.defineProperty(e, "__esModule", {
9
+ value: !0
10
+ }), Object.defineProperty(e, "addLocale", {
11
+ enumerable: !0,
12
+ get: function() {
13
+ return l;
14
+ }
15
+ });
16
+ const d = f(), l = function(t) {
17
+ for (var u = arguments.length, n = new Array(u > 1 ? u - 1 : 0), r = 1; r < u; r++)
18
+ n[r - 1] = arguments[r];
19
+ return process.env.__NEXT_I18N_SUPPORT ? (0, d.normalizePathTrailingSlash)(c().addLocale(t, ...n)) : t;
20
+ };
21
+ (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), o.exports = e.default);
22
+ }(a, a.exports), a.exports);
23
+ }
24
+ export {
25
+ g as __require
26
+ };
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { __module as o } from "./index180.mjs";
3
+ import { __require as d } from "./index111.mjs";
4
+ var f;
5
+ function m() {
6
+ return f ? o.exports : (f = 1, function(i, e) {
7
+ Object.defineProperty(e, "__esModule", {
8
+ value: !0
9
+ }), Object.defineProperty(e, "removeLocale", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return c;
13
+ }
14
+ });
15
+ const l = d();
16
+ function c(r, t) {
17
+ if (process.env.__NEXT_I18N_SUPPORT) {
18
+ const { pathname: u } = (0, l.parsePath)(r), n = u.toLowerCase(), a = t == null ? void 0 : t.toLowerCase();
19
+ return t && (n.startsWith("/" + a + "/") || n === "/" + a) ? (u.length === t.length + 1 ? "/" : "") + r.slice(t.length + 1) : r;
20
+ }
21
+ return r;
22
+ }
23
+ (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), i.exports = e.default);
24
+ }(o, o.exports), o.exports);
25
+ }
26
+ export {
27
+ m as __require
28
+ };
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { __module as r } from "./index181.mjs";
3
+ import { __require as o } from "./index116.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);
21
+ }
22
+ export {
23
+ l as __require
24
+ };
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { __module as a } from "./index182.mjs";
3
+ import { __require as _ } from "./index183.mjs";
4
+ import { __require as l } from "./index178.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
+ }
23
+ export {
24
+ h as __require
25
+ };
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { __module as t } from "./index184.mjs";
3
+ import { __require as s } from "./index185.mjs";
4
+ var a;
5
+ function _() {
6
+ return a ? t.exports : (a = 1, function(u, e) {
7
+ Object.defineProperty(e, "__esModule", {
8
+ value: !0
9
+ }), Object.defineProperty(e, "hasBasePath", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return n;
13
+ }
14
+ });
15
+ const r = s(), f = process.env.__NEXT_ROUTER_BASEPATH || "";
16
+ function n(i) {
17
+ return (0, r.pathHasPrefix)(i, f);
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), u.exports = e.default);
20
+ }(t, t.exports), t.exports);
21
+ }
22
+ export {
23
+ _ as __require
24
+ };