@instockng/storefront-ui 1.0.18 → 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 +129 -34
  235. package/dist/index6.mjs +190 -73
  236. package/dist/index60.mjs +22 -41
  237. package/dist/index61.mjs +148 -230
  238. package/dist/index62.mjs +2 -6
  239. package/dist/index63.mjs +21 -132
  240. package/dist/index64.mjs +73 -66
  241. package/dist/index65.mjs +14 -86
  242. package/dist/index66.mjs +59 -25
  243. package/dist/index67.mjs +4 -8
  244. package/dist/index68.mjs +2 -75
  245. package/dist/index69.mjs +5 -3
  246. package/dist/index7.mjs +97 -85
  247. package/dist/index70.mjs +1134 -2
  248. package/dist/index71.mjs +19 -82
  249. package/dist/index72.mjs +54 -53
  250. package/dist/index73.mjs +32 -5
  251. package/dist/index74.mjs +2 -5
  252. package/dist/index75.mjs +2 -179
  253. package/dist/index76.mjs +230 -48
  254. package/dist/index77.mjs +6 -69
  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 +5 -4
  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/index4.mjs CHANGED
@@ -1,202 +1,87 @@
1
1
  'use client';
2
- import { jsx as e, jsxs as r, Fragment as T } from "react/jsx-runtime";
3
- import { useState as E } from "react";
4
- import "./index18.mjs";
5
- import "@tanstack/react-query";
6
- import { useGetOrder as U, useConfirmOrder as M } from "./index30.mjs";
7
- import { Card as s, CardHeader as m, CardTitle as o, CardContent as i } from "./index12.mjs";
8
- import { Button as S } from "./index11.mjs";
9
- import { Badge as g } from "./index13.mjs";
10
- import { Loader2 as v, XCircle as _, Package as H, CheckCircle as L } from "lucide-react";
11
- import { cn as l, formatDateTime as k, formatCurrency as c } from "./index17.mjs";
12
- const b = "2348125648668", x = "0" + b.slice(3), W = `${x.slice(0, 4)} ${x.slice(4, 7)} ${x.slice(7)}`, $ = `https://wa.me/${b}`;
13
- function V({
14
- orderId: N,
15
- token: f,
16
- className: h,
17
- headerClassName: w,
18
- buttonClassName: P,
19
- cardClassName: n,
20
- whatsappHelpLink: A = $,
21
- whatsappHelpNumber: C = W,
22
- currency: B = "NGN",
23
- locale: F = "en-NG"
24
- }) {
25
- var y;
26
- const [p, j] = E(!1), { data: u, isLoading: D, error: O } = U(N, f, {
27
- retry: !1
28
- }), d = M({
29
- onSuccess: (t) => {
30
- j(!0);
31
- },
32
- onError: (t) => {
2
+ import { jsx as m } from "react/jsx-runtime";
3
+ import { createContext as x, useContext as g, useState as _, useEffect as w } from "react";
4
+ import l from "./index37.mjs";
5
+ const d = x(null);
6
+ function z({ children: c, pixelId: r, debug: P }) {
7
+ const [a, f] = _(!1), k = process.env.NODE_ENV === "development", i = P ?? k;
8
+ w(() => {
9
+ if (!r) {
10
+ i && console.log("[Meta Pixel] No pixel ID provided, tracking disabled");
11
+ return;
12
+ }
13
+ const t = {
14
+ autoConfig: !0,
15
+ debug: i
16
+ };
17
+ l.init(r, void 0, t), f(!0), i && console.log("[Meta Pixel] Initialized with ID:", r);
18
+ }, [r, i]);
19
+ const o = (t, e) => {
20
+ if (!a) {
21
+ i && console.log("[Meta Pixel] Track (not initialized):", t, e);
22
+ return;
33
23
  }
34
- });
35
- if (D)
36
- return /* @__PURE__ */ e("div", { className: l("min-h-screen bg-gray-50 flex items-center justify-center", h), children: /* @__PURE__ */ r("div", { className: "text-center", children: [
37
- /* @__PURE__ */ e(v, { className: "h-12 w-12 animate-spin text-blue-500 mx-auto mb-4" }),
38
- /* @__PURE__ */ e("p", { className: "text-gray-600", children: "Loading order details..." })
39
- ] }) });
40
- if (O || !u || "error" in u)
41
- return /* @__PURE__ */ e("div", { className: l("min-h-screen bg-gray-50 flex items-center justify-center p-4", h), children: /* @__PURE__ */ r(s, { className: l("max-w-md w-full", n), children: [
42
- /* @__PURE__ */ e(m, { children: /* @__PURE__ */ r("div", { className: "flex items-center space-x-2", children: [
43
- /* @__PURE__ */ e(_, { className: "h-6 w-6 text-red-500" }),
44
- /* @__PURE__ */ e(o, { children: "Order Not Found" })
45
- ] }) }),
46
- /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e("p", { className: "text-gray-600", children: "We couldn't find this order. The link may be invalid or expired. Please contact support if you need assistance." }) })
47
- ] }) });
48
- const a = u;
49
- return /* @__PURE__ */ e("div", { className: l("min-h-screen bg-gray-50 py-8 px-4", h), children: /* @__PURE__ */ r("div", { className: "max-w-3xl mx-auto space-y-6", children: [
50
- /* @__PURE__ */ r("div", { className: l("text-center", w), children: [
51
- a.brand.logoUrl ? /* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center w-24 h-16 mb-4", children: /* @__PURE__ */ e(
52
- "img",
53
- {
54
- src: a.brand.logoUrl,
55
- alt: `${a.brand.name} logo`,
56
- className: "max-w-full max-h-full object-contain"
57
- }
58
- ) }) : /* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center w-16 h-16 bg-blue-100 rounded-full mb-4", children: /* @__PURE__ */ e(H, { className: "h-8 w-8 text-blue-600" }) }),
59
- /* @__PURE__ */ r("h1", { className: "text-3xl font-bold text-gray-900", children: [
60
- "Order #",
61
- a.orderNumber
62
- ] }),
63
- /* @__PURE__ */ e("p", { className: "text-gray-600 mt-2", children: a.brand.name })
64
- ] }),
65
- p && /* @__PURE__ */ e(s, { className: l("border-green-200 bg-green-50", n), children: /* @__PURE__ */ e(i, { className: "pt-6", children: /* @__PURE__ */ r("div", { className: "flex items-start space-x-3", children: [
66
- /* @__PURE__ */ e(L, { className: "h-6 w-6 text-green-600 mt-0.5" }),
67
- /* @__PURE__ */ r("div", { children: [
68
- /* @__PURE__ */ e("h3", { className: "font-semibold text-green-900", children: "Order Confirmed!" }),
69
- /* @__PURE__ */ e("p", { className: "text-green-700 mt-1", children: "Thank you for confirming your order. We will contact you soon to arrange delivery." })
70
- ] })
71
- ] }) }) }),
72
- !p && a.confirmationMessage && /* @__PURE__ */ e(s, { className: l(a.canConfirm ? "border-orange-200 bg-orange-50" : "", n), children: /* @__PURE__ */ e(i, { className: "pt-6", children: /* @__PURE__ */ e("p", { className: a.canConfirm ? "text-orange-900" : "text-gray-700", children: a.confirmationMessage }) }) }),
73
- a.canConfirm && !p && /* @__PURE__ */ e(s, { className: n, children: /* @__PURE__ */ r(i, { className: "pt-6", children: [
74
- /* @__PURE__ */ e(
75
- S,
76
- {
77
- onClick: () => d.mutate({ orderId: N, token: f }),
78
- disabled: d.isPending,
79
- className: l("w-full", P),
80
- size: "lg",
81
- children: d.isPending ? /* @__PURE__ */ r(T, { children: [
82
- /* @__PURE__ */ e(v, { className: "mr-2 h-5 w-5 animate-spin" }),
83
- "Confirming..."
84
- ] }) : "Confirm Order"
85
- }
86
- ),
87
- d.isError && /* @__PURE__ */ e("p", { className: "text-red-600 text-sm mt-2 text-center", children: "Failed to confirm order. Please try again or contact support." })
88
- ] }) }),
89
- /* @__PURE__ */ r(s, { className: n, children: [
90
- /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(o, { children: "Order Details" }) }),
91
- /* @__PURE__ */ e(i, { className: "space-y-4", children: /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
92
- /* @__PURE__ */ r("div", { children: [
93
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Status" }),
94
- /* @__PURE__ */ e(g, { className: "mt-1", children: a.status })
95
- ] }),
96
- /* @__PURE__ */ r("div", { children: [
97
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Order Date" }),
98
- /* @__PURE__ */ e("p", { className: "font-medium", children: a.createdAt ? k(a.createdAt) : "N/A" })
99
- ] }),
100
- /* @__PURE__ */ r("div", { children: [
101
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Payment Method" }),
102
- /* @__PURE__ */ e("p", { className: "font-medium", children: a.paymentMethod === "cod" ? "Cash on Delivery" : "Online Payment" })
103
- ] }),
104
- /* @__PURE__ */ r("div", { children: [
105
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Estimated Delivery" }),
106
- /* @__PURE__ */ e("p", { className: "font-medium", children: a.estimatedDays ? `${a.estimatedDays} days` : "TBD" })
107
- ] })
108
- ] }) })
109
- ] }),
110
- /* @__PURE__ */ r(s, { className: n, children: [
111
- /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(o, { children: "Delivery Information" }) }),
112
- /* @__PURE__ */ r(i, { className: "space-y-3", children: [
113
- /* @__PURE__ */ r("div", { children: [
114
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Customer" }),
115
- /* @__PURE__ */ r("p", { className: "font-medium", children: [
116
- a.firstName,
117
- " ",
118
- a.lastName
119
- ] }),
120
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: a.phone })
121
- ] }),
122
- /* @__PURE__ */ r("div", { children: [
123
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Address" }),
124
- /* @__PURE__ */ e("p", { className: "font-medium", children: a.address }),
125
- /* @__PURE__ */ r("p", { className: "text-sm text-gray-600", children: [
126
- a.city,
127
- ", ",
128
- a.deliveryZone.state.name
129
- ] }),
130
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: a.deliveryZone.name })
131
- ] })
132
- ] })
133
- ] }),
134
- /* @__PURE__ */ r(s, { className: n, children: [
135
- /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(o, { children: "Items" }) }),
136
- /* @__PURE__ */ r(i, { children: [
137
- /* @__PURE__ */ e("div", { className: "space-y-4", children: (y = a.items) == null ? void 0 : y.map((t) => /* @__PURE__ */ r("div", { className: "flex items-start justify-between border-b pb-4 last:border-0", children: [
138
- /* @__PURE__ */ r("div", { className: "flex items-start space-x-4 flex-1", children: [
139
- (t.variant.thumbnailUrl || t.variant.product.thumbnailUrl) && /* @__PURE__ */ e(
140
- "img",
141
- {
142
- src: t.variant.thumbnailUrl || t.variant.product.thumbnailUrl || void 0,
143
- alt: t.variant.product.name,
144
- className: "w-16 h-16 object-cover rounded"
145
- }
146
- ),
147
- /* @__PURE__ */ r("div", { className: "flex-1", children: [
148
- /* @__PURE__ */ e("p", { className: "font-medium", children: t.variant.product.name }),
149
- t.variant.name && /* @__PURE__ */ e(g, { variant: "outline", className: "mt-1", children: t.variant.name }),
150
- /* @__PURE__ */ r("p", { className: "text-sm text-gray-600 mt-1", children: [
151
- "Quantity: ",
152
- t.quantity
153
- ] }),
154
- /* @__PURE__ */ r("p", { className: "text-sm text-gray-600", children: [
155
- "SKU: ",
156
- t.variant.sku
157
- ] })
158
- ] })
159
- ] }),
160
- /* @__PURE__ */ r("div", { className: "text-right", children: [
161
- /* @__PURE__ */ e("p", { className: "font-medium", children: c(t.priceAtPurchase * t.quantity) }),
162
- /* @__PURE__ */ r("p", { className: "text-sm text-gray-600", children: [
163
- c(t.priceAtPurchase),
164
- " each"
165
- ] })
166
- ] })
167
- ] }, t.id)) }),
168
- /* @__PURE__ */ r("div", { className: "mt-6 border-t pt-4 space-y-2", children: [
169
- /* @__PURE__ */ r("div", { className: "flex justify-between text-sm", children: [
170
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Subtotal" }),
171
- /* @__PURE__ */ e("span", { className: "font-medium", children: c(a.subtotal) })
172
- ] }),
173
- a.discountAmount && a.discountAmount > 0 && /* @__PURE__ */ r("div", { className: "flex justify-between text-sm text-green-600", children: [
174
- /* @__PURE__ */ e("span", { children: "Discount" }),
175
- /* @__PURE__ */ r("span", { children: [
176
- "-",
177
- c(a.discountAmount)
178
- ] })
179
- ] }),
180
- /* @__PURE__ */ r("div", { className: "flex justify-between text-sm", children: [
181
- /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Delivery Charge" }),
182
- /* @__PURE__ */ e("span", { className: "font-medium", children: c(a.deliveryCharge) })
183
- ] }),
184
- /* @__PURE__ */ r("div", { className: "flex justify-between text-lg font-bold border-t pt-2", children: [
185
- /* @__PURE__ */ e("span", { children: "Total" }),
186
- /* @__PURE__ */ e("span", { children: c(a.totalPrice) })
187
- ] })
188
- ] })
189
- ] })
190
- ] }),
191
- /* @__PURE__ */ e(s, { className: n, children: /* @__PURE__ */ e(i, { className: "pt-6", children: /* @__PURE__ */ r("p", { className: "text-sm text-gray-600 text-center", children: [
192
- "Need help with your order? Call us on ",
193
- C,
194
- " or contact us on",
195
- " ",
196
- /* @__PURE__ */ e("a", { href: A, target: "_blank", rel: "noopener noreferrer", className: "text-blue-600 hover:underline", children: "WhatsApp" })
197
- ] }) }) })
198
- ] }) });
24
+ l.track(t, e), i && console.log("[Meta Pixel] Track:", t, e);
25
+ }, p = {
26
+ track: o,
27
+ trackPageView: () => {
28
+ if (!a) {
29
+ i && console.log("[Meta Pixel] PageView (not initialized)");
30
+ return;
31
+ }
32
+ l.pageView(), i && console.log("[Meta Pixel] PageView");
33
+ },
34
+ trackProductView: (t, e, n) => {
35
+ o("ViewContent", {
36
+ content_ids: [t],
37
+ content_name: e,
38
+ content_type: "product",
39
+ value: n,
40
+ currency: "NGN"
41
+ });
42
+ },
43
+ trackAddToCart: (t, e, n, s) => {
44
+ o("AddToCart", {
45
+ content_ids: [t],
46
+ content_name: e,
47
+ content_type: "product",
48
+ value: n,
49
+ currency: "NGN",
50
+ num_items: s
51
+ });
52
+ },
53
+ trackInitiateCheckout: (t, e) => {
54
+ o("InitiateCheckout", {
55
+ value: t,
56
+ currency: "NGN",
57
+ num_items: e
58
+ });
59
+ },
60
+ trackPurchase: (t, e, n, s) => {
61
+ o("Purchase", {
62
+ value: t,
63
+ currency: e,
64
+ content_type: "product",
65
+ contents: s.map((u) => ({
66
+ id: u.id,
67
+ // SKU
68
+ quantity: u.quantity,
69
+ item_price: u.item_price
70
+ })),
71
+ order_id: n
72
+ });
73
+ },
74
+ isInitialized: a
75
+ };
76
+ return /* @__PURE__ */ m(d.Provider, { value: p, children: c });
77
+ }
78
+ function D() {
79
+ const c = g(d);
80
+ if (!c)
81
+ throw new Error("useMetaPixel must be used within MetaPixelProvider");
82
+ return c;
199
83
  }
