@instockng/storefront-ui 1.0.29 → 1.0.30

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 (65) hide show
  1. package/dist/components/Checkout.d.ts.map +1 -1
  2. package/dist/index12.mjs +136 -132
  3. package/dist/index134.mjs +1 -1
  4. package/dist/index136.mjs +1 -1
  5. package/dist/index137.mjs +2 -2
  6. package/dist/index141.mjs +2 -2
  7. package/dist/index150.mjs +1 -1
  8. package/dist/index151.mjs +1 -1
  9. package/dist/index153.mjs +1 -1
  10. package/dist/index154.mjs +1 -1
  11. package/dist/index156.mjs +1 -1
  12. package/dist/index157.mjs +1 -1
  13. package/dist/index159.mjs +2 -2
  14. package/dist/index160.mjs +1 -1
  15. package/dist/index165.mjs +2 -2
  16. package/dist/index167.mjs +1 -1
  17. package/dist/index205.mjs +12 -30
  18. package/dist/index206.mjs +7 -11
  19. package/dist/index207.mjs +30 -3
  20. package/dist/index208.mjs +10 -3
  21. package/dist/index209.mjs +4 -13
  22. package/dist/index210.mjs +4 -7
  23. package/dist/index217.mjs +2 -2
  24. package/dist/index218.mjs +2 -2
  25. package/dist/index220.mjs +2 -2
  26. package/dist/index221.mjs +2 -2
  27. package/dist/index222.mjs +2 -2
  28. package/dist/index223.mjs +108 -2
  29. package/dist/index224.mjs +2 -2
  30. package/dist/index225.mjs +2 -37
  31. package/dist/index226.mjs +37 -2
  32. package/dist/index227.mjs +2 -108
  33. package/dist/index228.mjs +2 -2
  34. package/dist/index229.mjs +2 -2
  35. package/dist/index247.mjs +1 -1
  36. package/dist/index248.mjs +1 -1
  37. package/dist/index29.mjs +1 -1
  38. package/dist/index32.mjs +1 -1
  39. package/dist/index33.mjs +1 -1
  40. package/dist/index34.mjs +1 -1
  41. package/dist/index35.mjs +1 -1
  42. package/dist/index36.mjs +1 -1
  43. package/dist/index37.mjs +2 -2
  44. package/dist/index38.mjs +2 -2
  45. package/dist/index42.mjs +1 -1
  46. package/dist/index49.mjs +45 -45
  47. package/dist/index50.mjs +1 -1
  48. package/dist/index51.mjs +1 -1
  49. package/dist/index52.mjs +1 -1
  50. package/dist/index53.mjs +1 -1
  51. package/dist/index54.mjs +1 -1
  52. package/dist/index55.mjs +1 -1
  53. package/dist/index56.mjs +1 -1
  54. package/dist/index57.mjs +1 -1
  55. package/dist/index58.mjs +1 -1
  56. package/dist/index59.mjs +1 -1
  57. package/dist/index60.mjs +21 -20
  58. package/dist/index61.mjs +2 -24
  59. package/dist/index62.mjs +153 -2
  60. package/dist/index63.mjs +4 -152
  61. package/dist/index64.mjs +22 -4
  62. package/dist/index67.mjs +1 -1
  63. package/dist/index73.mjs +1 -1
  64. package/package.json +2 -2
  65. package/src/components/Checkout.tsx +7 -9
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../../src/components/Checkout.tsx"],"names":[],"mappings":"AA4FA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxC,sCAAsC;IACtC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,4BAA4B;IAC5B,YAAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAID,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,OAAO,EACP,WAAW,EACX,SAAS,EACT,OAAO,EACP,gBAAgC,EAChC,YAAY,GACb,EAAE,aAAa,2CA22Bf"}
1
+ {"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../../src/components/Checkout.tsx"],"names":[],"mappings":"AA6FA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxC,sCAAsC;IACtC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,4BAA4B;IAC5B,YAAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAID,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,OAAO,EACP,WAAW,EACX,SAAS,EACT,OAAO,EACP,gBAAgC,EAChC,YAAY,GACb,EAAE,aAAa,2CAw2Bf"}
package/dist/index12.mjs CHANGED
@@ -1,74 +1,74 @@
1
1
  'use client';
2
- import { jsxs as a, jsx as e, Fragment as we } from "react/jsx-runtime";
3
- import { useState as x, useEffect as I, useMemo as $, useCallback as Ce } from "react";
4
- import { object as G, string as v, ValidationError as Pe } from "./index39.mjs";
2
+ import { jsxs as a, jsx as e, Fragment as Ce } from "react/jsx-runtime";
3
+ import { useState as x, useEffect as I, useMemo as O, useCallback as Pe } from "react";
4
+ import { object as G, string as v, ValidationError as ke } from "./index39.mjs";
5
5
  import "./index20.mjs";
