@burdenoff/microfe-kadaikodi 2026.719.2 → 2026.719.3

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.
@@ -1,133 +1,149 @@
1
1
  import { useKadaikodi as e } from "../../context/KadaikodiContext.js";
2
2
  import { cn as t } from "../../utils/cn.js";
3
3
  import { PageLayout as n } from "../../components/PageLayout.js";
4
- import { useOrders as r, usePlaceOrder as i } from "../../hooks/useKadaikodiApi.js";
5
- import { formatCurrency as a } from "../../utils/formatters.js";
6
- import { SegmentedTabs as o } from "../../components/viz/SegmentedTabs.js";
4
+ import { useMyAddresses as r, useMyPaymentMethods as i, useOrders as a, usePlaceOrder as o } from "../../hooks/useKadaikodiApi.js";
5
+ import { formatCurrency as s } from "../../utils/formatters.js";
6
+ import { SegmentedTabs as c } from "../../components/viz/SegmentedTabs.js";
7
7
  import "../../components/viz/index.js";
8
- import { ProviderImage as s } from "./shared.js";
9
- import { useMemo as c, useState as l } from "react";
10
- import { AlertCircle as u, ArrowLeft as d, Banknote as f, CheckCircle2 as p, CreditCard as m, Heart as h, Loader2 as g, MapPin as _, ShoppingBag as v, Smartphone as y, Wallet as b } from "lucide-react";
11
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
12
- import { GlassCard as C, PagePurpose as w } from "@burdenoff/fe-libs/ui";
8
+ import { ProviderImage as l } from "./shared.js";
9
+ import { useEffect as u, useMemo as d, useState as f } from "react";
10
+ import { AlertCircle as ee, ArrowLeft as te, Banknote as p, CheckCircle2 as m, CreditCard as h, Heart as g, Loader2 as _, MapPin as v, ShoppingBag as y, Smartphone as b, Wallet as x } from "lucide-react";
11
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
12
+ import { GlassCard as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
13
13
  //#region src/kadaikodi/pages/customer/CheckoutPage.tsx
14
- var T = [
14
+ var E = [
15
15
  {
16
16
  id: "cash",
17
17
  label: "Cash on Delivery",
18
- icon: f,
18
+ icon: p,
19
19
  description: "Pay when you receive"
20
20
  },
21
21
  {
22
22
  id: "card",
23
23
  label: "Credit / Debit Card",
24
- icon: m,
24
+ icon: h,
25
25
  description: "Visa, Mastercard, RuPay"
26
26
  },
27
27
  {
28
28
  id: "upi",
29
29
  label: "UPI",
30
- icon: y,
30
+ icon: b,
31
31
  description: "Google Pay, PhonePe, Paytm"
32
32
  },
33
33
  {
34
34
  id: "wallet",
35
35
  label: "Digital Wallet",
36
- icon: b,
36
+ icon: x,
37
37
  description: "Kadaikodi Wallet Balance"
38
38
  }
39
- ], E = [
39
+ ], D = [
40
40
  0,
41
41
  10,
42
42
  20,
43
43
  30
44
44
  ];
45
- function D() {
46
- let { navigateTo: f, currentUser: y } = e(), { data: b = [], isLoading: D } = r({ customerId: y?.id }), O = i(), k = c(() => b.find((e) => e.status === "pending") || b[0], [b]), [A, j] = l({
45
+ function O() {
46
+ let { navigateTo: p, currentUser: b } = e(), { data: x = [], isLoading: O } = a({ customerId: b?.id }), k = o(), { data: A = [] } = r(), { data: j = [] } = i(), M = d(() => x.find((e) => e.status === "pending") || x[0], [x]), [N, P] = f({
47
47
  addressLine1: "",
48
48
  addressLine2: "",
49
49
  city: "",
50
50
  state: "",
51
51
  pincode: ""
52
- }), [M, N] = l("delivery"), [P, F] = l("cash"), [I, L] = l({
52
+ }), [F, I] = f("delivery"), [L, R] = f("cash"), [z, B] = f({
53
53
  cardNumber: "",
54
54
  expiryDate: "",
55
55
  cvv: "",
56
56
  upiId: ""
57
- }), [R, z] = l(0), [B, V] = l(""), [H, U] = l(""), [W, G] = l(!1), K = c(() => {
58
- if (!k) return {
57
+ }), [V, H] = f(0), [U, W] = f(""), [G, K] = f(""), [ne, re] = f(!1), [q, J] = f(!1), [Y, X] = f(!1);
58
+ u(() => {
59
+ if (q || A.length === 0) return;
60
+ let e = A.find((e) => e.isDefault) ?? A[0];
61
+ e && (P({
62
+ addressLine1: e.addressLine1,
63
+ addressLine2: e.addressLine2 ?? "",
64
+ city: e.city,
65
+ state: e.state,
66
+ pincode: e.zipCode
67
+ }), J(!0));
68
+ }, [A, q]), u(() => {
69
+ if (Y || j.length === 0) return;
70
+ let e = j.find((e) => e.isDefault) ?? j[0];
71
+ e && (e.type === "CARD" ? R("card") : e.type === "UPI" && R("upi"), X(!0));
72
+ }, [j, Y]);
73
+ let Z = d(() => {
74
+ if (!M) return {
59
75
  subtotal: 0,
60
76
  deliveryFee: 0,
61
77
  tax: 0,
62
78
  total: 0
63
79
  };
64
- let e = k.subtotal, t = M === "delivery" ? k.deliveryFee : 0, n = k.taxes, r = k.discount ?? 0;
80
+ let e = M.subtotal, t = F === "delivery" ? M.deliveryFee : 0, n = M.taxes, r = M.discount ?? 0;
65
81
  return {
66
82
  subtotal: e,
67
83
  deliveryFee: t,
68
84
  tax: n,
69
85
  discount: r,
70
- total: e + t + n + R - r
86
+ total: e + t + n + V - r
71
87
  };
72
88
  }, [
73
- k,
74
- R,
75
- M
76
- ]), q = c(() => k ? k.items.reduce((e, t) => e + t.quantity, 0) : 0, [k]), J = (e, t) => {
77
- j((n) => ({
89
+ M,
90
+ V,
91
+ F
92
+ ]), ie = d(() => M ? M.items.reduce((e, t) => e + t.quantity, 0) : 0, [M]), Q = (e, t) => {
93
+ P((n) => ({
78
94
  ...n,
79
95
  [e]: t
80
96
  }));
81
- }, Y = (e, t) => {
82
- L((n) => ({
97
+ }, $ = (e, t) => {
98
+ B((n) => ({
83
99
  ...n,
84
100
  [e]: t
85
101
  }));
86
- }, X = () => {
87
- if (M === "delivery") {
88
- if (!A.addressLine1.trim()) return alert("Please enter delivery address"), !1;
89
- if (!A.pincode.trim() || A.pincode.length !== 6) return alert("Please enter a valid 6-digit pincode"), !1;
102
+ }, ae = () => {
103
+ if (F === "delivery") {
104
+ if (!N.addressLine1.trim()) return alert("Please enter delivery address"), !1;
105
+ if (!N.pincode.trim() || N.pincode.length !== 6) return alert("Please enter a valid 6-digit pincode"), !1;
90
106
  }
91
- if (P === "card") {
92
- if (!I.cardNumber || I.cardNumber.length < 16) return alert("Please enter a valid 16-digit card number"), !1;
93
- if (!I.expiryDate) return alert("Please enter card expiry date"), !1;
94
- if (!I.cvv || I.cvv.length < 3) return alert("Please enter a valid 3-digit CVV"), !1;
107
+ if (L === "card") {
108
+ if (!z.cardNumber || z.cardNumber.length < 16) return alert("Please enter a valid 16-digit card number"), !1;
109
+ if (!z.expiryDate) return alert("Please enter card expiry date"), !1;
110
+ if (!z.cvv || z.cvv.length < 3) return alert("Please enter a valid 3-digit CVV"), !1;
95
111
  }
96
- return P === "upi" && !I.upiId.trim() ? (alert("Please enter UPI ID"), !1) : P === "wallet" ? (alert("Digital wallet integration is coming soon. Please choose another payment method."), !1) : !0;
112
+ return L === "upi" && !z.upiId.trim() ? (alert("Please enter UPI ID"), !1) : L === "wallet" ? (alert("Digital wallet integration is coming soon. Please choose another payment method."), !1) : !0;
97
113
  };
98
- return D ? /* @__PURE__ */ x(n, {
114
+ return O ? /* @__PURE__ */ S(n, {
99
115
  title: "Checkout",
100
- children: /* @__PURE__ */ x("div", {
116
+ children: /* @__PURE__ */ S("div", {
101
117
  className: "flex h-[60vh] items-center justify-center",
102
- children: /* @__PURE__ */ x(g, { className: "h-8 w-8 animate-spin text-primary" })
118
+ children: /* @__PURE__ */ S(_, { className: "h-8 w-8 animate-spin text-primary" })
103
119
  })
104
- }) : k ? /* @__PURE__ */ S(n, {
105
- title: /* @__PURE__ */ S("div", {
120
+ }) : M ? /* @__PURE__ */ C(n, {
121
+ title: /* @__PURE__ */ C("div", {
106
122
  className: "flex items-center gap-3",
107
- children: [/* @__PURE__ */ x("button", {
123
+ children: [/* @__PURE__ */ S("button", {
108
124
  type: "button",
109
- onClick: () => f("/customer/discover"),
125
+ onClick: () => p("/customer/discover"),
110
126
  className: "rounded-md p-1 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
111
- children: /* @__PURE__ */ x(d, { className: "h-5 w-5" })
112
- }), /* @__PURE__ */ x("span", { children: "Checkout" })]
127
+ children: /* @__PURE__ */ S(te, { className: "h-5 w-5" })
128
+ }), /* @__PURE__ */ S("span", { children: "Checkout" })]
113
129
  }),
114
130
  description: "Review your order and complete payment",
115
- children: [/* @__PURE__ */ x(w, {
131
+ children: [/* @__PURE__ */ S(T, {
116
132
  className: "mb-6",
117
133
  children: "The last step before your food is on its way — confirm where it's going, pick how you'd like to pay, add a tip or special instructions, and review the total. Everything checks out? Place your order from the summary on the right."
118
- }), /* @__PURE__ */ S("div", {
134
+ }), /* @__PURE__ */ C("div", {
119
135
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
120
- children: [/* @__PURE__ */ S("div", {
136
+ children: [/* @__PURE__ */ C("div", {
121
137
  className: "lg:col-span-2 space-y-6",
122
138
  children: [
123
- /* @__PURE__ */ S("section", {
139
+ /* @__PURE__ */ C("section", {
124
140
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
125
141
  children: [
126
- /* @__PURE__ */ x("h2", {
142
+ /* @__PURE__ */ S("h2", {
127
143
  className: "text-base font-semibold text-text-primary mb-4",
128
144
  children: "Fulfilment"
129
145
  }),
130
- /* @__PURE__ */ x(o, {
146
+ /* @__PURE__ */ S(c, {
131
147
  fill: !0,
132
148
  "aria-label": "Fulfilment method",
133
149
  tabs: [
@@ -144,414 +160,414 @@ function D() {
144
160
  label: "On-location"
145
161
  }
146
162
  ],
147
- value: M,
148
- onChange: (e) => N(e)
163
+ value: F,
164
+ onChange: (e) => I(e)
149
165
  }),
150
- /* @__PURE__ */ x("p", {
166
+ /* @__PURE__ */ S("p", {
151
167
  className: "mt-3 text-xs text-text-secondary",
152
- children: M === "delivery" ? "A delivery partner brings your order to the address below." : M === "pickup" ? "Collect your order from the cart — no delivery fee." : "The cart serves you at your location — no delivery fee."
168
+ children: F === "delivery" ? "A delivery partner brings your order to the address below." : F === "pickup" ? "Collect your order from the cart — no delivery fee." : "The cart serves you at your location — no delivery fee."
153
169
  })
154
170
  ]
155
171
  }),
156
- M === "delivery" && /* @__PURE__ */ S("section", {
172
+ F === "delivery" && /* @__PURE__ */ C("section", {
157
173
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
158
- children: [/* @__PURE__ */ S("h2", {
174
+ children: [/* @__PURE__ */ C("h2", {
159
175
  className: "text-base font-semibold text-text-primary mb-4 flex items-center gap-2",
160
- children: [/* @__PURE__ */ x(_, { className: "h-4 w-4 text-text-secondary" }), "Delivery Address"]
161
- }), /* @__PURE__ */ S("div", {
176
+ children: [/* @__PURE__ */ S(v, { className: "h-4 w-4 text-text-secondary" }), "Delivery Address"]
177
+ }), /* @__PURE__ */ C("div", {
162
178
  className: "space-y-4",
163
179
  children: [
164
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
180
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
165
181
  className: "block text-sm font-medium text-text-primary mb-1.5",
166
- children: ["Address Line 1 ", /* @__PURE__ */ x("span", {
182
+ children: ["Address Line 1 ", /* @__PURE__ */ S("span", {
167
183
  className: "text-status-error-text",
168
184
  children: "*"
169
185
  })]
170
- }), /* @__PURE__ */ x("input", {
186
+ }), /* @__PURE__ */ S("input", {
171
187
  type: "text",
172
188
  placeholder: "Building, Street, Area",
173
- value: A.addressLine1,
174
- onChange: (e) => J("addressLine1", e.target.value),
189
+ value: N.addressLine1,
190
+ onChange: (e) => Q("addressLine1", e.target.value),
175
191
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
176
192
  })] }),
177
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
193
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
178
194
  className: "block text-sm font-medium text-text-primary mb-1.5",
179
195
  children: "Address Line 2"
180
- }), /* @__PURE__ */ x("input", {
196
+ }), /* @__PURE__ */ S("input", {
181
197
  type: "text",
182
198
  placeholder: "Apartment, Suite, Floor (Optional)",
183
- value: A.addressLine2,
184
- onChange: (e) => J("addressLine2", e.target.value),
199
+ value: N.addressLine2,
200
+ onChange: (e) => Q("addressLine2", e.target.value),
185
201
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
186
202
  })] }),
187
- /* @__PURE__ */ S("div", {
203
+ /* @__PURE__ */ C("div", {
188
204
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
189
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
205
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
190
206
  className: "block text-sm font-medium text-text-primary mb-1.5",
191
- children: ["City ", /* @__PURE__ */ x("span", {
207
+ children: ["City ", /* @__PURE__ */ S("span", {
192
208
  className: "text-status-error-text",
193
209
  children: "*"
194
210
  })]
195
- }), /* @__PURE__ */ x("input", {
211
+ }), /* @__PURE__ */ S("input", {
196
212
  type: "text",
197
213
  placeholder: "City",
198
- value: A.city,
199
- onChange: (e) => J("city", e.target.value),
214
+ value: N.city,
215
+ onChange: (e) => Q("city", e.target.value),
200
216
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
201
- })] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
217
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
202
218
  className: "block text-sm font-medium text-text-primary mb-1.5",
203
- children: ["State ", /* @__PURE__ */ x("span", {
219
+ children: ["State ", /* @__PURE__ */ S("span", {
204
220
  className: "text-status-error-text",
205
221
  children: "*"
206
222
  })]
207
- }), /* @__PURE__ */ x("input", {
223
+ }), /* @__PURE__ */ S("input", {
208
224
  type: "text",
209
225
  placeholder: "State",
210
- value: A.state,
211
- onChange: (e) => J("state", e.target.value),
226
+ value: N.state,
227
+ onChange: (e) => Q("state", e.target.value),
212
228
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
213
229
  })] })]
214
230
  }),
215
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
231
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
216
232
  className: "block text-sm font-medium text-text-primary mb-1.5",
217
- children: ["Pincode ", /* @__PURE__ */ x("span", {
233
+ children: ["Pincode ", /* @__PURE__ */ S("span", {
218
234
  className: "text-status-error-text",
219
235
  children: "*"
220
236
  })]
221
- }), /* @__PURE__ */ x("input", {
237
+ }), /* @__PURE__ */ S("input", {
222
238
  type: "text",
223
239
  placeholder: "560001",
224
240
  maxLength: 6,
225
- value: A.pincode,
226
- onChange: (e) => J("pincode", e.target.value.replace(/\D/g, "")),
241
+ value: N.pincode,
242
+ onChange: (e) => Q("pincode", e.target.value.replace(/\D/g, "")),
227
243
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
228
244
  })] })
229
245
  ]
230
246
  })]
231
247
  }),
232
- /* @__PURE__ */ S("section", {
248
+ /* @__PURE__ */ C("section", {
233
249
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
234
250
  children: [
235
- /* @__PURE__ */ S("h2", {
251
+ /* @__PURE__ */ C("h2", {
236
252
  className: "text-base font-semibold text-text-primary mb-4 flex items-center gap-2",
237
- children: [/* @__PURE__ */ x(m, { className: "h-4 w-4 text-text-secondary" }), "Payment Method"]
253
+ children: [/* @__PURE__ */ S(h, { className: "h-4 w-4 text-text-secondary" }), "Payment Method"]
238
254
  }),
239
- /* @__PURE__ */ x("div", {
255
+ /* @__PURE__ */ S("div", {
240
256
  className: "space-y-2",
241
- children: T.map((e) => {
257
+ children: E.map((e) => {
242
258
  let n = e.icon;
243
- return /* @__PURE__ */ S("button", {
259
+ return /* @__PURE__ */ C("button", {
244
260
  type: "button",
245
- onClick: () => F(e.id),
246
- className: t("flex w-full items-center gap-4 rounded-lg border p-3 transition-colors text-left", P === e.id ? "border-foreground bg-accent" : "border-border-subtle bg-bg-surface hover:bg-accent"),
261
+ onClick: () => R(e.id),
262
+ className: t("flex w-full items-center gap-4 rounded-lg border p-3 transition-colors text-left", L === e.id ? "border-foreground bg-accent" : "border-border-subtle bg-bg-surface hover:bg-accent"),
247
263
  children: [
248
- /* @__PURE__ */ x("div", {
264
+ /* @__PURE__ */ S("div", {
249
265
  className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-bg-sunken",
250
- children: /* @__PURE__ */ x(n, { className: "h-4 w-4 text-text-secondary" })
266
+ children: /* @__PURE__ */ S(n, { className: "h-4 w-4 text-text-secondary" })
251
267
  }),
252
- /* @__PURE__ */ S("div", {
268
+ /* @__PURE__ */ C("div", {
253
269
  className: "flex-1 min-w-0",
254
- children: [/* @__PURE__ */ x("p", {
270
+ children: [/* @__PURE__ */ S("p", {
255
271
  className: "text-sm font-medium text-text-primary",
256
272
  children: e.label
257
- }), /* @__PURE__ */ x("p", {
273
+ }), /* @__PURE__ */ S("p", {
258
274
  className: "text-xs text-text-secondary",
259
275
  children: e.description
260
276
  })]
261
277
  }),
262
- P === e.id && /* @__PURE__ */ x(p, { className: "h-5 w-5 text-text-primary shrink-0" })
278
+ L === e.id && /* @__PURE__ */ S(m, { className: "h-5 w-5 text-text-primary shrink-0" })
263
279
  ]
264
280
  }, e.id);
265
281
  })
266
282
  }),
267
- P === "card" && /* @__PURE__ */ S("div", {
283
+ L === "card" && /* @__PURE__ */ C("div", {
268
284
  className: "mt-4 space-y-4 border-t border-border-subtle pt-4",
269
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
285
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
270
286
  className: "block text-sm font-medium text-text-primary mb-1.5",
271
- children: ["Card Number ", /* @__PURE__ */ x("span", {
287
+ children: ["Card Number ", /* @__PURE__ */ S("span", {
272
288
  className: "text-status-error-text",
273
289
  children: "*"
274
290
  })]
275
- }), /* @__PURE__ */ x("input", {
291
+ }), /* @__PURE__ */ S("input", {
276
292
  type: "text",
277
293
  placeholder: "1234 5678 9012 3456",
278
294
  maxLength: 16,
279
- value: I.cardNumber,
280
- onChange: (e) => Y("cardNumber", e.target.value.replace(/\D/g, "")),
295
+ value: z.cardNumber,
296
+ onChange: (e) => $("cardNumber", e.target.value.replace(/\D/g, "")),
281
297
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
282
- })] }), /* @__PURE__ */ S("div", {
298
+ })] }), /* @__PURE__ */ C("div", {
283
299
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
284
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
300
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
285
301
  className: "block text-sm font-medium text-text-primary mb-1.5",
286
- children: ["Expiry Date ", /* @__PURE__ */ x("span", {
302
+ children: ["Expiry Date ", /* @__PURE__ */ S("span", {
287
303
  className: "text-status-error-text",
288
304
  children: "*"
289
305
  })]
290
- }), /* @__PURE__ */ x("input", {
306
+ }), /* @__PURE__ */ S("input", {
291
307
  type: "text",
292
308
  placeholder: "MM/YY",
293
309
  maxLength: 5,
294
- value: I.expiryDate,
310
+ value: z.expiryDate,
295
311
  onChange: (e) => {
296
312
  let t = e.target.value.replace(/\D/g, "");
297
- t.length >= 2 && (t = t.slice(0, 2) + "/" + t.slice(2, 4)), Y("expiryDate", t);
313
+ t.length >= 2 && (t = t.slice(0, 2) + "/" + t.slice(2, 4)), $("expiryDate", t);
298
314
  },
299
315
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
300
- })] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("label", {
316
+ })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
301
317
  className: "block text-sm font-medium text-text-primary mb-1.5",
302
- children: ["CVV ", /* @__PURE__ */ x("span", {
318
+ children: ["CVV ", /* @__PURE__ */ S("span", {
303
319
  className: "text-status-error-text",
304
320
  children: "*"
305
321
  })]
306
- }), /* @__PURE__ */ x("input", {
322
+ }), /* @__PURE__ */ S("input", {
307
323
  type: "text",
308
324
  placeholder: "123",
309
325
  maxLength: 3,
310
- value: I.cvv,
311
- onChange: (e) => Y("cvv", e.target.value.replace(/\D/g, "")),
326
+ value: z.cvv,
327
+ onChange: (e) => $("cvv", e.target.value.replace(/\D/g, "")),
312
328
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
313
329
  })] })]
314
330
  })]
315
331
  }),
316
- P === "upi" && /* @__PURE__ */ S("div", {
332
+ L === "upi" && /* @__PURE__ */ C("div", {
317
333
  className: "mt-4 border-t border-border-subtle pt-4",
318
- children: [/* @__PURE__ */ S("label", {
334
+ children: [/* @__PURE__ */ C("label", {
319
335
  className: "block text-sm font-medium text-text-primary mb-1.5",
320
- children: ["UPI ID ", /* @__PURE__ */ x("span", {
336
+ children: ["UPI ID ", /* @__PURE__ */ S("span", {
321
337
  className: "text-status-error-text",
322
338
  children: "*"
323
339
  })]
324
- }), /* @__PURE__ */ x("input", {
340
+ }), /* @__PURE__ */ S("input", {
325
341
  type: "text",
326
342
  placeholder: "user@paytm",
327
- value: I.upiId,
328
- onChange: (e) => Y("upiId", e.target.value),
343
+ value: z.upiId,
344
+ onChange: (e) => $("upiId", e.target.value),
329
345
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
330
346
  })]
331
347
  }),
332
- P === "wallet" && /* @__PURE__ */ S("div", {
348
+ L === "wallet" && /* @__PURE__ */ C("div", {
333
349
  className: "mt-4 flex items-start gap-3 rounded-lg bg-[var(--color-accent-soft)] p-4 border border-border-focus/20",
334
- children: [/* @__PURE__ */ x(u, { className: "h-4 w-4 text-text-primary mt-0.5 shrink-0" }), /* @__PURE__ */ x("p", {
350
+ children: [/* @__PURE__ */ S(ee, { className: "h-4 w-4 text-text-primary mt-0.5 shrink-0" }), /* @__PURE__ */ S("p", {
335
351
  className: "text-sm text-text-primary",
336
352
  children: "Digital wallet integration coming soon. Please choose another payment method."
337
353
  })]
338
354
  })
339
355
  ]
340
356
  }),
341
- /* @__PURE__ */ S("section", {
357
+ /* @__PURE__ */ C("section", {
342
358
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
343
- children: [/* @__PURE__ */ S("h2", {
359
+ children: [/* @__PURE__ */ C("h2", {
344
360
  className: "text-base font-semibold text-text-primary mb-4 flex items-center gap-2",
345
- children: [/* @__PURE__ */ x(h, { className: "h-4 w-4 text-text-secondary" }), "Additional Options"]
346
- }), /* @__PURE__ */ S("div", {
361
+ children: [/* @__PURE__ */ S(g, { className: "h-4 w-4 text-text-secondary" }), "Additional Options"]
362
+ }), /* @__PURE__ */ C("div", {
347
363
  className: "space-y-5",
348
- children: [/* @__PURE__ */ S("div", { children: [
349
- /* @__PURE__ */ x("label", {
364
+ children: [/* @__PURE__ */ C("div", { children: [
365
+ /* @__PURE__ */ S("label", {
350
366
  className: "block text-sm font-medium text-text-primary mb-2",
351
367
  children: "Tip for delivery partner"
352
368
  }),
353
- /* @__PURE__ */ x("div", {
369
+ /* @__PURE__ */ S("div", {
354
370
  className: "flex flex-wrap gap-2 mb-3",
355
- children: E.map((e) => /* @__PURE__ */ x("button", {
371
+ children: D.map((e) => /* @__PURE__ */ S("button", {
356
372
  type: "button",
357
373
  onClick: () => {
358
- z(e), V("");
374
+ H(e), W("");
359
375
  },
360
- className: t("flex-1 min-w-[64px] rounded-lg px-3 py-2.5 text-sm font-medium transition-colors", R === e && B === "" ? "bg-foreground text-background" : "bg-bg-sunken text-text-secondary hover:bg-accent hover:text-text-primary"),
376
+ className: t("flex-1 min-w-[64px] rounded-lg px-3 py-2.5 text-sm font-medium transition-colors", V === e && U === "" ? "bg-foreground text-background" : "bg-bg-sunken text-text-secondary hover:bg-accent hover:text-text-primary"),
361
377
  children: e === 0 ? "No Tip" : `₹${e}`
362
378
  }, e))
363
379
  }),
364
- /* @__PURE__ */ x("input", {
380
+ /* @__PURE__ */ S("input", {
365
381
  type: "number",
366
382
  placeholder: "Custom tip amount",
367
- value: B,
383
+ value: U,
368
384
  onChange: (e) => {
369
385
  let t = e.target.value;
370
- V(t), z(parseInt(t) || 0);
386
+ W(t), H(parseInt(t) || 0);
371
387
  },
372
388
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
373
389
  })
374
- ] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
390
+ ] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
375
391
  className: "block text-sm font-medium text-text-primary mb-2",
376
392
  children: "Special Instructions"
377
- }), /* @__PURE__ */ x("textarea", {
393
+ }), /* @__PURE__ */ S("textarea", {
378
394
  rows: 3,
379
395
  placeholder: "Any special requests for your order...",
380
- value: H,
381
- onChange: (e) => U(e.target.value),
396
+ value: G,
397
+ onChange: (e) => K(e.target.value),
382
398
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none"
383
399
  })] })]
384
400
  })]
385
401
  })
386
402
  ]
387
- }), /* @__PURE__ */ x("div", {
403
+ }), /* @__PURE__ */ S("div", {
388
404
  className: "lg:col-span-1",
389
- children: /* @__PURE__ */ S(C, {
405
+ children: /* @__PURE__ */ C(w, {
390
406
  treatment: "glass",
391
407
  glow: !0,
392
408
  className: "sticky top-6 p-5",
393
409
  children: [
394
- /* @__PURE__ */ x("h2", {
410
+ /* @__PURE__ */ S("h2", {
395
411
  className: "text-base font-semibold text-text-primary mb-4",
396
412
  children: "Order Summary"
397
413
  }),
398
- /* @__PURE__ */ S("div", {
414
+ /* @__PURE__ */ C("div", {
399
415
  className: "flex items-center gap-3 mb-4 pb-4 border-b border-border-subtle",
400
- children: [/* @__PURE__ */ x("div", {
416
+ children: [/* @__PURE__ */ S("div", {
401
417
  className: "h-12 w-12 rounded-md bg-bg-sunken overflow-hidden",
402
- children: /* @__PURE__ */ x(s, {
403
- src: k.cartImage,
404
- alt: k.cartName,
405
- seed: k.cartName
418
+ children: /* @__PURE__ */ S(l, {
419
+ src: M.cartImage,
420
+ alt: M.cartName,
421
+ seed: M.cartName
406
422
  })
407
- }), /* @__PURE__ */ S("div", {
423
+ }), /* @__PURE__ */ C("div", {
408
424
  className: "min-w-0",
409
- children: [/* @__PURE__ */ x("p", {
425
+ children: [/* @__PURE__ */ S("p", {
410
426
  className: "text-sm font-medium text-text-primary truncate",
411
- children: k.cartName
412
- }), /* @__PURE__ */ S("p", {
427
+ children: M.cartName
428
+ }), /* @__PURE__ */ C("p", {
413
429
  className: "text-xs text-text-secondary capitalize",
414
430
  children: [
415
- k.items.length,
431
+ M.items.length,
416
432
  " item",
417
- k.items.length === 1 ? "" : "s",
433
+ M.items.length === 1 ? "" : "s",
418
434
  " ·",
419
435
  " ",
420
- M.replace("_", "-")
436
+ F.replace("_", "-")
421
437
  ]
422
438
  })]
423
439
  })]
424
440
  }),
425
- /* @__PURE__ */ x("div", {
441
+ /* @__PURE__ */ S("div", {
426
442
  className: "space-y-2 mb-4",
427
- children: k.items.map((e) => /* @__PURE__ */ S("div", {
443
+ children: M.items.map((e) => /* @__PURE__ */ C("div", {
428
444
  className: "flex justify-between items-start",
429
- children: [/* @__PURE__ */ S("div", {
445
+ children: [/* @__PURE__ */ C("div", {
430
446
  className: "flex-1 min-w-0",
431
447
  children: [
432
- /* @__PURE__ */ x("p", {
448
+ /* @__PURE__ */ S("p", {
433
449
  className: "text-sm text-text-primary",
434
450
  children: e.name
435
451
  }),
436
- e.customizations && e.customizations.length > 0 && /* @__PURE__ */ x("p", {
452
+ e.customizations && e.customizations.length > 0 && /* @__PURE__ */ S("p", {
437
453
  className: "text-xs text-text-secondary mt-0.5",
438
454
  children: e.customizations.join(", ")
439
455
  }),
440
- /* @__PURE__ */ S("p", {
456
+ /* @__PURE__ */ C("p", {
441
457
  className: "text-xs text-text-secondary",
442
458
  children: [
443
- a(e.price, { minimumFractionDigits: 0 }),
459
+ s(e.price, { minimumFractionDigits: 0 }),
444
460
  " x ",
445
461
  e.quantity
446
462
  ]
447
463
  })
448
464
  ]
449
- }), /* @__PURE__ */ x("span", {
465
+ }), /* @__PURE__ */ S("span", {
450
466
  className: "text-sm font-medium text-text-primary",
451
- children: a(e.price * e.quantity, { minimumFractionDigits: 0 })
467
+ children: s(e.price * e.quantity, { minimumFractionDigits: 0 })
452
468
  })]
453
469
  }, e.id))
454
470
  }),
455
- /* @__PURE__ */ S("div", {
471
+ /* @__PURE__ */ C("div", {
456
472
  className: "border-t border-border-subtle pt-4 space-y-2.5 text-sm",
457
473
  children: [
458
- /* @__PURE__ */ S("div", {
474
+ /* @__PURE__ */ C("div", {
459
475
  className: "flex justify-between",
460
- children: [/* @__PURE__ */ S("span", {
476
+ children: [/* @__PURE__ */ C("span", {
461
477
  className: "text-text-secondary",
462
478
  children: [
463
479
  "Subtotal (",
464
- q,
480
+ ie,
465
481
  " items)"
466
482
  ]
467
- }), /* @__PURE__ */ x("span", {
483
+ }), /* @__PURE__ */ S("span", {
468
484
  className: "text-text-primary",
469
- children: a(K.subtotal, { minimumFractionDigits: 0 })
485
+ children: s(Z.subtotal, { minimumFractionDigits: 0 })
470
486
  })]
471
487
  }),
472
- /* @__PURE__ */ S("div", {
488
+ /* @__PURE__ */ C("div", {
473
489
  className: "flex justify-between",
474
- children: [/* @__PURE__ */ x("span", {
490
+ children: [/* @__PURE__ */ S("span", {
475
491
  className: "text-text-secondary",
476
492
  children: "Delivery Fee"
477
- }), /* @__PURE__ */ x("span", {
493
+ }), /* @__PURE__ */ S("span", {
478
494
  className: "text-text-primary",
479
- children: K.deliveryFee === 0 ? "FREE" : a(K.deliveryFee, { minimumFractionDigits: 0 })
495
+ children: Z.deliveryFee === 0 ? "FREE" : s(Z.deliveryFee, { minimumFractionDigits: 0 })
480
496
  })]
481
497
  }),
482
- /* @__PURE__ */ S("div", {
498
+ /* @__PURE__ */ C("div", {
483
499
  className: "flex justify-between",
484
- children: [/* @__PURE__ */ x("span", {
500
+ children: [/* @__PURE__ */ S("span", {
485
501
  className: "text-text-secondary",
486
502
  children: "Tax"
487
- }), /* @__PURE__ */ x("span", {
503
+ }), /* @__PURE__ */ S("span", {
488
504
  className: "text-text-primary",
489
- children: a(K.tax, { minimumFractionDigits: 0 })
505
+ children: s(Z.tax, { minimumFractionDigits: 0 })
490
506
  })]
491
507
  }),
492
- R > 0 && /* @__PURE__ */ S("div", {
508
+ V > 0 && /* @__PURE__ */ C("div", {
493
509
  className: "flex justify-between",
494
- children: [/* @__PURE__ */ x("span", {
510
+ children: [/* @__PURE__ */ S("span", {
495
511
  className: "text-text-secondary",
496
512
  children: "Tip"
497
- }), /* @__PURE__ */ x("span", {
513
+ }), /* @__PURE__ */ S("span", {
498
514
  className: "text-text-primary",
499
- children: a(R, { minimumFractionDigits: 0 })
515
+ children: s(V, { minimumFractionDigits: 0 })
500
516
  })]
501
517
  }),
502
- K.discount && K.discount > 0 && /* @__PURE__ */ S("div", {
518
+ Z.discount && Z.discount > 0 && /* @__PURE__ */ C("div", {
503
519
  className: "flex justify-between",
504
- children: [/* @__PURE__ */ x("span", {
520
+ children: [/* @__PURE__ */ S("span", {
505
521
  className: "text-status-success-text",
506
522
  children: "Discount"
507
- }), /* @__PURE__ */ S("span", {
523
+ }), /* @__PURE__ */ C("span", {
508
524
  className: "text-status-success-text",
509
- children: ["-", a(K.discount, { minimumFractionDigits: 0 })]
525
+ children: ["-", s(Z.discount, { minimumFractionDigits: 0 })]
510
526
  })]
511
527
  })
512
528
  ]
513
529
  }),
514
- /* @__PURE__ */ S("div", {
530
+ /* @__PURE__ */ C("div", {
515
531
  className: "mt-4 flex justify-between border-t border-border-subtle pt-4",
516
- children: [/* @__PURE__ */ x("span", {
532
+ children: [/* @__PURE__ */ S("span", {
517
533
  className: "text-base font-semibold text-text-primary",
518
534
  children: "Total"
519
- }), /* @__PURE__ */ x("span", {
535
+ }), /* @__PURE__ */ S("span", {
520
536
  className: "text-base font-bold text-text-primary",
521
- children: a(K.total, { minimumFractionDigits: 0 })
537
+ children: s(Z.total, { minimumFractionDigits: 0 })
522
538
  })]
523
539
  }),
524
- /* @__PURE__ */ S("button", {
540
+ /* @__PURE__ */ C("button", {
525
541
  type: "button",
526
542
  onClick: async () => {
527
- if (!(!X() || !k)) try {
528
- let e = await O.mutateAsync({
529
- providerId: k.cartId,
530
- customerId: y?.id,
531
- fulfillmentType: M,
532
- items: k.items.map((e) => ({
543
+ if (!(!ae() || !M)) try {
544
+ let e = await k.mutateAsync({
545
+ providerId: M.cartId,
546
+ customerId: b?.id,
547
+ fulfillmentType: F,
548
+ items: M.items.map((e) => ({
533
549
  offeringId: e.id,
534
550
  quantity: e.quantity,
535
551
  customizations: e.customizations
536
552
  })),
537
- deliveryAddress: M === "delivery" ? `${A.addressLine1}, ${A.addressLine2}, ${A.city}, ${A.state} - ${A.pincode}` : void 0,
538
- paymentMethod: P.toUpperCase(),
539
- notes: H,
540
- deliveryFee: K.deliveryFee,
541
- tax: K.tax,
542
- tip: R,
543
- total: K.total
553
+ deliveryAddress: F === "delivery" ? `${N.addressLine1}, ${N.addressLine2}, ${N.city}, ${N.state} - ${N.pincode}` : void 0,
554
+ paymentMethod: L.toUpperCase(),
555
+ notes: G,
556
+ deliveryFee: Z.deliveryFee,
557
+ tax: Z.tax,
558
+ tip: V,
559
+ total: Z.total
544
560
  });
545
- alert("Order placed successfully!"), f(`/customer/orders/${e.id}/track`);
561
+ alert("Order placed successfully!"), p(`/customer/orders/${e.id}/track`);
546
562
  } catch {
547
563
  alert("Failed to place order. Please try again.");
548
564
  }
549
565
  },
550
- disabled: O.isPending,
551
- className: t("mt-6 flex w-full items-center justify-center gap-2 rounded-lg py-3 text-sm font-medium transition-opacity", "bg-foreground text-background", O.isPending ? "opacity-60 cursor-not-allowed" : "hover:opacity-90"),
552
- children: [O.isPending ? /* @__PURE__ */ x(g, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ x(v, { className: "h-4 w-4" }), O.isPending ? "Placing Order..." : `Place Order - ${a(K.total, { minimumFractionDigits: 0 })}`]
566
+ disabled: k.isPending,
567
+ className: t("mt-6 flex w-full items-center justify-center gap-2 rounded-lg py-3 text-sm font-medium transition-opacity", "bg-foreground text-background", k.isPending ? "opacity-60 cursor-not-allowed" : "hover:opacity-90"),
568
+ children: [k.isPending ? /* @__PURE__ */ S(_, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(y, { className: "h-4 w-4" }), k.isPending ? "Placing Order..." : `Place Order - ${s(Z.total, { minimumFractionDigits: 0 })}`]
553
569
  }),
554
- /* @__PURE__ */ x("p", {
570
+ /* @__PURE__ */ S("p", {
555
571
  className: "mt-3 text-center text-xs text-text-secondary",
556
572
  children: "By placing this order, you agree to our Terms of Service and Privacy Policy"
557
573
  })
@@ -559,23 +575,23 @@ function D() {
559
575
  })
560
576
  })]
561
577
  })]
562
- }) : /* @__PURE__ */ x(n, {
578
+ }) : /* @__PURE__ */ S(n, {
563
579
  title: "Checkout",
564
- children: /* @__PURE__ */ S("div", {
580
+ children: /* @__PURE__ */ C("div", {
565
581
  className: "flex flex-col items-center justify-center py-16 text-center",
566
582
  children: [
567
- /* @__PURE__ */ x(v, { className: "h-16 w-16 text-text-secondary/40 mb-4" }),
568
- /* @__PURE__ */ x("h3", {
583
+ /* @__PURE__ */ S(y, { className: "h-16 w-16 text-text-secondary/40 mb-4" }),
584
+ /* @__PURE__ */ S("h3", {
569
585
  className: "text-lg font-semibold text-text-primary mb-2",
570
586
  children: "Your cart is empty"
571
587
  }),
572
- /* @__PURE__ */ x("p", {
588
+ /* @__PURE__ */ S("p", {
573
589
  className: "text-sm text-text-secondary mb-6",
574
590
  children: "Add some items to proceed with checkout"
575
591
  }),
576
- /* @__PURE__ */ x("button", {
592
+ /* @__PURE__ */ S("button", {
577
593
  type: "button",
578
- onClick: () => f("/customer/discover"),
594
+ onClick: () => p("/customer/discover"),
579
595
  className: "rounded-lg bg-foreground px-6 py-3 text-sm font-medium text-background hover:opacity-90 transition-opacity",
580
596
  children: "Browse Carts"
581
597
  })
@@ -584,6 +600,6 @@ function D() {
584
600
  });
585
601
  }
586
602
  //#endregion
587
- export { D as CheckoutPage };
603
+ export { O as CheckoutPage };
588
604
 
589
605
  //# sourceMappingURL=CheckoutPage.js.map