@burdenoff/microfe-kadaikodi 2026.1124.1 → 2026.1126.2

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 (28) hide show
  1. package/dist/kadaikodi/components/AppointmentSettingsSection.d.ts +13 -0
  2. package/dist/kadaikodi/components/AppointmentSettingsSection.js +206 -0
  3. package/dist/kadaikodi/components/AppointmentSettingsSection.js.map +1 -0
  4. package/dist/kadaikodi/components/AppointmentSlotPicker.d.ts +19 -0
  5. package/dist/kadaikodi/components/AppointmentSlotPicker.js +106 -0
  6. package/dist/kadaikodi/components/AppointmentSlotPicker.js.map +1 -0
  7. package/dist/kadaikodi/components/ProviderAppointmentQueue.d.ts +15 -0
  8. package/dist/kadaikodi/components/ProviderAppointmentQueue.js +179 -0
  9. package/dist/kadaikodi/components/ProviderAppointmentQueue.js.map +1 -0
  10. package/dist/kadaikodi/hooks/useAppointmentsApi.d.ts +122 -0
  11. package/dist/kadaikodi/hooks/useAppointmentsApi.js +186 -0
  12. package/dist/kadaikodi/hooks/useAppointmentsApi.js.map +1 -0
  13. package/dist/kadaikodi/hooks/useKadaikodiApi.d.ts +3 -0
  14. package/dist/kadaikodi/hooks/useKadaikodiApi.js +5 -4
  15. package/dist/kadaikodi/hooks/useKadaikodiApi.js.map +1 -1
  16. package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js +97 -94
  17. package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js.map +1 -1
  18. package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js +172 -170
  19. package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js.map +1 -1
  20. package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js +250 -241
  21. package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js.map +1 -1
  22. package/dist/kadaikodi/pages/customer/BookingDetailsPage.d.ts +3 -1
  23. package/dist/kadaikodi/pages/customer/BookingDetailsPage.js +317 -178
  24. package/dist/kadaikodi/pages/customer/BookingDetailsPage.js.map +1 -1
  25. package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.d.ts +3 -3
  26. package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js +307 -338
  27. package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,23 +1,39 @@
1
1
  import { PageLayout as e } from "../../components/PageLayout.js";
2
2
  import { StatusBadge as t } from "../../components/StatusBadge.js";
3
- import { EmptyState as n } from "../../components/EmptyState.js";
3
+ import { EmptyState as ee } from "../../components/EmptyState.js";
4
4
  import "../../components/viz/index.js";
5
- import { useKadaikodi as r } from "../../context/KadaikodiContext.js";
6
- import { useCreateReview as i, useOrder as a, useUpdateOrderStatus as o } from "../../hooks/useKadaikodiApi.js";
7
- import { cn as s } from "../../utils/cn.js";
8
- import { Timeline as c } from "../../components/viz/Timeline.js";
9
- import { formatCurrency as l, formatDate as u } from "../../utils/formatters.js";
10
- import { useMemo as d, useState as f } from "react";
11
- import { ArrowLeft as p, CalendarCheck as m, CheckCircle2 as h, Headphones as g, Loader2 as _, MapPin as v, ShoppingBag as y, Star as b, X as x, XCircle as S } from "lucide-react";
12
- import { useParams as C } from "react-router";
13
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
14
- import { GlassCard as E, PagePurpose as D } from "@burdenoff/fe-libs/ui";
5
+ import { useKadaikodi as n } from "../../context/KadaikodiContext.js";
6
+ import { useCreateReview as te, useOrder as ne, useUpdateOrderStatus as re } from "../../hooks/useKadaikodiApi.js";
7
+ import { customerCanChangeAppointment as r, formatAppointmentTime as ie, useAppointmentSettings as ae, useCancelAppointment as oe, useOrderAppointment as se, useRescheduleAppointment as ce } from "../../hooks/useAppointmentsApi.js";
8
+ import { Timeline as i } from "../../components/viz/Timeline.js";
9
+ import { AppointmentSlotPicker as a } from "../../components/AppointmentSlotPicker.js";
10
+ import { cn as o } from "../../utils/cn.js";
11
+ import { formatCurrency as s, formatDate as c } from "../../utils/formatters.js";
12
+ import { useEffect as le, useMemo as ue, useRef as l, useState as u } from "react";
13
+ import { useQueryClient as de } from "@tanstack/react-query";
14
+ import { ArrowLeft as fe, CalendarCheck as d, CheckCircle2 as f, Clock as p, Headphones as pe, Loader2 as m, MapPin as me, ShoppingBag as h, Star as g, X as he, XCircle as ge } from "lucide-react";
15
+ import { useParams as _e } from "react-router";
16
+ import { Fragment as ve, jsx as _, jsxs as v } from "react/jsx-runtime";
17
+ import { GlassCard as ye, PagePurpose as be } from "@burdenoff/fe-libs/ui";
15
18
  // src/kadaikodi/pages/customer/BookingDetailsPage.tsx