6
6
  import "@tanstack/react-query";
7
- import { useGetDeliveryZones as ke } from "./index35.mjs";
8
- import { useCart as Me } from "./index3.mjs";
9
- import { Modal as ne } from "./index16.mjs";
7
+ import { useGetDeliveryZones as Me } from "./index35.mjs";
8
+ import { useCart as qe } from "./index3.mjs";
9
+ import { Modal as ie } from "./index16.mjs";
10
10
  import { FormInput as k } from "./index17.mjs";
11
- import { FormSelect as de } from "./index18.mjs";
12
- import { Button as B } from "./index13.mjs";
13
- import { Loader2 as W, ChevronLeft as qe, ChevronRight as Ie, CheckCircle as je, Package as ie, Banknote as ce, Mail as Ze, Phone as Se, ChevronDown as ze, Zap as Fe } from "lucide-react";
14
- import { formatCurrency as M, cn as C, getFbCookies as oe } from "./index19.mjs";
15
- import Le from "./index40.mjs";
11
+ import { FormSelect as ce } from "./index18.mjs";
12
+ import { Button as T } from "./index13.mjs";
13
+ import { Loader2 as K, ChevronLeft as Ie, ChevronRight as je, CheckCircle as Ze, Package as oe, Banknote as me, Mail as Se, Phone as ze, ChevronDown as Fe, Zap as Le } from "lucide-react";
14
+ import { formatCurrency as M, cn as C, getFbCookies as ue } from "./index19.mjs";
15
+ import Te from "./index40.mjs";
16
16
  import { usePaystackPayment as Be } from "./index41.mjs";