200
84
  export {
201
- V as OrderConfirmation
85
+ z as MetaPixelProvider,
86
+ D as useMetaPixel
202
87
  };
package/dist/index40.mjs CHANGED
@@ -1,39 +1,5 @@
1
1
  'use client';
2
- import o from "./index41.mjs";
3
- const {
4
- Axios: e,
5
- AxiosError: a,
6
- CanceledError: s,
7
- isCancel: t,
8
- CancelToken: i,
9
- VERSION: l,
10
- all: n,
11
- Cancel: d,
12
- isAxiosError: x,
13
- spread: C,
14
- toFormData: c,
15
- AxiosHeaders: m,
16
- HttpStatusCode: p,
17
- formToJSON: A,
18
- getAdapter: f,
19
- mergeConfig: E
20
- } = o;
2
+ const c = "data:image/svg+xml,%3csvg%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20280.6%2050'%20style='enable-background:new%200%200%20280.6%2050;'%20xml:space='preserve'%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%2300C3F7;}%20.st1{fill:%23011B33;}%20%3c/style%3e%3cg%3e%3cg%3e%3cpath%20class='st0'%20d='M39.9,4.8H2.3C1.1,4.8,0,5.8,0,7.1v4.2c0,1.3,1.1,2.4,2.3,2.4h37.6c1.3,0,2.3-1.1,2.4-2.4V7.2%20C42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3e%3c/svg%3e";
21
3
  export {
22
- e as Axios,
23
- a as AxiosError,
24
- m as AxiosHeaders,
25
- d as Cancel,
26
- i as CancelToken,
27
- s as CanceledError,
28
- p as HttpStatusCode,
29
- l as VERSION,
30
- n as all,
31
- o as default,
32
- A as formToJSON,
33
- f as getAdapter,
34
- x as isAxiosError,
35
- t as isCancel,
36
- E as mergeConfig,
37
- C as spread,
38
- c as toFormData
4
+ c as default
39
5
  };