16
- var O = "support@kadaikodi.com";
17
- function k() {
18
- let { bookingId: k } = C(), { navigateTo: A, currentUser: j } = r(), { data: M, isLoading: N } = a(k), P = i(), F = o(), [I, L] = f(null), [R, z] = f(!1), [B, V] = f(5), [H, U] = f(""), W = (e) => {
19
- L(e), setTimeout(() => L(null), 3e3);
20
- }, G = d(() => M ? M.timeline.length > 0 ? M.timeline.map((e) => ({
19
+ var xe = "support@kadaikodi.com";
20
+ function y() {
21
+ let { bookingId: y } = _e(), { navigateTo: b, currentUser: x } = n(), { data: S, isLoading: Se } = ne(y), C = te(), w = re(), { data: T, isSuccess: E, isError: D, refetch: O, isFetching: k } = se(y), { data: A, isError: j, refetch: Ce, isFetching: we } = ae(T?.providerId), M = de(), N = T?.status, P = l(N);
22
+ le(() => {
23
+ let e = P.current;
24
+ P.current = N, e !== void 0 && N !== e && M.invalidateQueries({ queryKey: [
25
+ "kadaikodi",
26
+ "order",
27
+ y
28
+ ] });
29
+ }, [
30
+ N,
31
+ M,
32
+ y
33
+ ]);
34
+ let F = oe(), I = ce(), [L, R] = u(!1), [z, B] = u(""), [V, H] = u(null), [Te, U] = u(!1), [W, Ee] = u(5), [G, K] = u(""), q = (e) => {
35
+ H(e), setTimeout(() => H(null), 3e3);
36
+ }, De = ue(() => S ? S.timeline.length > 0 ? S.timeline.map((e) => ({
21
37
  status: e.status,
22
38
  label: e.description || e.status,
23
39
  timestamp: e.timestamp,
@@ -25,336 +41,459 @@ function k() {
25
41
  })) : [{
26
42
  status: "placed",
27
43
  label: "Order placed",
28
- timestamp: M.orderDate,
44
+ timestamp: S.orderDate,
29
45
  completed: !0
30
- }] : [], [M]);
31
- if (N) return /* @__PURE__ */ w(e, {
46
+ }] : [], [S]);
47
+ if (Se) return /* @__PURE__ */ _(e, {
32
48
  title: "Booking Details",
33
- children: /* @__PURE__ */ w("div", {
49
+ children: /* @__PURE__ */ _("div", {
34
50
  className: "flex items-center justify-center py-20",
35
- children: /* @__PURE__ */ w("div", { className: "h-12 w-12 animate-spin rounded-full border-b-2 border-foreground" })
51
+ children: /* @__PURE__ */ _("div", { className: "h-12 w-12 animate-spin rounded-full border-b-2 border-foreground" })
36
52
  })
37
53
  });
38
- if (!M) return /* @__PURE__ */ w(e, {
54
+ if (!S) return /* @__PURE__ */ _(e, {
39
55
  title: "Booking Not Found",
40
- children: /* @__PURE__ */ w(n, {
41
- icon: /* @__PURE__ */ w(m, { className: "h-12 w-12" }),
56
+ children: /* @__PURE__ */ _(ee, {
57
+ icon: /* @__PURE__ */ _(d, { className: "h-12 w-12" }),
42
58
  title: "Booking not found",
43
- description: `No booking found with ID "${k}".`,
44
- action: /* @__PURE__ */ w("button", {
59
+ description: `No booking found with ID "${y}".`,
60
+ action: /* @__PURE__ */ _("button", {
45
61
  type: "button",
46
- onClick: () => A("/customer/dashboard"),
62
+ onClick: () => b("/customer/dashboard"),
47
63
  className: "rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity",
48
64
  children: "Go to Dashboard"
49
65
  })
50
66
  })
51
67
  });
52
- let K = M.status === "cancelled", q = M.status === "delivered", J = !K && !q, Y = M.deliveryAddress, X = !!(Y.street || Y.area || Y.city), Z = M.rating != null && M.rating > 0;
53
- return /* @__PURE__ */ T(e, {
54
- title: /* @__PURE__ */ T("div", {
68
+ let Oe = S.status === "cancelled", J = S.status === "delivered", Y = T != null && A != null && r(T, A.cancellationCutoffHours, Date.now()), ke = E && (T ? Y : !Oe && !J), X = T != null && Y && T.timing === "SCHEDULED", Z = A?.timezone, Q = S.deliveryAddress, Ae = !!(Q.street || Q.area || Q.city), $ = S.rating != null && S.rating > 0;
69
+ return /* @__PURE__ */ v(e, {
70
+ title: /* @__PURE__ */ v("div", {
55
71
  className: "flex items-center gap-3",
56
- children: [/* @__PURE__ */ w("button", {
72
+ children: [/* @__PURE__ */ _("button", {
57
73
  type: "button",
58
- onClick: () => A("/customer/dashboard"),
74
+ onClick: () => b("/customer/dashboard"),
59
75
  className: "rounded-md p-1 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
60
- children: /* @__PURE__ */ w(p, { className: "h-5 w-5" })
61
- }), /* @__PURE__ */ T("span", { children: ["Booking #", M.id] })]
76
+ children: /* @__PURE__ */ _(fe, { className: "h-5 w-5" })
77
+ }), /* @__PURE__ */ v("span", { children: ["Booking #", S.id] })]
62
78
  }),
63
- actions: /* @__PURE__ */ w(t, { status: M.status }),
79
+ actions: /* @__PURE__ */ _(t, { status: S.status }),
64
80
  children: [
65
- /* @__PURE__ */ w(D, {
81
+ /* @__PURE__ */ _(be, {
66
82
  className: "mb-4",
67
83
  children: "The full picture of one service booking — who's providing it, what was ordered, what it costs, and the actions you can take such as contacting support or cancelling."
68
84
  }),
69
- I && /* @__PURE__ */ T("div", {
85
+ V && /* @__PURE__ */ v("div", {
70
86
  className: "mb-4 rounded-lg border border-status-success-text/30 bg-status-success-bg-subtle p-3 flex items-center gap-2",
71
- children: [/* @__PURE__ */ w(h, { className: "h-4 w-4 text-status-success-text shrink-0" }), /* @__PURE__ */ w("p", {
87
+ children: [/* @__PURE__ */ _(f, { className: "h-4 w-4 text-status-success-text shrink-0" }), /* @__PURE__ */ _("p", {
72
88
  className: "text-sm text-status-success-text",
73
- children: I
89
+ children: V
74
90
  })]
75
91
  }),
76
- /* @__PURE__ */ T("div", {
92
+ /* @__PURE__ */ v("div", {
77
93
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
78
- children: [/* @__PURE__ */ T("div", {
94
+ children: [/* @__PURE__ */ v("div", {
79
95
  className: "lg:col-span-2 space-y-6",
80
96
  children: [
81
- /* @__PURE__ */ T(E, {
97
+ /* @__PURE__ */ v(ye, {
82
98
  treatment: "glass",
83
99
  glow: !0,
84
100
  className: "p-6",
85
101
  children: [
86
- /* @__PURE__ */ w("h2", {
102
+ /* @__PURE__ */ _("h2", {
87
103
  className: "text-lg font-semibold text-text-primary",
88
- children: M.cartName
104
+ children: S.cartName
89
105
  }),
90
- /* @__PURE__ */ T("p", {
106
+ /* @__PURE__ */ v("p", {
91
107
  className: "mt-1 text-sm text-text-secondary",
92
- children: ["Order placed on ", u(M.orderDate)]
108
+ children: ["Order placed on ", c(S.orderDate)]
93
109
  }),
94
- M.items.length > 0 && /* @__PURE__ */ w("div", {
110
+ S.items.length > 0 && /* @__PURE__ */ _("div", {
95
111
  className: "mt-4 space-y-1.5",
96
- children: M.items.map((e, t) => /* @__PURE__ */ T("div", {
112
+ children: S.items.map((e, t) => /* @__PURE__ */ v("div", {
97
113
  className: "flex justify-between text-sm",
98
- children: [/* @__PURE__ */ T("span", {
114
+ children: [/* @__PURE__ */ v("span", {
99
115
  className: "text-text-primary",
100
116
  children: [
101
117
  e.quantity,
102
118
  "x ",
103
119
  e.name
104
120
  ]
105
- }), /* @__PURE__ */ w("span", {
121
+ }), /* @__PURE__ */ _("span", {
106
122
  className: "text-text-secondary",
107
- children: l(e.price * e.quantity, { minimumFractionDigits: 0 })
123
+ children: s(e.price * e.quantity, { minimumFractionDigits: 0 })
108
124
  })]
109
125
  }, e.id || t))
110
126
  })
111
127
  ]
112
128
  }),
113
- /* @__PURE__ */ T("div", {
129
+ T && /* @__PURE__ */ v("div", {
114
130
  className: "rounded-lg border border-border-subtle bg-bg-surface p-6",
115
- children: [/* @__PURE__ */ w("h2", {
131
+ children: [
132
+ /* @__PURE__ */ v("div", {
133
+ className: "flex items-start justify-between gap-3",
134
+ children: [/* @__PURE__ */ v("div", { children: [
135
+ /* @__PURE__ */ _("h2", {
136
+ className: "text-base font-semibold text-text-primary",
137
+ children: "Appointment"
138
+ }),
139
+ /* @__PURE__ */ v("p", {
140
+ className: "mt-1 flex items-center gap-2 text-sm text-text-primary",
141
+ children: [/* @__PURE__ */ _(p, { className: "h-4 w-4 text-text-secondary" }), Z ? /* @__PURE__ */ v(ve, { children: [
142
+ ie(T.scheduledAt, Z, {
143
+ weekday: "short",
144
+ day: "numeric",
145
+ month: "short",
146
+ hour: "numeric",
147
+ minute: "2-digit"
148
+ }),
149
+ " ",
150
+ "· ",
151
+ T.durationMinutes,
152
+ " min"
153
+ ] }) : j ? /* @__PURE__ */ v("span", {
154
+ className: "flex flex-wrap items-center gap-2 text-status-error-text",
155
+ children: ["Could not load the appointment time.", /* @__PURE__ */ _("button", {
156
+ type: "button",
157
+ onClick: () => void Ce(),
158
+ disabled: we,
159
+ className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent disabled:opacity-60 disabled:cursor-not-allowed",
160
+ children: "Retry"
161
+ })]
162
+ }) : /* @__PURE__ */ v("span", {
163
+ className: "inline-flex items-center gap-2 text-text-secondary",
164
+ children: [/* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin" }), "Loading time..."]
165
+ })]
166
+ }),
167
+ T.offering && /* @__PURE__ */ _("p", {
168
+ className: "mt-1 text-xs text-text-secondary",
169
+ children: T.offering.name
170
+ }),
171
+ T.cancellationReason && /* @__PURE__ */ v("p", {
172
+ className: "mt-1 text-xs text-text-secondary",
173
+ children: ["Reason: ", T.cancellationReason]
174
+ })
175
+ ] }), /* @__PURE__ */ _(t, { status: T.status })]
176
+ }),
177
+ X && !L && /* @__PURE__ */ _("button", {
178
+ type: "button",
179
+ onClick: () => R(!0),
180
+ className: "mt-4 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
181
+ children: "Reschedule"
182
+ }),
183
+ X && A && /* @__PURE__ */ v("p", {
184
+ className: "mt-2 text-xs text-text-secondary",
185
+ children: [
186
+ "Changes are allowed until ",
187
+ A.cancellationCutoffHours,
188
+ " hour",
189
+ A.cancellationCutoffHours === 1 ? "" : "s",
190
+ " before the slot."
191
+ ]
192
+ }),
193
+ L && X && /* @__PURE__ */ v("div", {
194
+ className: "mt-4 space-y-4 border-t border-border-subtle pt-4",
195
+ children: [/* @__PURE__ */ _(a, {
196
+ providerId: T.providerId,
197
+ offeringId: T.offeringId,
198
+ value: z,
199
+ onChange: B,
200
+ excludeStartsAt: T.scheduledAt
201
+ }), /* @__PURE__ */ v("div", {
202
+ className: "flex gap-3",
203
+ children: [/* @__PURE__ */ v("button", {
204
+ type: "button",
205
+ onClick: () => {
206
+ T && z && A && (T.timing === "SCHEDULED" && r(T, A.cancellationCutoffHours, Date.now()) ? I.mutate({
207
+ id: T.id,
208
+ scheduledAt: z
209
+ }, {
210
+ onSuccess: () => {
211
+ R(!1), B(""), q("Your appointment has been moved to the new slot.");
212
+ },
213
+ onError: (e) => q(e.message || "Could not reschedule. Please try again.")
214
+ }) : (R(!1), B(""), q("This appointment can no longer be rescheduled.")));
215
+ },
216
+ disabled: !z || I.isPending,
217
+ className: "inline-flex items-center gap-2 rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-60 disabled:cursor-not-allowed",
218
+ children: [I.isPending && /* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin" }), "Confirm New Slot"]
219
+ }), /* @__PURE__ */ _("button", {
220
+ type: "button",
221
+ onClick: () => {
222
+ R(!1), B("");
223
+ },
224
+ className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
225
+ children: "Keep Current Slot"
226
+ })]
227
+ })]
228
+ })
229
+ ]
230
+ }),
231
+ /* @__PURE__ */ v("div", {
232
+ className: "rounded-lg border border-border-subtle bg-bg-surface p-6",
233
+ children: [/* @__PURE__ */ _("h2", {
116
234
  className: "text-base font-semibold text-text-primary mb-4",
117
235
  children: "Service Provider"
118
- }), /* @__PURE__ */ T("div", {
236
+ }), /* @__PURE__ */ v("div", {
119
237
  className: "flex items-center gap-4",
120
238
  children: [
121
- /* @__PURE__ */ w("div", {
239
+ /* @__PURE__ */ _("div", {
122
240
  className: "flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken text-text-secondary",
123
- children: /* @__PURE__ */ w(y, { className: "h-6 w-6" })
241
+ children: /* @__PURE__ */ _(h, { className: "h-6 w-6" })
124
242
  }),
125
- /* @__PURE__ */ w("div", {
243
+ /* @__PURE__ */ _("div", {
126
244
  className: "flex-1 min-w-0",
127
- children: /* @__PURE__ */ w("p", {
245
+ children: /* @__PURE__ */ _("p", {
128
246
  className: "text-sm font-semibold text-text-primary",
129
- children: M.cartName
247
+ children: S.cartName
130
248
  })
131
249
  }),
132
- /* @__PURE__ */ w("button", {
250
+ /* @__PURE__ */ _("button", {
133
251
  type: "button",
134
- onClick: () => A(`/customer/cart/${M.cartId}`),
252
+ onClick: () => b(`/customer/cart/${S.cartId}`),
135
253
  className: "rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
136
254
  children: "View Cart"
137
255
  })
138
256
  ]
139
257
  })]
140
258
  }),
141
- /* @__PURE__ */ T("div", {
259
+ /* @__PURE__ */ v("div", {
142
260
  className: "rounded-lg border border-border-subtle bg-bg-surface p-6",
143
- children: [/* @__PURE__ */ w("h2", {
261
+ children: [/* @__PURE__ */ _("h2", {
144
262
  className: "text-base font-semibold text-text-primary mb-5",
145
263
  children: "Booking Timeline"
146
- }), /* @__PURE__ */ w(c, { items: G.map((e, t) => ({
264
+ }), /* @__PURE__ */ _(i, { items: De.map((e, t) => ({
147
265
  id: `${e.status}-${t}`,
148
266
  title: e.label,
149
267
  tone: e.status === "cancelled" ? "danger" : e.completed ? "success" : "muted",
150
- time: e.timestamp ? u(e.timestamp) : "Pending"
268
+ time: e.timestamp ? c(e.timestamp) : "Pending"
151
269
  })) })]
152
270
  }),
153
- /* @__PURE__ */ T("div", {
271
+ /* @__PURE__ */ v("div", {
154
272
  className: "flex flex-col sm:flex-row gap-3",
155
- children: [/* @__PURE__ */ T("a", {
156
- href: `mailto:${O}?subject=${encodeURIComponent(`Support request — Booking #${M.id}`)}`,
273
+ children: [/* @__PURE__ */ v("a", {
274
+ href: `mailto:${xe}?subject=${encodeURIComponent(`Support request — Booking #${S.id}`)}`,
157
275
  className: "flex-1 flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-4 py-3 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
158
- children: [/* @__PURE__ */ w(g, { className: "h-4 w-4" }), "Contact Support"]
159
- }), q && /* @__PURE__ */ T("button", {
276
+ children: [/* @__PURE__ */ _(pe, { className: "h-4 w-4" }), "Contact Support"]
277
+ }), J && /* @__PURE__ */ v("button", {
160
278
  type: "button",
161
- disabled: Z,
162
- onClick: () => z(!0),
163
- className: s("flex-1 flex items-center justify-center gap-2 rounded-lg px-4 py-3 text-sm font-medium transition-opacity", Z ? "bg-bg-sunken text-text-secondary cursor-not-allowed" : "bg-foreground text-background hover:opacity-90"),
164
- children: [/* @__PURE__ */ w(b, { className: "h-4 w-4" }), Z ? "Rated" : "Rate Service"]
279
+ disabled: $,
280
+ onClick: () => U(!0),
281
+ className: o("flex-1 flex items-center justify-center gap-2 rounded-lg px-4 py-3 text-sm font-medium transition-opacity", $ ? "bg-bg-sunken text-text-secondary cursor-not-allowed" : "bg-foreground text-background hover:opacity-90"),
282
+ children: [/* @__PURE__ */ _(g, { className: "h-4 w-4" }), $ ? "Rated" : "Rate Service"]
165
283
  })]
166
284
  })
167
285
  ]
168
- }), /* @__PURE__ */ T("div", {
286
+ }), /* @__PURE__ */ v("div", {
169
287
  className: "space-y-6",
170
288
  children: [
171
- /* @__PURE__ */ T("div", {
289
+ /* @__PURE__ */ v("div", {
172
290
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
173
291
  children: [
174
- /* @__PURE__ */ w("h3", {
292
+ /* @__PURE__ */ _("h3", {
175
293
  className: "text-base font-semibold text-text-primary mb-3",
176
294
  children: "Cart Information"
177
295
  }),
178
- /* @__PURE__ */ T("div", {
296
+ /* @__PURE__ */ v("div", {
179
297
  className: "flex items-center gap-3 mb-4",
180
- children: [/* @__PURE__ */ w("div", {
298
+ children: [/* @__PURE__ */ _("div", {
181
299
  className: "flex h-14 w-14 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary",
182
- children: /* @__PURE__ */ w(y, { className: "h-6 w-6" })
183
- }), /* @__PURE__ */ w("div", {
300
+ children: /* @__PURE__ */ _(h, { className: "h-6 w-6" })
301
+ }), /* @__PURE__ */ _("div", {
184
302
  className: "min-w-0",
185
- children: /* @__PURE__ */ w("p", {
303
+ children: /* @__PURE__ */ _("p", {
186
304
  className: "text-sm font-semibold text-text-primary",
187
- children: M.cartName
305
+ children: S.cartName
188
306
  })
189
307
  })]
190
308
  }),
191
- /* @__PURE__ */ w("button", {
309
+ /* @__PURE__ */ _("button", {
192
310
  type: "button",
193
- onClick: () => A(`/customer/cart/${M.cartId}`),
311
+ onClick: () => b(`/customer/cart/${S.cartId}`),
194
312
  className: "w-full rounded-lg border border-border-subtle px-4 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
195
313
  children: "View Cart Menu"
196
314
  })
197
315
  ]
198
316
  }),
199
- X && /* @__PURE__ */ T("div", {
317
+ Ae && /* @__PURE__ */ v("div", {
200
318
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
201
- children: [/* @__PURE__ */ w("h3", {
319
+ children: [/* @__PURE__ */ _("h3", {
202
320
  className: "text-base font-semibold text-text-primary mb-3",
203
321
  children: "Service Location"
204
- }), /* @__PURE__ */ T("div", {
322
+ }), /* @__PURE__ */ v("div", {
205
323
  className: "flex items-start gap-3",
206
- children: [/* @__PURE__ */ w(v, { className: "mt-0.5 h-5 w-5 shrink-0 text-text-secondary" }), /* @__PURE__ */ T("div", { children: [
207
- Y.street && /* @__PURE__ */ w("p", {
324
+ children: [/* @__PURE__ */ _(me, { className: "mt-0.5 h-5 w-5 shrink-0 text-text-secondary" }), /* @__PURE__ */ v("div", { children: [
325
+ Q.street && /* @__PURE__ */ _("p", {
208
326
  className: "text-sm text-text-primary",
209
- children: Y.street
327
+ children: Q.street
210
328
  }),
211
- /* @__PURE__ */ T("p", {
329
+ /* @__PURE__ */ v("p", {
212
330
  className: "text-sm text-text-secondary",
213
- children: [[Y.area, Y.city].filter(Boolean).join(", "), Y.pincode ? ` - ${Y.pincode}` : ""]
331
+ children: [[Q.area, Q.city].filter(Boolean).join(", "), Q.pincode ? ` - ${Q.pincode}` : ""]
214
332
  }),
215
- Y.landmark && /* @__PURE__ */ T("p", {
333
+ Q.landmark && /* @__PURE__ */ v("p", {
216
334
  className: "text-xs text-text-secondary mt-1",
217
- children: ["Landmark: ", Y.landmark]
335
+ children: ["Landmark: ", Q.landmark]
218
336
  })
219
337
  ] })]
220
338
  })]
221
339
  }),
222
- /* @__PURE__ */ T("div", {
340
+ /* @__PURE__ */ v("div", {
223
341
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
224
- children: [/* @__PURE__ */ w("h3", {
342
+ children: [/* @__PURE__ */ _("h3", {
225
343
  className: "text-base font-semibold text-text-primary mb-3",
226
344
  children: "Price Breakdown"
227
- }), /* @__PURE__ */ T("div", {
345
+ }), /* @__PURE__ */ v("div", {
228
346
  className: "space-y-2.5 text-sm",
229
347
  children: [
230
- /* @__PURE__ */ T("div", {
348
+ /* @__PURE__ */ v("div", {
231
349
  className: "flex justify-between",
232
- children: [/* @__PURE__ */ w("span", {
350
+ children: [/* @__PURE__ */ _("span", {
233
351
  className: "text-text-secondary",
234
352
  children: "Subtotal"
235
- }), /* @__PURE__ */ w("span", {
353
+ }), /* @__PURE__ */ _("span", {
236
354
  className: "text-text-primary",
237
- children: l(M.subtotal, { minimumFractionDigits: 0 })
355
+ children: s(S.subtotal, { minimumFractionDigits: 0 })
238
356
  })]
239
357
  }),
240
- /* @__PURE__ */ T("div", {
358
+ /* @__PURE__ */ v("div", {
241
359
  className: "flex justify-between",
242
- children: [/* @__PURE__ */ w("span", {
360
+ children: [/* @__PURE__ */ _("span", {
243
361
  className: "text-text-secondary",
244
362
  children: "Delivery Fee"
245
- }), /* @__PURE__ */ w("span", {
363
+ }), /* @__PURE__ */ _("span", {
246
364
  className: "text-text-primary",
247
- children: M.deliveryFee === 0 ? "FREE" : l(M.deliveryFee, { minimumFractionDigits: 0 })
365
+ children: S.deliveryFee === 0 ? "FREE" : s(S.deliveryFee, { minimumFractionDigits: 0 })
248
366
  })]
249
367
  }),
250
- /* @__PURE__ */ T("div", {
368
+ /* @__PURE__ */ v("div", {
251
369
  className: "flex justify-between",
252
- children: [/* @__PURE__ */ w("span", {
370
+ children: [/* @__PURE__ */ _("span", {
253
371
  className: "text-text-secondary",
254
372
  children: "Tax"
255
- }), /* @__PURE__ */ w("span", {
373
+ }), /* @__PURE__ */ _("span", {
256
374
  className: "text-text-primary",
257
- children: l(M.taxes, { minimumFractionDigits: 0 })
375
+ children: s(S.taxes, { minimumFractionDigits: 0 })
258
376
  })]
259
377
  }),
260
- M.discount != null && M.discount > 0 && /* @__PURE__ */ T("div", {
378
+ S.discount != null && S.discount > 0 && /* @__PURE__ */ v("div", {
261
379
  className: "flex justify-between",
262
- children: [/* @__PURE__ */ w("span", {
380
+ children: [/* @__PURE__ */ _("span", {
263
381
  className: "text-status-success-text",
264
382
  children: "Discount"
265
- }), /* @__PURE__ */ T("span", {
383
+ }), /* @__PURE__ */ v("span", {
266
384
  className: "text-status-success-text",
267
- children: ["-", l(M.discount, { minimumFractionDigits: 0 })]
385
+ children: ["-", s(S.discount, { minimumFractionDigits: 0 })]
268
386
  })]
269
387
  }),
270
- /* @__PURE__ */ T("div", {
388
+ /* @__PURE__ */ v("div", {
271
389
  className: "flex justify-between border-t border-border-subtle pt-2.5",
272
- children: [/* @__PURE__ */ w("span", {
390
+ children: [/* @__PURE__ */ _("span", {
273
391
  className: "font-semibold text-text-primary",
274
392
  children: "Total"
275
- }), /* @__PURE__ */ w("span", {
393
+ }), /* @__PURE__ */ _("span", {
276
394
  className: "font-bold text-text-primary",
277
- children: l(M.total, { minimumFractionDigits: 0 })
395
+ children: s(S.total, { minimumFractionDigits: 0 })
278
396
  })]
279
397
  })
280
398
  ]
281
399
  })]
282
400
  }),
283
- /* @__PURE__ */ T("div", {
401
+ /* @__PURE__ */ v("div", {
284
402
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
285
- children: [/* @__PURE__ */ w("h3", {
403
+ children: [/* @__PURE__ */ _("h3", {
286
404
  className: "text-base font-semibold text-text-primary mb-3",
287
405
  children: "Booking Info"
288
- }), /* @__PURE__ */ T("div", {
406
+ }), /* @__PURE__ */ v("div", {
289
407
  className: "space-y-3",
290
- children: [/* @__PURE__ */ T("div", {
408
+ children: [/* @__PURE__ */ v("div", {
291
409
  className: "flex items-center gap-2",
292
- children: [/* @__PURE__ */ w(m, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
410
+ children: [/* @__PURE__ */ _(d, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
293
411
  className: "text-xs text-text-secondary",
294
412
  children: "Booked On"
295
- }), /* @__PURE__ */ w("p", {
413
+ }), /* @__PURE__ */ _("p", {
296
414
  className: "text-sm text-text-primary",
297
- children: u(M.orderDate)
415
+ children: c(S.orderDate)
298
416
  })] })]
299
- }), /* @__PURE__ */ T("div", {
417
+ }), /* @__PURE__ */ v("div", {
300
418
  className: "flex items-center gap-2",
301
- children: [/* @__PURE__ */ w(h, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
419
+ children: [/* @__PURE__ */ _(f, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
302
420
  className: "text-xs text-text-secondary",
303
421
  children: "Payment"
304
- }), /* @__PURE__ */ T("p", {
422
+ }), /* @__PURE__ */ v("p", {
305
423
  className: "text-sm text-text-primary capitalize",
306
424
  children: [
307
- M.paymentMethod,
425
+ S.paymentMethod,
308
426
  " · ",
309
- M.paymentStatus
427
+ S.paymentStatus
310
428
  ]
311
429
  })] })]
312
430
  })]
313
431
  })]
314
432
  }),
315
- J && /* @__PURE__ */ T("button", {
433
+ D && !E && /* @__PURE__ */ v("div", {
434
+ className: "flex flex-wrap items-center gap-3 text-sm text-status-error-text",
435
+ children: ["Could not load this booking's appointment, so it cannot be changed right now.", /* @__PURE__ */ _("button", {
436
+ type: "button",
437
+ onClick: () => void O(),
438
+ disabled: k,
439
+ className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent disabled:opacity-60 disabled:cursor-not-allowed",
440
+ children: "Retry"
441
+ })]
442
+ }),
443
+ ke && /* @__PURE__ */ v("button", {
316
444
  type: "button",
317
445
  onClick: () => {
318
- window.confirm("Cancel this booking? This cannot be undone.") && F.mutate({
319
- id: M.id,
320
- status: "CANCELLED"
321
- }, {
322
- onSuccess: () => W("Your booking has been cancelled."),
323
- onError: () => W("Could not cancel the booking. Please try again.")
324
- });
446
+ if (E && window.confirm("Cancel this booking? This cannot be undone.")) {
447
+ if (T) {
448
+ if (!(A != null && r(T, A.cancellationCutoffHours, Date.now()))) {
449
+ q("This appointment can no longer be cancelled.");
450
+ return;
451
+ }
452
+ F.mutate({ id: T.id }, {
453
+ onSuccess: () => q("Your booking has been cancelled."),
454
+ onError: (e) => q(e.message || "Could not cancel the booking. Please try again.")
455
+ });
456
+ } else w.mutate({
457
+ id: S.id,
458
+ status: "CANCELLED"
459
+ }, {
460
+ onSuccess: () => q("Your booking has been cancelled."),
461
+ onError: () => q("Could not cancel the booking. Please try again.")
462
+ });
463
+ }
325
464
  },
326
- disabled: F.isPending,
327
- className: s("w-full inline-flex items-center justify-center gap-2 rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-3 text-sm font-medium text-status-error-text transition-colors", F.isPending ? "opacity-60 cursor-not-allowed" : "hover:bg-status-error-bg-subtle"),
328
- children: [F.isPending ? /* @__PURE__ */ w(_, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ w(S, { className: "h-4 w-4" }), "Cancel Booking"]
465
+ disabled: w.isPending || F.isPending,
466
+ className: o("w-full inline-flex items-center justify-center gap-2 rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-3 text-sm font-medium text-status-error-text transition-colors", w.isPending || F.isPending ? "opacity-60 cursor-not-allowed" : "hover:bg-status-error-bg-subtle"),
467
+ children: [w.isPending || F.isPending ? /* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ _(ge, { className: "h-4 w-4" }), "Cancel Booking"]
329
468
  })
330
469
  ]
331
470
  })]
332
471
  }),
333
- R && /* @__PURE__ */ w("div", {
472
+ Te && /* @__PURE__ */ _("div", {
334
473
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
335
- children: /* @__PURE__ */ w("div", {
474
+ children: /* @__PURE__ */ _("div", {
336
475
  className: "w-full max-w-md rounded-lg border border-border-subtle bg-bg-surface shadow-lg",
337
- children: /* @__PURE__ */ T("div", {
476
+ children: /* @__PURE__ */ v("div", {
338
477
  className: "p-5",
339
478
  children: [
340
- /* @__PURE__ */ T("div", {
479
+ /* @__PURE__ */ v("div", {
341
480
  className: "flex items-center justify-between mb-4",
342
- children: [/* @__PURE__ */ w("h3", {
481
+ children: [/* @__PURE__ */ _("h3", {
343
482
  className: "text-lg font-semibold text-text-primary",
344
483
  children: "Rate this service"
345
- }), /* @__PURE__ */ w("button", {
484
+ }), /* @__PURE__ */ _("button", {
346
485
  type: "button",
347
- onClick: () => z(!1),
486
+ onClick: () => U(!1),
348
487
  className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
349
- children: /* @__PURE__ */ w(x, { className: "h-4 w-4" })
488
+ children: /* @__PURE__ */ _(he, { className: "h-4 w-4" })
350
489
  })]
351
490
  }),
352
- /* @__PURE__ */ T("div", {
491
+ /* @__PURE__ */ v("div", {
353
492
  className: "mb-4",
354
- children: [/* @__PURE__ */ w("label", {
493
+ children: [/* @__PURE__ */ _("label", {
355
494
  className: "block text-sm font-medium text-text-primary mb-2",
356
495
  children: "Your rating"
357
- }), /* @__PURE__ */ w("div", {
496
+ }), /* @__PURE__ */ _("div", {
358
497
  className: "flex items-center gap-1",
359
498
  children: [
360
499
  1,
@@ -362,55 +501,55 @@ function k() {
362
501
  3,
363
502
  4,
364
503
  5
365
- ].map((e) => /* @__PURE__ */ w("button", {
504
+ ].map((e) => /* @__PURE__ */ _("button", {
366
505
  type: "button",
367
- onClick: () => V(e),
506
+ onClick: () => Ee(e),
368
507
  className: "p-0.5",
369
508
  "aria-label": `${e} star${e > 1 ? "s" : ""}`,
370
- children: /* @__PURE__ */ w(b, { className: s("h-7 w-7", e <= B ? "fill-status-warning-text text-status-warning-text" : "fill-none text-text-secondary/40") })
509
+ children: /* @__PURE__ */ _(g, { className: o("h-7 w-7", e <= W ? "fill-status-warning-text text-status-warning-text" : "fill-none text-text-secondary/40") })
371
510
  }, e))
372
511
  })]
373
512
  }),
374
- /* @__PURE__ */ T("div", {
513
+ /* @__PURE__ */ v("div", {
375
514
  className: "mb-5",
376
- children: [/* @__PURE__ */ T("label", {
515
+ children: [/* @__PURE__ */ v("label", {
377
516
  className: "block text-sm font-medium text-text-primary mb-1.5",
378
- children: ["Review ", /* @__PURE__ */ w("span", {
517
+ children: ["Review ", /* @__PURE__ */ _("span", {
379
518
  className: "text-text-secondary font-normal",
380
519
  children: "(optional)"
381
520
  })]
382
- }), /* @__PURE__ */ w("textarea", {
521
+ }), /* @__PURE__ */ _("textarea", {
383
522
  rows: 4,
384
- value: H,
385
- onChange: (e) => U(e.target.value),
523
+ value: G,
524
+ onChange: (e) => K(e.target.value),
386
525
  placeholder: "Share your experience with this service...",
387
526
  className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none"
388
527
  })]
389
528
  }),
390
- /* @__PURE__ */ T("div", {
529
+ /* @__PURE__ */ v("div", {
391
530
  className: "flex items-center gap-3",
392
- children: [/* @__PURE__ */ T("button", {
531
+ children: [/* @__PURE__ */ v("button", {
393
532
  type: "button",
394
533
  onClick: () => {
395
- j?.id ? P.mutate({
396
- providerId: M.cartId,
397
- orderId: M.id,
398
- customerId: j.id,
399
- rating: B,
400
- review: H.trim() || void 0
534
+ x?.id ? C.mutate({
535
+ providerId: S.cartId,
536
+ orderId: S.id,
537
+ customerId: x.id,
538
+ rating: W,
539
+ review: G.trim() || void 0
401
540
  }, {
402
541
  onSuccess: () => {
403
- z(!1), U(""), W("Thanks! Your rating has been submitted.");
542
+ U(!1), K(""), q("Thanks! Your rating has been submitted.");
404
543
  },
405
- onError: () => W("Could not submit your rating. Please try again.")
406
- }) : W("Please sign in to rate this service.");
544
+ onError: () => q("Could not submit your rating. Please try again.")
545
+ }) : q("Please sign in to rate this service.");
407
546
  },
408
- disabled: P.isPending,
409
- className: s("flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-opacity", P.isPending ? "opacity-60 cursor-not-allowed" : "hover:opacity-90"),
410
- children: [P.isPending && /* @__PURE__ */ w(_, { className: "h-4 w-4 animate-spin" }), "Submit Rating"]
411
- }), /* @__PURE__ */ w("button", {
547
+ disabled: C.isPending,
548
+ className: o("flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-opacity", C.isPending ? "opacity-60 cursor-not-allowed" : "hover:opacity-90"),
549
+ children: [C.isPending && /* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin" }), "Submit Rating"]
550
+ }), /* @__PURE__ */ _("button", {
412
551
  type: "button",
413
- onClick: () => z(!1),
552
+ onClick: () => U(!1),
414
553
  className: "rounded-lg border border-border-subtle px-4 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
415
554
  children: "Cancel"
416
555
  })]
@@ -422,6 +561,6 @@ function k() {
422
561
  ]
423
562
  });
424
563
  }
425
- export { k as BookingDetailsPage };
564
+ export { y as BookingDetailsPage };
426
565
 
427
566
  //# sourceMappingURL=BookingDetailsPage.js.map