@levo-so/studio 0.1.101 → 0.1.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/{AuthProvider-56TywIOB.js → AuthProvider-C6bvedwF.js} +16 -16
  2. package/Beams-DboMUgCv.js +102 -0
  3. package/{BillingStep-Brc1Mzo3.js → BillingStep-BA3H9BVu.js} +1 -1
  4. package/{Button-XTKnNIl9.js → Button-CZycqusY.js} +249 -138
  5. package/Button-lUfKisu8.js +116 -0
  6. package/CollectionField-xa-jed3_.js +232 -0
  7. package/CollectionInput-CpNGIXJx.js +147 -0
  8. package/DateTimeWidget-DP_nMhqe.js +256 -0
  9. package/Dialog-IrII0ugb.js +130 -0
  10. package/Dots-a8xSboDv.js +100 -0
  11. package/{EntryCard-DTcx6wfA.js → EntryCard-CQpKNX7G.js} +4 -4
  12. package/Grid-BJQvxnks.js +99 -0
  13. package/{LoginCard-CnHmCKUF.js → LoginCard-Cyvm-y_q.js} +3 -3
  14. package/{LoginForm-Ck-xFaDg.js → LoginForm-_44FtvWg.js} +207 -206
  15. package/{LoginModal-BdYM8INu.js → LoginModal-Cyw_XKvz.js} +4 -4
  16. package/{MessageCard-ChDBqLVG.js → MessageCard-C2lNTxFx.js} +2 -2
  17. package/{MessageFooter-AzAtJWMo.js → MessageFooter-59Pziq3i.js} +2 -2
  18. package/{ModalManager-SggxCIno.js → ModalManager-DHkd0Zdb.js} +1 -1
  19. package/{PendingApprovalCard-C6ORDqrY.js → PendingApprovalCard-C8iZjo06.js} +3 -3
  20. package/PhoneWidget-CxxxDXkz.js +100 -0
  21. package/{Popover-BdKCElnb.js → Popover-DOvRAGzc.js} +19 -20
  22. package/PopupRenderer-C7OHYphU-Ct5T6tWM.js +2668 -0
  23. package/RichTextWidget-BqlcssWt.js +113 -0
  24. package/RteThemeProvider-Cfepkyer.js +20 -0
  25. package/{StripePaymentModal-BHIBBvRj.js → StripePaymentModal-DrLMN18M.js} +17 -17
  26. package/Toolbar-BwxoYWO_.js +738 -0
  27. package/Tooltip-NEMQqPyr.js +67 -0
  28. package/VerifyButton-TNkt-SDu.js +177 -0
  29. package/authentication-hnV1BI8s.js +36 -0
  30. package/bookingCard-BDyuBC6X.js +636 -0
  31. package/collection.d.ts +83 -0
  32. package/collection.js +9 -8
  33. package/{dialog-Dw6n_36P.js → dialog-C8-iHixJ.js} +32 -32
  34. package/dist-CG-pwDW0.js +3188 -0
  35. package/generateRadiusScale-BpcgkGtN.js +71 -0
  36. package/getFieldValidations-CSkSV2hW.js +90 -0
  37. package/index.d.ts +96 -9
  38. package/index.js +6021 -7731
  39. package/inlineRteTheme-Ajq9PNpQ.js +9 -0
  40. package/{nodeAlignment-BZbdafVA.js → nodeAlignment-DKCIjzlR.js} +41 -62
  41. package/package.json +38 -40
  42. package/studio.css +1 -1
  43. package/useLogin-B2qE8710.js +127 -0
  44. package/{utils-kDaDLLGt.js → utils-CZLafTgN.js} +1 -1
  45. package/{widgets-CWDiqXm9.js → widgets-eu5zXTf-.js} +58 -125
  46. package/Beams-B0O3uyYF.js +0 -118
  47. package/CollectionInput-cmJ0RXzG.js +0 -132
  48. package/DateTimeWidget-B5lBr0_R.js +0 -255
  49. package/Dots-DjezbpLp.js +0 -137
  50. package/Grid-C9aUfXM-.js +0 -145
  51. package/Input-Btdc1Dee.js +0 -293
  52. package/PhoneWidget-BRIAve47.js +0 -100
  53. package/RichTextWidget-CjEoGecM.js +0 -1136
  54. package/Tooltip-BOq5vSOW.js +0 -68
  55. package/VerifyButton-Bl2QqMpB.js +0 -273
  56. package/bookingCard-D3ZSjq-P.js +0 -577
  57. package/dist-DuTd566a.js +0 -3112
  58. package/getFieldValidations-DZnDgNI0.js +0 -159
  59. /package/{Gradient-B1K9Yi04.js → Gradient-NacpoDCM.js} +0 -0
  60. /package/{Waves-BkaAfGqA.js → Waves-DUuT_IFr.js} +0 -0
  61. /package/{card-BQr9258p.js → card-E2LKF9nT.js} +0 -0
  62. /package/{theme.cssm-2YTdd8Yh.js → theme.cssm-BXDp-ojp.js} +0 -0