package/dist/index41.mjs CHANGED
@@ -1,47 +1,60 @@
1
1
  'use client';
2
- import a from "./index61.mjs";
3
- import p from "./index62.mjs";
4
- import m from "./index63.mjs";
5
- import i from "./index64.mjs";
6
- import f from "./index65.mjs";
7
- import l from "./index66.mjs";
8
- import c from "./index67.mjs";
9
- import d from "./index68.mjs";
10
- import u from "./index69.mjs";
11
- import { VERSION as x } from "./index70.mjs";
12
- import C from "./index71.mjs";
13
- import A from "./index72.mjs";
14
- import E from "./index73.mjs";
15
- import O from "./index74.mjs";
16
- import S from "./index75.mjs";
17
- import H from "./index76.mjs";
18
- import T from "./index77.mjs";
19
- function n(o) {
20
- const t = new m(o), e = p(m.prototype.request, t);
21
- return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
22
- return n(i(o, s));
23
- }, e;
2
+ import { useState as c, useEffect as f, useCallback as k } from "react";
3
+ function P({
4
+ publicKey: d,
5
+ onSuccess: e,
6
+ onClose: a
7
+ }) {
8
+ const [i, o] = c(!1), [l, r] = c(!1), [p, n] = c(null);
9
+ f(() => {
10
+ if (window.PaystackPop) {
11
+ o(!0);
12
+ return;
13
+ }
14
+ const s = document.querySelector('script[src="https://js.paystack.co/v1/inline.js"]');
15
+ if (s) {
16
+ s.addEventListener("load", () => o(!0));
17
+ return;
18
+ }
19
+ const t = document.createElement("script");
20
+ return t.src = "https://js.paystack.co/v1/inline.js", t.async = !0, t.onload = () => {
21
+ o(!0);
22
+ }, t.onerror = () => {
23
+ n("Failed to load Paystack script");
24
+ }, document.body.appendChild(t), () => {
25
+ };
26
+ }, []);
27
+ const u = k(
28
+ (s) => {
29
+ if (!i || !window.PaystackPop) {
30
+ n("Paystack script not loaded");
31
+ return;
32
+ }
33
+ r(!0), n(null);
34
+ try {
35
+ window.PaystackPop.setup({
36
+ ...s,
37
+ key: d,
38
+ callback: (y) => {
39
+ r(!1), e == null || e(y);
40
+ },
41
+ onClose: () => {
42
+ r(!1), a == null || a();
43
+ }
44
+ }).openIframe();
45
+ } catch (t) {
46
+ r(!1), n(t instanceof Error ? t.message : "Failed to initialize payment");
47
+ }
48
+ },
49
+ [i, d, e, a]
50
+ );
51
+ return {
52
+ isLoaded: i,
53
+ isLoading: l,
54
+ error: p,
55
+ initializePayment: u
56
+ };
24
57
  }
