@instockng/storefront-ui 1.0.56 → 1.0.57

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 (272) hide show
  1. package/dist/components/ProductAddOns.d.ts +1 -2
  2. package/dist/components/ProductAddOns.d.ts.map +1 -1
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.mjs +104 -100
  6. package/dist/index10.mjs +147 -91
  7. package/dist/index100.mjs +53 -2
  8. package/dist/index101.mjs +69 -28
  9. package/dist/index102.mjs +2 -18
  10. package/dist/index103.mjs +26 -213
  11. package/dist/index104.mjs +13 -175
  12. package/dist/index105.mjs +210 -17
  13. package/dist/index106.mjs +174 -17
  14. package/dist/index107.mjs +14 -25
  15. package/dist/index108.mjs +17 -150
  16. package/dist/index109.mjs +26 -13
  17. package/dist/index11.mjs +95 -171
  18. package/dist/index110.mjs +149 -24
  19. package/dist/index111.mjs +13 -77
  20. package/dist/index112.mjs +20 -27
  21. package/dist/index113.mjs +76 -137
  22. package/dist/index114.mjs +33 -50
  23. package/dist/index115.mjs +141 -19
  24. package/dist/index116.mjs +50 -22
  25. package/dist/index117.mjs +14 -14
  26. package/dist/index118.mjs +20 -18
  27. package/dist/index119.mjs +16 -14
  28. package/dist/index12.mjs +90 -90
  29. package/dist/index120.mjs +17 -14
  30. package/dist/index121.mjs +12 -12
  31. package/dist/index122.mjs +15 -58
  32. package/dist/index123.mjs +14 -11
  33. package/dist/index124.mjs +56 -30
  34. package/dist/index125.mjs +9 -15
  35. package/dist/index126.mjs +31 -26
  36. package/dist/index127.mjs +13 -16
  37. package/dist/index128.mjs +26 -11
  38. package/dist/index129.mjs +17 -11
  39. package/dist/index13.mjs +162 -717
  40. package/dist/index130.mjs +12 -40
  41. package/dist/index131.mjs +14 -16
  42. package/dist/index132.mjs +42 -263
  43. package/dist/index133.mjs +15 -62
  44. package/dist/index134.mjs +267 -7
  45. package/dist/index135.mjs +70 -2
  46. package/dist/index136.mjs +8 -2
  47. package/dist/index137.mjs +2 -33
  48. package/dist/index138.mjs +2 -2
  49. package/dist/index139.mjs +32 -20
  50. package/dist/index14.mjs +94 -56
  51. package/dist/index140.mjs +2 -56
  52. package/dist/index141.mjs +18 -26
  53. package/dist/index142.mjs +55 -6
  54. package/dist/index143.mjs +28 -51
  55. package/dist/index144.mjs +7 -6
  56. package/dist/index145.mjs +51 -11
  57. package/dist/index146.mjs +5 -6
  58. package/dist/index147.mjs +12 -28
  59. package/dist/index148.mjs +7 -2
  60. package/dist/index149.mjs +27 -69
  61. package/dist/index15.mjs +734 -62
  62. package/dist/index150.mjs +2 -167
  63. package/dist/index151.mjs +70 -2
  64. package/dist/index152.mjs +167 -2
  65. package/dist/index153.mjs +2 -2
  66. package/dist/index154.mjs +2 -18
  67. package/dist/index155.mjs +2 -32
  68. package/dist/index156.mjs +14 -34
  69. package/dist/index157.mjs +25 -11
  70. package/dist/index158.mjs +34 -14
  71. package/dist/index159.mjs +18 -2
  72. package/dist/index16.mjs +50 -14
  73. package/dist/index160.mjs +11 -13
  74. package/dist/index161.mjs +2 -46
  75. package/dist/index162.mjs +20 -2
  76. package/dist/index163.mjs +41 -25
  77. package/dist/index164.mjs +2 -18
  78. package/dist/index165.mjs +30 -2
  79. package/dist/index166.mjs +18 -2
  80. package/dist/index167.mjs +2 -2
  81. package/dist/index168.mjs +2 -2
  82. package/dist/index169.mjs +2 -72
  83. package/dist/index17.mjs +62 -109
  84. package/dist/index170.mjs +2 -2
  85. package/dist/index171.mjs +59 -40
  86. package/dist/index173.mjs +48 -31
  87. package/dist/index174.mjs +2 -152
  88. package/dist/index175.mjs +36 -2
  89. package/dist/index176.mjs +152 -2
  90. package/dist/index177.mjs +2 -19
  91. package/dist/index178.mjs +2 -2
  92. package/dist/index179.mjs +19 -2
  93. package/dist/index18.mjs +23 -41
  94. package/dist/index180.mjs +2 -26
  95. package/dist/index181.mjs +2 -2
  96. package/dist/index182.mjs +26 -2
  97. package/dist/index183.mjs +2 -24
  98. package/dist/index184.mjs +2 -23
  99. package/dist/index185.mjs +24 -2
  100. package/dist/index186.mjs +23 -2
  101. package/dist/index187.mjs +2 -2
  102. package/dist/index188.mjs +2 -23
  103. package/dist/index19.mjs +109 -42
  104. package/dist/index190.mjs +16 -16
  105. package/dist/index191.mjs +2 -2
  106. package/dist/index192.mjs +23 -2
  107. package/dist/index193.mjs +2 -2
  108. package/dist/index194.mjs +2 -23
  109. package/dist/index195.mjs +2 -2
  110. package/dist/index196.mjs +15 -15
  111. package/dist/index198.mjs +23 -2
  112. package/dist/index199.mjs +2 -2
  113. package/dist/index2.mjs +2 -2
  114. package/dist/index20.mjs +42 -67
  115. package/dist/index200.mjs +2 -2
  116. package/dist/index201.mjs +2 -2
  117. package/dist/index203.mjs +2 -2
  118. package/dist/index205.mjs +2 -127
  119. package/dist/index206.mjs +2 -2
  120. package/dist/index207.mjs +123 -70
  121. package/dist/index208.mjs +2 -74
  122. package/dist/index209.mjs +74 -2
  123. package/dist/index21.mjs +41 -31
  124. package/dist/index210.mjs +73 -30
  125. package/dist/index211.mjs +2 -11
  126. package/dist/index212.mjs +2 -4
  127. package/dist/index213.mjs +2 -4
  128. package/dist/index214.mjs +2 -13
  129. package/dist/index215.mjs +2 -7
  130. package/dist/index216.mjs +2 -12
  131. package/dist/index217.mjs +2 -5
  132. package/dist/index218.mjs +2 -33
  133. package/dist/index219.mjs +2 -31
  134. package/dist/index22.mjs +64 -6
  135. package/dist/index220.mjs +107 -27
  136. package/dist/index221.mjs +2 -61
  137. package/dist/index222.mjs +2 -2
  138. package/dist/index223.mjs +25 -96
  139. package/dist/index224.mjs +2 -2
  140. package/dist/index225.mjs +2 -2
  141. package/dist/index226.mjs +244 -2
  142. package/dist/index227.mjs +2 -2
  143. package/dist/index228.mjs +33 -2
  144. package/dist/index229.mjs +65 -2
  145. package/dist/index23.mjs +27 -17
  146. package/dist/index230.mjs +25 -2
  147. package/dist/index233.mjs +2 -37
  148. package/dist/index235.mjs +2 -244
  149. package/dist/index236.mjs +2 -2
  150. package/dist/index237.mjs +2 -33
  151. package/dist/index238.mjs +2 -65
  152. package/dist/index239.mjs +2 -25
  153. package/dist/index24.mjs +6 -32
  154. package/dist/index240.mjs +4 -2
  155. package/dist/index241.mjs +2 -2
  156. package/dist/index242.mjs +2 -2
  157. package/dist/index243.mjs +31 -2
  158. package/dist/index244.mjs +11 -2
  159. package/dist/index245.mjs +4 -2
  160. package/dist/index246.mjs +4 -2
  161. package/dist/index247.mjs +13 -2
  162. package/dist/index248.mjs +7 -2
  163. package/dist/index249.mjs +12 -2
  164. package/dist/index25.mjs +19 -27
  165. package/dist/index250.mjs +4 -3
  166. package/dist/index251.mjs +33 -2
  167. package/dist/index252.mjs +31 -2
  168. package/dist/index253.mjs +28 -3
  169. package/dist/index254.mjs +61 -2
  170. package/dist/index255.mjs +2 -2
  171. package/dist/index256.mjs +2 -17
  172. package/dist/index257.mjs +17 -12
  173. package/dist/index258.mjs +47 -6
  174. package/dist/index259.mjs +2 -30
  175. package/dist/index26.mjs +34 -103
  176. package/dist/index260.mjs +2 -2
  177. package/dist/index262.mjs +2 -2
  178. package/dist/index263.mjs +91 -2
  179. package/dist/index264.mjs +2 -2
  180. package/dist/index265.mjs +3 -91
  181. package/dist/index266.mjs +2 -2
  182. package/dist/index267.mjs +2 -18
  183. package/dist/index268.mjs +16 -46
  184. package/dist/index269.mjs +13 -2
  185. package/dist/index27.mjs +20 -21
  186. package/dist/index270.mjs +6 -2
  187. package/dist/index271.mjs +30 -2
  188. package/dist/index272.mjs +2 -2
  189. package/dist/index273.mjs +5 -0
  190. package/dist/index274.mjs +5 -0
  191. package/dist/index28.mjs +101 -8
  192. package/dist/index29.mjs +27 -7
  193. package/dist/index3.mjs +5 -5
  194. package/dist/index30.mjs +11 -105
  195. package/dist/index31.mjs +11 -23
  196. package/dist/index32.mjs +105 -68
  197. package/dist/index33.mjs +23 -105
  198. package/dist/index34.mjs +68 -28
  199. package/dist/index35.mjs +99 -21
  200. package/dist/index36.mjs +26 -9
  201. package/dist/index37.mjs +25 -9
  202. package/dist/index38.mjs +10 -122
  203. package/dist/index39.mjs +9 -387
  204. package/dist/index4.mjs +1 -1
  205. package/dist/index40.mjs +116 -18
  206. package/dist/index41.mjs +385 -99
  207. package/dist/index42.mjs +24 -6
  208. package/dist/index43.mjs +30 -1431
  209. package/dist/index44.mjs +6 -69
  210. package/dist/index45.mjs +1433 -2
  211. package/dist/index46.mjs +68 -58
  212. package/dist/index47.mjs +2 -51
  213. package/dist/index48.mjs +60 -33
  214. package/dist/index49.mjs +49 -13
  215. package/dist/index5.mjs +1 -1
  216. package/dist/index50.mjs +32 -2262
  217. package/dist/index51.mjs +15 -36
  218. package/dist/index52.mjs +2261 -42
  219. package/dist/index53.mjs +36 -99
  220. package/dist/index54.mjs +43 -112
  221. package/dist/index55.mjs +99 -81
  222. package/dist/index56.mjs +82 -76
  223. package/dist/index57.mjs +54 -68
  224. package/dist/index58.mjs +82 -56
  225. package/dist/index59.mjs +74 -58
  226. package/dist/index6.mjs +1 -1
  227. package/dist/index60.mjs +77 -15
  228. package/dist/index61.mjs +74 -15
  229. package/dist/index62.mjs +15 -59
  230. package/dist/index63.mjs +14 -119
  231. package/dist/index64.mjs +46 -112
  232. package/dist/index65.mjs +124 -23
  233. package/dist/index66.mjs +129 -2
  234. package/dist/index67.mjs +23 -4
  235. package/dist/index68.mjs +149 -19
  236. package/dist/index69.mjs +2 -153
  237. package/dist/index7.mjs +6 -6
  238. package/dist/index70.mjs +21 -73
  239. package/dist/index71.mjs +74 -14
  240. package/dist/index72.mjs +14 -62
  241. package/dist/index73.mjs +63 -2
  242. package/dist/index74.mjs +4 -5
  243. package/dist/index75.mjs +2 -1134
  244. package/dist/index76.mjs +5 -19
  245. package/dist/index77.mjs +1119 -40
  246. package/dist/index78.mjs +14 -27
  247. package/dist/index79.mjs +55 -2
  248. package/dist/index8.mjs +4 -4
  249. package/dist/index80.mjs +29 -231
  250. package/dist/index81.mjs +2 -6
  251. package/dist/index82.mjs +30 -130
  252. package/dist/index83.mjs +39 -64
  253. package/dist/index84.mjs +2 -87
  254. package/dist/index85.mjs +229 -23
  255. package/dist/index86.mjs +5 -8
  256. package/dist/index87.mjs +125 -66
  257. package/dist/index88.mjs +67 -3
  258. package/dist/index89.mjs +87 -2
  259. package/dist/index9.mjs +3 -3
  260. package/dist/index90.mjs +24 -78
  261. package/dist/index91.mjs +7 -52
  262. package/dist/index92.mjs +74 -5
  263. package/dist/index93.mjs +3 -4
  264. package/dist/index94.mjs +2 -179
  265. package/dist/index95.mjs +79 -49
  266. package/dist/index96.mjs +53 -68
  267. package/dist/index97.mjs +6 -34
  268. package/dist/index98.mjs +4 -42
  269. package/dist/index99.mjs +179 -2
  270. package/package.json +7 -8
  271. package/src/components/ProductAddOns.tsx +1 -1
  272. package/src/index.ts +6 -0