@@ -1,577 +0,0 @@
1
- "use client";
2
- import { n as e } from "./AuthProvider-56TywIOB.js";
3
- import { t } from "./Button-XTKnNIl9.js";
4
- import { n, t as r } from "./StripePaymentModal-BHIBBvRj.js";
5
- import { BillingStep as ee } from "./BillingStep-Brc1Mzo3.js";
6
- import { useRef as i, useState as a } from "react";
7
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
- import { cn as te, errorHandler as l, useLevo as u } from "@levo-so/react";
9
- import d from "dayjs";
10
- import { Calendar as f, CheckCircle2 as p, Clock as m, CreditCard as ne, Download as h, Loader2 as g, Pencil as re, RefreshCw as ie, ShieldCheck as _, Ticket as v, XCircle as y } from "lucide-react";
11
- import { useRazorpay as ae } from "react-razorpay";
12
- //#region src/components/bookingCard/BookingCard.tsx
13
- var b = ({ summary: b, billingDetails: x, onBillingEdit: S, onComplete: C, className: w }) => {
14
- let T = u(), { workspace: E } = e(), { Razorpay: D } = ae(), { stripePromise: O, config: k, isOpen: A, openStripeCheckout: j, closeStripeCheckout: M, setOnComplete: oe } = n(), [N, P] = a("summary"), [se, F] = a(null), [I, L] = a(!1), [R, z] = a(null), [B, V] = a("razorpay"), H = i(!1), U = i(null), W = i(null), G = (e, t) => {
15
- let n = t && t.trim() ? t : "INR", r = e / 100;
16
- return new Intl.NumberFormat("en-IN", {
17
- style: "currency",
18
- currency: n,
19
- minimumFractionDigits: 0
20
- }).format(r);
21
- }, K = (e) => e ? d(e).format("D MMM YYYY") : null, q = (e) => e ? d(e).format("h:mm A") : null, J = (e) => e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase()), Y = (e) => e == null ? "-" : typeof e == "boolean" ? e ? "Yes" : "No" : Array.isArray(e) ? e.join(", ") : typeof e == "object" ? JSON.stringify(e) : String(e), X = Object.entries(b.form_data || {}).filter(([e, t]) => t != null && t !== ""), Z = () => {
22
- if (!W.current) return;
23
- let e = W.current;
24
- T?.fetch?.url(`/v1/payment/booking/${b._id}/confirm`)?.options({ headers: { Origin: E?.id || "" } })?.post({ session_id: e })?.json().then((e) => {
25
- e?.content?.data ? (z(e.content.data), P("confirmed")) : (F("Payment received but confirmation failed. Please contact support."), P("failed")), M(), W.current = null;
26
- }).catch((e) => {
27
- console.error("Failed to confirm booking after Stripe payment:", e), l(e), F("Payment received but confirmation failed. Please contact support."), M(), W.current = null, P("failed");
28
- });
29
- }, Q = async () => {
30
- P("processing"), F(null);
31
- try {
32
- let e = x || b.billing_details, t = e ? { billing_details: e } : {}, n = await T?.fetch?.url(`/v1/payment/booking/${b._id}/pay`)?.options({ headers: { Origin: E?.id || "" } })?.post(t).json();
33
- if (n?.status && n?.content?.meta?.key) {
34
- let e = n.content.meta;
35
- V(e.provider || "razorpay"), e.provider === "stripe" && e.client_secret ? (W.current = e.session_id || null, oe(Z), await j({
36
- key: e.key,
37
- client_secret: e.client_secret,
38
- amount: e.amount,
39
- currency: e.currency,
40
- provider: "stripe",
41
- reference_id: e.reference_id
42
- })) : ce(e);
43
- } else F("Unable to initiate payment. Please try again."), P("failed");
44
- } catch (e) {
45
- console.error("Initiate payment error:", e), l(e), F("Unable to initiate payment. Please check your connection and try again."), P("failed");
46
- }
47
- }, ce = (e) => {
48
- H.current = !1, U.current = null;
49
- let t = {
50
- key: e.key,
51
- amount: e.amount,
52
- currency: e.currency,
53
- order_id: e.order_id,
54
- name: E?.name ?? "",
55
- description: b.instance_label || "Booking Payment",
56
- handler: (e) => {
57
- le({
58
- order_id: e.razorpay_order_id,
59
- payment_id: e.razorpay_payment_id,
60
- signature: e.razorpay_signature
61
- });
62
- },
63
- theme: { color: "#FC751A" }
64
- };
65
- t.modal = { ondismiss: () => {
66
- H.current ? (F(U.current || "Payment failed. Please try again."), P("failed")) : P("summary");
67
- } };
68
- let n = new D(t);
69
- n.on("payment.failed", () => {
70
- H.current = !0, U.current = "Payment was declined. Please try a different payment method.";
71
- }), n.open();
72
- }, le = async (e) => {
73
- try {
74
- let t = await T?.fetch?.url(`/v1/payment/booking/${b._id}/confirm`)?.options({ headers: { Origin: E?.id || "" } })?.post(e).json();
75
- t?.status && t?.content?.data ? (z(t.content.data), P("confirmed")) : (F("Payment received but confirmation failed. Please contact support."), P("failed"));
76
- } catch (e) {
77
- console.error("Confirm payment error:", e), l(e), F("Payment received but confirmation failed. Please contact support."), P("failed");
78
- }
79
- }, $ = !b.unit_amount || b.unit_amount === 0;
80
- return /* @__PURE__ */ c(o, { children: [
81
- /* @__PURE__ */ c("div", {
82
- className: te("overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm", w),
83
- children: [
84
- N === "summary" && /* @__PURE__ */ c("div", {
85
- className: "flex flex-col",
86
- children: [b.cover_image?.location && /* @__PURE__ */ c("div", {
87
- className: "relative h-44 w-full overflow-hidden bg-gray-100",
88
- children: [/* @__PURE__ */ s("img", {
89
- src: b.cover_image.location,
90
- alt: b.instance_label,
91
- className: "h-full w-full object-cover"
92
- }), /* @__PURE__ */ s("div", { className: "absolute inset-0 bg-gradient-to-t from-black/30 to-transparent" })]
93
- }), /* @__PURE__ */ c("div", {
94
- className: "flex flex-col px-6 py-5 sm:px-8",
95
- children: [
96
- /* @__PURE__ */ c("div", {
97
- className: "mx-auto mb-5 w-full max-w-lg text-center",
98
- children: [/* @__PURE__ */ s("p", {
99
- className: "mb-1 font-medium text-gray-500 text-xs uppercase tracking-wider",
100
- children: "Booking Summary"
101
- }), /* @__PURE__ */ s("h3", {
102
- className: "font-semibold text-gray-900 text-xl leading-tight",
103
- children: b.instance_label || b.context_label || "Booking"
104
- })]
105
- }),
106
- (b.starts_at || b.ends_at) && /* @__PURE__ */ c("div", {
107
- className: "mx-auto mb-5 flex w-full max-w-lg flex-wrap justify-center gap-4 rounded-lg bg-orange-50 px-4 py-3",
108
- children: [b.starts_at && /* @__PURE__ */ c("div", {
109
- className: "flex items-center gap-2 text-gray-700 text-sm",
110
- children: [/* @__PURE__ */ s(f, { className: "size-4 text-orange-500" }), /* @__PURE__ */ s("span", { children: K(b.starts_at) })]
111
- }), b.starts_at && /* @__PURE__ */ c("div", {
112
- className: "flex items-center gap-2 text-gray-700 text-sm",
113
- children: [/* @__PURE__ */ s(m, { className: "size-4 text-orange-500" }), /* @__PURE__ */ s("span", { children: q(b.starts_at) })]
114
- })]
115
- }),
116
- X.length > 0 && /* @__PURE__ */ c("div", {
117
- className: "mx-auto mb-5 w-full max-w-lg",
118
- children: [/* @__PURE__ */ s("h4", {
119
- className: "mb-3 text-center font-medium text-gray-500 text-xs uppercase tracking-wider",
120
- children: "Your Details"
121
- }), /* @__PURE__ */ s("div", {
122
- className: "rounded-lg border border-gray-100 bg-gray-50/50 p-4",
123
- children: /* @__PURE__ */ s("div", {
124
- className: "space-y-2.5",
125
- children: X.map(([e, t]) => /* @__PURE__ */ c("div", {
126
- className: "flex items-start justify-between gap-3",
127
- children: [/* @__PURE__ */ s("span", {
128
- className: "text-gray-500 text-sm",
129
- children: J(e)
130
- }), /* @__PURE__ */ s("span", {
131
- className: "text-right font-medium text-gray-900 text-sm",
132
- children: Y(t)
133
- })]
134
- }, e))
135
- })
136
- })]
137
- }),
138
- (() => {
139
- let e = x || b.billing_details;
140
- return e ? /* @__PURE__ */ c("div", {
141
- className: "mx-auto mb-5 w-full max-w-lg",
142
- children: [/* @__PURE__ */ c("div", {
143
- className: "mb-3 flex items-center justify-center gap-2",
144
- children: [/* @__PURE__ */ s("h4", {
145
- className: "text-center font-medium text-gray-500 text-xs uppercase tracking-wider",
146
- children: "Billing Details"
147
- }), S && /* @__PURE__ */ s("button", {
148
- type: "button",
149
- onClick: () => L(!0),
150
- className: "text-orange-500 hover:text-orange-600",
151
- children: /* @__PURE__ */ s(re, { className: "size-3.5" })
152
- })]
153
- }), /* @__PURE__ */ s("div", {
154
- className: "rounded-lg border border-gray-100 bg-gray-50/50 p-4",
155
- children: /* @__PURE__ */ c("div", {
156
- className: "space-y-2.5",
157
- children: [
158
- /* @__PURE__ */ c("div", {
159
- className: "flex items-start justify-between gap-3",
160
- children: [/* @__PURE__ */ s("span", {
161
- className: "text-gray-500 text-sm",
162
- children: "Name"
163
- }), /* @__PURE__ */ s("span", {
164
- className: "text-right font-medium text-gray-900 text-sm",
165
- children: e.name
166
- })]
167
- }),
168
- e.tax_id && /* @__PURE__ */ c("div", {
169
- className: "flex items-start justify-between gap-3",
170
- children: [/* @__PURE__ */ s("span", {
171
- className: "text-gray-500 text-sm",
172
- children: "Tax ID"
173
- }), /* @__PURE__ */ s("span", {
174
- className: "text-right font-medium text-gray-900 text-sm",
175
- children: e.tax_id
176
- })]
177
- }),
178
- /* @__PURE__ */ c("div", {
179
- className: "flex items-start justify-between gap-3",
180
- children: [/* @__PURE__ */ s("span", {
181
- className: "text-gray-500 text-sm",
182
- children: "Address"
183
- }), /* @__PURE__ */ s("span", {
184
- className: "text-right font-medium text-gray-900 text-sm",
185
- children: [
186
- e.address.line1,
187
- e.address.line2,
188
- e.address.city,
189
- e.address.state,
190
- e.address.postal_code,
191
- e.address.country
192
- ].filter(Boolean).join(", ")
193
- })]
194
- })
195
- ]
196
- })
197
- })]
198
- }) : null;
199
- })(),
200
- /* @__PURE__ */ c("div", {
201
- className: "mx-auto mb-5 w-full max-w-lg",
202
- children: [/* @__PURE__ */ s("h4", {
203
- className: "mb-3 text-center font-medium text-gray-500 text-xs uppercase tracking-wider",
204
- children: "Payment"
205
- }), /* @__PURE__ */ c("div", {
206
- className: "rounded-lg border border-gray-200 bg-white p-4",
207
- children: [/* @__PURE__ */ c("div", {
208
- className: "space-y-2",
209
- children: [
210
- /* @__PURE__ */ c("div", {
211
- className: "flex items-center justify-between text-sm",
212
- children: [/* @__PURE__ */ s("span", {
213
- className: "text-gray-600",
214
- children: "Unit Price"
215
- }), /* @__PURE__ */ s("span", {
216
- className: "text-gray-900",
217
- children: G(b.unit_amount, b.currency)
218
- })]
219
- }),
220
- b.quantity > 1 && /* @__PURE__ */ c("div", {
221
- className: "flex items-center justify-between text-sm",
222
- children: [/* @__PURE__ */ s("span", {
223
- className: "text-gray-600",
224
- children: "Quantity"
225
- }), /* @__PURE__ */ c("span", {
226
- className: "text-gray-900",
227
- children: ["×", b.quantity]
228
- })]
229
- }),
230
- typeof b.discount == "number" && b.discount > 0 && /* @__PURE__ */ c("div", {
231
- className: "flex items-center justify-between text-sm",
232
- children: [/* @__PURE__ */ s("span", {
233
- className: "text-gray-600",
234
- children: "Discount"
235
- }), /* @__PURE__ */ c("span", {
236
- className: "text-green-600",
237
- children: ["-", G(b.discount, b.currency)]
238
- })]
239
- }),
240
- b.taxes && b.taxes.length > 0 && b.taxes.map((e) => /* @__PURE__ */ c("div", {
241
- className: "flex items-center justify-between text-sm",
242
- children: [/* @__PURE__ */ s("span", {
243
- className: "text-gray-600",
244
- children: e.label
245
- }), /* @__PURE__ */ s("span", {
246
- className: "text-gray-900",
247
- children: G(e.amount, b.currency)
248
- })]
249
- }, e.id))
250
- ]
251
- }), /* @__PURE__ */ c("div", {
252
- className: "mt-3 flex items-center justify-between border-gray-100 border-t pt-3",
253
- children: [/* @__PURE__ */ s("span", {
254
- className: "font-medium text-gray-900",
255
- children: "Total"
256
- }), /* @__PURE__ */ s("span", {
257
- className: "font-bold text-gray-900 text-xl",
258
- children: $ ? "Free" : G(b.total_amount, b.currency)
259
- })]
260
- })]
261
- })]
262
- }),
263
- /* @__PURE__ */ s(t, {
264
- elementKey: "booking-pay-btn",
265
- onClick: $ ? () => P("confirmed") : Q,
266
- className: "mx-auto w-full max-w-lg rounded-lg px-4 py-3.5 font-semibold",
267
- children: /* @__PURE__ */ s("span", {
268
- className: "flex items-center justify-center gap-2",
269
- children: $ ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(p, { className: "size-5" }), /* @__PURE__ */ s("span", { children: "Confirm Booking" })] }) : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(ne, { className: "size-5" }), /* @__PURE__ */ c("span", { children: ["Pay ", G(b.total_amount, b.currency)] })] })
270
- })
271
- }),
272
- !$ && /* @__PURE__ */ c("div", {
273
- className: "mx-auto mt-4 flex w-full max-w-lg items-center justify-center gap-1.5 text-gray-400 text-xs",
274
- children: [/* @__PURE__ */ s(_, { className: "size-3.5" }), /* @__PURE__ */ s("span", { children: "Secure payment" })]
275
- })
276
- ]
277
- })]
278
- }),
279
- N === "processing" && /* @__PURE__ */ c("div", {
280
- className: "flex flex-col items-center justify-center px-6 py-16",
281
- children: [
282
- /* @__PURE__ */ c("div", {
283
- className: "relative mb-6",
284
- children: [/* @__PURE__ */ s("div", { className: "absolute inset-0 animate-ping rounded-full bg-orange-200 opacity-75" }), /* @__PURE__ */ s("div", {
285
- className: "relative flex size-16 items-center justify-center rounded-full bg-orange-100",
286
- children: /* @__PURE__ */ s(g, { className: "size-8 animate-spin text-orange-500" })
287
- })]
288
- }),
289
- /* @__PURE__ */ s("h3", {
290
- className: "mb-1 font-semibold text-gray-900 text-lg",
291
- children: "Processing Payment"
292
- }),
293
- /* @__PURE__ */ s("p", {
294
- className: "text-center text-gray-500 text-sm",
295
- children: "Please wait while we confirm your payment..."
296
- }),
297
- /* @__PURE__ */ s("div", {
298
- className: "mt-6 rounded-lg bg-gray-50 px-6 py-3",
299
- children: /* @__PURE__ */ c("p", {
300
- className: "text-center text-gray-600 text-sm",
301
- children: [
302
- "Amount:",
303
- " ",
304
- /* @__PURE__ */ s("span", {
305
- className: "font-semibold text-gray-900",
306
- children: G(b.total_amount, b.currency)
307
- })
308
- ]
309
- })
310
- })
311
- ]
312
- }),
313
- N === "failed" && /* @__PURE__ */ c("div", {
314
- className: "flex flex-col",
315
- children: [/* @__PURE__ */ s("div", {
316
- className: "bg-gradient-to-br from-red-50 to-orange-50 px-6 py-6",
317
- children: /* @__PURE__ */ c("div", {
318
- className: "flex flex-col items-center",
319
- children: [
320
- /* @__PURE__ */ s("div", {
321
- className: "mb-3 flex size-14 items-center justify-center rounded-full bg-red-100",
322
- children: /* @__PURE__ */ s(y, { className: "size-8 text-red-500" })
323
- }),
324
- /* @__PURE__ */ s("h3", {
325
- className: "mb-1 font-semibold text-gray-900 text-lg",
326
- children: "Payment Failed"
327
- }),
328
- /* @__PURE__ */ s("p", {
329
- className: "text-center text-gray-600 text-sm",
330
- children: se || "Something went wrong. Please try again."
331
- })
332
- ]
333
- })
334
- }), /* @__PURE__ */ c("div", {
335
- className: "flex flex-col px-6 py-5 sm:px-8",
336
- children: [
337
- /* @__PURE__ */ s("div", {
338
- className: "mx-auto mb-4 w-full max-w-lg text-center",
339
- children: /* @__PURE__ */ s("h4", {
340
- className: "font-semibold text-base text-gray-900",
341
- children: b.instance_label || b.context_label || "Booking"
342
- })
343
- }),
344
- (b.starts_at || b.ends_at) && /* @__PURE__ */ c("div", {
345
- className: "mx-auto mb-4 flex w-full max-w-lg flex-wrap justify-center gap-4 rounded-lg bg-gray-50 px-4 py-2.5",
346
- children: [b.starts_at && /* @__PURE__ */ c("div", {
347
- className: "flex items-center gap-2 text-gray-600 text-sm",
348
- children: [/* @__PURE__ */ s(f, { className: "size-4 text-gray-400" }), /* @__PURE__ */ s("span", { children: K(b.starts_at) })]
349
- }), b.starts_at && /* @__PURE__ */ c("div", {
350
- className: "flex items-center gap-2 text-gray-600 text-sm",
351
- children: [/* @__PURE__ */ s(m, { className: "size-4 text-gray-400" }), /* @__PURE__ */ s("span", { children: q(b.starts_at) })]
352
- })]
353
- }),
354
- X.length > 0 && /* @__PURE__ */ s("div", {
355
- className: "mx-auto mb-4 w-full max-w-lg rounded-lg border border-gray-100 bg-gray-50/50 p-3",
356
- children: /* @__PURE__ */ c("div", {
357
- className: "space-y-1.5",
358
- children: [X.slice(0, 3).map(([e, t]) => /* @__PURE__ */ c("div", {
359
- className: "flex items-center justify-between gap-3 text-sm",
360
- children: [/* @__PURE__ */ s("span", {
361
- className: "text-gray-500",
362
- children: J(e)
363
- }), /* @__PURE__ */ s("span", {
364
- className: "max-w-[50%] truncate font-medium text-gray-900",
365
- children: Y(t)
366
- })]
367
- }, e)), X.length > 3 && /* @__PURE__ */ c("p", {
368
- className: "pt-1 text-center text-gray-400 text-xs",
369
- children: [
370
- "+",
371
- X.length - 3,
372
- " more"
373
- ]
374
- })]
375
- })
376
- }),
377
- /* @__PURE__ */ s("div", {
378
- className: "mx-auto mb-5 w-full max-w-lg rounded-lg border border-gray-200 bg-white p-4",
379
- children: /* @__PURE__ */ c("div", {
380
- className: "flex items-center justify-between",
381
- children: [/* @__PURE__ */ s("span", {
382
- className: "font-medium text-gray-700",
383
- children: "Amount to Pay"
384
- }), /* @__PURE__ */ s("span", {
385
- className: "font-bold text-gray-900 text-xl",
386
- children: G(b.total_amount, b.currency)
387
- })]
388
- })
389
- }),
390
- /* @__PURE__ */ s(t, {
391
- elementKey: "booking-retry-btn",
392
- onClick: () => {
393
- F(null), Q();
394
- },
395
- className: "mx-auto w-full max-w-lg rounded-lg px-4 py-3.5 font-semibold",
396
- children: /* @__PURE__ */ c("span", {
397
- className: "flex items-center justify-center gap-2",
398
- children: [/* @__PURE__ */ s(ie, { className: "size-5" }), /* @__PURE__ */ s("span", { children: "Try Again" })]
399
- })
400
- }),
401
- /* @__PURE__ */ c("div", {
402
- className: "mx-auto mt-4 flex w-full max-w-lg items-center justify-center gap-1.5 text-gray-400 text-xs",
403
- children: [/* @__PURE__ */ s(_, { className: "size-3.5" }), /* @__PURE__ */ c("span", { children: ["Secured by ", B === "stripe" ? "Stripe" : "Razorpay"] })]
404
- }),
405
- /* @__PURE__ */ s("p", {
406
- className: "mx-auto mt-3 w-full max-w-lg text-center text-gray-400 text-xs",
407
- children: "If the problem persists, please contact support"
408
- })
409
- ]
410
- })]
411
- }),
412
- N === "confirmed" && /* @__PURE__ */ c("div", {
413
- className: "flex flex-col",
414
- children: [/* @__PURE__ */ s("div", {
415
- className: "bg-gradient-to-br from-green-50 to-emerald-50 px-6 py-8",
416
- children: /* @__PURE__ */ c("div", {
417
- className: "flex flex-col items-center",
418
- children: [
419
- /* @__PURE__ */ c("div", {
420
- className: "relative mb-4",
421
- children: [/* @__PURE__ */ s("div", { className: "absolute -inset-2 animate-pulse rounded-full bg-green-200/50" }), /* @__PURE__ */ s("div", {
422
- className: "relative flex size-16 items-center justify-center rounded-full bg-green-100 ring-4 ring-green-50",
423
- children: /* @__PURE__ */ s(p, { className: "size-9 text-green-600" })
424
- })]
425
- }),
426
- /* @__PURE__ */ s("h3", {
427
- className: "mb-1 font-bold text-gray-900 text-xl",
428
- children: $ ? "Booking Confirmed!" : "Payment Successful!"
429
- }),
430
- /* @__PURE__ */ s("p", {
431
- className: "text-center text-gray-600 text-sm",
432
- children: $ ? "Your booking has been confirmed" : "Your payment has been processed successfully"
433
- })
434
- ]
435
- })
436
- }), /* @__PURE__ */ c("div", {
437
- className: "px-6 py-5 sm:px-8",
438
- children: [
439
- /* @__PURE__ */ c("div", {
440
- className: "relative mx-auto max-w-lg overflow-hidden rounded-xl border border-gray-200 bg-white",
441
- children: [
442
- /* @__PURE__ */ s("div", { className: "absolute top-1/2 -left-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
443
- /* @__PURE__ */ s("div", { className: "absolute top-1/2 -right-3 size-6 -translate-y-1/2 rounded-full bg-gray-100" }),
444
- /* @__PURE__ */ c("div", {
445
- className: "px-5 py-4",
446
- children: [
447
- /* @__PURE__ */ c("div", {
448
- className: "mb-4 flex items-start gap-3",
449
- children: [/* @__PURE__ */ s("div", {
450
- className: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-orange-100",
451
- children: /* @__PURE__ */ s(v, { className: "size-5 text-orange-600" })
452
- }), /* @__PURE__ */ s("div", {
453
- className: "min-w-0 flex-1",
454
- children: /* @__PURE__ */ s("p", {
455
- className: "font-semibold text-gray-900 leading-tight",
456
- children: b.instance_label || b.context_label || "Booking"
457
- })
458
- })]
459
- }),
460
- b.qr_image?.location && /* @__PURE__ */ s("div", {
461
- className: "mb-4 flex flex-col items-center",
462
- children: /* @__PURE__ */ s("div", {
463
- className: "rounded-lg border border-gray-200 bg-white p-2",
464
- children: /* @__PURE__ */ s("img", {
465
- src: b.qr_image.location,
466
- alt: "Booking QR Code",
467
- className: "size-24"
468
- })
469
- })
470
- }),
471
- /* @__PURE__ */ c("div", {
472
- className: "mb-4 flex items-center justify-between rounded-lg bg-gray-50 px-3 py-2.5",
473
- children: [/* @__PURE__ */ s("span", {
474
- className: "font-medium text-gray-500 text-xs uppercase tracking-wide",
475
- children: "Booking ID"
476
- }), /* @__PURE__ */ s("span", {
477
- className: "font-mono font-semibold text-gray-900 text-sm",
478
- children: b._id
479
- })]
480
- }),
481
- /* @__PURE__ */ s("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
482
- /* @__PURE__ */ c("div", {
483
- className: "space-y-2.5",
484
- children: [b.starts_at && /* @__PURE__ */ c("div", {
485
- className: "flex items-center justify-between",
486
- children: [/* @__PURE__ */ c("div", {
487
- className: "flex items-center gap-2 text-gray-500 text-sm",
488
- children: [/* @__PURE__ */ s(f, { className: "size-4" }), /* @__PURE__ */ s("span", { children: "Date & Time" })]
489
- }), /* @__PURE__ */ c("p", {
490
- className: "font-medium text-gray-900 text-sm",
491
- children: [
492
- K(b.starts_at),
493
- ", ",
494
- q(b.starts_at)
495
- ]
496
- })]
497
- }), X.slice(0, 3).map(([e, t]) => /* @__PURE__ */ c("div", {
498
- className: "flex items-center justify-between",
499
- children: [/* @__PURE__ */ s("span", {
500
- className: "text-gray-500 text-sm",
501
- children: J(e)
502
- }), /* @__PURE__ */ s("span", {
503
- className: "max-w-[50%] truncate font-medium text-gray-900 text-sm",
504
- children: Y(t)
505
- })]
506
- }, e))]
507
- }),
508
- /* @__PURE__ */ s("div", { className: "my-4 border-gray-200 border-t border-dashed" }),
509
- /* @__PURE__ */ c("div", {
510
- className: "flex items-center justify-between",
511
- children: [/* @__PURE__ */ s("span", {
512
- className: "font-medium text-gray-700",
513
- children: $ ? "Total" : "Amount Paid"
514
- }), /* @__PURE__ */ s("span", {
515
- className: "font-bold text-gray-900 text-lg",
516
- children: $ ? "Free" : G(b.total_amount, b.currency)
517
- })]
518
- }),
519
- (() => {
520
- let e = R?.invoice?.location || b.invoice?.location;
521
- return e ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { className: "my-4 border-gray-200 border-t border-dashed" }), /* @__PURE__ */ c("a", {
522
- href: e,
523
- target: "_blank",
524
- rel: "noopener noreferrer",
525
- className: "flex w-full items-center justify-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-2.5 font-medium text-gray-700 text-sm transition-colors hover:bg-gray-100",
526
- children: [/* @__PURE__ */ s(h, { className: "size-4" }), "Download Invoice"]
527
- })] }) : null;
528
- })()
529
- ]
530
- })
531
- ]
532
- }),
533
- C && /* @__PURE__ */ s("div", {
534
- className: "mx-auto mt-5 max-w-lg",
535
- children: /* @__PURE__ */ s(t, {
536
- elementKey: "booking-done-btn",
537
- onClick: C,
538
- className: "flex w-full items-center justify-center gap-2 rounded-lg bg-gray-900 px-4 py-3.5 font-semibold text-white transition-colors hover:bg-gray-800",
539
- children: "Done"
540
- })
541
- }),
542
- /* @__PURE__ */ s("p", {
543
- className: "mt-4 text-center text-gray-400 text-xs",
544
- children: "A confirmation has been sent to your email"
545
- })
546
- ]
547
- })]
548
- })
549
- ]
550
- }),
551
- I && S && /* @__PURE__ */ s("div", {
552
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
553
- children: /* @__PURE__ */ s("div", {
554
- className: "max-h-[90vh] w-full max-w-lg overflow-auto rounded-xl bg-white shadow-xl",
555
- children: /* @__PURE__ */ s(ee, {
556
- isEdit: !0,
557
- prefillData: x || b.billing_details,
558
- onSubmit: (e) => {
559
- S(e), L(!1);
560
- },
561
- onClose: () => L(!1)
562
- })
563
- })
564
- }),
565
- A && k && /* @__PURE__ */ s(r, {
566
- isOpen: A,
567
- onClose: () => {
568
- M(), P("summary");
569
- },
570
- stripePromise: O,
571
- clientSecret: k.clientSecret,
572
- onComplete: Z
573
- })
574
- ] });
575
- };
576
- //#endregion
577
- export { b as BookingCard };