@instockng/storefront-ui 1.0.9 → 1.0.11
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/README.md +26 -0
- package/dist/components/Checkout.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index10.mjs +144 -141
- package/dist/index101.mjs +1 -1
- package/dist/index102.mjs +3 -3
- package/dist/index103.mjs +3 -3
- package/dist/index105.mjs +1 -1
- package/dist/index111.mjs +1 -1
- package/dist/index20.mjs +2 -2
- package/dist/index21.mjs +1 -1
- package/dist/index28.mjs +11 -11
- package/dist/index29.mjs +1 -1
- package/dist/index3.mjs +88 -74
- package/dist/index30.mjs +1 -1
- package/dist/index31.mjs +1 -1
- package/dist/index32.mjs +1 -1
- package/dist/index37.mjs +1 -1
- package/dist/index41.mjs +36 -23
- package/dist/index42.mjs +44 -36
- package/dist/index43.mjs +99 -44
- package/dist/index44.mjs +112 -99
- package/dist/index45.mjs +44 -80
- package/dist/index46.mjs +64 -53
- package/dist/index47.mjs +66 -49
- package/dist/index48.mjs +54 -73
- package/dist/index49.mjs +52 -63
- package/dist/index50.mjs +14 -70
- package/dist/index51.mjs +13 -14
- package/dist/index52.mjs +58 -13
- package/dist/index53.mjs +101 -34
- package/dist/index54.mjs +99 -95
- package/dist/index55.mjs +22 -132
- package/dist/index58.mjs +2 -2
- package/dist/index59.mjs +4 -3
- package/dist/index60.mjs +4 -2
- package/dist/index61.mjs +2 -5
- package/dist/index62.mjs +30 -231
- package/dist/index63.mjs +42 -5
- package/dist/index64.mjs +228 -127
- package/dist/index65.mjs +4 -66
- package/dist/index66.mjs +124 -77
- package/dist/index67.mjs +65 -26
- package/dist/index68.mjs +84 -6
- package/dist/index69.mjs +26 -72
- package/dist/index70.mjs +8 -3
- package/dist/index71.mjs +75 -2
- package/dist/index72.mjs +3 -82
- package/dist/index73.mjs +2 -54
- package/dist/index74.mjs +82 -5
- package/dist/index75.mjs +53 -4
- package/dist/index76.mjs +5 -178
- package/dist/index77.mjs +5 -53
- package/dist/index78.mjs +178 -68
- package/dist/index79.mjs +50 -31
- package/dist/index80.mjs +69 -43
- package/dist/index81.mjs +2 -2
- package/dist/index82.mjs +1 -1
- package/dist/index83.mjs +6 -6
- package/dist/index84.mjs +2 -2
- package/dist/index85.mjs +2 -2
- package/dist/index87.mjs +2 -2
- package/dist/index88.mjs +2 -2
- package/dist/index89.mjs +1 -1
- package/dist/index91.mjs +4 -4
- package/dist/index92.mjs +3 -3
- package/dist/index93.mjs +30 -12
- package/dist/index94.mjs +11 -7
- package/dist/index95.mjs +3 -30
- package/dist/index96.mjs +3 -10
- package/dist/index97.mjs +13 -4
- package/dist/index98.mjs +7 -4
- package/dist/index99.mjs +1 -1
- package/dist/styles.css +1 -0
- package/package.json +14 -13
- package/src/components/CartItem.stories.tsx +94 -0
- package/src/components/CartItem.tsx +141 -0
- package/src/components/Checkout.stories.tsx +380 -0
- package/src/components/Checkout.tsx +954 -0
- package/src/components/DiscountCodeInput.stories.tsx +76 -0
- package/src/components/DiscountCodeInput.tsx +162 -0
- package/src/components/OrderConfirmation.stories.tsx +142 -0
- package/src/components/OrderConfirmation.tsx +301 -0
- package/src/components/ProductCard.stories.tsx +112 -0
- package/src/components/ProductCard.tsx +195 -0
- package/src/components/ProductGrid.stories.tsx +137 -0
- package/src/components/ProductGrid.tsx +141 -0
- package/src/components/ShoppingCart.stories.tsx +459 -0
- package/src/components/ShoppingCart.tsx +262 -0
- package/src/components/ui/badge.tsx +37 -0
- package/src/components/ui/button.tsx +71 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/form-input.tsx +78 -0
- package/src/components/ui/form-select.tsx +73 -0
- package/src/components/ui/modal.tsx +181 -0
- package/src/contexts/CartContext.tsx +305 -0
- package/src/hooks/usePaystackPayment.ts +137 -0
- package/src/index.ts +51 -0
- package/src/lib/utils.ts +45 -0
- package/src/paystack.svg +67 -0
- package/src/providers/StorefrontProvider.tsx +70 -0
- package/src/styles.css +1 -0
- package/src/test-utils/MockCartProvider.tsx +424 -0
- package/src/vite-env.d.ts +12 -0
package/README.md
CHANGED
|
@@ -35,6 +35,32 @@ npm install react react-dom @tanstack/react-query lucide-react
|
|
|
35
35
|
|
|
36
36
|
### Setup
|
|
37
37
|
|
|
38
|
+
#### Option A: If your project already uses Tailwind CSS (Recommended)
|
|
39
|
+
|
|
40
|
+
Add storefront-ui to your Tailwind config's content array:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// tailwind.config.ts
|
|
44
|
+
export default {
|
|
45
|
+
content: [
|
|
46
|
+
'./app/**/*.{js,ts,jsx,tsx}',
|
|
47
|
+
'./node_modules/@instockng/storefront-ui/src/**/*.{js,ts,jsx,tsx}', // Add this
|
|
48
|
+
],
|
|
49
|
+
// ... rest of your config
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Option B: If your project doesn't use Tailwind CSS
|
|
54
|
+
|
|
55
|
+
Import the pre-built CSS file:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
// app/layout.tsx or _app.tsx
|
|
59
|
+
import '@instockng/storefront-ui/styles.css';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Providers
|
|
63
|
+
|
|
38
64
|
Wrap your app with providers:
|
|
39
65
|
|
|
40
66
|
```tsx
|
|
@@ -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,EA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AC,IAAI,CAAC,CAAC;IAC9C,0BAA0B;IAC1B,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,2BAA2B;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,6CAA6C;IAC7C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,wBAAwB;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,kDAA+C,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,IAAI,CAAC,OAAO,4BAA4B,EAAE,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;CACxG;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,iBAAiB,2CA2NxG;AAED;;GAEG;AACH,wBAAgB,OAAO,qBAMtB"}
|
package/dist/index10.mjs
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as a, jsx as e, Fragment as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { object as
|
|
2
|
+
import { jsxs as a, jsx as e, Fragment as fe } from "react/jsx-runtime";
|
|
3
|
+
import { useState as N, useEffect as q, useMemo as te, useCallback as pe } from "react";
|
|
4
|
+
import { object as $, string as y, ValidationError as ve } from "./index34.mjs";
|
|
5
5
|
import "./index18.mjs";
|
|
6
6
|
import "@tanstack/react-query";
|
|
7
|
-
import { useGetDeliveryZones as
|
|
8
|
-
import { useCart as
|
|
9
|
-
import { Modal as
|
|
7
|
+
import { useGetDeliveryZones as Ne } from "./index32.mjs";
|
|
8
|
+
import { useCart as ge } from "./index3.mjs";
|
|
9
|
+
import { Modal as re } from "./index14.mjs";
|
|
10
10
|
import { FormInput as P } from "./index15.mjs";
|
|
11
|
-
import { FormSelect as
|
|
11
|
+
import { FormSelect as ae } from "./index16.mjs";
|
|
12
12
|
import { Button as L } from "./index11.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import { formatCurrency as k, cn as
|
|
15
|
-
import
|
|
16
|
-
import { usePaystackPayment as
|
|
17
|
-
const
|
|
13
|
+
import { Loader2 as R, ChevronLeft as be, ChevronRight as xe, CheckCircle as we, Package as Ce, Mail as Pe, Phone as ke, Zap as Me, Banknote as qe, ChevronDown as Ie } from "lucide-react";
|
|
14
|
+
import { formatCurrency as k, cn as w } from "./index17.mjs";
|
|
15
|
+
import Ze from "./index35.mjs";
|
|
16
|
+
import { usePaystackPayment as je } from "./index36.mjs";
|
|
17
|
+
const Se = (d) => d.replace(/\D/g, ""), ze = $({
|
|
18
18
|
firstName: y().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: y().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: y().required("Email is required").email("Please enter a valid email address"),
|
|
21
|
-
phone: y().required("Phone number is required").test("nigerian-phone", "Please enter a valid Nigerian phone number (e.g. 0812 564 8668)", (
|
|
22
|
-
if (!
|
|
23
|
-
const M =
|
|
21
|
+
phone: y().required("Phone number is required").test("nigerian-phone", "Please enter a valid Nigerian phone number (e.g. 0812 564 8668)", (d) => {
|
|
22
|
+
if (!d) return !1;
|
|
23
|
+
const M = Se(d);
|
|
24
24
|
return [
|
|
25
25
|
/^0[789]\d{9}$/
|
|
26
26
|
// 0xxxxxxxxx (11 digits total)
|
|
27
27
|
].some((f) => f.test(M));
|
|
28
28
|
})
|
|
29
|
-
}),
|
|
29
|
+
}), Fe = $({
|
|
30
30
|
address: y().required("Street address is required").min(10, "Please provide a complete address"),
|
|
31
31
|
city: y().required("City is required").min(3, "City name must be at least 3 characters"),
|
|
32
|
-
state: y().required("State is required").test("not-empty", "State is required", (
|
|
33
|
-
deliveryZoneId: y().required("Delivery zone is required").test("not-empty", "Delivery zone is required", (
|
|
34
|
-
}),
|
|
32
|
+
state: y().required("State is required").test("not-empty", "State is required", (d) => !!d && d.trim() !== ""),
|
|
33
|
+
deliveryZoneId: y().required("Delivery zone is required").test("not-empty", "Delivery zone is required", (d) => !!d && d.trim() !== "")
|
|
34
|
+
}), Le = $({
|
|
35
35
|
paymentMethod: y().oneOf(["cod", "online"], "Please select a payment method").required("Payment method is required")
|
|
36
36
|
});
|
|
37
|
-
function
|
|
38
|
-
isOpen:
|
|
37
|
+
function Xe({
|
|
38
|
+
isOpen: d,
|
|
39
39
|
onClose: M,
|
|
40
40
|
initialData: l,
|
|
41
41
|
onSuccess: f,
|
|
42
42
|
onError: c,
|
|
43
|
-
submitButtonText:
|
|
43
|
+
submitButtonText: se = "Place Order",
|
|
44
44
|
refundPolicy: I
|
|
45
45
|
}) {
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
publicKey:
|
|
46
|
+
var W, J, Q, U, X, E, D, ee;
|
|
47
|
+
const ne = "pk_live_dfb74efb5f74d2acbc253d5ca396ab9015ef0fa7", [o, p] = N("customer"), [Z, le] = N(void 0), [g, G] = N(void 0), [u, B] = N(null), { refetch: K, isLoading: O, cart: s, updateCartMutation: T, checkoutMutation: de } = ge(), V = je({
|
|
48
|
+
publicKey: ne,
|
|
49
49
|
onSuccess: async (t) => {
|
|
50
50
|
try {
|
|
51
|
-
const
|
|
51
|
+
const n = await C.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:
|
|
58
|
+
deliveryZoneId: g || r.deliveryZoneId,
|
|
59
59
|
paymentMethod: r.paymentMethod,
|
|
60
60
|
paystackReference: t.reference
|
|
61
61
|
});
|
|
62
|
-
if ("error" in
|
|
63
|
-
const
|
|
64
|
-
c == null || c(new Error((
|
|
62
|
+
if ("error" in n) {
|
|
63
|
+
const i = n.error;
|
|
64
|
+
c == null || c(new Error((i == null ? void 0 : i.message) || "Checkout failed"));
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
B(
|
|
68
|
-
} catch (
|
|
69
|
-
c == null || c(
|
|
67
|
+
B(n), f == null || f(n.id);
|
|
68
|
+
} catch (n) {
|
|
69
|
+
c == null || c(n);
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
onClose: () => {
|
|
@@ -74,15 +74,15 @@ function Qe({
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
q(() => {
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
const { data:
|
|
80
|
-
enabled: !!((
|
|
81
|
-
}), h =
|
|
77
|
+
d && K();
|
|
78
|
+
}, [d, K]);
|
|
79
|
+
const { data: b } = Ne(((W = s == null ? void 0 : s.brand) == null ? void 0 : W.id) || "", {
|
|
80
|
+
enabled: !!((J = s == null ? void 0 : s.brand) != null && J.id)
|
|
81
|
+
}), h = te(() => b == null ? void 0 : b.find((t) => t.id === Z), [b, Z]), C = de;
|
|
82
82
|
q(() => {
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
const [r, _] =
|
|
83
|
+
d || (B(null), p("customer"), C.reset());
|
|
84
|
+
}, [d]);
|
|
85
|
+
const [r, _] = N({
|
|
86
86
|
firstName: (l == null ? void 0 : l.firstName) || "",
|
|
87
87
|
lastName: (l == null ? void 0 : l.lastName) || "",
|
|
88
88
|
email: (l == null ? void 0 : l.email) || "",
|
|
@@ -94,64 +94,66 @@ function Qe({
|
|
|
94
94
|
notes: (l == null ? void 0 : l.notes) || ""
|
|
95
95
|
});
|
|
96
96
|
q(() => {
|
|
97
|
-
|
|
98
|
-
}, [
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
d && p("customer");
|
|
98
|
+
}, [d]);
|
|
99
|
+
const [Y, H] = N(!1);
|
|
100
|
+
q(() => {
|
|
101
|
+
d && s && !l && !Y && (_((t) => {
|
|
102
|
+
var n;
|
|
101
103
|
return {
|
|
102
104
|
...t,
|
|
103
|
-
firstName:
|
|
104
|
-
lastName:
|
|
105
|
-
email:
|
|
106
|
-
phone:
|
|
107
|
-
deliveryZoneId: ((
|
|
105
|
+
firstName: s.customerFirstName || t.firstName,
|
|
106
|
+
lastName: s.customerLastName || t.lastName,
|
|
107
|
+
email: s.customerEmail || t.email,
|
|
108
|
+
phone: s.customerPhone || t.phone,
|
|
109
|
+
deliveryZoneId: ((n = s.deliveryZone) == null ? void 0 : n.id) || t.deliveryZoneId
|
|
108
110
|
};
|
|
109
|
-
});
|
|
110
|
-
}, [
|
|
111
|
-
if (
|
|
112
|
-
const t = h == null ? void 0 : h.zones.find((
|
|
113
|
-
t && _((
|
|
114
|
-
...
|
|
111
|
+
}), H(!0)), d || H(!1);
|
|
112
|
+
}, [d, s, l, Y]), q(() => {
|
|
113
|
+
if (g) {
|
|
114
|
+
const t = h == null ? void 0 : h.zones.find((n) => n.id === g);
|
|
115
|
+
t && _((n) => ({
|
|
116
|
+
...n,
|
|
115
117
|
paymentMethod: t.allowOnline ? "online" : "cod"
|
|
116
118
|
}));
|
|
117
119
|
}
|
|
118
|
-
}, [
|
|
119
|
-
const [m, j] =
|
|
120
|
-
const { name:
|
|
121
|
-
_((x) => ({ ...x, [
|
|
122
|
-
}, S =
|
|
120
|
+
}, [g, h]);
|
|
121
|
+
const [m, j] = N({}), [A, ie] = N(!1), v = (t) => {
|
|
122
|
+
const { name: n, value: i } = t.target;
|
|
123
|
+
_((x) => ({ ...x, [n]: i })), m[n] && j((x) => ({ ...x, [n]: void 0 }));
|
|
124
|
+
}, S = pe(
|
|
123
125
|
(t) => {
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const
|
|
127
|
-
t === "firstName" ?
|
|
126
|
+
const n = r[t];
|
|
127
|
+
if (!n) return;
|
|
128
|
+
const i = {};
|
|
129
|
+
t === "firstName" ? i.customerFirstName = n : t === "lastName" ? i.customerLastName = n : t === "email" ? i.customerEmail = n : t === "phone" && (i.customerPhone = n), T.mutate(i);
|
|
128
130
|
},
|
|
129
131
|
[r, T]
|
|
130
132
|
), z = (t) => {
|
|
131
|
-
const
|
|
133
|
+
const n = {};
|
|
132
134
|
try {
|
|
133
135
|
if (t === "customer")
|
|
134
|
-
|
|
136
|
+
ze.validateSync(r, { abortEarly: !1 });
|
|
135
137
|
else if (t === "delivery") {
|
|
136
|
-
const
|
|
138
|
+
const i = {
|
|
137
139
|
address: r.address,
|
|
138
140
|
city: r.city,
|
|
139
141
|
state: Z || r.state || "",
|
|
140
|
-
deliveryZoneId:
|
|
142
|
+
deliveryZoneId: g || r.deliveryZoneId || ""
|
|
141
143
|
};
|
|
142
|
-
|
|
143
|
-
} else t === "payment" &&
|
|
144
|
-
} catch (
|
|
145
|
-
|
|
146
|
-
x.path && (
|
|
144
|
+
Fe.validateSync(i, { abortEarly: !1 });
|
|
145
|
+
} else t === "payment" && Le.validateSync(r, { abortEarly: !1 });
|
|
146
|
+
} catch (i) {
|
|
147
|
+
i instanceof ve && i.inner.forEach((x) => {
|
|
148
|
+
x.path && (n[x.path] = x.message);
|
|
147
149
|
});
|
|
148
150
|
}
|
|
149
|
-
return j(
|
|
150
|
-
},
|
|
151
|
+
return j(n), Object.keys(n).length === 0;
|
|
152
|
+
}, ce = () => {
|
|
151
153
|
z(o) && (o === "customer" ? p("delivery") : o === "delivery" && p("payment"));
|
|
152
|
-
},
|
|
154
|
+
}, oe = () => {
|
|
153
155
|
o === "payment" ? p("delivery") : o === "delivery" && p("customer");
|
|
154
|
-
},
|
|
156
|
+
}, me = async () => {
|
|
155
157
|
if (!z("customer")) {
|
|
156
158
|
p("customer");
|
|
157
159
|
return;
|
|
@@ -162,17 +164,17 @@ function Qe({
|
|
|
162
164
|
}
|
|
163
165
|
if (z("payment")) {
|
|
164
166
|
if (r.paymentMethod === "online") {
|
|
165
|
-
if (!
|
|
167
|
+
if (!V.isLoaded) {
|
|
166
168
|
c == null || c(new Error("Payment system is loading. Please try again."));
|
|
167
169
|
return;
|
|
168
170
|
}
|
|
169
|
-
const t = Math.round(
|
|
170
|
-
|
|
171
|
-
email: r.email || (
|
|
171
|
+
const t = Math.round(s.pricing.total * 100);
|
|
172
|
+
V.initializePayment({
|
|
173
|
+
email: r.email || (s == null ? void 0 : s.customerEmail) || "customer@example.com",
|
|
172
174
|
amount: t,
|
|
173
175
|
currency: "NGN",
|
|
174
176
|
metadata: {
|
|
175
|
-
cartId:
|
|
177
|
+
cartId: s == null ? void 0 : s.id,
|
|
176
178
|
custom_fields: [
|
|
177
179
|
{
|
|
178
180
|
display_name: "Customer Name",
|
|
@@ -190,19 +192,19 @@ function Qe({
|
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
194
|
try {
|
|
193
|
-
const t = await
|
|
195
|
+
const t = await C.mutateAsync({
|
|
194
196
|
firstName: r.firstName,
|
|
195
197
|
lastName: r.lastName,
|
|
196
198
|
email: r.email,
|
|
197
199
|
phone: r.phone,
|
|
198
200
|
address: r.address,
|
|
199
201
|
city: r.city,
|
|
200
|
-
deliveryZoneId:
|
|
202
|
+
deliveryZoneId: g || r.deliveryZoneId,
|
|
201
203
|
paymentMethod: r.paymentMethod
|
|
202
204
|
});
|
|
203
205
|
if ("error" in t) {
|
|
204
|
-
const
|
|
205
|
-
c == null || c(new Error((
|
|
206
|
+
const n = t.error;
|
|
207
|
+
c == null || c(new Error((n == null ? void 0 : n.message) || "Checkout failed"));
|
|
206
208
|
return;
|
|
207
209
|
}
|
|
208
210
|
B(t), f == null || f(t.id);
|
|
@@ -210,31 +212,32 @@ function Qe({
|
|
|
210
212
|
c == null || c(t);
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
|
-
},
|
|
215
|
+
}, ue = {
|
|
214
216
|
customer: "Customer Information",
|
|
215
217
|
delivery: "Delivery Address",
|
|
216
218
|
payment: "Payment Method"
|
|
217
|
-
},
|
|
218
|
-
(o === "payment" || o === "delivery") && ((
|
|
219
|
+
}, he = te(() => ue[o], [o]), ye = /* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
220
|
+
(o === "payment" || o === "delivery") && ((Q = s == null ? void 0 : s.pricing) == null ? void 0 : Q.total) && /* @__PURE__ */ a("div", { className: "text-sm text-black relative", children: [
|
|
221
|
+
O && /* @__PURE__ */ e("div", { className: "absolute flex items-center justify-center inset-0 bg-white opacity-50", children: /* @__PURE__ */ e(R, { className: "animate-spin text-accent-500" }) }),
|
|
219
222
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
220
223
|
/* @__PURE__ */ e("span", { children: "Subtotal" }),
|
|
221
|
-
/* @__PURE__ */ e("span", { children: k(((
|
|
224
|
+
/* @__PURE__ */ e("span", { children: k(((U = s == null ? void 0 : s.pricing) == null ? void 0 : U.subtotal) ?? 0) })
|
|
222
225
|
] }),
|
|
223
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
226
|
+
s.pricing.discount && /* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
224
227
|
/* @__PURE__ */ e("span", { children: "Discount" }),
|
|
225
228
|
/* @__PURE__ */ a("span", { className: "text-green-600", children: [
|
|
226
229
|
"-",
|
|
227
|
-
k(((
|
|
230
|
+
k(((E = (X = s == null ? void 0 : s.pricing) == null ? void 0 : X.discount) == null ? void 0 : E.amount) ?? 0)
|
|
228
231
|
] })
|
|
229
232
|
] }),
|
|
230
233
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
231
234
|
/* @__PURE__ */ e("span", { children: "Delivery Fee" }),
|
|
232
|
-
/* @__PURE__ */ e("span", { children: k(((
|
|
235
|
+
/* @__PURE__ */ e("span", { children: k(((D = s == null ? void 0 : s.pricing) == null ? void 0 : D.deliveryCharge) ?? 0) })
|
|
233
236
|
] }),
|
|
234
237
|
/* @__PURE__ */ e("hr", { className: "border-gray-200 my-2" }),
|
|
235
238
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between font-medium", children: [
|
|
236
239
|
/* @__PURE__ */ e("span", { children: "Total" }),
|
|
237
|
-
/* @__PURE__ */ e("span", { children: k(((
|
|
240
|
+
/* @__PURE__ */ e("span", { children: k(((ee = s == null ? void 0 : s.pricing) == null ? void 0 : ee.total) ?? 0) })
|
|
238
241
|
] })
|
|
239
242
|
] }),
|
|
240
243
|
/* @__PURE__ */ a("div", { className: "flex gap-3", children: [
|
|
@@ -243,11 +246,11 @@ function Qe({
|
|
|
243
246
|
{
|
|
244
247
|
type: "button",
|
|
245
248
|
variant: "outline",
|
|
246
|
-
onClick:
|
|
249
|
+
onClick: oe,
|
|
247
250
|
className: "flex-1 border-gray-400",
|
|
248
251
|
size: "lg",
|
|
249
252
|
children: [
|
|
250
|
-
/* @__PURE__ */ e(
|
|
253
|
+
/* @__PURE__ */ e(be, { className: "mr-2 h-4 w-4" }),
|
|
251
254
|
"Back"
|
|
252
255
|
]
|
|
253
256
|
}
|
|
@@ -256,35 +259,35 @@ function Qe({
|
|
|
256
259
|
L,
|
|
257
260
|
{
|
|
258
261
|
type: "button",
|
|
259
|
-
onClick:
|
|
262
|
+
onClick: ce,
|
|
260
263
|
className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
|
|
261
264
|
size: "lg",
|
|
262
265
|
children: [
|
|
263
266
|
"Next",
|
|
264
|
-
/* @__PURE__ */ e(
|
|
267
|
+
/* @__PURE__ */ e(xe, { className: "ml-2 h-4 w-4" })
|
|
265
268
|
]
|
|
266
269
|
}
|
|
267
270
|
) : /* @__PURE__ */ e(
|
|
268
271
|
L,
|
|
269
272
|
{
|
|
270
273
|
type: "button",
|
|
271
|
-
onClick:
|
|
272
|
-
disabled:
|
|
274
|
+
onClick: me,
|
|
275
|
+
disabled: C.isPending,
|
|
273
276
|
className: "flex-1 bg-accent-500 text-white hover:bg-accent-600",
|
|
274
277
|
size: "lg",
|
|
275
|
-
children:
|
|
276
|
-
/* @__PURE__ */ e(
|
|
278
|
+
children: C.isPending ? /* @__PURE__ */ a(fe, { children: [
|
|
279
|
+
/* @__PURE__ */ e(R, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
277
280
|
"Processing..."
|
|
278
|
-
] }) :
|
|
281
|
+
] }) : se
|
|
279
282
|
}
|
|
280
283
|
)
|
|
281
284
|
] }),
|
|
282
|
-
|
|
283
|
-
] }), F = (t) => !(
|
|
285
|
+
C.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." })
|
|
286
|
+
] }), F = (t) => !(s != null && s.availablePaymentMethods.includes(t));
|
|
284
287
|
return u ? /* @__PURE__ */ e(
|
|
285
|
-
|
|
288
|
+
re,
|
|
286
289
|
{
|
|
287
|
-
isOpen:
|
|
290
|
+
isOpen: d,
|
|
288
291
|
onClose: M,
|
|
289
292
|
title: "Order Placed Successfully!",
|
|
290
293
|
footer: /* @__PURE__ */ e(
|
|
@@ -299,14 +302,14 @@ function Qe({
|
|
|
299
302
|
size: "lg",
|
|
300
303
|
contentClassName: "p-6",
|
|
301
304
|
children: /* @__PURE__ */ a("div", { className: "text-center space-y-6", children: [
|
|
302
|
-
/* @__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(
|
|
305
|
+
/* @__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(we, { className: "h-12 w-12 text-green-600" }) }) }),
|
|
303
306
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
304
307
|
/* @__PURE__ */ e("h3", { className: "text-2xl font-bold text-gray-900", children: "Thank You!" }),
|
|
305
308
|
/* @__PURE__ */ e("p", { className: "text-gray-600", children: "Your order has been placed successfully." })
|
|
306
309
|
] }),
|
|
307
310
|
/* @__PURE__ */ a("div", { className: "bg-gray-50 rounded-lg p-6 space-y-4", children: [
|
|
308
311
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-center space-x-2 text-gray-700", children: [
|
|
309
|
-
/* @__PURE__ */ e(
|
|
312
|
+
/* @__PURE__ */ e(Ce, { className: "h-5 w-5" }),
|
|
310
313
|
/* @__PURE__ */ a("span", { className: "font-medium", children: [
|
|
311
314
|
"Order #",
|
|
312
315
|
u.orderNumber
|
|
@@ -347,18 +350,18 @@ function Qe({
|
|
|
347
350
|
] })
|
|
348
351
|
}
|
|
349
352
|
) : /* @__PURE__ */ e(
|
|
350
|
-
|
|
353
|
+
re,
|
|
351
354
|
{
|
|
352
|
-
isOpen:
|
|
355
|
+
isOpen: d,
|
|
353
356
|
onClose: M,
|
|
354
|
-
title:
|
|
355
|
-
footer:
|
|
357
|
+
title: he,
|
|
358
|
+
footer: ye,
|
|
356
359
|
size: "lg",
|
|
357
360
|
contentClassName: "p-0",
|
|
358
|
-
children:
|
|
361
|
+
children: O ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[300px]", children: /* @__PURE__ */ e(R, { className: "h-8 w-8 animate-spin text-gray-600" }) }) : /* @__PURE__ */ e("div", { className: "w-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "relative w-full", children: /* @__PURE__ */ a(
|
|
359
362
|
"div",
|
|
360
363
|
{
|
|
361
|
-
className:
|
|
364
|
+
className: w(
|
|
362
365
|
"flex transition-transform duration-300 ease-in-out w-full",
|
|
363
366
|
o === "customer" && "translate-x-0",
|
|
364
367
|
o === "delivery" && "-translate-x-full",
|
|
@@ -404,7 +407,7 @@ function Qe({
|
|
|
404
407
|
onChange: v,
|
|
405
408
|
onBlur: () => S("email"),
|
|
406
409
|
error: m.email,
|
|
407
|
-
icon: /* @__PURE__ */ e(
|
|
410
|
+
icon: /* @__PURE__ */ e(Pe, { size: 16 }),
|
|
408
411
|
autoCorrect: "off",
|
|
409
412
|
required: !0
|
|
410
413
|
}
|
|
@@ -421,7 +424,7 @@ function Qe({
|
|
|
421
424
|
placeholder: "e.g. 08012345678",
|
|
422
425
|
maxLength: 18,
|
|
423
426
|
error: m.phone,
|
|
424
|
-
icon: /* @__PURE__ */ e(
|
|
427
|
+
icon: /* @__PURE__ */ e(ke, { size: 16 }),
|
|
425
428
|
autoCorrect: "off",
|
|
426
429
|
required: !0,
|
|
427
430
|
className: "font-semibold"
|
|
@@ -457,32 +460,32 @@ function Qe({
|
|
|
457
460
|
}
|
|
458
461
|
),
|
|
459
462
|
/* @__PURE__ */ a(
|
|
460
|
-
|
|
463
|
+
ae,
|
|
461
464
|
{
|
|
462
465
|
label: "State",
|
|
463
466
|
name: "state",
|
|
464
467
|
value: Z || "",
|
|
465
468
|
onChange: (t) => {
|
|
466
|
-
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
+
G("");
|
|
470
|
+
const n = t.target.value;
|
|
471
|
+
le(n || void 0), m.state && j((i) => ({ ...i, state: void 0 }));
|
|
469
472
|
},
|
|
470
473
|
error: m.state,
|
|
471
474
|
required: !0,
|
|
472
475
|
children: [
|
|
473
476
|
/* @__PURE__ */ e("option", { disabled: !0, value: "", children: "Select State" }),
|
|
474
|
-
|
|
477
|
+
b == null ? void 0 : b.map((t) => /* @__PURE__ */ e("option", { value: t.id, children: t.name }, t.id))
|
|
475
478
|
]
|
|
476
479
|
}
|
|
477
480
|
),
|
|
478
481
|
/* @__PURE__ */ a(
|
|
479
|
-
|
|
482
|
+
ae,
|
|
480
483
|
{
|
|
481
484
|
label: "Delivery Zone",
|
|
482
|
-
value:
|
|
485
|
+
value: g || "",
|
|
483
486
|
onChange: (t) => {
|
|
484
|
-
const
|
|
485
|
-
|
|
487
|
+
const n = t.target.value;
|
|
488
|
+
G(n || void 0), m.deliveryZoneId && j((i) => ({ ...i, deliveryZoneId: void 0 })), n && T.mutate({ deliveryZoneId: n });
|
|
486
489
|
},
|
|
487
490
|
disabled: !h,
|
|
488
491
|
error: m.deliveryZoneId,
|
|
@@ -505,7 +508,7 @@ function Qe({
|
|
|
505
508
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ a(
|
|
506
509
|
"label",
|
|
507
510
|
{
|
|
508
|
-
className:
|
|
511
|
+
className: w(
|
|
509
512
|
"flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
|
|
510
513
|
r.paymentMethod === "online" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
|
|
511
514
|
F("online") && "opacity-50 cursor-not-allowed"
|
|
@@ -527,11 +530,11 @@ function Qe({
|
|
|
527
530
|
/* @__PURE__ */ e(
|
|
528
531
|
"div",
|
|
529
532
|
{
|
|
530
|
-
className:
|
|
533
|
+
className: w(
|
|
531
534
|
"p-3 rounded-full",
|
|
532
535
|
r.paymentMethod === "online" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
|
|
533
536
|
),
|
|
534
|
-
children: /* @__PURE__ */ e(
|
|
537
|
+
children: /* @__PURE__ */ e(Me, { size: 24 })
|
|
535
538
|
}
|
|
536
539
|
),
|
|
537
540
|
/* @__PURE__ */ a("div", { children: [
|
|
@@ -540,7 +543,7 @@ function Qe({
|
|
|
540
543
|
/* @__PURE__ */ e(
|
|
541
544
|
"img",
|
|
542
545
|
{
|
|
543
|
-
src:
|
|
546
|
+
src: Ze,
|
|
544
547
|
alt: "Paystack",
|
|
545
548
|
className: "h-4 w-auto mt-2 mx-auto"
|
|
546
549
|
}
|
|
@@ -554,7 +557,7 @@ function Qe({
|
|
|
554
557
|
/* @__PURE__ */ a(
|
|
555
558
|
"label",
|
|
556
559
|
{
|
|
557
|
-
className:
|
|
560
|
+
className: w(
|
|
558
561
|
"flex items-center justify-center relative p-4 border-2 rounded-xl cursor-pointer transition-all duration-200",
|
|
559
562
|
r.paymentMethod === "cod" ? "border-accent-500 bg-accent-50" : "border-gray-200 hover:border-gray-300",
|
|
560
563
|
F("cod") && "opacity-50 cursor-not-allowed"
|
|
@@ -576,11 +579,11 @@ function Qe({
|
|
|
576
579
|
/* @__PURE__ */ e(
|
|
577
580
|
"div",
|
|
578
581
|
{
|
|
579
|
-
className:
|
|
582
|
+
className: w(
|
|
580
583
|
"p-3 rounded-full",
|
|
581
584
|
r.paymentMethod === "cod" ? "bg-accent-100 text-accent-600" : "bg-gray-100 text-gray-600"
|
|
582
585
|
),
|
|
583
|
-
children: /* @__PURE__ */ e(
|
|
586
|
+
children: /* @__PURE__ */ e(qe, { size: 24 })
|
|
584
587
|
}
|
|
585
588
|
),
|
|
586
589
|
/* @__PURE__ */ a("div", { children: [
|
|
@@ -599,15 +602,15 @@ function Qe({
|
|
|
599
602
|
"button",
|
|
600
603
|
{
|
|
601
604
|
type: "button",
|
|
602
|
-
onClick: () =>
|
|
605
|
+
onClick: () => ie(!A),
|
|
603
606
|
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",
|
|
604
607
|
children: [
|
|
605
608
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-gray-700", children: I.title || "🤔 Curious about Refunds?" }),
|
|
606
609
|
/* @__PURE__ */ e(
|
|
607
|
-
|
|
610
|
+
Ie,
|
|
608
611
|
{
|
|
609
612
|
size: 16,
|
|
610
|
-
className:
|
|
613
|
+
className: w(
|
|
611
614
|
"transform transition-transform duration-200 text-gray-500",
|
|
612
615
|
A && "rotate-180"
|
|
613
616
|
)
|
|
@@ -619,16 +622,16 @@ function Qe({
|
|
|
619
622
|
/* @__PURE__ */ e(
|
|
620
623
|
"div",
|
|
621
624
|
{
|
|
622
|
-
className:
|
|
625
|
+
className: w(
|
|
623
626
|
"overflow-hidden transition-all duration-300 ease-in-out",
|
|
624
627
|
A ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
|
|
625
628
|
),
|
|
626
629
|
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: I.policies && /* @__PURE__ */ a("div", { children: [
|
|
627
630
|
/* @__PURE__ */ e("h4", { className: "font-bold text-gray-800 mb-2", children: "Our Refund Policy" }),
|
|
628
|
-
/* @__PURE__ */ e("ul", { className: "space-y-1 ml-4", children: I.policies.map((t,
|
|
631
|
+
/* @__PURE__ */ e("ul", { className: "space-y-1 ml-4", children: I.policies.map((t, n) => /* @__PURE__ */ a("li", { className: "flex items-start", children: [
|
|
629
632
|
/* @__PURE__ */ e("span", { className: "text-green-600 mr-2", children: "✓" }),
|
|
630
633
|
/* @__PURE__ */ e("span", { children: t })
|
|
631
|
-
] },
|
|
634
|
+
] }, n)) })
|
|
632
635
|
] }) }) })
|
|
633
636
|
}
|
|
634
637
|
)
|
|
@@ -641,5 +644,5 @@ function Qe({
|
|
|
641
644
|
);
|
|
642
645
|
}
|
|
643
646
|
export {
|
|
644
|
-
|
|
647
|
+
Xe as Checkout
|
|
645
648
|
};
|