package/dist/index13.mjs CHANGED
@@ -1,737 +1,182 @@
1
1
  'use client';
2
- import { jsxs as a, jsx as e, Fragment as Ie } from "react/jsx-runtime";
3
- import { useState as w, useEffect as _, useMemo as K, useCallback as qe } from "react";
4
- import { object as V, string as N, ValidationError as je } from "./index43.mjs";
5
- import "./index21.mjs";
6
- import "@tanstack/react-query";
7
- import { useGetDeliveryZones as Ze } from "./index36.mjs";
8
- import { useCart as _e } from "./index3.mjs";
9
- import { Modal as he } from "./index17.mjs";
10
- import { FormInput as I } from "./index18.mjs";
11
- import { FormSelect as ye } from "./index19.mjs";
12
- import { Button as B } from "./index14.mjs";
13
- import { Loader2 as U, ChevronLeft as Se, ChevronRight as Le, Package as pe, Banknote as fe, Mail as ze, Phone as Ae, ChevronDown as Fe, Zap as Te } from "lucide-react";
14
- import { PostPurchaseUpsell as Be } from "./index44.mjs";
15
- import { formatCurrency as q, cn as k, getFbCookies as G, getTikTokCookies as O } from "./index20.mjs";
16
- import We from "./index45.mjs";
17
- import { usePaystackPayment as Re } from "./index46.mjs";
18
- const $e = "2348125648668", He = `https://wa.me/${$e}`, Ke = (i) => i.replace(/\D/g, ""), Ue = V({
19
- firstName: N().required("First name is required").min(2, "First name must be at least 2 characters").max(50, "First name must be less than 50 characters"),
20
- lastName: N().required("Last name is required").min(2, "Last name must be at least 2 characters").max(50, "Last name must be less than 50 characters"),
21
- email: N().required("Email is required").email("Please enter a valid email address"),
22
- phone: N().required("Phone number is required").test("nigerian-phone", "Please enter a valid Nigerian phone number (e.g. 0812 564 8668)", (i) => {
23
- if (!i) return !1;
24
- const j = Ke(i);
25
- return [
26
- /^0[789]\d{9}$/
27
- // 0xxxxxxxxx (11 digits total)
28
- ].some((g) => g.test(j));
29
- })
30
- }), Ge = V({
31
- address: N().required("Street address is required").min(10, "Please provide a complete address"),
32
- city: N().required("City is required").min(3, "City name must be at least 3 characters"),
33
- state: N().required("State is required").test("not-empty", "State is required", (i) => !!i && i.trim() !== ""),
34
- deliveryZoneId: N().required("Delivery zone is required").test("not-empty", "Delivery zone is required", (i) => !!i && i.trim() !== "")
35
- }), Oe = V({
36
- paymentMethod: N().oneOf(["cod", "online"], "Please select a payment method").required("Payment method is required")
37
- });
38
- function ct({
39
- isOpen: i,
40
- onClose: j,
41
- initialData: l,
42
- onSuccess: g,
43
- onError: o,
44
- submitButtonText: ve = "Place Order",
45
- refundPolicy: S
2
+ import { jsxs as a, Fragment as b, jsx as e } from "react/jsx-runtime";
3
+ import { useState as H, useEffect as P } from "react";
4
+ import { useCart as T } from "./index3.mjs";
5
+ import { CartItem as X } from "./index12.mjs";
6
+ import { DiscountCodeInput as Z } from "./index14.mjs";
7
+ import { Checkout as A } from "./index15.mjs";
8
+ import { RecommendedProducts as G } from "./index11.mjs";
9
+ import { Button as v } from "./index16.mjs";
10
+ import { X as J, Loader2 as K, Package as h } from "lucide-react";
11
+ import { cn as n, formatCurrency as c } from "./index22.mjs";
12
+ import { useHideBodyOverflow as M } from "./index44.mjs";
13
+ function ie({
14
+ isOpen: r,
15
+ onClose: s,
16
+ onCheckout: d,
17
+ onContinueShopping: o,
18
+ onPurchaseSuccess: m,
19
+ className: w,
20
+ showDiscountCode: k = !0,
21
+ showContinueShopping: j = !0,
22
+ checkoutButtonText: C = "Complete Purchase",
23
+ continueShoppingText: E = "Continue Shopping",
24
+ checkoutButtonClassName: I,
25
+ continueShoppingButtonClassName: L,
26
+ disableCheckout: z = !1,
27
+ emptyMessage: R = "Your cart is empty"
46
28
  }) {
47
- var re, se, ne, le, ie, de, oe, ce, me, ue;
48
- const [c, b] = w("customer"), [L, Ne] = w(void 0), [f, Y] = w(void 0), [y, W] = w(null), { refetch: J, isLoading: Q, cart: s, updateCartMutation: R, checkoutMutation: ge, clearAndCreateNewCart: X } = _e(), E = (re = s == null ? void 0 : s.brand) == null ? void 0 : re.paystackPublicKey, D = Re({
49
- isOpen: i,
50
- publicKey: E || "",
51
- onSuccess: async (r) => {
52
- try {
53
- const { fbc: n, fbp: d } = G(), { ttp: h, ttclid: Z } = O(), v = await M.mutateAsync({
54
- firstName: t.firstName,
55
- lastName: t.lastName,
56
- email: t.email,
57
- phone: t.phone,
58
- address: t.address,
59
- city: t.city,
60
- deliveryZoneId: f || t.deliveryZoneId,
61
- paymentMethod: t.paymentMethod,
62
- paystackReference: r.reference,
63
- fbc: n,
64
- fbp: d,
65
- ttp: h,
66
- ttclid: Z
67
- });
68
- if ("error" in v) {
69
- const P = v.error;
70
- o == null || o(new Error((P == null ? void 0 : P.message) || "Checkout failed"));
71
- return;
72
- }
73
- W(v), X(), g == null || g(v);
74
- } catch (n) {
75
- o == null || o(n);
76
- }
77
- },
78
- onClose: () => {
79
- console.log("Payment popup closed by user");
80
- }
81
- });
82
- _(() => {
83
- i && J();
84
- }, [i, J]);
85
- const { data: C } = Ze(((se = s == null ? void 0 : s.brand) == null ? void 0 : se.id) || "", {
86
- enabled: !!((ne = s == null ? void 0 : s.brand) != null && ne.id)
87
- }), m = K(() => C == null ? void 0 : C.find((r) => r.id === L), [C, L]), p = K(() => m == null ? void 0 : m.zones.find((r) => r.id === f), [m, f]), M = ge;
88
- _(() => {
89
- i || (W(null), b("customer"), M.reset());
90
- }, [i]);
91
- const [t, $] = w({
92
- firstName: (l == null ? void 0 : l.firstName) || "",
93
- lastName: (l == null ? void 0 : l.lastName) || "",
94
- email: (l == null ? void 0 : l.email) || "",
95
- phone: (l == null ? void 0 : l.phone) || "",
96
- address: (l == null ? void 0 : l.address) || "",
97
- city: (l == null ? void 0 : l.city) || "",
98
- deliveryZoneId: (l == null ? void 0 : l.deliveryZoneId) || "",
99
- paymentMethod: (l == null ? void 0 : l.paymentMethod) || "online",
100
- notes: (l == null ? void 0 : l.notes) || ""
101
- });
102
- _(() => {
103
- i && b("customer");
104
- }, [i]);
105
- const [ee, te] = w(!1);
106
- _(() => {
107
- i && s && !l && !ee && ($((r) => {
108
- var n;
109
- return {
110
- ...r,
111
- firstName: s.customerFirstName || r.firstName,
112
- lastName: s.customerLastName || r.lastName,
113
- email: s.customerEmail || r.email,
114
- phone: s.customerPhone || r.phone,
115
- deliveryZoneId: ((n = s.deliveryZone) == null ? void 0 : n.id) || r.deliveryZoneId
116
- };
117
- }), te(!0)), i || te(!1);
118
- }, [i, s, l, ee]), _(() => {
119
- if (f) {
120
- const r = m == null ? void 0 : m.zones.find((n) => n.id === f);
121
- r && $((n) => ({
122
- ...n,
123
- paymentMethod: r.allowOnline ? "online" : "cod"
124
- }));
125
- }
126
- }, [f, m]);
127
- const [u, z] = w({}), [H, be] = w(!1), x = (r) => {
128
- const { name: n, value: d } = r.target;
129
- $((h) => ({ ...h, [n]: d })), u[n] && z((h) => ({ ...h, [n]: void 0 }));
130
- }, A = qe(
131
- (r) => {
132
- const n = t[r];
133
- if (!n) return;
134
- const d = {};
135
- r === "firstName" ? d.customerFirstName = n : r === "lastName" ? d.customerLastName = n : r === "email" ? d.customerEmail = n : r === "phone" && (d.customerPhone = n), R.mutate(d);
136
- },
137
- [t, R]
138
- ), F = (r) => {
139
- const n = {};
140
- try {
141
- if (r === "customer")
142
- Ue.validateSync(t, { abortEarly: !1 });
143
- else if (r === "delivery") {
144
- const d = {
145
- address: t.address,
146
- city: t.city,
147
- state: L || t.state || "",
148
- deliveryZoneId: f || t.deliveryZoneId || ""
149
- };
150
- Ge.validateSync(d, { abortEarly: !1 });
151
- } else r === "payment" && Oe.validateSync(t, { abortEarly: !1 });
152
- } catch (d) {
153
- d instanceof je && d.inner.forEach((h) => {
154
- h.path && (n[h.path] = h.message);
155
- });
156
- }
157
- return z(n), Object.keys(n).length === 0;
158
- }, xe = () => {
159
- F(c) && (c === "customer" ? b("delivery") : c === "delivery" && b("payment"));
160
- }, we = () => {
161
- c === "payment" ? b("delivery") : c === "delivery" && b("customer");
162
- }, Ce = async () => {
163
- var r;
164
- if (!F("customer")) {
165
- b("customer");
166
- return;
167
- }
168
- if (!F("delivery")) {
169
- b("delivery");
170
- return;
171
- }
172
- if (F("payment")) {
173
- if (t.paymentMethod === "online") {
174
- if (!E) {
175
- o == null || o(new Error("Paystack is not configured. Please contact support."));
176
- return;
177
- }
178
- if (!D.isLoaded) {
179
- o == null || o(new Error("Payment system is loading. Please try again."));
180
- return;
181
- }
182
- const n = Math.round(s.pricing.total * 100), { fbc: d, fbp: h } = G(), { ttp: Z, ttclid: v } = O();
183
- D.initializePayment({
184
- email: t.email || (s == null ? void 0 : s.customerEmail) || "customer@example.com",
185
- amount: n,
186
- currency: "NGN",
187
- metadata: {
188
- cartId: s == null ? void 0 : s.id,
189
- brandSlug: (r = s == null ? void 0 : s.brand) == null ? void 0 : r.slug,
190
- address: t.address,
191
- city: t.city,
192
- delivery_zone_id: f || t.deliveryZoneId,
193
- firstName: t.firstName,
194
- lastName: t.lastName,
195
- email: t.email,
196
- phone: t.phone,
197
- fbc: d,
198
- fbp: h,
199
- ttp: Z,
200
- ttclid: v,
201
- custom_fields: [
202
- {
203
- display_name: "Customer Name",
204
- variable_name: "customer_name",
205
- value: `${t.firstName} ${t.lastName}`
206
- },
207
- {
208
- display_name: "Phone Number",
209
- variable_name: "phone_number",
210
- value: t.phone
211
- },
212
- {
213
- display_name: "Address",
214
- variable_name: "address",
215
- value: t.address
216
- },
217
- {
218
- display_name: "City",
219
- variable_name: "city",
220
- value: t.city
221
- },
222
- {
223
- display_name: "Delivery Zone ID",
224
- variable_name: "delivery_zone_id",
225
- value: f || t.deliveryZoneId
226
- }
227
- ]
228
- }
229
- });
230
- return;
231
- }
232
- try {
233
- const { fbc: n, fbp: d } = G(), { ttp: h, ttclid: Z } = O(), v = await M.mutateAsync({
234
- firstName: t.firstName,
235
- lastName: t.lastName,
236
- email: t.email,
237
- phone: t.phone,
238
- address: t.address,
239
- city: t.city,
240
- deliveryZoneId: f || t.deliveryZoneId,
241
- paymentMethod: t.paymentMethod,
242
- fbc: n,
243
- fbp: d,
244
- ttp: h,
245
- ttclid: Z
246
- });
247
- if ("error" in v) {
248
- const P = v.error;
249
- o == null || o(new Error((P == null ? void 0 : P.message) || "Checkout failed"));
250
- return;
251
- }
252
- W(v), X(), g == null || g(v);
253
- } catch (n) {
254
- o == null || o(n);
29
+ var x, g, y;
30
+ const { cart: t, isLoading: l, error: f, trackCheckoutInitiated: B } = T(), [D, p] = H(!1);
31
+ M(r), P(() => {
32
+ const i = (N) => {
33
+ N.key === "Escape" && r && s();
34
+ };
35
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
36
+ }, [r, s]);
37
+ const F = ((x = t == null ? void 0 : t.pricing) == null ? void 0 : x.subtotal) || 0, u = ((g = t == null ? void 0 : t.pricing.discount) == null ? void 0 : g.amount) || 0, Y = () => {
38
+ B(), p(!0), d == null || d();
39
+ }, q = () => {
40
+ o == null || o(), s();
41
+ };
42
+ return /* @__PURE__ */ a(b, { children: [
43
+ /* @__PURE__ */ e(
44
+ "div",
45
+ {
46
+ className: n(
47
+ "fixed inset-0 z-40 bg-black/50 transition-opacity duration-300",
48
+ r ? "opacity-100" : "pointer-events-none opacity-0"
49
+ ),
50
+ onClick: s,
51
+ "aria-hidden": "true"
255
52
  }
256
- }
257
- }, Pe = {
258
- customer: "Customer Information",
259
- delivery: "Delivery Address",
260
- payment: "Payment Method"
261
- }, ke = K(() => Pe[c], [c]), Me = /* @__PURE__ */ a("div", { className: "space-y-3", children: [
262
- (c === "payment" || c === "delivery") && ((le = s == null ? void 0 : s.pricing) == null ? void 0 : le.total) && /* @__PURE__ */ a("div", { className: "text-sm text-black relative", children: [
263
- Q && /* @__PURE__ */ e("div", { className: "absolute flex items-center justify-center inset-0 bg-white opacity-50", children: /* @__PURE__ */ e(U, { className: "animate-spin text-accent-500" }) }),
264
- /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
265
- /* @__PURE__ */ e("span", { children: "Subtotal" }),
266
- /* @__PURE__ */ e("span", { children: q(((ie = s == null ? void 0 : s.pricing) == null ? void 0 : ie.subtotal) ?? 0) })
267
- ] }),
268
- s.pricing.discount && /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
269
- /* @__PURE__ */ e("span", { children: "Discount" }),
270
- /* @__PURE__ */ a("span", { className: "text-green-600", children: [
271
- "-",
272
- q(((oe = (de = s == null ? void 0 : s.pricing) == null ? void 0 : de.discount) == null ? void 0 : oe.amount) ?? 0)
273
- ] })
274
- ] }),
275
- /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
276
- /* @__PURE__ */ e("span", { children: "Delivery Fee" }),
277
- /* @__PURE__ */ e("span", { children: q(((ce = s == null ? void 0 : s.pricing) == null ? void 0 : ce.deliveryCharge) ?? 0) })
278
- ] }),
279
- /* @__PURE__ */ e("hr", { className: "border-gray-200 my-2" }),
280
- /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
281
- /* @__PURE__ */ e("span", { children: "Total" }),
282
- /* @__PURE__ */ e("span", { children: q(((me = s == null ? void 0 : s.pricing) == null ? void 0 : me.total) ?? 0) })
283
- ] })
284
- ] }),
285
- /* @__PURE__ */ a("div", { className: "flex gap-3", children: [
286
- c !== "customer" && /* @__PURE__ */ a(
287
- B,
288
- {
289
- type: "button",
290
- variant: "outline",
291
- onClick: we,
292
- className: "flex-1 border-gray-400",
293
- size: "lg",
294
- children: [
295
- /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4" }),
296
- "Back"
297
- ]
298
- }
299
- ),
300
- c !== "payment" ? /* @__PURE__ */ a(
301
- B,
302
- {
303
- type: "button",
304
- onClick: xe,
305
- className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
306
- size: "lg",
307
- children: [
308
- "Next",
309
- /* @__PURE__ */ e(Le, { className: "ml-2 h-4 w-4" })
310
- ]
311
- }
312
- ) : /* @__PURE__ */ e(
313
- B,
314
- {
315
- type: "button",
316
- onClick: Ce,
317
- disabled: M.isPending,
318
- className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
319
- size: "lg",
320
- children: M.isPending ? /* @__PURE__ */ a(Ie, { children: [
321
- /* @__PURE__ */ e(U, { className: "mr-2 h-4 w-4 animate-spin" }),
322
- "Processing..."
323
- ] }) : ve
324
- }
325
- )
326
- ] }),
327
- M.isError && /* @__PURE__ */ e("div", { className: "rounded-lg bg-red-50 p-3 text-sm text-red-600", children: "Failed to place order. Please check your information and try again." })
328
- ] }), T = (r) => !(s != null && s.availablePaymentMethods.includes(r));
329
- if (y)
330
- return /* @__PURE__ */ e(
331
- he,
53
+ ),
54
+ /* @__PURE__ */ e(
55
+ "div",
332
56
  {
333
- isOpen: i,
334
- onClose: j,
335
- title: /* @__PURE__ */ a("span", { className: "flex items-center gap-3", children: [
336
- /* @__PURE__ */ e("span", { className: "w-10 h-10 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ e("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) }),
337
- /* @__PURE__ */ a("span", { children: [
338
- "Thank You!",
339
- /* @__PURE__ */ e("br", {}),
340
- "We'll contact you shortly"
341
- ] })
342
- ] }),
343
- footer: /* @__PURE__ */ e(
344
- B,
345
- {
346
- onClick: j,
347
- className: "w-full bg-accent-500 text-white hover:bg-accent-600",
348
- size: "lg",
349
- children: "Close"
350
- }
57
+ className: n(
58
+ "fixed right-0 top-0 z-50 h-full w-full bg-white shadow-2xl transition-transform duration-300 ease-in-out sm:w-[480px]",
59
+ r ? "translate-x-0" : "translate-x-full",
60
+ w
351
61
  ),
352
- size: "lg",
353
- contentClassName: "p-4",
354
- children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
355
- /* @__PURE__ */ a("div", { className: "bg-gray-50 rounded-lg p-4 space-y-2", children: [
356
- /* @__PURE__ */ a("div", { className: "flex items-center justify-center space-x-2 text-gray-700", children: [
357
- /* @__PURE__ */ e(pe, { className: "h-4 w-4" }),
358
- /* @__PURE__ */ a("span", { className: "text-sm font-medium", children: [
359
- "Order #",
360
- y.orderNumber
361
- ] })
62
+ children: /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
63
+ /* @__PURE__ */ e("div", { className: "border-b border-gray-300 px-4 py-2", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
64
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
65
+ /* @__PURE__ */ e("div", { className: "bg-accent-500 text-white px-2 py-1 rounded-full text-sm aspect-square flex items-center justify-center w-8 h-8", children: (y = t == null ? void 0 : t.items) == null ? void 0 : y.length }),
66
+ /* @__PURE__ */ e("h2", { className: "text-lg font-medium", children: "Your Cart" })
362
67
  ] }),
363
- /* @__PURE__ */ a("div", { className: "border-t border-gray-200 pt-2 space-y-1.5", children: [
364
- /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
365
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Customer" }),
366
- /* @__PURE__ */ a("span", { className: "font-medium text-gray-900", children: [
367
- y.firstName,
368
- " ",
369
- y.lastName
370
- ] })
371
- ] }),
372
- /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
373
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Phone" }),
374
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: y.phone })
375
- ] }),
376
- y.email && /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
377
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Email" }),
378
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: y.email })
379
- ] }),
380
- /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
381
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Payment" }),
382
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: y.paymentMethod === "cod" ? "Cash on Delivery" : "Online" })
383
- ] }),
384
- /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
385
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Total" }),
386
- /* @__PURE__ */ e("span", { className: "font-bold text-gray-900", children: q(y.totalPrice) })
387
- ] })
388
- ] })
389
- ] }),
390
- /* @__PURE__ */ e(
391
- Be,
392
- {
393
- orderId: y.id,
394
- token: y.userActionToken,
395
- limit: 4,
396
- brandSiteUrl: (ue = y.brand) == null ? void 0 : ue.siteUrl
397
- }
398
- )
399
- ] })
400
- }
401
- );
402
- const ae = p && (c === "delivery" || c === "payment") && (p.waybillOnly || !(p != null && p.allowCOD));
403
- return /* @__PURE__ */ e(
404
- he,
405
- {
406
- isOpen: i,
407
- onClose: j,
408
- title: ke,
409
- footer: Me,
410
- size: "lg",
411
- contentClassName: "p-0",
412
- children: Q ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[300px]", children: /* @__PURE__ */ e(U, { className: "h-8 w-8 animate-spin text-gray-600" }) }) : /* @__PURE__ */ e("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ a("div", { className: "relative w-full", children: [
413
- ae && /* @__PURE__ */ a("div", { className: "space-y-3 p-4 pb-0", children: [
414
- p.noteTitle && p.noteContent && /* @__PURE__ */ e("div", { className: "bg-amber-50 border border-amber-200 rounded-lg p-4", children: /* @__PURE__ */ a("div", { className: "flex items-start gap-3", children: [
415
- /* @__PURE__ */ e(pe, { className: "h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" }),
416
- /* @__PURE__ */ a("div", { className: "space-y-1", children: [
417
- /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-amber-900 whitespace-pre-wrap", children: p.noteTitle }),
418
- /* @__PURE__ */ e("p", { className: "text-sm text-amber-800 whitespace-pre-wrap", children: p.noteContent })
419
- ] })
68
+ /* @__PURE__ */ e(
69
+ "button",
70
+ {
71
+ onClick: s,
72
+ className: "rounded-full p-2 transition-colors hover:bg-gray-100",
73
+ "aria-label": "Close cart",
74
+ children: /* @__PURE__ */ e(J, { className: "h-6 w-6" })
75
+ }
76
+ )
420
77
  ] }) }),
421
- !(p != null && p.allowCOD) && /* @__PURE__ */ e("div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4", children: /* @__PURE__ */ a("div", { className: "flex items-start gap-3", children: [
422
- /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
423
- /* @__PURE__ */ a("div", { className: "space-y-1", children: [
424
- /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-blue-900", children: "Cash on Delivery Unavailable" }),
425
- /* @__PURE__ */ e("p", { className: "text-sm text-blue-800", children: "We're unable to offer cash on delivery to this location. Please use online payment to complete your order." })
426
- ] })
427
- ] }) })
428
- ] }),
429
- /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ a(
430
- "a",
431
- {
432
- href: He,
433
- target: "_blank",
434
- rel: "noopener noreferrer",
435
- className: "flex items-center justify-center gap-2 p-3 bg-green-500 hover:bg-green-600 rounded-lg transition-colors",
436
- children: [
437
- /* @__PURE__ */ e(
438
- "img",
439
- {
440
- src: "https://toyland.ng/cdn-cgi/image/width=64/icon-whatsapp.svg",
441
- alt: "WhatsApp",
442
- className: "h-5 w-5"
443
- }
444
- ),
445
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-white", children: "Need help with your order? Click to Contact us on WhatsApp" })
446
- ]
447
- }
448
- ) }),
449
- /* @__PURE__ */ a(
450
- "div",
451
- {
452
- className: k(
453
- "flex transition-transform duration-300 ease-in-out w-full",
454
- c === "customer" && "translate-x-0",
455
- c === "delivery" && "-translate-x-full",
456
- c === "payment" && "-translate-x-[200%]"
457
- ),
458
- children: [
459
- /* @__PURE__ */ e("div", { className: "w-full min-w-full flex-shrink-0 p-4", children: /* @__PURE__ */ e("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
460
- /* @__PURE__ */ e(
461
- I,
462
- {
463
- label: "First Name",
464
- type: "text",
465
- name: "firstName",
466
- value: t.firstName,
467
- onChange: x,
468
- onBlur: () => A("firstName"),
469
- error: u.firstName,
470
- autoCorrect: "off",
471
- required: !0
472
- }
473
- ),
78
+ l && /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "text-center", children: [
79
+ /* @__PURE__ */ e(K, { className: "mx-auto mb-4 h-12 w-12 animate-spin text-accent-500" }),
80
+ /* @__PURE__ */ e("p", { className: "text-gray-600", children: "Loading cart..." })
81
+ ] }) }),
82
+ f && !l && /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "text-center", children: [
83
+ /* @__PURE__ */ e(h, { className: "mx-auto mb-4 h-12 w-12 text-red-600" }),
84
+ /* @__PURE__ */ e("p", { className: "text-red-600", children: "Failed to load cart. Please try again." })
85
+ ] }) }),
86
+ !l && !f && (!t || !t.items || t.items.length === 0) && /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "text-center", children: [
87
+ /* @__PURE__ */ e(h, { className: "mx-auto mb-4 h-12 w-12 text-gray-400" }),
88
+ /* @__PURE__ */ e("p", { className: "text-gray-600", children: R })
89
+ ] }) }),
90
+ !l && !f && t && t.items && t.items.length > 0 && /* @__PURE__ */ a(b, { children: [
91
+ /* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto", children: [
92
+ /* @__PURE__ */ e("div", { className: "space-y-4 p-4", children: t.items.map((i, N) => /* @__PURE__ */ a("div", { children: [
474
93
  /* @__PURE__ */ e(
475
- I,
94
+ X,
476
95
  {
477
- label: "Last Name",
478
- type: "text",
479
- name: "lastName",
480
- value: t.lastName,
481
- onChange: x,
482
- onBlur: () => A("lastName"),
483
- error: u.lastName,
484
- autoCorrect: "off",
485
- required: !0
96
+ item: i
486
97
  }
487
98
  ),
488
- /* @__PURE__ */ e(
489
- I,
99
+ /* @__PURE__ */ e("hr", { className: "border-gray-200 mt-2" })
100
+ ] }, i.id)) }),
101
+ k && /* @__PURE__ */ e("div", { className: "px-4 pb-4", children: /* @__PURE__ */ e(Z, {}) })
102
+ ] }),
103
+ /* @__PURE__ */ e(G, { limit: 6, className: "border-t border-gray-200" }),
104
+ /* @__PURE__ */ a("div", { className: "border-t border-gray-300 bg-white", children: [
105
+ /* @__PURE__ */ a("div", { className: " text-base", children: [
106
+ /* @__PURE__ */ a("div", { className: "px-4 py-2 space-y-2", children: [
107
+ /* @__PURE__ */ a("div", { className: "flex justify-between", children: [
108
+ /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Subtotal" }),
109
+ /* @__PURE__ */ e("span", { className: "font-semibold", children: c(F) })
110
+ ] }),
111
+ u > 0 && /* @__PURE__ */ a("div", { className: "flex justify-between text-green-600", children: [
112
+ /* @__PURE__ */ e("span", { children: "Discount" }),
113
+ /* @__PURE__ */ a("span", { className: "font-semibold", children: [
114
+ "-",
115
+ c(u)
116
+ ] })
117
+ ] }),
118
+ /* @__PURE__ */ a("div", { className: "flex justify-between", children: [
119
+ /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Shipping" }),
120
+ /* @__PURE__ */ e("span", { className: "font-semibold", children: t.pricing && t.deliveryZone ? c(t.pricing.deliveryCharge) : "-" })
121
+ ] })
122
+ ] }),
123
+ /* @__PURE__ */ a("div", { className: "flex justify-between p-4 border-t border-gray-300 text-lg", children: [
124
+ /* @__PURE__ */ e("span", { className: "font-bold", children: "Total" }),
125
+ /* @__PURE__ */ e("span", { className: "font-bold", children: c(t.pricing.total) })
126
+ ] })
127
+ ] }),
128
+ /* @__PURE__ */ a("div", { className: "px-4 py-2 space-y-2 pt-0", children: [
129
+ /* @__PURE__ */ a(
130
+ v,
490
131
  {
491
- label: "Email",
492
- type: "email",
493
- name: "email",
494
- value: t.email,
495
- onChange: x,
496
- onBlur: () => A("email"),
497
- error: u.email,
498
- icon: /* @__PURE__ */ e(ze, { size: 16 }),
499
- autoCorrect: "off",
500
- required: !0
132
+ onClick: Y,
133
+ disabled: z || t.items.length === 0,
134
+ className: n("w-full bg-accent-500 text-white hover:bg-accent-600", I),
135
+ size: "lg",
136
+ children: [
137
+ /* @__PURE__ */ e(h, { className: "h-5 w-5" }),
138
+ C
139
+ ]
501
140
  }
502
141
  ),
503
- /* @__PURE__ */ e(
504
- I,
142
+ j && /* @__PURE__ */ e(
143
+ v,
505
144
  {
506
- label: "Phone Number",
507
- type: "tel",
508
- name: "phone",
509
- value: t.phone,
510
- onChange: x,
511
- onBlur: () => A("phone"),
512
- placeholder: "e.g. 08012345678",
513
- maxLength: 18,
514
- error: u.phone,
515
- icon: /* @__PURE__ */ e(Ae, { size: 16 }),
516
- autoCorrect: "off",
517
- required: !0,
518
- className: "font-semibold"
145
+ onClick: q,
146
+ variant: "outline",
147
+ className: n("w-full border-gray-300 text-gray-600 hover:bg-gray-100", L),
148
+ size: "lg",
149
+ children: E
519
150
  }
520
151
  )
521
- ] }) }) }),
522
- /* @__PURE__ */ e("div", { className: "w-full min-w-full flex-shrink-0 p-4", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
523
- /* @__PURE__ */ e(
524
- I,
525
- {
526
- label: "Street Address",
527
- type: "text",
528
- name: "address",
529
- value: t.address,
530
- onChange: x,
531
- error: u.address,
532
- autoCorrect: "off",
533
- required: !0
534
- }
535
- ),
536
- /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
537
- /* @__PURE__ */ e(
538
- I,
539
- {
540
- label: "Area",
541
- type: "text",
542
- name: "city",
543
- value: t.city,
544
- onChange: x,
545
- error: u.city,
546
- autoCorrect: "off",
547
- required: !0
548
- }
549
- ),
550
- /* @__PURE__ */ a(
551
- ye,
552
- {
553
- label: "State",
554
- name: "state",
555
- value: L || "",
556
- onChange: (r) => {
557
- Y("");
558
- const n = r.target.value;
559
- Ne(n || void 0), u.state && z((d) => ({ ...d, state: void 0 }));
560
- },
561
- error: u.state,
562
- required: !0,
563
- children: [
564
- /* @__PURE__ */ e("option", { disabled: !0, value: "", children: "Select State" }),
565
- C == null ? void 0 : C.map((r) => /* @__PURE__ */ e("option", { value: r.id, children: r.name }, r.id))
566
- ]
567
- }
568
- ),
569
- /* @__PURE__ */ a(
570
- ye,
571
- {
572
- label: "Delivery Zone",
573
- value: f || "",
574
- onChange: (r) => {
575
- const n = r.target.value;
576
- Y(n || void 0), u.deliveryZoneId && z((d) => ({ ...d, deliveryZoneId: void 0 })), n && R.mutate({ deliveryZoneId: n });
577
- },
578
- disabled: !m,
579
- error: u.deliveryZoneId,
580
- required: !0,
581
- children: [
582
- /* @__PURE__ */ e("option", { disabled: !0, value: "", children: m ? "Select Delivery Zone" : "Select State First" }),
583
- m == null ? void 0 : m.zones.map((r) => /* @__PURE__ */ a("option", { value: r.id, children: [
584
- r.name,
585
- " (",
586
- q(r.deliveryCost),
587
- ")"
588
- ] }, r.id))
589
- ]
590
- }
591
- )
592
- ] })
593
- ] }) }),
594
- /* @__PURE__ */ e("div", { className: "w-full min-w-full flex-shrink-0 p-4", children: /* @__PURE__ */ a("div", { className: "space-y-6", children: [
595
- S && /* @__PURE__ */ a("div", { className: `border border-gray-200 rounded-lg ${ae ? "mt-4" : ""}`, children: [
596
- /* @__PURE__ */ a(
597
- "button",
598
- {
599
- type: "button",
600
- onClick: () => be(!H),
601
- className: "overflow-hidden w-full flex items-center overflow-hidden rounded-lg rounded-b-none justify-between p-4 text-left hover:bg-gray-50 transition-colors",
602
- children: [
603
- /* @__PURE__ */ e("span", { className: "text-sm font-bold text-accent-700", children: S.title || "🤔 Curious about Refunds?" }),
604
- /* @__PURE__ */ e(
605
- Fe,
606
- {
607
- size: 16,
608
- className: k(
609
- "transform transition-transform duration-200 text-gray-500",
610
- H && "rotate-180"
611
- )
612
- }
613
- )
614
- ]
615
- }
616
- ),
617
- /* @__PURE__ */ e(
618
- "div",
619
- {
620
- className: k(
621
- "overflow-hidden transition-all duration-300 ease-in-out",
622
- H ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
623
- ),
624
- children: /* @__PURE__ */ e("div", { className: "px-4 pb-4 border-t border-gray-100", children: /* @__PURE__ */ e("div", { className: "text-sm text-gray-600 space-y-3 pt-4", children: S.policies && /* @__PURE__ */ a("div", { children: [
625
- /* @__PURE__ */ e("h4", { className: "font-bold text-gray-800 mb-2", children: "Our Refund Policy" }),
626
- /* @__PURE__ */ e("ul", { className: "space-y-1", children: S.policies.map((r, n) => /* @__PURE__ */ a("li", { className: "flex items-start", children: [
627
- /* @__PURE__ */ e("span", { className: "text-green-600 mr-2", children: "✓" }),
628
- /* @__PURE__ */ e("span", { children: r })
629
- ] }, n)) })
630
- ] }) }) })
631
- }
632
- )
633
- ] }),
634
- /* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-4", children: [
635
- /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ a(
636
- "label",
637
- {
638
- className: k(
639
- "flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
640
- t.paymentMethod === "online" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
641
- T("online") && "opacity-50 cursor-not-allowed"
642
- ),
643
- children: [
644
- /* @__PURE__ */ e(
645
- "input",
646
- {
647
- type: "radio",
648
- name: "paymentMethod",
649
- value: "online",
650
- disabled: T("online"),
651
- checked: t.paymentMethod === "online",
652
- onChange: x,
653
- className: "sr-only"
654
- }
655
- ),
656
- /* @__PURE__ */ a("div", { className: "flex flex-col items-center text-center space-y-3", children: [
657
- /* @__PURE__ */ e(
658
- "div",
659
- {
660
- className: k(
661
- "p-3 rounded-full",
662
- t.paymentMethod === "online" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
663
- ),
664
- children: /* @__PURE__ */ e(Te, { size: 24 })
665
- }
666
- ),
667
- /* @__PURE__ */ a("div", { children: [
668
- /* @__PURE__ */ e("div", { className: "font-semibold text-gray-900", children: "Pay Online" }),
669
- /* @__PURE__ */ e("div", { className: "text-sm text-gray-500 mt-1", children: "Bank transfer" }),
670
- /* @__PURE__ */ e(
671
- "img",
672
- {
673
- src: We,
674
- alt: "Paystack",
675
- className: "h-4 w-auto mt-2 mx-auto"
676
- }
677
- )
678
- ] })
679
- ] }),
680
- t.paymentMethod === "online" && /* @__PURE__ */ e("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ e("div", { className: "w-5 h-5 bg-accent-600 rounded-full flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-2 h-2 bg-white rounded-full" }) }) })
681
- ]
682
- }
683
- ) }),
684
- /* @__PURE__ */ a(
685
- "label",
686
- {
687
- className: k(
688
- "flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
689
- t.paymentMethod === "cod" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
690
- T("cod") && "opacity-50 cursor-not-allowed"
691
- ),
692
- children: [
693
- /* @__PURE__ */ e(
694
- "input",
695
- {
696
- type: "radio",
697
- name: "paymentMethod",
698
- value: "cod",
699
- disabled: T("cod"),
700
- checked: t.paymentMethod === "cod",
701
- onChange: x,
702
- className: "sr-only"
703
- }
704
- ),
705
- /* @__PURE__ */ a("div", { className: "flex flex-col items-center text-center space-y-3", children: [
706
- /* @__PURE__ */ e(
707
- "div",
708
- {
709
- className: k(
710
- "p-3 rounded-full",
711
- t.paymentMethod === "cod" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
712
- ),
713
- children: /* @__PURE__ */ e(fe, { size: 24 })
714
- }
715
- ),
716
- /* @__PURE__ */ a("div", { children: [
717
- /* @__PURE__ */ e("div", { className: "font-semibold text-gray-900", children: "Pay on Delivery" }),
718
- /* @__PURE__ */ e("div", { className: "text-sm text-gray-500 mt-1", children: "Pay when item arrives" })
719
- ] })
720
- ] }),
721
- t.paymentMethod === "cod" && /* @__PURE__ */ e("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ e("div", { className: "w-5 h-5 bg-accent-600 rounded-full flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-2 h-2 bg-white rounded-full" }) }) })
722
- ]
723
- }
724
- )
725
- ] }),
726
- u.paymentMethod && /* @__PURE__ */ e("p", { className: "text-red-600 text-sm", children: u.paymentMethod })
727
- ] }) })
728
- ]
729
- }
730
- )
731
- ] }) })
732
- }
733
- );
152
+ ] })
153
+ ] })
154
+ ] })
155
+ ] })
156
+ }
157
+ ),
158
+ /* @__PURE__ */ e(
159
+ A,
160
+ {
161
+ isOpen: D,
162
+ onSuccess: (i) => {
163
+ m == null || m(i), s();
164
+ },
165
+ onClose: () => p(!1),
166
+ refundPolicy: {
167
+ title: "🤔 Curious about Refunds?",
168
+ policies: [
169
+ "2 day return window from delivery date",
170
+ "Items must be unused and in original packaging",
171
+ "Refunds processed as soon as item is received",
172
+ "Refunds issued to original payment method",
173
+ "Contact hello@instock.ng to initiate a refund"
174
+ ]
175
+ }
176
+ }
177
+ )
178
+ ] });
734
179
  }
735
180
  export {
736
- ct as Checkout
181
+ ie as ShoppingCart
737
182
  };