17
- const Te = (i) => i.replace(/\D/g, ""), _e = G({
17
+ const Ae = (i) => i.replace(/\D/g, ""), _e = G({
18
18
  firstName: v().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"),
19
19
  lastName: v().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"),
20
20
  email: v().required("Email is required").email("Please enter a valid email address"),
21
21
  phone: v().required("Phone number is required").test("nigerian-phone", "Please enter a valid Nigerian phone number (e.g. 0812 564 8668)", (i) => {
22
22
  if (!i) return !1;
23
- const q = Te(i);
23
+ const q = Ae(i);
24
24
  return [
25
25
  /^0[789]\d{9}$/
26
26
  // 0xxxxxxxxx (11 digits total)
27
27
  ].some((N) => N.test(q));
28
28
  })
29
- }), Ae = G({
29
+ }), Re = G({
30
30
  address: v().required("Street address is required").min(10, "Please provide a complete address"),
31
31
  city: v().required("City is required").min(3, "City name must be at least 3 characters"),
32
32
  state: v().required("State is required").test("not-empty", "State is required", (i) => !!i && i.trim() !== ""),
33
33
  deliveryZoneId: v().required("Delivery zone is required").test("not-empty", "Delivery zone is required", (i) => !!i && i.trim() !== "")
34
- }), Oe = G({
34
+ }), $e = G({
35
35
  paymentMethod: v().oneOf(["cod", "online"], "Please select a payment method").required("Payment method is required")
36
36
  });
37
- function at({
37
+ function rt({
38
38
  isOpen: i,
39
39
  onClose: q,
40
40
  initialData: n,
41
41
  onSuccess: N,
42
- onError: m,
43
- submitButtonText: me = "Place Order",
42
+ onError: c,
43
+ submitButtonText: he = "Place Order",
44
44
  refundPolicy: j
45
45
  }) {
46
- var E, D, ee, te, ae, re, se, le;
47
- const ue = "pk_live_dfb74efb5f74d2acbc253d5ca396ab9015ef0fa7", [c, b] = x("customer"), [Z, he] = x(void 0), [y, K] = x(void 0), [f, T] = x(null), { refetch: Y, isLoading: V, cart: s, updateCartMutation: _, checkoutMutation: ye, clearAndCreateNewCart: H } = Me(), U = Be({
48
- publicKey: ue,
46
+ var D, ee, te, ae, re, se, le, ne, de;
47
+ const [o, b] = x("customer"), [Z, ye] = x(void 0), [f, W] = x(void 0), [p, B] = x(null), { refetch: V, isLoading: Y, cart: s, updateCartMutation: A, checkoutMutation: fe, clearAndCreateNewCart: H } = qe(), U = (D = s == null ? void 0 : s.brand) == null ? void 0 : D.paystackPublicKey, J = Be({
48
+ publicKey: U || "",
49
49
  onSuccess: async (t) => {
50
50
  try {
51
- const { fbc: l, fbp: d } = oe(), o = await P.mutateAsync({
51
+ const { fbc: l, fbp: d } = ue(), m = await P.mutateAsync({
52
52
  firstName: r.firstName,
53
53
  lastName: r.lastName,
54
54
  email: r.email,
55
55
  phone: r.phone,
56
56
  address: r.address,
57
57
  city: r.city,
58
- deliveryZoneId: y || r.deliveryZoneId,
58
+ deliveryZoneId: f || r.deliveryZoneId,
59
59
  paymentMethod: r.paymentMethod,
60
60
  paystackReference: t.reference,
61
61
  fbc: l,
62
62
  fbp: d
63
63
  });
64
- if ("error" in o) {
65
- const R = o.error;
66
- m == null || m(new Error((R == null ? void 0 : R.message) || "Checkout failed"));
64
+ if ("error" in m) {
65
+ const $ = m.error;
66
+ c == null || c(new Error(($ == null ? void 0 : $.message) || "Checkout failed"));
67
67
  return;
68
68
  }
69
- T(o), H(), N == null || N(o.id);
69
+ B(m), H(), N == null || N(m.id);
70
70
  } catch (l) {
71
- m == null || m(l);
71
+ c == null || c(l);
72
72
  }
73
73
  },
74
74
  onClose: () => {
@@ -76,15 +76,15 @@ function at({
76
76
  }
77
77
  });
78
78
  I(() => {
79
- i && Y();
80
- }, [i, Y]);
81
- const { data: w } = ke(((E = s == null ? void 0 : s.brand) == null ? void 0 : E.id) || "", {
82
- enabled: !!((D = s == null ? void 0 : s.brand) != null && D.id)
83
- }), u = $(() => w == null ? void 0 : w.find((t) => t.id === Z), [w, Z]), p = $(() => u == null ? void 0 : u.zones.find((t) => t.id === y), [u, y]), P = ye;
79
+ i && V();
80
+ }, [i, V]);
81
+ const { data: w } = Me(((ee = s == null ? void 0 : s.brand) == null ? void 0 : ee.id) || "", {
82
+ enabled: !!((te = s == null ? void 0 : s.brand) != null && te.id)
83
+ }), u = O(() => w == null ? void 0 : w.find((t) => t.id === Z), [w, Z]), y = O(() => u == null ? void 0 : u.zones.find((t) => t.id === f), [u, f]), P = fe;
84
84
  I(() => {
85
- i || (T(null), b("customer"), P.reset());
85
+ i || (B(null), b("customer"), P.reset());
86
86
  }, [i]);
87
- const [r, A] = x({
87
+ const [r, _] = x({
88
88
  firstName: (n == null ? void 0 : n.firstName) || "",
89
89
  lastName: (n == null ? void 0 : n.lastName) || "",
90
90
  email: (n == null ? void 0 : n.email) || "",
@@ -98,9 +98,9 @@ function at({
98
98
  I(() => {
99
99
  i && b("customer");
100
100
  }, [i]);
101
- const [J, Q] = x(!1);
101
+ const [Q, X] = x(!1);
102
102
  I(() => {
103
- i && s && !n && !J && (A((t) => {
103
+ i && s && !n && !Q && (_((t) => {
104
104
  var l;
105
105
  return {
106
106
  ...t,
@@ -110,27 +110,27 @@ function at({
110
110
  phone: s.customerPhone || t.phone,
111
111
  deliveryZoneId: ((l = s.deliveryZone) == null ? void 0 : l.id) || t.deliveryZoneId
112
112
  };
113
- }), Q(!0)), i || Q(!1);
114
- }, [i, s, n, J]), I(() => {
115
- if (y) {
116
- const t = u == null ? void 0 : u.zones.find((l) => l.id === y);
117
- t && A((l) => ({
113
+ }), X(!0)), i || X(!1);
114
+ }, [i, s, n, Q]), I(() => {
115
+ if (f) {
116
+ const t = u == null ? void 0 : u.zones.find((l) => l.id === f);
117
+ t && _((l) => ({
118
118
  ...l,
119
119
  paymentMethod: t.allowOnline ? "online" : "cod"
120
120
  }));
121
121
  }
122
- }, [y, u]);
123
- const [h, S] = x({}), [O, fe] = x(!1), g = (t) => {
122
+ }, [f, u]);
123
+ const [h, S] = x({}), [R, pe] = x(!1), g = (t) => {
124
124
  const { name: l, value: d } = t.target;
125
- A((o) => ({ ...o, [l]: d })), h[l] && S((o) => ({ ...o, [l]: void 0 }));
126
- }, z = Ce(
125
+ _((m) => ({ ...m, [l]: d })), h[l] && S((m) => ({ ...m, [l]: void 0 }));
126
+ }, z = Pe(
127
127
  (t) => {
128
128
  const l = r[t];
129
129
  if (!l) return;
130
130
  const d = {};
131
- t === "firstName" ? d.customerFirstName = l : t === "lastName" ? d.customerLastName = l : t === "email" ? d.customerEmail = l : t === "phone" && (d.customerPhone = l), _.mutate(d);
131
+ t === "firstName" ? d.customerFirstName = l : t === "lastName" ? d.customerLastName = l : t === "email" ? d.customerEmail = l : t === "phone" && (d.customerPhone = l), A.mutate(d);
132
132
  },
133
- [r, _]
133
+ [r, A]
134
134
  ), F = (t) => {
135
135
  const l = {};
136
136
  try {
@@ -141,21 +141,21 @@ function at({
141
141
  address: r.address,
142
142
  city: r.city,
143
143
  state: Z || r.state || "",
144
- deliveryZoneId: y || r.deliveryZoneId || ""
144
+ deliveryZoneId: f || r.deliveryZoneId || ""
145
145
  };
146
- Ae.validateSync(d, { abortEarly: !1 });
147
- } else t === "payment" && Oe.validateSync(r, { abortEarly: !1 });
146
+ Re.validateSync(d, { abortEarly: !1 });
147
+ } else t === "payment" && $e.validateSync(r, { abortEarly: !1 });
148
148
  } catch (d) {
149
- d instanceof Pe && d.inner.forEach((o) => {
150
- o.path && (l[o.path] = o.message);
149
+ d instanceof ke && d.inner.forEach((m) => {
150
+ m.path && (l[m.path] = m.message);
151
151
  });
152
152
  }
153
153
  return S(l), Object.keys(l).length === 0;
154
- }, pe = () => {
155
- F(c) && (c === "customer" ? b("delivery") : c === "delivery" && b("payment"));
156
154
  }, ve = () => {
157
- c === "payment" ? b("delivery") : c === "delivery" && b("customer");
158
- }, Ne = async () => {
155
+ F(o) && (o === "customer" ? b("delivery") : o === "delivery" && b("payment"));
156
+ }, Ne = () => {
157
+ o === "payment" ? b("delivery") : o === "delivery" && b("customer");
158
+ }, be = async () => {
159
159
  if (!F("customer")) {
160
160
  b("customer");
161
161
  return;
@@ -166,12 +166,16 @@ function at({
166
166
  }
167
167
  if (F("payment")) {
168
168
  if (r.paymentMethod === "online") {
169
- if (!U.isLoaded) {
170
- m == null || m(new Error("Payment system is loading. Please try again."));
169
+ if (!U) {
170
+ c == null || c(new Error("Paystack is not configured. Please contact support."));
171
+ return;
172
+ }
173
+ if (!J.isLoaded) {
174
+ c == null || c(new Error("Payment system is loading. Please try again."));
171
175
  return;
172
176
  }
173
177
  const t = Math.round(s.pricing.total * 100);
174
- U.initializePayment({
178
+ J.initializePayment({
175
179
  email: r.email || (s == null ? void 0 : s.customerEmail) || "customer@example.com",
176
180
  amount: t,
177
181
  currency: "NGN",
@@ -194,109 +198,109 @@ function at({
194
198
  return;
195
199
  }
196
200
  try {
197
- const { fbc: t, fbp: l } = oe(), d = await P.mutateAsync({
201
+ const { fbc: t, fbp: l } = ue(), d = await P.mutateAsync({
198
202
  firstName: r.firstName,
199
203
  lastName: r.lastName,
200
204
  email: r.email,
201
205
  phone: r.phone,
202
206
  address: r.address,
203
207
  city: r.city,
204
- deliveryZoneId: y || r.deliveryZoneId,
208
+ deliveryZoneId: f || r.deliveryZoneId,
205
209
  paymentMethod: r.paymentMethod,
206
210
  fbc: t,
207
211
  fbp: l
208
212
  });
209
213
  if ("error" in d) {
210
- const o = d.error;
211
- m == null || m(new Error((o == null ? void 0 : o.message) || "Checkout failed"));
214
+ const m = d.error;
215
+ c == null || c(new Error((m == null ? void 0 : m.message) || "Checkout failed"));
212
216
  return;
213
217
  }
214
- T(d), H(), N == null || N(d.id);
218
+ B(d), H(), N == null || N(d.id);
215
219
  } catch (t) {
216
- m == null || m(t);
220
+ c == null || c(t);
217
221
  }
218
222
  }
219
- }, be = {
223
+ }, ge = {
220
224
  customer: "Customer Information",
221
225
  delivery: "Delivery Address",
222
226
  payment: "Payment Method"
223
- }, ge = $(() => be[c], [c]), xe = /* @__PURE__ */ a("div", { className: "space-y-3", children: [
224
- (c === "payment" || c === "delivery") && ((ee = s == null ? void 0 : s.pricing) == null ? void 0 : ee.total) && /* @__PURE__ */ a("div", { className: "text-sm text-black relative", children: [
225
- V && /* @__PURE__ */ e("div", { className: "absolute flex items-center justify-center inset-0 bg-white opacity-50", children: /* @__PURE__ */ e(W, { className: "animate-spin text-accent-500" }) }),
227
+ }, xe = O(() => ge[o], [o]), we = /* @__PURE__ */ a("div", { className: "space-y-3", children: [
228
+ (o === "payment" || o === "delivery") && ((ae = s == null ? void 0 : s.pricing) == null ? void 0 : ae.total) && /* @__PURE__ */ a("div", { className: "text-sm text-black relative", children: [
229
+ Y && /* @__PURE__ */ e("div", { className: "absolute flex items-center justify-center inset-0 bg-white opacity-50", children: /* @__PURE__ */ e(K, { className: "animate-spin text-accent-500" }) }),
226
230
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
227
231
  /* @__PURE__ */ e("span", { children: "Subtotal" }),
228
- /* @__PURE__ */ e("span", { children: M(((te = s == null ? void 0 : s.pricing) == null ? void 0 : te.subtotal) ?? 0) })
232
+ /* @__PURE__ */ e("span", { children: M(((re = s == null ? void 0 : s.pricing) == null ? void 0 : re.subtotal) ?? 0) })
229
233
  ] }),
230
234
  s.pricing.discount && /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
231
235
  /* @__PURE__ */ e("span", { children: "Discount" }),
232
236
  /* @__PURE__ */ a("span", { className: "text-green-600", children: [
233
237
  "-",
234
- M(((re = (ae = s == null ? void 0 : s.pricing) == null ? void 0 : ae.discount) == null ? void 0 : re.amount) ?? 0)
238
+ M(((le = (se = s == null ? void 0 : s.pricing) == null ? void 0 : se.discount) == null ? void 0 : le.amount) ?? 0)
235
239
  ] })
236
240
  ] }),
237
241
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
238
242
  /* @__PURE__ */ e("span", { children: "Delivery Fee" }),
239
- /* @__PURE__ */ e("span", { children: M(((se = s == null ? void 0 : s.pricing) == null ? void 0 : se.deliveryCharge) ?? 0) })
243
+ /* @__PURE__ */ e("span", { children: M(((ne = s == null ? void 0 : s.pricing) == null ? void 0 : ne.deliveryCharge) ?? 0) })
240
244
  ] }),
241
245
  /* @__PURE__ */ e("hr", { className: "border-gray-200 my-2" }),
242
246
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
243
247
  /* @__PURE__ */ e("span", { children: "Total" }),
244
- /* @__PURE__ */ e("span", { children: M(((le = s == null ? void 0 : s.pricing) == null ? void 0 : le.total) ?? 0) })
248
+ /* @__PURE__ */ e("span", { children: M(((de = s == null ? void 0 : s.pricing) == null ? void 0 : de.total) ?? 0) })
245
249
  ] })
246
250
  ] }),
247
251
  /* @__PURE__ */ a("div", { className: "flex gap-3", children: [
248
- c !== "customer" && /* @__PURE__ */ a(
249
- B,
252
+ o !== "customer" && /* @__PURE__ */ a(
253
+ T,
250
254
  {
251
255
  type: "button",
252
256
  variant: "outline",
253
- onClick: ve,
257
+ onClick: Ne,
254
258
  className: "flex-1 border-gray-400",
255
259
  size: "lg",
256
260
  children: [
257
- /* @__PURE__ */ e(qe, { className: "mr-2 h-4 w-4" }),
261
+ /* @__PURE__ */ e(Ie, { className: "mr-2 h-4 w-4" }),
258
262
  "Back"
259
263
  ]
260
264
  }
261
265
  ),
262
- c !== "payment" ? /* @__PURE__ */ a(
263
- B,
266
+ o !== "payment" ? /* @__PURE__ */ a(
267
+ T,
264
268
  {
265
269
  type: "button",
266
- onClick: pe,
270
+ onClick: ve,
267
271
  className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
268
272
  size: "lg",
269
273
  children: [
270
274
  "Next",
271
- /* @__PURE__ */ e(Ie, { className: "ml-2 h-4 w-4" })
275
+ /* @__PURE__ */ e(je, { className: "ml-2 h-4 w-4" })
272
276
  ]
273
277
  }
274
278
  ) : /* @__PURE__ */ e(
275
- B,
279
+ T,
276
280
  {
277
281
  type: "button",
278
- onClick: Ne,
282
+ onClick: be,
279
283
  disabled: P.isPending,
280
284
  className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
281
285
  size: "lg",
282
- children: P.isPending ? /* @__PURE__ */ a(we, { children: [
283
- /* @__PURE__ */ e(W, { className: "mr-2 h-4 w-4 animate-spin" }),
286
+ children: P.isPending ? /* @__PURE__ */ a(Ce, { children: [
287
+ /* @__PURE__ */ e(K, { className: "mr-2 h-4 w-4 animate-spin" }),
284
288
  "Processing..."
285
- ] }) : me
289
+ ] }) : he
286
290
  }
287
291
  )
288
292
  ] }),
289
293
  P.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." })
290
294
  ] }), L = (t) => !(s != null && s.availablePaymentMethods.includes(t));
291
- if (f)
295
+ if (p)
292
296
  return /* @__PURE__ */ e(
293
- ne,
297
+ ie,
294
298
  {
295
299
  isOpen: i,
296
300
  onClose: q,
297
301
  title: "Order Placed Successfully!",
298
302
  footer: /* @__PURE__ */ e(
299
- B,
303
+ T,
300
304
  {
301
305
  onClick: q,
302
306
  className: "w-full bg-accent-500 text-white hover:bg-accent-600",
@@ -307,43 +311,43 @@ function at({
307
311
  size: "lg",
308
312
  contentClassName: "p-6",
309
313
  children: /* @__PURE__ */ a("div", { className: "text-center space-y-6", children: [
310
- /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e("div", { className: "w-20 h-20 bg-green-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ e(je, { className: "h-12 w-12 text-green-600" }) }) }),
314
+ /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e("div", { className: "w-20 h-20 bg-green-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ e(Ze, { className: "h-12 w-12 text-green-600" }) }) }),
311
315
  /* @__PURE__ */ a("div", { className: "space-y-2", children: [
312
316
  /* @__PURE__ */ e("h3", { className: "text-2xl font-bold text-gray-900", children: "Thank You!" }),
313
317
  /* @__PURE__ */ e("p", { className: "text-gray-600", children: "Your order has been placed successfully." })
314
318
  ] }),
315
319
  /* @__PURE__ */ a("div", { className: "bg-gray-50 rounded-lg p-6 space-y-4", children: [
316
320
  /* @__PURE__ */ a("div", { className: "flex items-center justify-center space-x-2 text-gray-700", children: [
317
- /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
321
+ /* @__PURE__ */ e(oe, { className: "h-5 w-5" }),
318
322
  /* @__PURE__ */ a("span", { className: "font-medium", children: [
319
323
  "Order #",
320
- f.orderNumber
324
+ p.orderNumber
321
325
  ] })
322
326
  ] }),
323
327
  /* @__PURE__ */ a("div", { className: "border-t border-gray-200 pt-4 space-y-3", children: [
324
328
  /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
325
329
  /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Customer" }),
326
330
  /* @__PURE__ */ a("span", { className: "font-medium text-gray-900", children: [
327
- f.firstName,
331
+ p.firstName,
328
332
  " ",
329
- f.lastName
333
+ p.lastName
330
334
  ] })
331
335
  ] }),
332
336
  /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
333
337
  /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Phone" }),
334
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: f.phone })
338
+ /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: p.phone })
335
339
  ] }),
336
- f.email && /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
340
+ p.email && /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
337
341
  /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Email" }),
338
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: f.email })
342
+ /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: p.email })
339
343
  ] }),
340
344
  /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
341
345
  /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Payment Method" }),
342
- /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: f.paymentMethod === "cod" ? "Cash on Delivery" : "Online Payment" })
346
+ /* @__PURE__ */ e("span", { className: "font-medium text-gray-900", children: p.paymentMethod === "cod" ? "Cash on Delivery" : "Online Payment" })
343
347
  ] }),
344
348
  /* @__PURE__ */ a("div", { className: "flex justify-between text-sm", children: [
345
349
  /* @__PURE__ */ e("span", { className: "text-gray-600", children: "Total" }),
346
- /* @__PURE__ */ e("span", { className: "font-bold text-gray-900", children: M(f.totalPrice) })
350
+ /* @__PURE__ */ e("span", { className: "font-bold text-gray-900", children: M(p.totalPrice) })
347
351
  ] })
348
352
  ] })
349
353
  ] }),
@@ -355,27 +359,27 @@ function at({
355
359
  ] })
356
360
  }
357
361
  );
358
- const X = p && (c === "delivery" || c === "payment") && (p.waybillOnly || !(p != null && p.allowCOD));
362
+ const E = y && (o === "delivery" || o === "payment") && (y.waybillOnly || !(y != null && y.allowCOD));
359
363
  return /* @__PURE__ */ e(
360
- ne,
364
+ ie,
361
365
  {
362
366
  isOpen: i,
363
367
  onClose: q,
364
- title: ge,
365
- footer: xe,
368
+ title: xe,
369
+ footer: we,
366
370
  size: "lg",
367
371
  contentClassName: "p-0",
368
- children: V ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[300px]", children: /* @__PURE__ */ e(W, { 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: [
369
- X && /* @__PURE__ */ a("div", { className: "space-y-3 p-4 pb-0", children: [
370
- p.waybillOnly && /* @__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: [
371
- /* @__PURE__ */ e(ie, { className: "h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" }),
372
+ children: Y ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[300px]", children: /* @__PURE__ */ e(K, { 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: [
373
+ E && /* @__PURE__ */ a("div", { className: "space-y-3 p-4 pb-0", children: [
374
+ y.noteTitle && y.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: [
375
+ /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" }),
372
376
  /* @__PURE__ */ a("div", { className: "space-y-1", children: [
373
- /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-amber-900", children: "Waybill Delivery" }),
374
- /* @__PURE__ */ e("p", { className: "text-sm text-amber-800", children: "We deliver orders to this location using waybill service. You'll need to pick up your order at a motor park near you." })
377
+ /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-amber-900", children: y.noteTitle }),
378
+ /* @__PURE__ */ e("p", { className: "text-sm text-amber-800", children: y.noteContent })
375
379
  ] })
376
380
  ] }) }),
377
- !(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: [
378
- /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
381
+ !(y != null && y.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: [
382
+ /* @__PURE__ */ e(me, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
379
383
  /* @__PURE__ */ a("div", { className: "space-y-1", children: [
380
384
  /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-blue-900", children: "Cash on Delivery Unavailable" }),
381
385
  /* @__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." })
@@ -387,9 +391,9 @@ function at({
387
391
  {
388
392
  className: C(
389
393
  "flex transition-transform duration-300 ease-in-out w-full",
390
- c === "customer" && "translate-x-0",
391
- c === "delivery" && "-translate-x-full",
392
- c === "payment" && "-translate-x-[200%]"
394
+ o === "customer" && "translate-x-0",
395
+ o === "delivery" && "-translate-x-full",
396
+ o === "payment" && "-translate-x-[200%]"
393
397
  ),
394
398
  children: [
395
399
  /* @__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: [
@@ -431,7 +435,7 @@ function at({
431
435
  onChange: g,
432
436
  onBlur: () => z("email"),
433
437
  error: h.email,
434
- icon: /* @__PURE__ */ e(Ze, { size: 16 }),
438
+ icon: /* @__PURE__ */ e(Se, { size: 16 }),
435
439
  autoCorrect: "off",
436
440
  required: !0
437
441
  }
@@ -448,7 +452,7 @@ function at({
448
452
  placeholder: "e.g. 08012345678",
449
453
  maxLength: 18,
450
454
  error: h.phone,
451
- icon: /* @__PURE__ */ e(Se, { size: 16 }),
455
+ icon: /* @__PURE__ */ e(ze, { size: 16 }),
452
456
  autoCorrect: "off",
453
457
  required: !0,
454
458
  className: "font-semibold"
@@ -484,15 +488,15 @@ function at({
484
488
  }
485
489
  ),
486
490
  /* @__PURE__ */ a(
487
- de,
491
+ ce,
488
492
  {
489
493
  label: "State",
490
494
  name: "state",
491
495
  value: Z || "",
492
496
  onChange: (t) => {
493
- K("");
497
+ W("");
494
498
  const l = t.target.value;
495
- he(l || void 0), h.state && S((d) => ({ ...d, state: void 0 }));
499
+ ye(l || void 0), h.state && S((d) => ({ ...d, state: void 0 }));
496
500
  },
497
501
  error: h.state,
498
502
  required: !0,
@@ -503,13 +507,13 @@ function at({
503
507
  }
504
508
  ),
505
509
  /* @__PURE__ */ a(
506
- de,
510
+ ce,
507
511
  {
508
512
  label: "Delivery Zone",
509
- value: y || "",
513
+ value: f || "",
510
514
  onChange: (t) => {
511
515
  const l = t.target.value;
512
- K(l || void 0), h.deliveryZoneId && S((d) => ({ ...d, deliveryZoneId: void 0 })), l && _.mutate({ deliveryZoneId: l });
516
+ W(l || void 0), h.deliveryZoneId && S((d) => ({ ...d, deliveryZoneId: void 0 })), l && A.mutate({ deliveryZoneId: l });
513
517
  },
514
518
  disabled: !u,
515
519
  error: h.deliveryZoneId,
@@ -528,22 +532,22 @@ function at({
528
532
  ] })
529
533
  ] }) }),
530
534
  /* @__PURE__ */ e("div", { className: "w-full min-w-full flex-shrink-0 p-4", children: /* @__PURE__ */ a("div", { className: "space-y-6", children: [
531
- j && /* @__PURE__ */ a("div", { className: `border border-gray-200 rounded-lg ${X ? "mt-4" : ""}`, children: [
535
+ j && /* @__PURE__ */ a("div", { className: `border border-gray-200 rounded-lg ${E ? "mt-4" : ""}`, children: [
532
536
  /* @__PURE__ */ a(
533
537
  "button",
534
538
  {
535
539
  type: "button",
536
- onClick: () => fe(!O),
540
+ onClick: () => pe(!R),
537
541
  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",
538
542
  children: [
539
543
  /* @__PURE__ */ e("span", { className: "text-sm font-bold text-accent-700", children: j.title || "🤔 Curious about Refunds?" }),
540
544
  /* @__PURE__ */ e(
541
- ze,
545
+ Fe,
542
546
  {
543
547
  size: 16,
544
548
  className: C(
545
549
  "transform transition-transform duration-200 text-gray-500",
546
- O && "rotate-180"
550
+ R && "rotate-180"
547
551
  )
548
552
  }
549
553
  )
@@ -555,7 +559,7 @@ function at({
555
559
  {
556
560
  className: C(
557
561
  "overflow-hidden transition-all duration-300 ease-in-out",
558
- O ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
562
+ R ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
559
563
  ),
560
564
  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: j.policies && /* @__PURE__ */ a("div", { children: [
561
565
  /* @__PURE__ */ e("h4", { className: "font-bold text-gray-800 mb-2", children: "Our Refund Policy" }),
@@ -597,7 +601,7 @@ function at({
597
601
  "p-3 rounded-full",
598
602
  r.paymentMethod === "online" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
599
603
  ),
600
- children: /* @__PURE__ */ e(Fe, { size: 24 })
604
+ children: /* @__PURE__ */ e(Le, { size: 24 })
601
605
  }
602
606
  ),
603
607
  /* @__PURE__ */ a("div", { children: [
@@ -606,7 +610,7 @@ function at({
606
610
  /* @__PURE__ */ e(
607
611
  "img",
608
612
  {
609
- src: Le,
613
+ src: Te,
610
614
  alt: "Paystack",
611
615
  className: "h-4 w-auto mt-2 mx-auto"
612
616
  }
@@ -646,7 +650,7 @@ function at({
646
650
  "p-3 rounded-full",
647
651
  r.paymentMethod === "cod" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
648
652
  ),
649
- children: /* @__PURE__ */ e(ce, { size: 24 })
653
+ children: /* @__PURE__ */ e(me, { size: 24 })
650
654
  }
651
655
  ),
652
656
  /* @__PURE__ */ a("div", { children: [
@@ -669,5 +673,5 @@ function at({
669
673
  );
670
674
  }
671
675
  export {
672
- at as Checkout
676
+ rt as Checkout
673
677
  };
package/dist/index134.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import f from "./index75.mjs";
3
- import d from "./index205.mjs";
3
+ import d from "./index207.mjs";
4
4
  function l(e) {
5
5
  return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
6
6
  }
package/dist/index136.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import r from "./index206.mjs";
2
+ import r from "./index208.mjs";
3
3
  import p from "./index83.mjs";
4
4
  import l from "./index79.mjs";
5
5
  import m from "./index81.mjs";
package/dist/index137.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import r from "./index207.mjs";
3
- import f from "./index208.mjs";
2
+ import r from "./index209.mjs";
3
+ import f from "./index210.mjs";
4
4
  function u(l, i, t) {
5
5
  let o = !r(i);
6
6
  return l && (o || t == !1) ? f(l, i) : i;