25
- const r = n(f);
26
- r.Axios = m;
27
- r.CanceledError = c;
28
- r.CancelToken = d;
29
- r.isCancel = u;
30
- r.VERSION = x;
31
- r.toFormData = C;
32
- r.AxiosError = A;
33
- r.Cancel = r.CanceledError;
34
- r.all = function(t) {
35
- return Promise.all(t);
36
- };
37
- r.spread = E;
38
- r.isAxiosError = O;
39
- r.mergeConfig = i;
40
- r.AxiosHeaders = S;
41
- r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
42
- r.getAdapter = H.getAdapter;
43
- r.HttpStatusCode = T;
44
- r.default = r;
45
58
  export {
46
- r as default
59
+ P as usePaystackPayment
47
60
  };
package/dist/index42.mjs CHANGED
@@ -1,102 +1,54 @@
1
1
  'use client';
2
- var p = Object.defineProperty;
3
- var k = (r, e, i) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
4
- var h = (r, e, i) => k(r, typeof e != "symbol" ? e + "" : e, i);
5
- import { serialize as j } from "./index59.mjs";
6
- import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index60.mjs";
7
- var v = (r, e) => new Proxy(() => {
8
- }, {
9
- get(t, s) {
10
- if (!(typeof s != "string" || s === "then"))
11
- return v(r, [...e, s]);
12
- },
13
- apply(t, s, a) {
14
- return r({
15
- path: e,
16
- args: a
17
- });
2
+ import * as l from "react";
3
+ import { composeRefs as m } from "./index63.mjs";
4
+ import { jsx as u } from "react/jsx-runtime";
5
+ // @__NO_SIDE_EFFECTS__
6
+ function y(e) {
7
+ const t = /* @__PURE__ */ S(e), o = l.forwardRef((n, r) => {
8
+ const { children: i, ...c } = n, s = l.Children.toArray(i), a = s.find(E);
9
+ if (a) {
10
+ const f = a.props.children, d = s.map((p) => p === a ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : p);
11
+ return /* @__PURE__ */ u(t, { ...c, ref: r, children: l.isValidElement(f) ? l.cloneElement(f, void 0, d) : null });
12
+ }
13
+ return /* @__PURE__ */ u(t, { ...c, ref: r, children: i });
14
+ });
15
+ return o.displayName = `${e}.Slot`, o;
16
+ }
17
+ var V = /* @__PURE__ */ y("Slot");
18
+ // @__NO_SIDE_EFFECTS__
19
+ function S(e) {
20
+ const t = l.forwardRef((o, n) => {
21
+ const { children: r, ...i } = o;
22
+ if (l.isValidElement(r)) {
23
+ const c = R(r), s = C(i, r.props);
24
+ return r.type !== l.Fragment && (s.ref = n ? m(n, c) : c), l.cloneElement(r, s);
25
+ }
26
+ return l.Children.count(r) > 1 ? l.Children.only(null) : null;
27
+ });
28
+ return t.displayName = `${e}.SlotClone`, t;
29
+ }
30
+ var g = Symbol("radix.slottable");
31
+ function E(e) {
32
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === g;
33
+ }
34
+ function C(e, t) {
35
+ const o = { ...t };
36
+ for (const n in t) {
37
+ const r = e[n], i = t[n];
38
+ /^on[A-Z]/.test(n) ? r && i ? o[n] = (...s) => {
39
+ const a = i(...s);
40
+ return r(...s), a;
41
+ } : r && (o[n] = r) : n === "style" ? o[n] = { ...r, ...i } : n === "className" && (o[n] = [r, i].filter(Boolean).join(" "));
18
42
  }
19
- }), T = class {
20
- constructor(r, e) {
21
- h(this, "url");
22
- h(this, "method");
23
- h(this, "queryParams");
24
- h(this, "pathParams", {});
25
- h(this, "rBody");
26
- h(this, "cType");
27
- h(this, "fetch", async (r, e) => {
28
- if (r) {
29
- if (r.query && (this.queryParams = S(r.query)), r.form) {
30
- const o = new FormData();
31
- for (const [c, f] of Object.entries(r.form))
32
- if (Array.isArray(f))
33
- for (const l of f)
34
- o.append(c, l);
35
- else
36
- o.append(c, f);
37
- this.rBody = o;
38
- }
39
- r.json && (this.rBody = JSON.stringify(r.json), this.cType = "application/json"), r.param && (this.pathParams = r.param);
40
- }
41
- let i = this.method.toUpperCase();
42
- const t = {
43
- ...r == null ? void 0 : r.header,
44
- ...typeof (e == null ? void 0 : e.headers) == "function" ? await e.headers() : e == null ? void 0 : e.headers
45
- };
46
- if (r != null && r.cookie) {
47
- const o = [];
48
- for (const [c, f] of Object.entries(r.cookie))
49
- o.push(j(c, f, { path: "/" }));
50
- t.Cookie = o.join(",");
51
- }
52
- this.cType && (t["Content-Type"] = this.cType);
53
- const s = new Headers(t ?? void 0);
54
- let a = this.url;
55
- a = w(a), a = P(a, this.pathParams), this.queryParams && (a = a + "?" + this.queryParams.toString()), i = this.method.toUpperCase();
56
- const u = !(i === "GET" || i === "HEAD");
57
- return ((e == null ? void 0 : e.fetch) || fetch)(a, {
58
- body: u ? this.rBody : void 0,
59
- method: i,
60
- headers: s,
61
- ...e == null ? void 0 : e.init
62
- });
63
- });
64
- this.url = r, this.method = e;
65
- }
66
- }, E = (r, e) => v(function i(t) {
67
- var l;
68
- const s = [...t.path], a = s.slice(-3).reverse();
69
- if (a[0] === "toString")
70
- return a[1] === "name" ? a[2] || "" : i.toString();
71
- if (a[0] === "valueOf")
72
- return a[1] === "name" ? a[2] || "" : i;
73
- let u = "";
74
- if (/^\$/.test(a[0])) {
75
- const n = s.pop();
76
- n && (u = n.replace(/^\$/, ""));
77
- }
78
- const o = s.join("/"), c = U(r, o);
79
- if (u === "url") {
80
- let n = c;
81
- return t.args[0] && (t.args[0].param && (n = P(c, t.args[0].param)), t.args[0].query && (n = n + "?" + S(t.args[0].query).toString())), n = w(n), new URL(n);
82
- }
83
- if (u === "ws") {
84
- const n = x(
85
- t.args[0] && t.args[0].param ? P(c, t.args[0].param) : c,
86
- "ws"
87
- ), y = new URL(n), b = (l = t.args[0]) == null ? void 0 : l.query;
88
- return b && Object.entries(b).forEach(([m, d]) => {
89
- Array.isArray(d) ? d.forEach((q) => y.searchParams.append(m, q)) : y.searchParams.set(m, d);
90
- }), ((...m) => (e == null ? void 0 : e.webSocket) !== void 0 && typeof e.webSocket == "function" ? e.webSocket(...m) : new WebSocket(...m))(y.toString());
91
- }
92
- const f = new T(c, u);
93
- if (u) {
94
- e ?? (e = {});
95
- const n = C(e, { ...t.args[1] });
96
- return f.fetch(t.args[0], n);
97
- }
98
- return f;
99
- }, []);
43
+ return { ...e, ...o };
44
+ }
45
+ function R(e) {
46
+ var n, r;
47
+ let t = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, o = t && "isReactWarning" in t && t.isReactWarning;
48
+ return o ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
49
+ }
100
50
  export {
101
- E as hc
51
+ V as Root,
52
+ V as Slot,
53
+ y as createSlot
102
54
  };