@instockng/storefront-ui 1.0.101 → 1.0.102
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.
- package/dist/components/Checkout.d.ts.map +1 -1
- package/dist/index100.mjs +2 -9
- package/dist/index101.mjs +78 -70
- package/dist/index102.mjs +53 -3
- package/dist/index103.mjs +6 -2
- package/dist/index104.mjs +4 -82
- package/dist/index105.mjs +176 -51
- package/dist/index106.mjs +53 -6
- package/dist/index107.mjs +69 -5
- package/dist/index108.mjs +37 -179
- package/dist/index109.mjs +41 -51
- package/dist/index110.mjs +2 -69
- package/dist/index150.mjs +2 -2
- package/dist/index151.mjs +1 -1
- package/dist/index152.mjs +6 -6
- package/dist/index153.mjs +2 -2
- package/dist/index154.mjs +2 -2
- package/dist/index156.mjs +2 -2
- package/dist/index157.mjs +2 -2
- package/dist/index158.mjs +1 -1
- package/dist/index16.mjs +13 -13
- package/dist/index160.mjs +8 -8
- package/dist/index161.mjs +8 -8
- package/dist/index166.mjs +1 -1
- package/dist/index167.mjs +1 -1
- package/dist/index168.mjs +1 -1
- package/dist/index169.mjs +1 -1
- package/dist/index170.mjs +1 -1
- package/dist/index172.mjs +1 -1
- package/dist/index173.mjs +1 -1
- package/dist/index175.mjs +2 -2
- package/dist/index176.mjs +1 -1
- package/dist/index181.mjs +2 -2
- package/dist/index183.mjs +1 -1
- package/dist/index185.mjs +2 -2
- package/dist/index186.mjs +5 -5
- package/dist/index189.mjs +1 -1
- package/dist/index192.mjs +1 -1
- package/dist/index195.mjs +1 -1
- package/dist/index196.mjs +1 -1
- package/dist/index20.mjs +98 -95
- package/dist/index200.mjs +1 -1
- package/dist/index202.mjs +1 -1
- package/dist/index206.mjs +1 -1
- package/dist/index208.mjs +1 -1
- package/dist/index217.mjs +2 -2
- package/dist/index219.mjs +1 -1
- package/dist/index220.mjs +1 -1
- package/dist/index221.mjs +31 -2
- package/dist/index222.mjs +11 -2
- package/dist/index223.mjs +4 -2
- package/dist/index224.mjs +4 -2
- package/dist/index225.mjs +13 -2
- package/dist/index226.mjs +7 -2
- package/dist/index227.mjs +12 -2
- package/dist/index228.mjs +5 -2
- package/dist/index229.mjs +33 -108
- package/dist/index230.mjs +31 -2
- package/dist/index231.mjs +28 -2
- package/dist/index232.mjs +58 -34
- package/dist/index233.mjs +2 -2
- package/dist/index234.mjs +2 -244
- package/dist/index235.mjs +2 -2
- package/dist/index236.mjs +2 -33
- package/dist/index237.mjs +2 -65
- package/dist/index238.mjs +2 -25
- package/dist/index239.mjs +108 -2
- package/dist/index240.mjs +2 -2
- package/dist/index242.mjs +2 -2
- package/dist/index243.mjs +2 -2
- package/dist/index244.mjs +37 -2
- package/dist/index245.mjs +2 -2
- package/dist/index246.mjs +2 -2
- package/dist/index247.mjs +244 -2
- package/dist/index249.mjs +33 -2
- package/dist/index250.mjs +65 -13
- package/dist/index251.mjs +25 -7
- package/dist/index252.mjs +2 -31
- package/dist/index253.mjs +2 -11
- package/dist/index254.mjs +2 -4
- package/dist/index255.mjs +2 -4
- package/dist/index256.mjs +2 -12
- package/dist/index257.mjs +2 -5
- package/dist/index258.mjs +2 -33
- package/dist/index259.mjs +4 -31
- package/dist/index260.mjs +2 -28
- package/dist/index261.mjs +2 -61
- package/dist/index262.mjs +2 -2
- package/dist/index263.mjs +2 -4
- package/dist/index264.mjs +3 -2
- package/dist/index265.mjs +2 -18
- package/dist/index266.mjs +2 -47
- package/dist/index268.mjs +17 -2
- package/dist/index269.mjs +13 -2
- package/dist/index270.mjs +6 -2
- package/dist/index271.mjs +30 -2
- package/dist/index272.mjs +2 -91
- package/dist/index273.mjs +18 -3
- package/dist/index274.mjs +47 -2
- package/dist/index275.mjs +2 -2
- package/dist/index276.mjs +2 -2
- package/dist/index277.mjs +2 -17
- package/dist/index278.mjs +2 -13
- package/dist/index279.mjs +91 -6
- package/dist/index280.mjs +2 -30
- package/dist/index45.mjs +1 -1
- package/dist/index55.mjs +1 -1
- package/dist/index60.mjs +17 -17
- package/dist/index61.mjs +2 -2
- package/dist/index78.mjs +23 -2
- package/dist/index79.mjs +2 -23
- package/dist/index82.mjs +1 -1
- package/dist/index91.mjs +235 -2
- package/dist/index92.mjs +6 -37
- package/dist/index93.mjs +130 -39
- package/dist/index94.mjs +62 -229
- package/dist/index95.mjs +86 -5
- package/dist/index96.mjs +26 -131
- package/dist/index97.mjs +8 -67
- package/dist/index98.mjs +71 -83
- package/dist/index99.mjs +3 -28
- package/package.json +1 -1
- package/src/components/Checkout.stories.tsx +1 -1
- package/src/components/Checkout.tsx +13 -6
- package/src/components/ShoppingCart.tsx +1 -1
package/dist/index166.mjs
CHANGED
package/dist/index167.mjs
CHANGED
package/dist/index168.mjs
CHANGED
package/dist/index169.mjs
CHANGED
package/dist/index170.mjs
CHANGED
package/dist/index172.mjs
CHANGED
package/dist/index173.mjs
CHANGED
package/dist/index175.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { __exports as e } from "./
|
|
3
|
-
import { __require as f } from "./
|
|
2
|
+
import { __exports as e } from "./index238.mjs";
|
|
3
|
+
import { __require as f } from "./index239.mjs";
|
|
4
4
|
import { __require as _ } from "./index120.mjs";
|
|
5
5
|
var i;
|
|
6
6
|
function R() {
|
package/dist/index176.mjs
CHANGED
package/dist/index181.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { __exports as u } from "./
|
|
3
|
-
import { __require as d } from "./
|
|
2
|
+
import { __exports as u } from "./index243.mjs";
|
|
3
|
+
import { __require as d } from "./index244.mjs";
|
|
4
4
|
var a;
|
|
5
5
|
function h() {
|
|
6
6
|
return a ? u : (a = 1, function(c) {
|
package/dist/index183.mjs
CHANGED
package/dist/index185.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { __exports as n } from "./
|
|
3
|
-
import { __require as d } from "./
|
|
2
|
+
import { __exports as n } from "./index246.mjs";
|
|
3
|
+
import { __require as d } from "./index247.mjs";
|
|
4
4
|
var o;
|
|
5
5
|
function p() {
|
|
6
6
|
return o ? n : (o = 1, function(i) {
|
package/dist/index186.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { __exports as A } from "./
|
|
3
|
-
import { __require as T } from "./
|
|
2
|
+
import { __exports as A } from "./index248.mjs";
|
|
3
|
+
import { __require as T } from "./index247.mjs";
|
|
4
4
|
import { __require as L } from "./index189.mjs";
|
|
5
|
-
import { __require as N } from "./
|
|
5
|
+
import { __require as N } from "./index249.mjs";
|
|
6
6
|
import { __require as U } from "./index181.mjs";
|
|
7
|
-
import { __require as j } from "./
|
|
8
|
-
import { __require as v } from "./
|
|
7
|
+
import { __require as j } from "./index250.mjs";
|
|
8
|
+
import { __require as v } from "./index251.mjs";
|
|
9
9
|
var S;
|
|
10
10
|
function W() {
|
|
11
11
|
return S ? A : (S = 1, function(R) {
|
package/dist/index189.mjs
CHANGED
package/dist/index192.mjs
CHANGED
package/dist/index195.mjs
CHANGED
package/dist/index196.mjs
CHANGED
package/dist/index20.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs as a, jsx as e, Fragment as O } from "react/jsx-runtime";
|
|
3
|
-
import { useState as C, useEffect as
|
|
3
|
+
import { useState as C, useEffect as Z, useMemo as V, useCallback as qe } from "react";
|
|
4
4
|
import { object as Q, string as S, ValidationError as _e } from "./index51.mjs";
|
|
5
5
|
import "./index28.mjs";
|
|
6
6
|
import "@tanstack/react-query";
|
|
7
|
-
import { useGetDeliveryZones as
|
|
8
|
-
import { useCart as
|
|
7
|
+
import { useGetDeliveryZones as Le } from "./index44.mjs";
|
|
8
|
+
import { useCart as Ze } from "./index3.mjs";
|
|
9
9
|
import { Modal as fe } from "./index24.mjs";
|
|
10
10
|
import { FormInput as W } from "./index25.mjs";
|
|
11
11
|
import { FormSelect as ve } from "./index26.mjs";
|
|
12
12
|
import { Button as R } from "./index21.mjs";
|
|
13
|
-
import { Loader2 as U, ChevronLeft as
|
|
13
|
+
import { Loader2 as U, ChevronLeft as ze, ChevronRight as Fe, Package as ge, Banknote as Ne, Phone as Te, ChevronDown as Ae, Zap as Be } from "lucide-react";
|
|
14
14
|
import { PostPurchaseUpsell as We } from "./index52.mjs";
|
|
15
|
-
import { formatCurrency as _, cn as
|
|
15
|
+
import { formatCurrency as _, cn as M, getFbCookies as Y, getTikTokCookies as J } from "./index27.mjs";
|
|
16
16
|
import Re from "./index53.mjs";
|
|
17
17
|
import { usePaystackPayment as Ue } from "./index54.mjs";
|
|
18
18
|
const $e = "2348125648668", He = `https://wa.me/${$e}`, Ke = (d) => d.replace(/\D/g, ""), $ = (d) => {
|
|
19
|
-
const x = d.trim().split(/\s+/),
|
|
20
|
-
return { firstName:
|
|
19
|
+
const x = d.trim().split(/\s+/), i = x[0] || "", b = x.slice(1).join(" ") || "-";
|
|
20
|
+
return { firstName: i, lastName: b };
|
|
21
21
|
}, Ge = Q({
|
|
22
22
|
fullName: S().required("Name is required").min(2, "Name must be at least 2 characters").max(100, "Name must be less than 100 characters"),
|
|
23
23
|
phone: S().required("Phone number is required").test("nigerian-phone", "Please enter a valid Nigerian phone number (e.g. 0812 564 8668)", (d) => {
|
|
@@ -39,21 +39,21 @@ const $e = "2348125648668", He = `https://wa.me/${$e}`, Ke = (d) => d.replace(/\
|
|
|
39
39
|
function mt({
|
|
40
40
|
isOpen: d,
|
|
41
41
|
onClose: x,
|
|
42
|
-
initialData:
|
|
42
|
+
initialData: i,
|
|
43
43
|
onSuccess: b,
|
|
44
44
|
onError: c,
|
|
45
45
|
submitButtonText: be = "Place Order",
|
|
46
|
-
refundPolicy:
|
|
46
|
+
refundPolicy: z
|
|
47
47
|
}) {
|
|
48
48
|
var ie, de, oe, ce, me, he, ue, pe, ye;
|
|
49
|
-
const [m, w] = C("customer"), [
|
|
49
|
+
const [m, w] = C("customer"), [F, xe] = C(void 0), [y, X] = C(void 0), [f, H] = C(null), { refetch: E, isLoading: D, cart: t, updateCartMutation: P, checkoutMutation: we, clearAndCreateNewCart: ee } = Ze(), te = (ie = t == null ? void 0 : t.brand) == null ? void 0 : ie.paystackPublicKey, ae = Ue({
|
|
50
50
|
isOpen: d,
|
|
51
51
|
publicKey: te || "",
|
|
52
52
|
onSuccess: async (n) => {
|
|
53
53
|
try {
|
|
54
|
-
const { fbc: s, fbp:
|
|
54
|
+
const { fbc: s, fbp: l } = Y(), { ttp: o, ttclid: g } = J(), { firstName: p, lastName: L } = $(r.fullName), N = await j.mutateAsync({
|
|
55
55
|
firstName: p,
|
|
56
|
-
lastName:
|
|
56
|
+
lastName: L,
|
|
57
57
|
phone: r.phone,
|
|
58
58
|
address: r.address,
|
|
59
59
|
city: r.city,
|
|
@@ -61,16 +61,16 @@ function mt({
|
|
|
61
61
|
paymentMethod: r.paymentMethod,
|
|
62
62
|
paystackReference: n.reference,
|
|
63
63
|
fbc: s,
|
|
64
|
-
fbp:
|
|
64
|
+
fbp: l,
|
|
65
65
|
ttp: o,
|
|
66
|
-
ttclid:
|
|
66
|
+
ttclid: g
|
|
67
67
|
});
|
|
68
|
-
if ("error" in
|
|
69
|
-
const
|
|
70
|
-
c == null || c(new Error((
|
|
68
|
+
if ("error" in N) {
|
|
69
|
+
const I = N.error;
|
|
70
|
+
c == null || c(new Error((I == null ? void 0 : I.message) || "Checkout failed"));
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
H(
|
|
73
|
+
H(N), ee(), b == null || b(N);
|
|
74
74
|
} catch (s) {
|
|
75
75
|
c == null || c(s);
|
|
76
76
|
}
|
|
@@ -79,43 +79,43 @@ function mt({
|
|
|
79
79
|
console.log("Payment popup closed by user");
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
Z(() => {
|
|
83
83
|
d && E();
|
|
84
84
|
}, [d, E]);
|
|
85
|
-
const { data: k } =
|
|
85
|
+
const { data: k } = Le(((de = t == null ? void 0 : t.brand) == null ? void 0 : de.id) || "", {
|
|
86
86
|
enabled: !!((oe = t == null ? void 0 : t.brand) != null && oe.id)
|
|
87
|
-
}), u = V(() => k == null ? void 0 : k.find((n) => n.id ===
|
|
88
|
-
|
|
87
|
+
}), u = V(() => k == null ? void 0 : k.find((n) => n.id === F), [k, F]), h = V(() => u == null ? void 0 : u.zones.find((n) => n.id === y), [u, y]), j = we;
|
|
88
|
+
Z(() => {
|
|
89
89
|
d || (H(null), w("customer"), j.reset());
|
|
90
90
|
}, [d]);
|
|
91
91
|
const [r, K] = C({
|
|
92
|
-
fullName: (
|
|
93
|
-
phone: (
|
|
94
|
-
address: (
|
|
95
|
-
city: (
|
|
96
|
-
deliveryZoneId: (
|
|
97
|
-
paymentMethod: (
|
|
98
|
-
notes: (
|
|
92
|
+
fullName: (i == null ? void 0 : i.fullName) || "",
|
|
93
|
+
phone: (i == null ? void 0 : i.phone) || "",
|
|
94
|
+
address: (i == null ? void 0 : i.address) || "",
|
|
95
|
+
city: (i == null ? void 0 : i.city) || "",
|
|
96
|
+
deliveryZoneId: (i == null ? void 0 : i.deliveryZoneId) || "",
|
|
97
|
+
paymentMethod: (i == null ? void 0 : i.paymentMethod) || "online",
|
|
98
|
+
notes: (i == null ? void 0 : i.notes) || ""
|
|
99
99
|
});
|
|
100
|
-
|
|
100
|
+
Z(() => {
|
|
101
101
|
d && w("customer");
|
|
102
102
|
}, [d]);
|
|
103
|
-
const [
|
|
104
|
-
|
|
105
|
-
if (d && t && !
|
|
103
|
+
const [se, re] = C(!1);
|
|
104
|
+
Z(() => {
|
|
105
|
+
if (d && t && !i && !se) {
|
|
106
106
|
const n = [t.customerFirstName, t.customerLastName].filter(Boolean).join(" ");
|
|
107
107
|
K((s) => {
|
|
108
|
-
var
|
|
108
|
+
var l;
|
|
109
109
|
return {
|
|
110
110
|
...s,
|
|
111
111
|
fullName: n || s.fullName,
|
|
112
112
|
phone: t.customerPhone || s.phone,
|
|
113
|
-
deliveryZoneId: ((
|
|
113
|
+
deliveryZoneId: ((l = t.deliveryZone) == null ? void 0 : l.id) || s.deliveryZoneId
|
|
114
114
|
};
|
|
115
|
-
}),
|
|
115
|
+
}), re(!0);
|
|
116
116
|
}
|
|
117
|
-
d ||
|
|
118
|
-
}, [d, t,
|
|
117
|
+
d || re(!1);
|
|
118
|
+
}, [d, t, i, se]), Z(() => {
|
|
119
119
|
if (y) {
|
|
120
120
|
const n = u == null ? void 0 : u.zones.find((s) => s.id === y);
|
|
121
121
|
n && K((s) => ({
|
|
@@ -124,16 +124,16 @@ function mt({
|
|
|
124
124
|
}));
|
|
125
125
|
}
|
|
126
126
|
}, [y, u]);
|
|
127
|
-
const [v,
|
|
128
|
-
const { name: s, value:
|
|
129
|
-
K((o) => ({ ...o, [s]:
|
|
127
|
+
const [v, T] = C({}), [G, Ce] = C(!1), q = (n) => {
|
|
128
|
+
const { name: s, value: l } = n.target;
|
|
129
|
+
K((o) => ({ ...o, [s]: l })), v[s] && T((o) => ({ ...o, [s]: void 0 }));
|
|
130
130
|
}, ne = qe(
|
|
131
131
|
(n) => {
|
|
132
132
|
const s = r[n];
|
|
133
133
|
if (s)
|
|
134
134
|
if (n === "fullName") {
|
|
135
|
-
const { firstName:
|
|
136
|
-
P.mutate({ customerFirstName:
|
|
135
|
+
const { firstName: l, lastName: o } = $(s);
|
|
136
|
+
P.mutate({ customerFirstName: l, customerLastName: o });
|
|
137
137
|
} else n === "phone" && P.mutate({ customerPhone: s });
|
|
138
138
|
},
|
|
139
139
|
[r, P]
|
|
@@ -143,25 +143,25 @@ function mt({
|
|
|
143
143
|
if (n === "customer")
|
|
144
144
|
Ge.validateSync(r, { abortEarly: !1 });
|
|
145
145
|
else if (n === "delivery") {
|
|
146
|
-
const
|
|
146
|
+
const l = {
|
|
147
147
|
address: r.address,
|
|
148
148
|
city: r.city,
|
|
149
|
-
state:
|
|
149
|
+
state: F || r.state || "",
|
|
150
150
|
deliveryZoneId: y || r.deliveryZoneId || ""
|
|
151
151
|
};
|
|
152
|
-
Oe.validateSync(
|
|
152
|
+
Oe.validateSync(l, { abortEarly: !1 });
|
|
153
153
|
} else n === "payment" && Ve.validateSync(r, { abortEarly: !1 });
|
|
154
|
-
} catch (
|
|
155
|
-
|
|
154
|
+
} catch (l) {
|
|
155
|
+
l instanceof _e && l.inner.forEach((o) => {
|
|
156
156
|
o.path && (s[o.path] = o.message);
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
return
|
|
159
|
+
return T(s), Object.keys(s).length === 0;
|
|
160
160
|
}, Pe = () => {
|
|
161
161
|
A(m) && (m === "customer" ? w("delivery") : m === "delivery" && w("payment"));
|
|
162
162
|
}, ke = () => {
|
|
163
163
|
m === "payment" ? w("delivery") : m === "delivery" && w("customer");
|
|
164
|
-
},
|
|
164
|
+
}, Ie = async () => {
|
|
165
165
|
var n;
|
|
166
166
|
if (!A("customer")) {
|
|
167
167
|
w("customer");
|
|
@@ -181,7 +181,7 @@ function mt({
|
|
|
181
181
|
c == null || c(new Error("Payment system is loading. Please try again."));
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
const s = Math.round(t.pricing.total * 100), { fbc:
|
|
184
|
+
const s = Math.round(t.pricing.total * 100), { fbc: l, fbp: o } = Y(), { ttp: g, ttclid: p } = J(), { firstName: L, lastName: N } = $(r.fullName);
|
|
185
185
|
ae.initializePayment({
|
|
186
186
|
email: (t == null ? void 0 : t.customerEmail) || "customer@example.com",
|
|
187
187
|
amount: s,
|
|
@@ -192,12 +192,12 @@ function mt({
|
|
|
192
192
|
address: r.address,
|
|
193
193
|
city: r.city,
|
|
194
194
|
delivery_zone_id: y || r.deliveryZoneId,
|
|
195
|
-
firstName:
|
|
196
|
-
lastName:
|
|
195
|
+
firstName: L,
|
|
196
|
+
lastName: N,
|
|
197
197
|
phone: r.phone,
|
|
198
|
-
fbc:
|
|
198
|
+
fbc: l,
|
|
199
199
|
fbp: o,
|
|
200
|
-
ttp:
|
|
200
|
+
ttp: g,
|
|
201
201
|
ttclid: p,
|
|
202
202
|
custom_fields: [
|
|
203
203
|
{
|
|
@@ -231,34 +231,34 @@ function mt({
|
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
try {
|
|
234
|
-
const { fbc: s, fbp:
|
|
234
|
+
const { fbc: s, fbp: l } = Y(), { ttp: o, ttclid: g } = J(), { firstName: p, lastName: L } = $(r.fullName), N = await j.mutateAsync({
|
|
235
235
|
firstName: p,
|
|
236
|
-
lastName:
|
|
236
|
+
lastName: L,
|
|
237
237
|
phone: r.phone,
|
|
238
238
|
address: r.address,
|
|
239
239
|
city: r.city,
|
|
240
240
|
deliveryZoneId: y || r.deliveryZoneId,
|
|
241
241
|
paymentMethod: r.paymentMethod,
|
|
242
242
|
fbc: s,
|
|
243
|
-
fbp:
|
|
243
|
+
fbp: l,
|
|
244
244
|
ttp: o,
|
|
245
|
-
ttclid:
|
|
245
|
+
ttclid: g
|
|
246
246
|
});
|
|
247
|
-
if ("error" in
|
|
248
|
-
const
|
|
249
|
-
c == null || c(new Error((
|
|
247
|
+
if ("error" in N) {
|
|
248
|
+
const I = N.error;
|
|
249
|
+
c == null || c(new Error((I == null ? void 0 : I.message) || "Checkout failed"));
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
H(
|
|
252
|
+
H(N), ee(), b == null || b(N);
|
|
253
253
|
} catch (s) {
|
|
254
254
|
c == null || c(s);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, Me = {
|
|
258
258
|
customer: "Customer Information",
|
|
259
259
|
delivery: "Delivery Address",
|
|
260
260
|
payment: "Payment Method"
|
|
261
|
-
}, Se = V(() =>
|
|
261
|
+
}, Se = V(() => Me[m], [m]), je = /* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
262
262
|
(m === "payment" || m === "delivery") && ((ce = t == null ? void 0 : t.pricing) == null ? void 0 : ce.total) && /* @__PURE__ */ a("div", { className: "text-sm text-black relative", children: [
|
|
263
263
|
D && /* @__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
264
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
@@ -275,14 +275,14 @@ function mt({
|
|
|
275
275
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
276
276
|
/* @__PURE__ */ e("span", { children: "Delivery Fee" }),
|
|
277
277
|
/* @__PURE__ */ e("span", { children: (() => {
|
|
278
|
-
var o,
|
|
278
|
+
var o, g, p;
|
|
279
279
|
if (!y)
|
|
280
280
|
return /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "Select zone first" });
|
|
281
|
-
const n = (o = t == null ? void 0 : t.brand) == null ? void 0 : o.freeShippingThreshold, s = ((
|
|
281
|
+
const n = (o = t == null ? void 0 : t.brand) == null ? void 0 : o.freeShippingThreshold, s = ((g = t == null ? void 0 : t.pricing) == null ? void 0 : g.subtotal) ?? 0;
|
|
282
282
|
if (n && s >= n)
|
|
283
283
|
return /* @__PURE__ */ e("span", { className: "text-green-600", children: "Free" });
|
|
284
|
-
const
|
|
285
|
-
return
|
|
284
|
+
const l = P.isPending ? (h == null ? void 0 : h.deliveryCost) ?? 0 : ((p = t == null ? void 0 : t.pricing) == null ? void 0 : p.deliveryCharge) ?? 0;
|
|
285
|
+
return l === 0 ? /* @__PURE__ */ e("span", { className: "text-green-600", children: "Free" }) : _(l);
|
|
286
286
|
})() })
|
|
287
287
|
] }),
|
|
288
288
|
/* @__PURE__ */ e("hr", { className: "border-gray-200 my-2" }),
|
|
@@ -301,7 +301,7 @@ function mt({
|
|
|
301
301
|
className: "flex-1 border-gray-400",
|
|
302
302
|
size: "lg",
|
|
303
303
|
children: [
|
|
304
|
-
/* @__PURE__ */ e(
|
|
304
|
+
/* @__PURE__ */ e(ze, { className: "mr-2 h-4 w-4" }),
|
|
305
305
|
"Back"
|
|
306
306
|
]
|
|
307
307
|
}
|
|
@@ -319,14 +319,14 @@ function mt({
|
|
|
319
319
|
"Updating..."
|
|
320
320
|
] }) : /* @__PURE__ */ a(O, { children: [
|
|
321
321
|
"Next",
|
|
322
|
-
/* @__PURE__ */ e(
|
|
322
|
+
/* @__PURE__ */ e(Fe, { className: "ml-2 h-4 w-4" })
|
|
323
323
|
] })
|
|
324
324
|
}
|
|
325
325
|
) : /* @__PURE__ */ e(
|
|
326
326
|
R,
|
|
327
327
|
{
|
|
328
328
|
type: "button",
|
|
329
|
-
onClick:
|
|
329
|
+
onClick: Ie,
|
|
330
330
|
disabled: j.isPending,
|
|
331
331
|
className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
|
|
332
332
|
size: "lg",
|
|
@@ -367,7 +367,7 @@ function mt({
|
|
|
367
367
|
children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
368
368
|
/* @__PURE__ */ a("div", { className: "bg-gray-50 rounded-lg p-4 space-y-2", children: [
|
|
369
369
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-center space-x-2 text-gray-700", children: [
|
|
370
|
-
/* @__PURE__ */ e(
|
|
370
|
+
/* @__PURE__ */ e(ge, { className: "h-4 w-4" }),
|
|
371
371
|
/* @__PURE__ */ a("span", { className: "text-sm font-medium", children: [
|
|
372
372
|
"Order #",
|
|
373
373
|
f.orderNumber
|
|
@@ -425,14 +425,14 @@ function mt({
|
|
|
425
425
|
children: D ? /* @__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: [
|
|
426
426
|
le && /* @__PURE__ */ a("div", { className: "space-y-3 p-4 pb-0", children: [
|
|
427
427
|
h.noteTitle && h.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: [
|
|
428
|
-
/* @__PURE__ */ e(
|
|
428
|
+
/* @__PURE__ */ e(ge, { className: "h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" }),
|
|
429
429
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
430
430
|
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-amber-900 whitespace-pre-wrap", children: h.noteTitle }),
|
|
431
431
|
/* @__PURE__ */ e("p", { className: "text-sm text-amber-800 whitespace-pre-wrap", children: h.noteContent })
|
|
432
432
|
] })
|
|
433
433
|
] }) }),
|
|
434
434
|
!(h != null && h.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: [
|
|
435
|
-
/* @__PURE__ */ e(
|
|
435
|
+
/* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
436
436
|
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
437
437
|
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-blue-900", children: "Cash on Delivery Unavailable" }),
|
|
438
438
|
/* @__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." })
|
|
@@ -462,7 +462,7 @@ function mt({
|
|
|
462
462
|
/* @__PURE__ */ a(
|
|
463
463
|
"div",
|
|
464
464
|
{
|
|
465
|
-
className:
|
|
465
|
+
className: M(
|
|
466
466
|
"flex transition-transform duration-300 ease-in-out w-full",
|
|
467
467
|
m === "customer" && "translate-x-0",
|
|
468
468
|
m === "delivery" && "-translate-x-full",
|
|
@@ -496,7 +496,7 @@ function mt({
|
|
|
496
496
|
placeholder: "e.g. 08012345678",
|
|
497
497
|
maxLength: 18,
|
|
498
498
|
error: v.phone,
|
|
499
|
-
icon: /* @__PURE__ */ e(
|
|
499
|
+
icon: /* @__PURE__ */ e(Te, { size: 16 }),
|
|
500
500
|
autoCorrect: "off",
|
|
501
501
|
required: !0,
|
|
502
502
|
className: "font-semibold"
|
|
@@ -536,17 +536,20 @@ function mt({
|
|
|
536
536
|
{
|
|
537
537
|
label: "State",
|
|
538
538
|
name: "state",
|
|
539
|
-
value:
|
|
539
|
+
value: F || "",
|
|
540
540
|
onChange: (n) => {
|
|
541
541
|
X("");
|
|
542
542
|
const s = n.target.value;
|
|
543
|
-
xe(s || void 0), v.state &&
|
|
543
|
+
xe(s || void 0), v.state && T((l) => ({ ...l, state: void 0 }));
|
|
544
544
|
},
|
|
545
545
|
error: v.state,
|
|
546
546
|
required: !0,
|
|
547
547
|
children: [
|
|
548
548
|
/* @__PURE__ */ e("option", { disabled: !0, value: "", children: "Select State" }),
|
|
549
|
-
k == null ? void 0 : k.
|
|
549
|
+
k == null ? void 0 : k.slice().sort((n, s) => {
|
|
550
|
+
const l = n.name.toLowerCase() === "lagos" ? 0 : 1, o = s.name.toLowerCase() === "lagos" ? 0 : 1;
|
|
551
|
+
return l - o;
|
|
552
|
+
}).map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.name }, n.id))
|
|
550
553
|
]
|
|
551
554
|
}
|
|
552
555
|
),
|
|
@@ -557,7 +560,7 @@ function mt({
|
|
|
557
560
|
value: y || "",
|
|
558
561
|
onChange: (n) => {
|
|
559
562
|
const s = n.target.value;
|
|
560
|
-
X(s || void 0), v.deliveryZoneId &&
|
|
563
|
+
X(s || void 0), v.deliveryZoneId && T((l) => ({ ...l, deliveryZoneId: void 0 })), s && P.mutate({ deliveryZoneId: s });
|
|
561
564
|
},
|
|
562
565
|
disabled: !u,
|
|
563
566
|
error: v.deliveryZoneId,
|
|
@@ -565,11 +568,11 @@ function mt({
|
|
|
565
568
|
children: [
|
|
566
569
|
/* @__PURE__ */ e("option", { disabled: !0, value: "", children: u ? "Select Delivery Zone" : "Select State First" }),
|
|
567
570
|
(() => {
|
|
568
|
-
var o,
|
|
569
|
-
const n = ((o = t == null ? void 0 : t.pricing) == null ? void 0 : o.subtotal) ?? 0, s = (
|
|
571
|
+
var o, g;
|
|
572
|
+
const n = ((o = t == null ? void 0 : t.pricing) == null ? void 0 : o.subtotal) ?? 0, s = (g = t == null ? void 0 : t.brand) == null ? void 0 : g.freeShippingThreshold, l = s && n >= s;
|
|
570
573
|
return u == null ? void 0 : u.zones.map((p) => /* @__PURE__ */ a("option", { value: p.id, children: [
|
|
571
574
|
p.name,
|
|
572
|
-
|
|
575
|
+
l ? "" : ` (${_(p.deliveryCost)})`
|
|
573
576
|
] }, p.id));
|
|
574
577
|
})()
|
|
575
578
|
]
|
|
@@ -578,7 +581,7 @@ function mt({
|
|
|
578
581
|
] })
|
|
579
582
|
] }) }),
|
|
580
583
|
/* @__PURE__ */ e("div", { className: "w-full min-w-full flex-shrink-0 p-4", children: /* @__PURE__ */ a("div", { className: "space-y-6", children: [
|
|
581
|
-
|
|
584
|
+
z && /* @__PURE__ */ a("div", { className: `border border-gray-200 rounded-lg ${le ? "mt-4" : ""}`, children: [
|
|
582
585
|
/* @__PURE__ */ a(
|
|
583
586
|
"button",
|
|
584
587
|
{
|
|
@@ -586,12 +589,12 @@ function mt({
|
|
|
586
589
|
onClick: () => Ce(!G),
|
|
587
590
|
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",
|
|
588
591
|
children: [
|
|
589
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-bold text-accent-700", children:
|
|
592
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-bold text-accent-700", children: z.title || "Yes, we offer refunds!" }),
|
|
590
593
|
/* @__PURE__ */ e(
|
|
591
594
|
Ae,
|
|
592
595
|
{
|
|
593
596
|
size: 16,
|
|
594
|
-
className:
|
|
597
|
+
className: M(
|
|
595
598
|
"transform transition-transform duration-200 text-gray-500",
|
|
596
599
|
G && "rotate-180"
|
|
597
600
|
)
|
|
@@ -603,13 +606,13 @@ function mt({
|
|
|
603
606
|
/* @__PURE__ */ e(
|
|
604
607
|
"div",
|
|
605
608
|
{
|
|
606
|
-
className:
|
|
609
|
+
className: M(
|
|
607
610
|
"overflow-hidden transition-all duration-300 ease-in-out",
|
|
608
611
|
G ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
|
|
609
612
|
),
|
|
610
|
-
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:
|
|
613
|
+
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: z.policies && /* @__PURE__ */ a("div", { children: [
|
|
611
614
|
/* @__PURE__ */ e("h4", { className: "font-bold text-gray-800 mb-2", children: "Our Refund Policy" }),
|
|
612
|
-
/* @__PURE__ */ e("ul", { className: "space-y-1", children:
|
|
615
|
+
/* @__PURE__ */ e("ul", { className: "space-y-1", children: z.policies.map((n, s) => /* @__PURE__ */ a("li", { className: "flex items-start", children: [
|
|
613
616
|
/* @__PURE__ */ e("span", { className: "text-green-600 mr-2", children: "✓" }),
|
|
614
617
|
/* @__PURE__ */ e("span", { children: n })
|
|
615
618
|
] }, s)) })
|
|
@@ -621,7 +624,7 @@ function mt({
|
|
|
621
624
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ a(
|
|
622
625
|
"label",
|
|
623
626
|
{
|
|
624
|
-
className:
|
|
627
|
+
className: M(
|
|
625
628
|
"flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
|
|
626
629
|
r.paymentMethod === "online" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
|
|
627
630
|
B("online") && "opacity-50 cursor-not-allowed"
|
|
@@ -643,7 +646,7 @@ function mt({
|
|
|
643
646
|
/* @__PURE__ */ e(
|
|
644
647
|
"div",
|
|
645
648
|
{
|
|
646
|
-
className:
|
|
649
|
+
className: M(
|
|
647
650
|
"p-3 rounded-full",
|
|
648
651
|
r.paymentMethod === "online" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
|
|
649
652
|
),
|
|
@@ -670,7 +673,7 @@ function mt({
|
|
|
670
673
|
/* @__PURE__ */ a(
|
|
671
674
|
"label",
|
|
672
675
|
{
|
|
673
|
-
className:
|
|
676
|
+
className: M(
|
|
674
677
|
"flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
|
|
675
678
|
r.paymentMethod === "cod" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
|
|
676
679
|
B("cod") && "opacity-50 cursor-not-allowed"
|
|
@@ -692,11 +695,11 @@ function mt({
|
|
|
692
695
|
/* @__PURE__ */ e(
|
|
693
696
|
"div",
|
|
694
697
|
{
|
|
695
|
-
className:
|
|
698
|
+
className: M(
|
|
696
699
|
"p-3 rounded-full",
|
|
697
700
|
r.paymentMethod === "cod" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
|
|
698
701
|
),
|
|
699
|
-
children: /* @__PURE__ */ e(
|
|
702
|
+
children: /* @__PURE__ */ e(Ne, { size: 24 })
|
|
700
703
|
}
|
|
701
704
|
),
|
|
702
705
|
/* @__PURE__ */ a("div", { children: [
|