@alfadocs/ui-kit 0.33.9 → 0.33.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/booking-Db4BQ9eH.js +2495 -0
- package/dist/_chunks/{date-range-picker-D4dgDlLU.js → date-range-picker-D8CHNYQT.js} +72 -74
- package/dist/_chunks/{editable-currency-cell-renderer-B9VRSV_S.js → editable-currency-cell-renderer-CZcVWBPo.js} +2 -2
- package/dist/_chunks/slot-grid-BlHHP9Qy.js +502 -0
- package/dist/_chunks/subDays-CANHP9hz.js +8 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/booking/booking-types.d.ts +37 -0
- package/dist/components/booking/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/slot-grid/index.js +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/_chunks/booking-CbdbYvWp.js +0 -2340
- package/dist/_chunks/parseISO-DEpUNwxZ.js +0 -120
- package/dist/_chunks/slot-grid-Dz13dH82.js +0 -387
|
@@ -0,0 +1,2495 @@
|
|
|
1
|
+
import { jsxs as b, jsx as s, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Qe, useId as et, useState as j, useCallback as q, useRef as ae, useEffect as G, useMemo as C, useImperativeHandle as xt } from "react";
|
|
3
|
+
import { c as Me } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as B, Trans as St } from "react-i18next";
|
|
5
|
+
import { u as Nt } from "./registry-nPAVE19X.js";
|
|
6
|
+
import { A as K } from "./alert-ywPR59NE.js";
|
|
7
|
+
import { B as se } from "./button-DD_0Xdmr.js";
|
|
8
|
+
import { C as Ve } from "./checkbox-DRcOdmXv.js";
|
|
9
|
+
import { C as It } from "./checkbox-group-CpUwlHug.js";
|
|
10
|
+
import { D as wt } from "./date-picker-B94HAV4A.js";
|
|
11
|
+
import { E as Ct } from "./email-input-lQivsFrw.js";
|
|
12
|
+
import { F as Z } from "./form-field-BOm9hK35.js";
|
|
13
|
+
import { P as Mt } from "./phone-input-DfZbPPvh.js";
|
|
14
|
+
import { T as Dt } from "./text-area-BIx0tZ05.js";
|
|
15
|
+
import { T as xe } from "./text-input-BaClJL8Y.js";
|
|
16
|
+
import { S as At } from "./spinner-CCByyvcb.js";
|
|
17
|
+
import { I as Ye } from "./icon-button-CKEOrN37.js";
|
|
18
|
+
import { S as De } from "./select-hsCaJSX3.js";
|
|
19
|
+
import { S as Ce } from "./skeleton-CZbwyJAA.js";
|
|
20
|
+
import { E as tt } from "./empty-state-BLy7tigq.js";
|
|
21
|
+
import { S as _t } from "./stepper-accordion-BfS6lUB9.js";
|
|
22
|
+
import { S as Tt } from "./stepper-progress-DDjq5nei.js";
|
|
23
|
+
import { p as $, S as Bt } from "./slot-grid-BlHHP9Qy.js";
|
|
24
|
+
import { s as ne, i as Je } from "./isSameDay-DUEiAT0G.js";
|
|
25
|
+
import { w as at, n as oe, a as Le, m as Ot, f as he, d as Pt, h as we, x as Se } from "./react-day-picker-DsjfS7uI.js";
|
|
26
|
+
import { s as Et } from "./subDays-CANHP9hz.js";
|
|
27
|
+
import { C as Rt } from "./chevron-left-CX1jqD2M.js";
|
|
28
|
+
import { C as Vt } from "./chevron-right-BrpYejk0.js";
|
|
29
|
+
import { c as V } from "./createLucideIcon-CrFbzy84.js";
|
|
30
|
+
import { M as Lt, S as Ft } from "./sun-BuXE0xUS.js";
|
|
31
|
+
import { S as $t } from "./stethoscope-DT5qCW8Y.js";
|
|
32
|
+
import { H as zt } from "./heart-pulse-CvuyFKHB.js";
|
|
33
|
+
import { E as Kt } from "./eye-LHlSU38h.js";
|
|
34
|
+
import { S as jt } from "./sparkles-CuYXqQLg.js";
|
|
35
|
+
/**
|
|
36
|
+
* @license lucide-react v1.8.0 - ISC
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the ISC license.
|
|
39
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/
|
|
41
|
+
const qt = [
|
|
42
|
+
[
|
|
43
|
+
"path",
|
|
44
|
+
{
|
|
45
|
+
d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
|
|
46
|
+
key: "169zse"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
], Ht = V("activity", qt);
|
|
50
|
+
/**
|
|
51
|
+
* @license lucide-react v1.8.0 - ISC
|
|
52
|
+
*
|
|
53
|
+
* This source code is licensed under the ISC license.
|
|
54
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
+
*/
|
|
56
|
+
const Gt = [
|
|
57
|
+
["path", { d: "M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5", key: "1u7htd" }],
|
|
58
|
+
["path", { d: "M15 12h.01", key: "1k8ypt" }],
|
|
59
|
+
[
|
|
60
|
+
"path",
|
|
61
|
+
{
|
|
62
|
+
d: "M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",
|
|
63
|
+
key: "11xh7x"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
["path", { d: "M9 12h.01", key: "157uk2" }]
|
|
67
|
+
], Ut = V("baby", Gt);
|
|
68
|
+
/**
|
|
69
|
+
* @license lucide-react v1.8.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/
|
|
74
|
+
const Yt = [
|
|
75
|
+
[
|
|
76
|
+
"path",
|
|
77
|
+
{
|
|
78
|
+
d: "M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",
|
|
79
|
+
key: "w610uw"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
], Jt = V("bone", Yt);
|
|
83
|
+
/**
|
|
84
|
+
* @license lucide-react v1.8.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/
|
|
89
|
+
const Zt = [
|
|
90
|
+
["path", { d: "M12 18V5", key: "adv99a" }],
|
|
91
|
+
["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
|
|
92
|
+
["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
|
|
93
|
+
["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
|
|
94
|
+
["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
|
|
95
|
+
["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
|
|
96
|
+
["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
|
|
97
|
+
["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
|
|
98
|
+
], Wt = V("brain", Zt);
|
|
99
|
+
/**
|
|
100
|
+
* @license lucide-react v1.8.0 - ISC
|
|
101
|
+
*
|
|
102
|
+
* This source code is licensed under the ISC license.
|
|
103
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
+
*/
|
|
105
|
+
const Xt = [
|
|
106
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
107
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
108
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
109
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
110
|
+
["path", { d: "M17 14h-6", key: "bkmgh3" }],
|
|
111
|
+
["path", { d: "M13 18H7", key: "bb0bb7" }],
|
|
112
|
+
["path", { d: "M7 14h.01", key: "1qa3f1" }],
|
|
113
|
+
["path", { d: "M17 18h.01", key: "1bdyru" }]
|
|
114
|
+
], Qt = V("calendar-range", Xt);
|
|
115
|
+
/**
|
|
116
|
+
* @license lucide-react v1.8.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/
|
|
121
|
+
const ea = [
|
|
122
|
+
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
|
|
123
|
+
[
|
|
124
|
+
"path",
|
|
125
|
+
{
|
|
126
|
+
d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
|
|
127
|
+
key: "116196"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
["path", { d: "m9 14 2 2 4-4", key: "df797q" }]
|
|
131
|
+
], ta = V("clipboard-check", ea);
|
|
132
|
+
/**
|
|
133
|
+
* @license lucide-react v1.8.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/
|
|
138
|
+
const aa = [
|
|
139
|
+
["path", { d: "M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0", key: "1dfaln" }],
|
|
140
|
+
["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
|
|
141
|
+
], sa = V("ear", aa);
|
|
142
|
+
/**
|
|
143
|
+
* @license lucide-react v1.8.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/
|
|
148
|
+
const ia = [
|
|
149
|
+
["path", { d: "M6 18h8", key: "1borvv" }],
|
|
150
|
+
["path", { d: "M3 22h18", key: "8prr45" }],
|
|
151
|
+
["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
|
|
152
|
+
["path", { d: "M9 14h2", key: "197e7h" }],
|
|
153
|
+
["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
|
|
154
|
+
["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
|
|
155
|
+
], na = V("microscope", ia);
|
|
156
|
+
/**
|
|
157
|
+
* @license lucide-react v1.8.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/
|
|
162
|
+
const oa = [
|
|
163
|
+
[
|
|
164
|
+
"path",
|
|
165
|
+
{ d: "m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z", key: "wa1lgi" }
|
|
166
|
+
],
|
|
167
|
+
["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
|
|
168
|
+
], ra = V("pill", oa);
|
|
169
|
+
/**
|
|
170
|
+
* @license lucide-react v1.8.0 - ISC
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the ISC license.
|
|
173
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
+
*/
|
|
175
|
+
const da = [
|
|
176
|
+
["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
|
|
177
|
+
["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
|
|
178
|
+
["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
|
|
179
|
+
["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }],
|
|
180
|
+
["path", { d: "M7 12h10", key: "b7w52i" }]
|
|
181
|
+
], la = V("scan-line", da);
|
|
182
|
+
/**
|
|
183
|
+
* @license lucide-react v1.8.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/
|
|
188
|
+
const ca = [
|
|
189
|
+
["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
|
|
190
|
+
["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
|
|
191
|
+
["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
|
|
192
|
+
["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
|
|
193
|
+
["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
|
|
194
|
+
], ua = V("scissors", ca);
|
|
195
|
+
/**
|
|
196
|
+
* @license lucide-react v1.8.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/
|
|
201
|
+
const ma = [
|
|
202
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
203
|
+
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
204
|
+
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
205
|
+
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
206
|
+
], pa = V("smile", ma);
|
|
207
|
+
/**
|
|
208
|
+
* @license lucide-react v1.8.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/
|
|
213
|
+
const ga = [
|
|
214
|
+
["path", { d: "M12 10V2", key: "16sf7g" }],
|
|
215
|
+
["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
|
|
216
|
+
["path", { d: "M2 18h2", key: "j10viu" }],
|
|
217
|
+
["path", { d: "M20 18h2", key: "wocana" }],
|
|
218
|
+
["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
|
|
219
|
+
["path", { d: "M22 22H2", key: "19qnx5" }],
|
|
220
|
+
["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
|
|
221
|
+
["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
|
|
222
|
+
], fa = V("sunset", ga);
|
|
223
|
+
/**
|
|
224
|
+
* @license lucide-react v1.8.0 - ISC
|
|
225
|
+
*
|
|
226
|
+
* This source code is licensed under the ISC license.
|
|
227
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
+
*/
|
|
229
|
+
const ha = [
|
|
230
|
+
["path", { d: "m18 2 4 4", key: "22kx64" }],
|
|
231
|
+
["path", { d: "m17 7 3-3", key: "1w1zoj" }],
|
|
232
|
+
["path", { d: "M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5", key: "1exhtz" }],
|
|
233
|
+
["path", { d: "m9 11 4 4", key: "rovt3i" }],
|
|
234
|
+
["path", { d: "m5 19-3 3", key: "59f2uf" }],
|
|
235
|
+
["path", { d: "m14 4 6 6", key: "yqp9t2" }]
|
|
236
|
+
], Ze = V("syringe", ha);
|
|
237
|
+
function va(e, t, a) {
|
|
238
|
+
return at(e, -1, a);
|
|
239
|
+
}
|
|
240
|
+
const ba = {
|
|
241
|
+
id: "booking",
|
|
242
|
+
capabilities: ["navigate", "view_change"],
|
|
243
|
+
state: {
|
|
244
|
+
variant: {
|
|
245
|
+
type: "string",
|
|
246
|
+
descriptionKey: "ui.agent.booking.state.variant",
|
|
247
|
+
description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
|
|
248
|
+
read: (e) => e.getVariant()
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
actions: {
|
|
252
|
+
reset: {
|
|
253
|
+
safety: "write",
|
|
254
|
+
descriptionKey: "ui.agent.booking.actions.reset",
|
|
255
|
+
description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
|
|
256
|
+
invoke: (e) => {
|
|
257
|
+
e.reset();
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
goto_step: {
|
|
261
|
+
safety: "read",
|
|
262
|
+
argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
|
|
263
|
+
descriptionKey: "ui.agent.booking.actions.gotoStep",
|
|
264
|
+
description: "Jump to the given step. Implementations may clamp to the first incomplete step if the requested one is not reachable yet.",
|
|
265
|
+
invoke: (e, t) => {
|
|
266
|
+
e.goToStep(t.step);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
domHooks: {
|
|
271
|
+
root: {
|
|
272
|
+
attr: "data-component",
|
|
273
|
+
value: "booking",
|
|
274
|
+
description: "Marks the Booking root region."
|
|
275
|
+
},
|
|
276
|
+
instanceId: {
|
|
277
|
+
attr: "data-component-id",
|
|
278
|
+
sourceProp: "id",
|
|
279
|
+
description: "Sourced from the id prop."
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, Fe = [
|
|
283
|
+
"email",
|
|
284
|
+
"whatsapp",
|
|
285
|
+
"sms"
|
|
286
|
+
], ve = "all", ya = "de";
|
|
287
|
+
function ka(e) {
|
|
288
|
+
return [...e.lockedOperatorId ? e.specialties.filter(
|
|
289
|
+
(a) => {
|
|
290
|
+
var i;
|
|
291
|
+
return (i = a.operatorIds) == null ? void 0 : i.includes(e.lockedOperatorId);
|
|
292
|
+
}
|
|
293
|
+
) : e.specialties].sort((a, i) => {
|
|
294
|
+
const n = a.sequenceNumber ?? Number.POSITIVE_INFINITY, o = i.sequenceNumber ?? Number.POSITIVE_INFINITY;
|
|
295
|
+
return n - o;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function xa(e) {
|
|
299
|
+
let t = e.services;
|
|
300
|
+
return e.lockedOperatorId && (t = t.filter(
|
|
301
|
+
(i) => {
|
|
302
|
+
var n;
|
|
303
|
+
return (n = i.operatorIds) == null ? void 0 : n.includes(e.lockedOperatorId);
|
|
304
|
+
}
|
|
305
|
+
)), (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && e.value.specialtyId && (t = t.filter((i) => i.specialtyId === e.value.specialtyId)), t;
|
|
306
|
+
}
|
|
307
|
+
function Sa(e) {
|
|
308
|
+
const t = e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties;
|
|
309
|
+
if (t && e.value.specialtyId) {
|
|
310
|
+
const a = e.value.specialtyId;
|
|
311
|
+
return e.operators.filter(
|
|
312
|
+
(i) => {
|
|
313
|
+
var n;
|
|
314
|
+
return (n = i.specialtyIds) == null ? void 0 : n.includes(a);
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
if (!t && e.value.serviceId) {
|
|
319
|
+
const a = e.value.serviceId;
|
|
320
|
+
return e.operators.filter(
|
|
321
|
+
(i) => {
|
|
322
|
+
var n;
|
|
323
|
+
return (n = i.appointmentBookingReasonIds) == null ? void 0 : n.includes(a);
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return [];
|
|
328
|
+
}
|
|
329
|
+
function Na(e, t) {
|
|
330
|
+
const a = e.country === ya, i = !a || e.value.insuranceType !== void 0, o = (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && i, p = !o || e.value.specialtyId !== void 0, c = !p || e.value.serviceId !== void 0, l = t.operators, d = !!e.allowOperatorSelection && c && e.value.serviceId !== void 0 && !e.lockedOperatorId && l.length > 1, m = c && e.value.serviceId !== void 0, S = (!m || e.value.date !== void 0) && e.value.date !== void 0, w = (!S || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, N = !!e.value.serviceId && l.length === 0;
|
|
331
|
+
return {
|
|
332
|
+
insurance: a,
|
|
333
|
+
specialty: o,
|
|
334
|
+
service: p,
|
|
335
|
+
operator: d,
|
|
336
|
+
date: m,
|
|
337
|
+
slot: S,
|
|
338
|
+
details: w,
|
|
339
|
+
onboardingIncomplete: N
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function Ia(e, t) {
|
|
343
|
+
const a = [];
|
|
344
|
+
t.insurance && a.push(1), t.specialty && a.push(2), a.push(3), t.operator && a.push(4), a.push(5), a.push(6), a.push(7);
|
|
345
|
+
const i = {
|
|
346
|
+
1: e.value.insuranceType !== void 0,
|
|
347
|
+
2: e.value.specialtyId !== void 0,
|
|
348
|
+
3: e.value.serviceId !== void 0,
|
|
349
|
+
4: e.value.operatorId !== void 0,
|
|
350
|
+
5: e.value.date !== void 0,
|
|
351
|
+
6: e.value.slotKey !== void 0,
|
|
352
|
+
7: !1
|
|
353
|
+
// details fulfilment is owned by the form's own validation
|
|
354
|
+
};
|
|
355
|
+
return {
|
|
356
|
+
currentStep: a.find((o) => !i[o]) ?? 7,
|
|
357
|
+
visibleSteps: a
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function wa(e) {
|
|
361
|
+
const t = {
|
|
362
|
+
specialties: ka(e),
|
|
363
|
+
services: xa(e),
|
|
364
|
+
operators: Sa(e)
|
|
365
|
+
}, a = Na(e, t), { currentStep: i, visibleSteps: n } = Ia(e, a);
|
|
366
|
+
let o;
|
|
367
|
+
if (e.value.date && e.value.slotKey) {
|
|
368
|
+
const c = e.availableSlots[e.value.date];
|
|
369
|
+
c && (o = c.find((l) => l.key === e.value.slotKey));
|
|
370
|
+
}
|
|
371
|
+
const u = e.value.serviceId ? e.services.find((c) => c.id === e.value.serviceId) : void 0, p = e.value.serviceId !== void 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!a.insurance || e.value.insuranceType !== void 0) && (!a.specialty || e.value.specialtyId !== void 0);
|
|
372
|
+
return {
|
|
373
|
+
gates: a,
|
|
374
|
+
filtered: t,
|
|
375
|
+
currentStep: i,
|
|
376
|
+
totalSteps: n.length,
|
|
377
|
+
visibleSteps: n,
|
|
378
|
+
isReadyToSubmit: p,
|
|
379
|
+
durationMin: u == null ? void 0 : u.durationMin,
|
|
380
|
+
selectedSlot: o
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function st(e, t) {
|
|
384
|
+
return {
|
|
385
|
+
...e,
|
|
386
|
+
insuranceType: t,
|
|
387
|
+
specialtyId: void 0,
|
|
388
|
+
serviceId: void 0,
|
|
389
|
+
operatorId: void 0,
|
|
390
|
+
date: void 0,
|
|
391
|
+
slotKey: void 0,
|
|
392
|
+
details: void 0
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function it(e, t) {
|
|
396
|
+
return {
|
|
397
|
+
...e,
|
|
398
|
+
specialtyId: t,
|
|
399
|
+
serviceId: void 0,
|
|
400
|
+
operatorId: void 0,
|
|
401
|
+
date: void 0,
|
|
402
|
+
slotKey: void 0,
|
|
403
|
+
details: void 0
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function nt(e, t) {
|
|
407
|
+
return {
|
|
408
|
+
...e,
|
|
409
|
+
serviceId: t,
|
|
410
|
+
// Default the operator to the "All operators" sentinel so a patient
|
|
411
|
+
// who doesn't care about picking lands on a satisfied step 4 without
|
|
412
|
+
// any further input.
|
|
413
|
+
operatorId: t ? ve : void 0,
|
|
414
|
+
date: void 0,
|
|
415
|
+
slotKey: void 0,
|
|
416
|
+
details: void 0
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function ot(e, t) {
|
|
420
|
+
return {
|
|
421
|
+
...e,
|
|
422
|
+
operatorId: t,
|
|
423
|
+
date: void 0,
|
|
424
|
+
slotKey: void 0,
|
|
425
|
+
details: void 0
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function Ae(e, t) {
|
|
429
|
+
return {
|
|
430
|
+
...e,
|
|
431
|
+
date: t,
|
|
432
|
+
slotKey: void 0
|
|
433
|
+
// Keep details — date/slot changes shouldn't wipe the patient form
|
|
434
|
+
// since the user has already filled some fields.
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function rt(e, t) {
|
|
438
|
+
return {
|
|
439
|
+
...e,
|
|
440
|
+
slotKey: t
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function Ca(e, t) {
|
|
444
|
+
let a = e;
|
|
445
|
+
if (t.lockedOperatorId && a.operatorId !== t.lockedOperatorId && (a = { ...a, operatorId: t.lockedOperatorId }), (t.useSpecialties === void 0 ? t.specialties.length > 0 : t.useSpecialties) && t.specialties.length === 1 && a.specialtyId === void 0 && (a = { ...a, specialtyId: t.specialties[0].id }), t.autoSelectSingleService) {
|
|
446
|
+
const n = a.specialtyId ? t.services.filter((o) => o.specialtyId === a.specialtyId) : t.services;
|
|
447
|
+
n.length === 1 && a.serviceId === void 0 && (a = { ...a, serviceId: n[0].id }, a.operatorId === void 0 && (a = { ...a, operatorId: ve }));
|
|
448
|
+
}
|
|
449
|
+
return a;
|
|
450
|
+
}
|
|
451
|
+
function $e(e) {
|
|
452
|
+
if (e.operatorId && e.operatorId !== ve)
|
|
453
|
+
return e.operatorId;
|
|
454
|
+
}
|
|
455
|
+
function Ma(e) {
|
|
456
|
+
if (!e) return !1;
|
|
457
|
+
const t = e.trim();
|
|
458
|
+
return /^\+?\d[\d\s\-()]{6,}$/.test(t);
|
|
459
|
+
}
|
|
460
|
+
function dt(e) {
|
|
461
|
+
const t = e && e.length > 0 ? e : ["email"], a = new Set(t);
|
|
462
|
+
return Fe.filter((i) => a.has(i));
|
|
463
|
+
}
|
|
464
|
+
function Da(e, t, a) {
|
|
465
|
+
const i = dt(e), n = new Set(i);
|
|
466
|
+
if (a)
|
|
467
|
+
return Fe.filter(
|
|
468
|
+
(l) => a.includes(l) && n.has(l)
|
|
469
|
+
);
|
|
470
|
+
const o = [];
|
|
471
|
+
n.has("email") && o.push("email");
|
|
472
|
+
const u = Ma(t), p = n.has("whatsapp");
|
|
473
|
+
p && u && o.push("whatsapp"), !p && n.has("sms") && o.push("sms");
|
|
474
|
+
const c = new Set(o);
|
|
475
|
+
return Fe.filter((l) => c.has(l));
|
|
476
|
+
}
|
|
477
|
+
const We = 500, Aa = /^[A-Z0-9]{16}$/, _a = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Xe = 300, Ne = { state: "idle" }, ze = Qe(
|
|
478
|
+
({
|
|
479
|
+
value: e,
|
|
480
|
+
onChange: t,
|
|
481
|
+
onSubmit: a,
|
|
482
|
+
requireCodiceFiscale: i = !1,
|
|
483
|
+
requireDateOfBirth: n = !1,
|
|
484
|
+
requireInsuranceNumber: o = !1,
|
|
485
|
+
insuranceType: u,
|
|
486
|
+
showNote: p = !1,
|
|
487
|
+
showReturningPatientFlag: c = !1,
|
|
488
|
+
privacyPolicyUrl: l,
|
|
489
|
+
termsUrl: d,
|
|
490
|
+
validateCodiceFiscale: m,
|
|
491
|
+
validateInsuranceNumber: y,
|
|
492
|
+
submitting: S = !1,
|
|
493
|
+
summarySlot: h,
|
|
494
|
+
defaultPhoneCountry: w,
|
|
495
|
+
confirmationChannels: N,
|
|
496
|
+
defaultConfirmationChannels: I,
|
|
497
|
+
submitError: k
|
|
498
|
+
}, v) => {
|
|
499
|
+
var L, ee;
|
|
500
|
+
const { t: r } = B(), O = et(), [A, f] = j(Ne), [x, _] = j(Ne), [D, U] = j({}), E = q(
|
|
501
|
+
(g) => U((M) => ({ ...M, [g]: !0 })),
|
|
502
|
+
[]
|
|
503
|
+
), R = ae(null), Y = ae(
|
|
504
|
+
null
|
|
505
|
+
);
|
|
506
|
+
G(
|
|
507
|
+
() => () => {
|
|
508
|
+
R.current && clearTimeout(R.current), Y.current && clearTimeout(Y.current);
|
|
509
|
+
},
|
|
510
|
+
[]
|
|
511
|
+
);
|
|
512
|
+
const T = q(
|
|
513
|
+
(g) => t({ ...e, ...g }),
|
|
514
|
+
[e, t]
|
|
515
|
+
), X = C(
|
|
516
|
+
() => dt(N),
|
|
517
|
+
[N]
|
|
518
|
+
), H = X.length >= 2, re = ae(!1);
|
|
519
|
+
G(() => {
|
|
520
|
+
if (!H) {
|
|
521
|
+
e.confirmationChannels !== void 0 && T({ confirmationChannels: void 0 });
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
if (e.confirmationChannels !== void 0) {
|
|
525
|
+
re.current = !0;
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
const g = Da(
|
|
529
|
+
X,
|
|
530
|
+
e.mobilePhone,
|
|
531
|
+
I
|
|
532
|
+
);
|
|
533
|
+
re.current = !0, T({ confirmationChannels: g });
|
|
534
|
+
}, [
|
|
535
|
+
H,
|
|
536
|
+
X,
|
|
537
|
+
e.mobilePhone,
|
|
538
|
+
I
|
|
539
|
+
]);
|
|
540
|
+
const Q = C(
|
|
541
|
+
() => e.confirmationChannels ?? [],
|
|
542
|
+
[e.confirmationChannels]
|
|
543
|
+
), _e = H && Q.length === 0;
|
|
544
|
+
G(() => {
|
|
545
|
+
const g = e.codiceFiscale;
|
|
546
|
+
if (!i || !m || !g) {
|
|
547
|
+
f(Ne);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (!Aa.test(g)) {
|
|
551
|
+
f({
|
|
552
|
+
state: "invalid",
|
|
553
|
+
hint: r("booking.details.codiceFiscale.invalidFormat")
|
|
554
|
+
});
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
f({ state: "pending" }), R.current && clearTimeout(R.current), R.current = setTimeout(() => {
|
|
558
|
+
m(g).then(
|
|
559
|
+
(M) => f(
|
|
560
|
+
M.valid ? { state: "valid" } : { state: "invalid", hint: M.hint }
|
|
561
|
+
)
|
|
562
|
+
).catch(
|
|
563
|
+
() => f({
|
|
564
|
+
state: "invalid",
|
|
565
|
+
hint: r("booking.details.codiceFiscale.unavailable")
|
|
566
|
+
})
|
|
567
|
+
);
|
|
568
|
+
}, Xe);
|
|
569
|
+
}, [i, m, e.codiceFiscale, r]);
|
|
570
|
+
const J = o && u === "public";
|
|
571
|
+
G(() => {
|
|
572
|
+
const g = e.insuranceNumber;
|
|
573
|
+
if (!J || !y || !g) {
|
|
574
|
+
_(Ne);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
_({ state: "pending" }), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => {
|
|
578
|
+
y(g).then(
|
|
579
|
+
(M) => _(
|
|
580
|
+
M.valid ? { state: "valid" } : { state: "invalid", hint: M.hint }
|
|
581
|
+
)
|
|
582
|
+
).catch(
|
|
583
|
+
() => _({
|
|
584
|
+
state: "invalid",
|
|
585
|
+
hint: r("booking.details.insuranceNumber.unavailable")
|
|
586
|
+
})
|
|
587
|
+
);
|
|
588
|
+
}, Xe);
|
|
589
|
+
}, [J, y, e.insuranceNumber, r]);
|
|
590
|
+
const ie = C(
|
|
591
|
+
() => !!(e.email && _a.test(e.email)),
|
|
592
|
+
[e.email]
|
|
593
|
+
), de = C(
|
|
594
|
+
() => !!(e.mobilePhone && e.mobilePhone.length >= 6),
|
|
595
|
+
[e.mobilePhone]
|
|
596
|
+
), le = C(() => {
|
|
597
|
+
var g, M;
|
|
598
|
+
return !(!((g = e.firstName) != null && g.trim()) || !((M = e.lastName) != null && M.trim()) || !ie || !de || i && A.state !== "valid" || n && !e.dateOfBirth || J && x.state !== "valid");
|
|
599
|
+
}, [
|
|
600
|
+
e.firstName,
|
|
601
|
+
e.lastName,
|
|
602
|
+
ie,
|
|
603
|
+
de,
|
|
604
|
+
i,
|
|
605
|
+
A.state,
|
|
606
|
+
n,
|
|
607
|
+
e.dateOfBirth,
|
|
608
|
+
J,
|
|
609
|
+
x.state
|
|
610
|
+
]), Te = !!(e.privacyConsent && e.termsConsent), Be = !H || Q.length > 0, ye = le && Te && Be && !S, ce = (g) => {
|
|
611
|
+
if (g.preventDefault(), U({
|
|
612
|
+
firstName: !0,
|
|
613
|
+
lastName: !0,
|
|
614
|
+
email: !0,
|
|
615
|
+
mobilePhone: !0,
|
|
616
|
+
codiceFiscale: !0,
|
|
617
|
+
dateOfBirth: !0,
|
|
618
|
+
insuranceNumber: !0
|
|
619
|
+
}), !ye) return;
|
|
620
|
+
const M = {
|
|
621
|
+
firstName: e.firstName.trim(),
|
|
622
|
+
lastName: e.lastName.trim(),
|
|
623
|
+
email: e.email.trim(),
|
|
624
|
+
mobilePhone: e.mobilePhone,
|
|
625
|
+
privacyConsent: !0,
|
|
626
|
+
termsConsent: !0,
|
|
627
|
+
codiceFiscale: e.codiceFiscale,
|
|
628
|
+
dateOfBirth: e.dateOfBirth,
|
|
629
|
+
insuranceNumber: e.insuranceNumber,
|
|
630
|
+
note: e.note,
|
|
631
|
+
returningPatient: e.returningPatient,
|
|
632
|
+
// Only include when the picker was visible; otherwise the single
|
|
633
|
+
// implicit channel is inferred backend-side from the practice
|
|
634
|
+
// config.
|
|
635
|
+
confirmationChannels: H ? Q : void 0
|
|
636
|
+
};
|
|
637
|
+
a(M);
|
|
638
|
+
}, ke = (g, M) => {
|
|
639
|
+
const P = M && /^https?:\/\//i.test(M) ? M : void 0;
|
|
640
|
+
return P ? /* @__PURE__ */ s(
|
|
641
|
+
St,
|
|
642
|
+
{
|
|
643
|
+
i18nKey: g,
|
|
644
|
+
components: {
|
|
645
|
+
// The `<Trans>` runtime injects link text from the i18n
|
|
646
|
+
// string. The anchor renders empty at static-analysis time,
|
|
647
|
+
// so `jsx-a11y/anchor-has-content` would false-flag — silence
|
|
648
|
+
// it; the runtime content is the localised policy / terms
|
|
649
|
+
// label.
|
|
650
|
+
policyLink: (
|
|
651
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
652
|
+
/* @__PURE__ */ s(
|
|
653
|
+
"a",
|
|
654
|
+
{
|
|
655
|
+
href: P,
|
|
656
|
+
target: "_blank",
|
|
657
|
+
rel: "noopener noreferrer",
|
|
658
|
+
className: "ds:underline ds:text-[var(--primary)]"
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
)
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
) : r(g);
|
|
665
|
+
};
|
|
666
|
+
return /* @__PURE__ */ b(
|
|
667
|
+
"form",
|
|
668
|
+
{
|
|
669
|
+
ref: v,
|
|
670
|
+
id: O,
|
|
671
|
+
noValidate: !0,
|
|
672
|
+
onSubmit: ce,
|
|
673
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
674
|
+
children: [
|
|
675
|
+
h,
|
|
676
|
+
/* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
|
|
677
|
+
/* @__PURE__ */ s(
|
|
678
|
+
Z,
|
|
679
|
+
{
|
|
680
|
+
label: r("booking.details.firstName.label"),
|
|
681
|
+
required: !0,
|
|
682
|
+
error: D.firstName && !((L = e.firstName) != null && L.trim()) ? r("booking.details.firstName.required") : void 0,
|
|
683
|
+
children: /* @__PURE__ */ s(
|
|
684
|
+
xe,
|
|
685
|
+
{
|
|
686
|
+
autoComplete: "given-name",
|
|
687
|
+
value: e.firstName ?? "",
|
|
688
|
+
onChange: (g) => T({ firstName: g.target.value }),
|
|
689
|
+
onBlur: () => E("firstName")
|
|
690
|
+
}
|
|
691
|
+
)
|
|
692
|
+
}
|
|
693
|
+
),
|
|
694
|
+
/* @__PURE__ */ s(
|
|
695
|
+
Z,
|
|
696
|
+
{
|
|
697
|
+
label: r("booking.details.lastName.label"),
|
|
698
|
+
required: !0,
|
|
699
|
+
error: D.lastName && !((ee = e.lastName) != null && ee.trim()) ? r("booking.details.lastName.required") : void 0,
|
|
700
|
+
children: /* @__PURE__ */ s(
|
|
701
|
+
xe,
|
|
702
|
+
{
|
|
703
|
+
autoComplete: "family-name",
|
|
704
|
+
value: e.lastName ?? "",
|
|
705
|
+
onChange: (g) => T({ lastName: g.target.value }),
|
|
706
|
+
onBlur: () => E("lastName")
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
] }),
|
|
712
|
+
/* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
|
|
713
|
+
/* @__PURE__ */ s(
|
|
714
|
+
Z,
|
|
715
|
+
{
|
|
716
|
+
label: r("booking.details.email.label"),
|
|
717
|
+
required: !0,
|
|
718
|
+
error: D.email && !ie ? r("booking.details.email.invalid") : void 0,
|
|
719
|
+
children: /* @__PURE__ */ s(
|
|
720
|
+
Ct,
|
|
721
|
+
{
|
|
722
|
+
value: e.email ?? "",
|
|
723
|
+
onChange: (g) => T({ email: g.target.value }),
|
|
724
|
+
onBlur: () => E("email")
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
/* @__PURE__ */ s(
|
|
730
|
+
Z,
|
|
731
|
+
{
|
|
732
|
+
label: r("booking.details.mobilePhone.label"),
|
|
733
|
+
required: !0,
|
|
734
|
+
error: D.mobilePhone && !de ? r("booking.details.mobilePhone.invalid") : void 0,
|
|
735
|
+
children: /* @__PURE__ */ s(
|
|
736
|
+
Mt,
|
|
737
|
+
{
|
|
738
|
+
value: e.mobilePhone ?? "",
|
|
739
|
+
defaultCountry: w == null ? void 0 : w.toUpperCase(),
|
|
740
|
+
onChange: (g) => {
|
|
741
|
+
T({ mobilePhone: g }), E("mobilePhone");
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
)
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
] }),
|
|
748
|
+
i || n ? /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
|
|
749
|
+
i ? /* @__PURE__ */ s(
|
|
750
|
+
Z,
|
|
751
|
+
{
|
|
752
|
+
label: r("booking.details.codiceFiscale.label"),
|
|
753
|
+
required: !0,
|
|
754
|
+
description: A.state === "pending" ? r("booking.details.codiceFiscale.checking") : r("booking.details.codiceFiscale.helper"),
|
|
755
|
+
error: D.codiceFiscale && A.state === "invalid" ? A.hint ?? r("booking.details.codiceFiscale.invalid") : void 0,
|
|
756
|
+
children: /* @__PURE__ */ s(
|
|
757
|
+
xe,
|
|
758
|
+
{
|
|
759
|
+
value: e.codiceFiscale ?? "",
|
|
760
|
+
maxLength: 16,
|
|
761
|
+
onChange: (g) => T({
|
|
762
|
+
codiceFiscale: g.target.value.slice(0, 16).toUpperCase()
|
|
763
|
+
}),
|
|
764
|
+
onBlur: () => E("codiceFiscale")
|
|
765
|
+
}
|
|
766
|
+
)
|
|
767
|
+
}
|
|
768
|
+
) : null,
|
|
769
|
+
n ? /* @__PURE__ */ s(
|
|
770
|
+
Z,
|
|
771
|
+
{
|
|
772
|
+
label: r("booking.details.dateOfBirth.label"),
|
|
773
|
+
required: !0,
|
|
774
|
+
error: D.dateOfBirth && !e.dateOfBirth ? r("booking.details.dateOfBirth.required") : void 0,
|
|
775
|
+
children: /* @__PURE__ */ s(
|
|
776
|
+
wt,
|
|
777
|
+
{
|
|
778
|
+
value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
|
|
779
|
+
onChange: (g) => {
|
|
780
|
+
T({
|
|
781
|
+
dateOfBirth: g ? g.toISOString().slice(0, 10) : void 0
|
|
782
|
+
}), E("dateOfBirth");
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
}
|
|
787
|
+
) : null
|
|
788
|
+
] }) : null,
|
|
789
|
+
J ? /* @__PURE__ */ s(
|
|
790
|
+
Z,
|
|
791
|
+
{
|
|
792
|
+
label: r("booking.details.insuranceNumber.label"),
|
|
793
|
+
required: !0,
|
|
794
|
+
description: x.state === "pending" ? r("booking.details.insuranceNumber.checking") : void 0,
|
|
795
|
+
error: D.insuranceNumber && x.state === "invalid" ? x.hint ?? r("booking.details.insuranceNumber.invalid") : void 0,
|
|
796
|
+
children: /* @__PURE__ */ s(
|
|
797
|
+
xe,
|
|
798
|
+
{
|
|
799
|
+
value: e.insuranceNumber ?? "",
|
|
800
|
+
onChange: (g) => T({ insuranceNumber: g.target.value }),
|
|
801
|
+
onBlur: () => E("insuranceNumber")
|
|
802
|
+
}
|
|
803
|
+
)
|
|
804
|
+
}
|
|
805
|
+
) : null,
|
|
806
|
+
p ? /* @__PURE__ */ s(
|
|
807
|
+
Z,
|
|
808
|
+
{
|
|
809
|
+
label: r("booking.details.note.label"),
|
|
810
|
+
description: r("booking.details.note.helper", {
|
|
811
|
+
max: We
|
|
812
|
+
}),
|
|
813
|
+
children: /* @__PURE__ */ s(
|
|
814
|
+
Dt,
|
|
815
|
+
{
|
|
816
|
+
value: e.note ?? "",
|
|
817
|
+
maxLength: We,
|
|
818
|
+
rows: 3,
|
|
819
|
+
onChange: (g) => T({ note: g.target.value })
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
}
|
|
823
|
+
) : null,
|
|
824
|
+
c ? /* @__PURE__ */ s(
|
|
825
|
+
Ve,
|
|
826
|
+
{
|
|
827
|
+
checked: !!e.returningPatient,
|
|
828
|
+
onCheckedChange: (g) => T({ returningPatient: g === !0 }),
|
|
829
|
+
label: r("booking.details.returningPatient.label")
|
|
830
|
+
}
|
|
831
|
+
) : null,
|
|
832
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
833
|
+
/* @__PURE__ */ s(
|
|
834
|
+
Ve,
|
|
835
|
+
{
|
|
836
|
+
checked: !!e.privacyConsent,
|
|
837
|
+
onCheckedChange: (g) => T({ privacyConsent: g === !0 }),
|
|
838
|
+
label: /* @__PURE__ */ b(W, { children: [
|
|
839
|
+
ke(
|
|
840
|
+
"booking.details.consent.privacy.label",
|
|
841
|
+
l
|
|
842
|
+
),
|
|
843
|
+
/* @__PURE__ */ s(
|
|
844
|
+
"span",
|
|
845
|
+
{
|
|
846
|
+
"aria-hidden": "true",
|
|
847
|
+
className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
|
|
848
|
+
children: "*"
|
|
849
|
+
}
|
|
850
|
+
)
|
|
851
|
+
] })
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
/* @__PURE__ */ s(
|
|
855
|
+
Ve,
|
|
856
|
+
{
|
|
857
|
+
checked: !!e.termsConsent,
|
|
858
|
+
onCheckedChange: (g) => T({ termsConsent: g === !0 }),
|
|
859
|
+
label: /* @__PURE__ */ b(W, { children: [
|
|
860
|
+
ke(
|
|
861
|
+
"booking.details.consent.terms.label",
|
|
862
|
+
d
|
|
863
|
+
),
|
|
864
|
+
/* @__PURE__ */ s(
|
|
865
|
+
"span",
|
|
866
|
+
{
|
|
867
|
+
"aria-hidden": "true",
|
|
868
|
+
className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
|
|
869
|
+
children: "*"
|
|
870
|
+
}
|
|
871
|
+
)
|
|
872
|
+
] })
|
|
873
|
+
}
|
|
874
|
+
)
|
|
875
|
+
] }),
|
|
876
|
+
H ? /* @__PURE__ */ s(
|
|
877
|
+
"div",
|
|
878
|
+
{
|
|
879
|
+
"data-component": "booking-confirmation-channels",
|
|
880
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
881
|
+
children: /* @__PURE__ */ s(
|
|
882
|
+
It,
|
|
883
|
+
{
|
|
884
|
+
label: r("booking.confirmation.heading"),
|
|
885
|
+
helperText: r("booking.confirmation.helper"),
|
|
886
|
+
value: Q,
|
|
887
|
+
onChange: (g) => T({
|
|
888
|
+
confirmationChannels: g
|
|
889
|
+
}),
|
|
890
|
+
orientation: "vertical",
|
|
891
|
+
options: X.map((g) => ({
|
|
892
|
+
value: g,
|
|
893
|
+
label: r(`booking.confirmation.channel.${g}`)
|
|
894
|
+
})),
|
|
895
|
+
error: _e ? r("booking.confirmation.atLeastOne") : void 0
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
}
|
|
899
|
+
) : null,
|
|
900
|
+
k ? /* @__PURE__ */ s(K, { variant: "error", children: /* @__PURE__ */ s(K.Description, { children: k }) }) : null,
|
|
901
|
+
/* @__PURE__ */ s(
|
|
902
|
+
se,
|
|
903
|
+
{
|
|
904
|
+
intent: "primary",
|
|
905
|
+
size: "md",
|
|
906
|
+
type: "submit",
|
|
907
|
+
disabled: !ye,
|
|
908
|
+
startIcon: S ? /* @__PURE__ */ s(At, { size: "sm" }) : void 0,
|
|
909
|
+
children: r("booking.details.submit")
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
);
|
|
917
|
+
ze.displayName = "BookingDetailsForm";
|
|
918
|
+
const Ta = Me(
|
|
919
|
+
"ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
|
|
920
|
+
{
|
|
921
|
+
variants: {
|
|
922
|
+
variant: {
|
|
923
|
+
"inline-list": "ds:gap-[var(--spacing-md)]",
|
|
924
|
+
accordion: "ds:gap-[var(--spacing-md)]",
|
|
925
|
+
calendar: "ds:gap-[var(--spacing-md)]",
|
|
926
|
+
flexible: "ds:gap-[var(--spacing-lg)]",
|
|
927
|
+
progress: "ds:gap-[var(--spacing-sm)]"
|
|
928
|
+
},
|
|
929
|
+
// `surface="elevated"` matches `Card variant="elevated"` — same
|
|
930
|
+
// tokens, same padding, same boundary behaviour — so consumers can
|
|
931
|
+
// drop their own Card wraps without a double-card look. Default
|
|
932
|
+
// `'flat'` preserves 0.30.x rendering.
|
|
933
|
+
surface: {
|
|
934
|
+
flat: "",
|
|
935
|
+
elevated: [
|
|
936
|
+
"ds:rounded-[var(--radius-lg)]",
|
|
937
|
+
"ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
|
|
938
|
+
"ds:border ds:border-[color:var(--card-border)]",
|
|
939
|
+
"ds:shadow-[var(--shadow-card)]",
|
|
940
|
+
"ds:p-[var(--spacing-md)]"
|
|
941
|
+
].join(" ")
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
defaultVariants: { variant: "inline-list", surface: "flat" }
|
|
945
|
+
}
|
|
946
|
+
), Ba = [
|
|
947
|
+
[
|
|
948
|
+
/\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
|
|
949
|
+
Ze
|
|
950
|
+
],
|
|
951
|
+
[/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, zt],
|
|
952
|
+
[/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, pa],
|
|
953
|
+
[/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, Kt],
|
|
954
|
+
[/\b(otorin|udito|orecchi|hearing|ear)/i, sa],
|
|
955
|
+
[/\b(neuro|brain|cervello)/i, Wt],
|
|
956
|
+
[/\b(pediatr|child|bambin)/i, Ut],
|
|
957
|
+
[/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Jt],
|
|
958
|
+
[/\b(lab|analis|test|sang|esami)/i, na],
|
|
959
|
+
[/\b(farmaco|pharm|pillol|refill)/i, ra],
|
|
960
|
+
[/\b(chirurg|surg|intervent|operat)/i, ua],
|
|
961
|
+
[/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, la],
|
|
962
|
+
[/\b(vacc|inject|inie|punto)/i, Ze],
|
|
963
|
+
[/\b(derma|skin|pelle)/i, jt],
|
|
964
|
+
[/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, ta],
|
|
965
|
+
[/\b(general|medicin|family|control|check[-\s]?up)/i, Ht]
|
|
966
|
+
];
|
|
967
|
+
function Oa(e) {
|
|
968
|
+
for (const [t, a] of Ba)
|
|
969
|
+
if (t.test(e)) return a;
|
|
970
|
+
return null;
|
|
971
|
+
}
|
|
972
|
+
function Pa(e) {
|
|
973
|
+
const t = Oa(e.label) ?? $t;
|
|
974
|
+
return /* @__PURE__ */ s(t, { "aria-hidden": "true", className: "ds:size-5" });
|
|
975
|
+
}
|
|
976
|
+
function te(e) {
|
|
977
|
+
return we(e, "yyyy-MM-dd");
|
|
978
|
+
}
|
|
979
|
+
const Ea = [
|
|
980
|
+
"ds:relative ds:flex ds:items-center ds:justify-center",
|
|
981
|
+
"ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
|
|
982
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
983
|
+
"ds:text-[length:var(--font-size-sm)]",
|
|
984
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)]",
|
|
985
|
+
"ds:motion-reduce:transition-none",
|
|
986
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
987
|
+
"ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
988
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
989
|
+
].join(" "), Ra = Me(Ea, {
|
|
990
|
+
variants: {
|
|
991
|
+
state: {
|
|
992
|
+
available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
|
|
993
|
+
unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
|
|
994
|
+
selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
|
|
995
|
+
outside: "ds:text-[var(--muted-foreground)]/40"
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
defaultVariants: { state: "unavailable" }
|
|
999
|
+
});
|
|
1000
|
+
function Va({
|
|
1001
|
+
availableDates: e,
|
|
1002
|
+
selectedDate: t,
|
|
1003
|
+
onSelectDate: a,
|
|
1004
|
+
locale: i,
|
|
1005
|
+
loading: n
|
|
1006
|
+
}) {
|
|
1007
|
+
const { t: o } = B(), u = C(() => t ? he($(t)) : e.length > 0 ? he($(e[0])) : he(/* @__PURE__ */ new Date()), [t, e]), [p, c] = j(u), [l, d] = j(null), m = C(() => {
|
|
1008
|
+
const k = he(p), v = Pt(p), r = k.getDay(), O = v.getDate(), A = [];
|
|
1009
|
+
for (let f = r; f > 0; f -= 1) {
|
|
1010
|
+
const x = new Date(k);
|
|
1011
|
+
x.setDate(k.getDate() - f), A.push(x);
|
|
1012
|
+
}
|
|
1013
|
+
for (let f = 0; f < O; f += 1) {
|
|
1014
|
+
const x = new Date(k);
|
|
1015
|
+
x.setDate(k.getDate() + f), A.push(x);
|
|
1016
|
+
}
|
|
1017
|
+
for (; A.length < 42; ) {
|
|
1018
|
+
const f = A[A.length - 1], x = new Date(f);
|
|
1019
|
+
x.setDate(f.getDate() + 1), A.push(x);
|
|
1020
|
+
}
|
|
1021
|
+
return A;
|
|
1022
|
+
}, [p]), y = C(() => {
|
|
1023
|
+
try {
|
|
1024
|
+
return new Intl.DateTimeFormat(i, {
|
|
1025
|
+
month: "long",
|
|
1026
|
+
year: "numeric"
|
|
1027
|
+
}).format(p);
|
|
1028
|
+
} catch {
|
|
1029
|
+
return we(p, "MMMM yyyy");
|
|
1030
|
+
}
|
|
1031
|
+
}, [p, i]), S = C(() => {
|
|
1032
|
+
const k = new Date(2024, 0, 7);
|
|
1033
|
+
return Array.from({ length: 7 }, (v, r) => {
|
|
1034
|
+
const O = new Date(k);
|
|
1035
|
+
O.setDate(k.getDate() + r);
|
|
1036
|
+
try {
|
|
1037
|
+
return new Intl.DateTimeFormat(i, { weekday: "short" }).format(O);
|
|
1038
|
+
} catch {
|
|
1039
|
+
return we(O, "EEE");
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}, [i]), h = C(() => new Set(e), [e]), w = q(
|
|
1043
|
+
(k) => h.has(te(k)),
|
|
1044
|
+
[h]
|
|
1045
|
+
), N = C(() => {
|
|
1046
|
+
if (l) return l;
|
|
1047
|
+
if (t) return $(t);
|
|
1048
|
+
const k = m.find(
|
|
1049
|
+
(v) => Se(v, p) && w(v)
|
|
1050
|
+
);
|
|
1051
|
+
return k || (m.find((v) => Se(v, p)) ?? null);
|
|
1052
|
+
}, [l, t, m, p, w]), I = q(
|
|
1053
|
+
(k, v) => {
|
|
1054
|
+
let r = null;
|
|
1055
|
+
switch (k.key) {
|
|
1056
|
+
case "ArrowLeft":
|
|
1057
|
+
r = new Date(v), r.setDate(v.getDate() - 1);
|
|
1058
|
+
break;
|
|
1059
|
+
case "ArrowRight":
|
|
1060
|
+
r = new Date(v), r.setDate(v.getDate() + 1);
|
|
1061
|
+
break;
|
|
1062
|
+
case "ArrowUp":
|
|
1063
|
+
r = new Date(v), r.setDate(v.getDate() - 7);
|
|
1064
|
+
break;
|
|
1065
|
+
case "ArrowDown":
|
|
1066
|
+
r = new Date(v), r.setDate(v.getDate() + 7);
|
|
1067
|
+
break;
|
|
1068
|
+
case "Home":
|
|
1069
|
+
r = new Date(v), r.setDate(v.getDate() - v.getDay());
|
|
1070
|
+
break;
|
|
1071
|
+
case "End":
|
|
1072
|
+
r = new Date(v), r.setDate(v.getDate() + (6 - v.getDay()));
|
|
1073
|
+
break;
|
|
1074
|
+
case "Enter":
|
|
1075
|
+
case " ": {
|
|
1076
|
+
k.preventDefault(), w(v) && a(te(v));
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
default:
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
r && (k.preventDefault(), Se(r, p) || c(he(r)), d(r));
|
|
1083
|
+
},
|
|
1084
|
+
[w, a, p]
|
|
1085
|
+
);
|
|
1086
|
+
return n ? /* @__PURE__ */ b(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
role: "status",
|
|
1090
|
+
"aria-live": "polite",
|
|
1091
|
+
"aria-label": o("common.loading"),
|
|
1092
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
1093
|
+
children: [
|
|
1094
|
+
/* @__PURE__ */ s(Ce, { variant: "text", width: "40%" }),
|
|
1095
|
+
/* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (k, v) => /* @__PURE__ */ s(Ce, { variant: "rounded", height: "2.5rem" }, `mg-skel-${v}`)) })
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1099
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
|
|
1100
|
+
/* @__PURE__ */ s(
|
|
1101
|
+
Ye,
|
|
1102
|
+
{
|
|
1103
|
+
icon: /* @__PURE__ */ s(Rt, {}),
|
|
1104
|
+
"aria-label": o("booking.previousMonth"),
|
|
1105
|
+
size: "sm",
|
|
1106
|
+
intent: "ghost",
|
|
1107
|
+
flipIconInRtl: !0,
|
|
1108
|
+
onClick: () => {
|
|
1109
|
+
c((k) => va(k)), d(null);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
),
|
|
1113
|
+
/* @__PURE__ */ s(
|
|
1114
|
+
"span",
|
|
1115
|
+
{
|
|
1116
|
+
className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
|
|
1117
|
+
"aria-live": "polite",
|
|
1118
|
+
children: y
|
|
1119
|
+
}
|
|
1120
|
+
),
|
|
1121
|
+
/* @__PURE__ */ s(
|
|
1122
|
+
Ye,
|
|
1123
|
+
{
|
|
1124
|
+
icon: /* @__PURE__ */ s(Vt, {}),
|
|
1125
|
+
"aria-label": o("booking.nextMonth"),
|
|
1126
|
+
size: "sm",
|
|
1127
|
+
intent: "ghost",
|
|
1128
|
+
flipIconInRtl: !0,
|
|
1129
|
+
onClick: () => {
|
|
1130
|
+
c((k) => at(k, 1)), d(null);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
] }),
|
|
1135
|
+
/* @__PURE__ */ b(
|
|
1136
|
+
"div",
|
|
1137
|
+
{
|
|
1138
|
+
role: "grid",
|
|
1139
|
+
"aria-label": o("booking.monthGridLabel"),
|
|
1140
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
|
|
1141
|
+
children: [
|
|
1142
|
+
/* @__PURE__ */ s(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
role: "row",
|
|
1146
|
+
className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
|
|
1147
|
+
children: S.map((k, v) => /* @__PURE__ */ s(
|
|
1148
|
+
"div",
|
|
1149
|
+
{
|
|
1150
|
+
role: "columnheader",
|
|
1151
|
+
className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
|
|
1152
|
+
children: k
|
|
1153
|
+
},
|
|
1154
|
+
`wd-${v}`
|
|
1155
|
+
))
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
Array.from({ length: 6 }, (k, v) => /* @__PURE__ */ s(
|
|
1159
|
+
"div",
|
|
1160
|
+
{
|
|
1161
|
+
role: "row",
|
|
1162
|
+
className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
|
|
1163
|
+
children: m.slice(v * 7, v * 7 + 7).map((r, O) => {
|
|
1164
|
+
const A = v * 7 + O, f = Se(r, p), x = f && w(r), _ = t ? Je(r, $(t)) : !1, D = f ? _ ? "selected" : x ? "available" : "unavailable" : "outside", U = N ? Je(N, r) : !1, E = (() => {
|
|
1165
|
+
try {
|
|
1166
|
+
return new Intl.DateTimeFormat(i, {
|
|
1167
|
+
dateStyle: "full"
|
|
1168
|
+
}).format(r);
|
|
1169
|
+
} catch {
|
|
1170
|
+
return we(r, "PPP");
|
|
1171
|
+
}
|
|
1172
|
+
})();
|
|
1173
|
+
return /* @__PURE__ */ s(
|
|
1174
|
+
"button",
|
|
1175
|
+
{
|
|
1176
|
+
type: "button",
|
|
1177
|
+
role: "gridcell",
|
|
1178
|
+
"aria-label": E,
|
|
1179
|
+
"aria-selected": _ || void 0,
|
|
1180
|
+
"aria-disabled": !x || void 0,
|
|
1181
|
+
tabIndex: U ? 0 : -1,
|
|
1182
|
+
disabled: !x,
|
|
1183
|
+
onClick: () => {
|
|
1184
|
+
x && a(te(r));
|
|
1185
|
+
},
|
|
1186
|
+
onKeyDown: (R) => I(R, r),
|
|
1187
|
+
className: Ra({ state: D }),
|
|
1188
|
+
children: /* @__PURE__ */ s("span", { "aria-hidden": "true", children: r.getDate() })
|
|
1189
|
+
},
|
|
1190
|
+
`mg-cell-${A}`
|
|
1191
|
+
);
|
|
1192
|
+
})
|
|
1193
|
+
},
|
|
1194
|
+
`mg-row-${v}`
|
|
1195
|
+
))
|
|
1196
|
+
]
|
|
1197
|
+
}
|
|
1198
|
+
)
|
|
1199
|
+
] });
|
|
1200
|
+
}
|
|
1201
|
+
const La = Me(
|
|
1202
|
+
[
|
|
1203
|
+
"ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
|
|
1204
|
+
"ds:min-h-[var(--min-target-size)]",
|
|
1205
|
+
"ds:rounded-[var(--radius-md)]",
|
|
1206
|
+
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
1207
|
+
"ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
|
|
1208
|
+
"ds:text-start",
|
|
1209
|
+
"ds:transition-[background-color,box-shadow]",
|
|
1210
|
+
"ds:duration-[var(--animation-duration)]",
|
|
1211
|
+
"ds:motion-reduce:transition-none",
|
|
1212
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
1213
|
+
"ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
1214
|
+
"ds:forced-colors:[outline:1px_solid_CanvasText]",
|
|
1215
|
+
"ds:cursor-pointer"
|
|
1216
|
+
].join(" "),
|
|
1217
|
+
{
|
|
1218
|
+
variants: {
|
|
1219
|
+
state: {
|
|
1220
|
+
idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
|
|
1221
|
+
selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
defaultVariants: { state: "idle" }
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
function Fa({
|
|
1228
|
+
services: e,
|
|
1229
|
+
selectedServiceId: t,
|
|
1230
|
+
onSelect: a
|
|
1231
|
+
}) {
|
|
1232
|
+
const { t: i } = B(), n = et(), [o, u] = j(() => {
|
|
1233
|
+
if (t) {
|
|
1234
|
+
const d = e.findIndex((m) => m.id === t);
|
|
1235
|
+
if (d >= 0) return d;
|
|
1236
|
+
}
|
|
1237
|
+
return 0;
|
|
1238
|
+
}), p = ae(/* @__PURE__ */ new Map()), c = q((d) => {
|
|
1239
|
+
var m;
|
|
1240
|
+
(m = p.current.get(d)) == null || m.focus();
|
|
1241
|
+
}, []), l = q(
|
|
1242
|
+
(d, m, y) => {
|
|
1243
|
+
const S = e.length;
|
|
1244
|
+
if (S !== 0)
|
|
1245
|
+
switch (d.key) {
|
|
1246
|
+
case "ArrowDown":
|
|
1247
|
+
case "ArrowRight": {
|
|
1248
|
+
d.preventDefault();
|
|
1249
|
+
const h = (m + 1) % S;
|
|
1250
|
+
u(h), c(h);
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
case "ArrowUp":
|
|
1254
|
+
case "ArrowLeft": {
|
|
1255
|
+
d.preventDefault();
|
|
1256
|
+
const h = (m - 1 + S) % S;
|
|
1257
|
+
u(h), c(h);
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
case "Home": {
|
|
1261
|
+
d.preventDefault(), u(0), c(0);
|
|
1262
|
+
break;
|
|
1263
|
+
}
|
|
1264
|
+
case "End": {
|
|
1265
|
+
d.preventDefault();
|
|
1266
|
+
const h = S - 1;
|
|
1267
|
+
u(h), c(h);
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
case "Enter":
|
|
1271
|
+
case " ": {
|
|
1272
|
+
d.preventDefault(), a(y);
|
|
1273
|
+
break;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
[e.length, c, a]
|
|
1278
|
+
);
|
|
1279
|
+
return e.length === 0 ? null : /* @__PURE__ */ s(
|
|
1280
|
+
"div",
|
|
1281
|
+
{
|
|
1282
|
+
role: "radiogroup",
|
|
1283
|
+
"aria-label": i("booking.serviceListLabel"),
|
|
1284
|
+
id: n,
|
|
1285
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
1286
|
+
children: e.map((d, m) => {
|
|
1287
|
+
const y = t === d.id, S = o === m, h = i("booking.serviceCardLabel", {
|
|
1288
|
+
label: d.label,
|
|
1289
|
+
duration: d.durationMin
|
|
1290
|
+
}), w = Pa(d);
|
|
1291
|
+
return /* @__PURE__ */ b(
|
|
1292
|
+
"button",
|
|
1293
|
+
{
|
|
1294
|
+
ref: (N) => {
|
|
1295
|
+
N ? p.current.set(m, N) : p.current.delete(m);
|
|
1296
|
+
},
|
|
1297
|
+
type: "button",
|
|
1298
|
+
role: "radio",
|
|
1299
|
+
"aria-checked": y,
|
|
1300
|
+
"aria-label": h,
|
|
1301
|
+
tabIndex: S ? 0 : -1,
|
|
1302
|
+
onClick: () => a(d.id),
|
|
1303
|
+
onFocus: () => u(m),
|
|
1304
|
+
onKeyDown: (N) => l(N, m, d.id),
|
|
1305
|
+
className: La({
|
|
1306
|
+
state: y ? "selected" : "idle"
|
|
1307
|
+
}),
|
|
1308
|
+
children: [
|
|
1309
|
+
/* @__PURE__ */ s(
|
|
1310
|
+
"span",
|
|
1311
|
+
{
|
|
1312
|
+
"aria-hidden": "true",
|
|
1313
|
+
className: "ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[var(--primary)]/10 ds:text-[var(--primary)]",
|
|
1314
|
+
children: w
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
/* @__PURE__ */ b("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
|
|
1318
|
+
/* @__PURE__ */ s("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: d.label }),
|
|
1319
|
+
/* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: i("booking.serviceSummary", { minutes: d.durationMin }) })
|
|
1320
|
+
] })
|
|
1321
|
+
]
|
|
1322
|
+
},
|
|
1323
|
+
d.id
|
|
1324
|
+
);
|
|
1325
|
+
})
|
|
1326
|
+
}
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
const $a = Me(
|
|
1330
|
+
[
|
|
1331
|
+
"ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
|
|
1332
|
+
"ds:min-h-[var(--min-target-size)]",
|
|
1333
|
+
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
1334
|
+
"ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
|
|
1335
|
+
"ds:rounded-[var(--radius-md)]",
|
|
1336
|
+
"ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
|
|
1337
|
+
"ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
|
|
1338
|
+
"ds:motion-reduce:transition-none",
|
|
1339
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
1340
|
+
"ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
1341
|
+
"ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
|
|
1342
|
+
"ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
|
|
1343
|
+
].join(" "),
|
|
1344
|
+
{
|
|
1345
|
+
variants: {
|
|
1346
|
+
state: {
|
|
1347
|
+
idle: "ds:bg-[color:var(--card)] ds:text-[color:var(--foreground)] ds:shadow-[var(--shadow-sm)] ds:hover:enabled:bg-[color:var(--muted)]/40 ds:hover:enabled:shadow-[var(--shadow-md)]",
|
|
1348
|
+
selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
|
|
1349
|
+
unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
defaultVariants: { state: "idle" }
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1355
|
+
function za(e) {
|
|
1356
|
+
const [t] = e.split(":").map((i) => parseInt(i, 10)), a = Number.isFinite(t) ? t : 0;
|
|
1357
|
+
return a < 12 ? "morning" : a < 17 ? "afternoon" : "evening";
|
|
1358
|
+
}
|
|
1359
|
+
const Ka = {
|
|
1360
|
+
morning: Ft,
|
|
1361
|
+
afternoon: fa,
|
|
1362
|
+
evening: Lt
|
|
1363
|
+
};
|
|
1364
|
+
function ja({
|
|
1365
|
+
date: e,
|
|
1366
|
+
slots: t,
|
|
1367
|
+
selectedSlotKey: a,
|
|
1368
|
+
onSelect: i,
|
|
1369
|
+
loading: n,
|
|
1370
|
+
locale: o
|
|
1371
|
+
}) {
|
|
1372
|
+
const { t: u } = B(), p = C(() => {
|
|
1373
|
+
try {
|
|
1374
|
+
return new Intl.DateTimeFormat(o, {
|
|
1375
|
+
weekday: "long",
|
|
1376
|
+
day: "numeric",
|
|
1377
|
+
month: "long"
|
|
1378
|
+
}).format($(e));
|
|
1379
|
+
} catch {
|
|
1380
|
+
return e;
|
|
1381
|
+
}
|
|
1382
|
+
}, [e, o]), c = C(() => {
|
|
1383
|
+
const m = {
|
|
1384
|
+
morning: [],
|
|
1385
|
+
afternoon: [],
|
|
1386
|
+
evening: []
|
|
1387
|
+
};
|
|
1388
|
+
for (const y of t)
|
|
1389
|
+
m[za(y.time)].push(y);
|
|
1390
|
+
return m;
|
|
1391
|
+
}, [t]), l = t.filter((m) => m.available).length, d = ["morning", "afternoon", "evening"];
|
|
1392
|
+
return n ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1393
|
+
/* @__PURE__ */ s(Ce, { variant: "text", width: "60%" }),
|
|
1394
|
+
[0, 1].map((m) => /* @__PURE__ */ s(
|
|
1395
|
+
"div",
|
|
1396
|
+
{
|
|
1397
|
+
className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
|
|
1398
|
+
children: [0, 1, 2].map((y) => /* @__PURE__ */ s(Ce, { variant: "rounded", height: "44px" }, y))
|
|
1399
|
+
},
|
|
1400
|
+
m
|
|
1401
|
+
))
|
|
1402
|
+
] }) : l === 0 ? /* @__PURE__ */ s(tt, { variant: "no-results", title: u("booking.noSlotsForDate") }) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1403
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
|
|
1404
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
1405
|
+
/* @__PURE__ */ s(
|
|
1406
|
+
Qt,
|
|
1407
|
+
{
|
|
1408
|
+
"aria-hidden": "true",
|
|
1409
|
+
className: "ds:size-4 ds:text-[color:var(--accent)]"
|
|
1410
|
+
}
|
|
1411
|
+
),
|
|
1412
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: p })
|
|
1413
|
+
] }),
|
|
1414
|
+
/* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: u("booking.slotsAvailable", { count: l }) })
|
|
1415
|
+
] }),
|
|
1416
|
+
d.map((m) => {
|
|
1417
|
+
const y = c[m];
|
|
1418
|
+
if (y.length === 0) return null;
|
|
1419
|
+
const S = Ka[m];
|
|
1420
|
+
return /* @__PURE__ */ b(
|
|
1421
|
+
"div",
|
|
1422
|
+
{
|
|
1423
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
1424
|
+
children: [
|
|
1425
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
|
|
1426
|
+
/* @__PURE__ */ s(S, { "aria-hidden": "true", className: "ds:size-3.5" }),
|
|
1427
|
+
/* @__PURE__ */ s("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: u(`booking.timeOfDay.${m}`) })
|
|
1428
|
+
] }),
|
|
1429
|
+
/* @__PURE__ */ s(
|
|
1430
|
+
"div",
|
|
1431
|
+
{
|
|
1432
|
+
role: "group",
|
|
1433
|
+
"aria-label": u(`booking.timeOfDay.${m}`),
|
|
1434
|
+
className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
|
|
1435
|
+
children: y.map((h) => {
|
|
1436
|
+
const w = h.key === a, N = h.available ? w ? "selected" : "idle" : "unavailable";
|
|
1437
|
+
return /* @__PURE__ */ s(
|
|
1438
|
+
"button",
|
|
1439
|
+
{
|
|
1440
|
+
type: "button",
|
|
1441
|
+
"data-slot-id": h.key,
|
|
1442
|
+
disabled: !h.available,
|
|
1443
|
+
"aria-pressed": w,
|
|
1444
|
+
"aria-label": u("booking.slotAvailableLabel", {
|
|
1445
|
+
time: h.time
|
|
1446
|
+
}),
|
|
1447
|
+
onClick: () => h.available && i(h),
|
|
1448
|
+
className: $a({ state: N }),
|
|
1449
|
+
children: h.time
|
|
1450
|
+
},
|
|
1451
|
+
h.key
|
|
1452
|
+
);
|
|
1453
|
+
})
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1456
|
+
]
|
|
1457
|
+
},
|
|
1458
|
+
m
|
|
1459
|
+
);
|
|
1460
|
+
})
|
|
1461
|
+
] });
|
|
1462
|
+
}
|
|
1463
|
+
const Ie = 4;
|
|
1464
|
+
function qa({
|
|
1465
|
+
availableDates: e,
|
|
1466
|
+
availableSlots: t,
|
|
1467
|
+
value: a,
|
|
1468
|
+
onChange: i,
|
|
1469
|
+
onDateSelect: n,
|
|
1470
|
+
onWindowChange: o,
|
|
1471
|
+
loadingDates: u,
|
|
1472
|
+
loadingSlots: p,
|
|
1473
|
+
locale: c
|
|
1474
|
+
}) {
|
|
1475
|
+
const l = C(() => ne(/* @__PURE__ */ new Date()), []), [d, m] = j(() => {
|
|
1476
|
+
if (a.date) {
|
|
1477
|
+
const f = ne($(a.date));
|
|
1478
|
+
if (!oe(l, f)) return f;
|
|
1479
|
+
}
|
|
1480
|
+
if (e.length > 0) {
|
|
1481
|
+
const f = ne($(e[0]));
|
|
1482
|
+
if (oe(f, l)) return f;
|
|
1483
|
+
}
|
|
1484
|
+
return l;
|
|
1485
|
+
}), y = C(
|
|
1486
|
+
() => Le(d, Ie - 1),
|
|
1487
|
+
[d]
|
|
1488
|
+
), S = C(() => Array.from({ length: Ie }, (f, x) => {
|
|
1489
|
+
const _ = Le(d, x), D = te(_), E = (t[D] ?? []).map((R) => ({
|
|
1490
|
+
id: R.key,
|
|
1491
|
+
// SlotGrid formats `start` as a time via Intl.DateTimeFormat —
|
|
1492
|
+
// compose a full ISO from the column's date + the slot's HH:mm
|
|
1493
|
+
// so the locale-formatter has a real timestamp to work with.
|
|
1494
|
+
start: `${D}T${R.time}:00`,
|
|
1495
|
+
available: R.available
|
|
1496
|
+
}));
|
|
1497
|
+
return { date: D, slots: E };
|
|
1498
|
+
}), [d, t]), h = oe(d, l), w = !0, N = q(() => {
|
|
1499
|
+
m((f) => {
|
|
1500
|
+
const x = Et(f, Ie);
|
|
1501
|
+
return oe(l, x) ? l : x;
|
|
1502
|
+
});
|
|
1503
|
+
}, [l]), I = q(() => {
|
|
1504
|
+
m((f) => Le(f, Ie));
|
|
1505
|
+
}, []);
|
|
1506
|
+
G(() => {
|
|
1507
|
+
if (e.length === 0) return;
|
|
1508
|
+
const f = ne($(e[0]));
|
|
1509
|
+
!oe(f, l) || e.some((_) => {
|
|
1510
|
+
const D = ne($(_));
|
|
1511
|
+
return !oe(D, y) && !Ot(D, d);
|
|
1512
|
+
}) || m(f);
|
|
1513
|
+
}, [e]), G(() => {
|
|
1514
|
+
o == null || o(te(d), te(y));
|
|
1515
|
+
}, [d, y, o]);
|
|
1516
|
+
const k = q(
|
|
1517
|
+
(f, x) => {
|
|
1518
|
+
const _ = typeof x.date == "string" ? x.date : te(x.date);
|
|
1519
|
+
i({
|
|
1520
|
+
...rt(Ae(a, _), f.id)
|
|
1521
|
+
}), n == null || n(_);
|
|
1522
|
+
},
|
|
1523
|
+
[i, n, a]
|
|
1524
|
+
), v = u || p ? "loading" : "default", r = S.some((f) => f.slots.length > 0), O = e[0];
|
|
1525
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1526
|
+
!r && !!O ? /* @__PURE__ */ s(
|
|
1527
|
+
Ke,
|
|
1528
|
+
{
|
|
1529
|
+
nextAvailableDate: O,
|
|
1530
|
+
onJump: () => m(ne($(O))),
|
|
1531
|
+
locale: c
|
|
1532
|
+
}
|
|
1533
|
+
) : null,
|
|
1534
|
+
/* @__PURE__ */ s(
|
|
1535
|
+
Bt,
|
|
1536
|
+
{
|
|
1537
|
+
days: S,
|
|
1538
|
+
state: v,
|
|
1539
|
+
selectedSlotId: a.slotKey,
|
|
1540
|
+
maxInitialSlotsPerDay: 6,
|
|
1541
|
+
locale: c,
|
|
1542
|
+
hasPrevious: h,
|
|
1543
|
+
hasNext: w,
|
|
1544
|
+
onSlotSelect: k,
|
|
1545
|
+
onPreviousDays: N,
|
|
1546
|
+
onNextDays: I
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1549
|
+
] });
|
|
1550
|
+
}
|
|
1551
|
+
function lt(e) {
|
|
1552
|
+
const {
|
|
1553
|
+
inputs: t,
|
|
1554
|
+
value: a,
|
|
1555
|
+
onChange: i,
|
|
1556
|
+
onDateSelect: n,
|
|
1557
|
+
onWindowChange: o,
|
|
1558
|
+
loadingDates: u,
|
|
1559
|
+
loadingSlots: p,
|
|
1560
|
+
locale: c,
|
|
1561
|
+
datePickerStyle: l
|
|
1562
|
+
} = e;
|
|
1563
|
+
return l === "four-day-grid" ? /* @__PURE__ */ s(
|
|
1564
|
+
qa,
|
|
1565
|
+
{
|
|
1566
|
+
availableDates: t.availableDates,
|
|
1567
|
+
availableSlots: t.availableSlots,
|
|
1568
|
+
value: a,
|
|
1569
|
+
onChange: i,
|
|
1570
|
+
onDateSelect: n,
|
|
1571
|
+
onWindowChange: o,
|
|
1572
|
+
loadingDates: u,
|
|
1573
|
+
loadingSlots: p,
|
|
1574
|
+
locale: c
|
|
1575
|
+
}
|
|
1576
|
+
) : /* @__PURE__ */ s(
|
|
1577
|
+
Va,
|
|
1578
|
+
{
|
|
1579
|
+
availableDates: t.availableDates,
|
|
1580
|
+
selectedDate: a.date,
|
|
1581
|
+
onSelectDate: (d) => {
|
|
1582
|
+
i(Ae(a, d)), n == null || n(d);
|
|
1583
|
+
},
|
|
1584
|
+
locale: c,
|
|
1585
|
+
loading: u ?? p
|
|
1586
|
+
}
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
function ct(e) {
|
|
1590
|
+
const { inputs: t, value: a, onChange: i, loadingSlots: n, locale: o, datePickerStyle: u } = e;
|
|
1591
|
+
return u === "four-day-grid" || !a.date ? null : /* @__PURE__ */ s(
|
|
1592
|
+
ja,
|
|
1593
|
+
{
|
|
1594
|
+
date: a.date,
|
|
1595
|
+
slots: t.availableSlots[a.date] ?? [],
|
|
1596
|
+
selectedSlotKey: a.slotKey,
|
|
1597
|
+
onSelect: (p) => i(rt(a, p.key)),
|
|
1598
|
+
loading: n,
|
|
1599
|
+
locale: o
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1603
|
+
function ut({ value: e, onChange: t }) {
|
|
1604
|
+
const { t: a } = B(), i = [
|
|
1605
|
+
{ value: "private", label: a("booking.insurance.private") },
|
|
1606
|
+
{ value: "public", label: a("booking.insurance.public") }
|
|
1607
|
+
];
|
|
1608
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1609
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: a("booking.insurance.heading") }),
|
|
1610
|
+
/* @__PURE__ */ s(
|
|
1611
|
+
De,
|
|
1612
|
+
{
|
|
1613
|
+
options: i,
|
|
1614
|
+
value: e ?? "",
|
|
1615
|
+
onValueChange: (n) => {
|
|
1616
|
+
(n === "private" || n === "public") && t(n);
|
|
1617
|
+
},
|
|
1618
|
+
placeholder: a("booking.insurance.placeholder"),
|
|
1619
|
+
"aria-label": a("booking.insurance.heading")
|
|
1620
|
+
}
|
|
1621
|
+
)
|
|
1622
|
+
] });
|
|
1623
|
+
}
|
|
1624
|
+
function mt({ specialties: e, value: t, onChange: a }) {
|
|
1625
|
+
const { t: i } = B(), n = e.map((o) => ({
|
|
1626
|
+
value: o.id,
|
|
1627
|
+
label: o.label
|
|
1628
|
+
}));
|
|
1629
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1630
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: i("booking.specialty.heading") }),
|
|
1631
|
+
/* @__PURE__ */ s(
|
|
1632
|
+
De,
|
|
1633
|
+
{
|
|
1634
|
+
options: n,
|
|
1635
|
+
value: t ?? "",
|
|
1636
|
+
onValueChange: (o) => a(o),
|
|
1637
|
+
placeholder: i("booking.specialty.placeholder"),
|
|
1638
|
+
"aria-label": i("booking.specialty.heading")
|
|
1639
|
+
}
|
|
1640
|
+
)
|
|
1641
|
+
] });
|
|
1642
|
+
}
|
|
1643
|
+
function pt({ services: e, value: t, onChange: a, compact: i }) {
|
|
1644
|
+
const { t: n } = B();
|
|
1645
|
+
if (i) {
|
|
1646
|
+
const o = e.map((u) => ({
|
|
1647
|
+
value: u.id,
|
|
1648
|
+
label: `${u.label} · ${n("booking.serviceSummary", {
|
|
1649
|
+
minutes: u.durationMin
|
|
1650
|
+
})}`
|
|
1651
|
+
}));
|
|
1652
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1653
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: n("booking.service.heading") }),
|
|
1654
|
+
/* @__PURE__ */ s(
|
|
1655
|
+
De,
|
|
1656
|
+
{
|
|
1657
|
+
options: o,
|
|
1658
|
+
value: t ?? "",
|
|
1659
|
+
onValueChange: (u) => a(u),
|
|
1660
|
+
placeholder: n("booking.service.placeholder"),
|
|
1661
|
+
"aria-label": n("booking.service.heading")
|
|
1662
|
+
}
|
|
1663
|
+
)
|
|
1664
|
+
] });
|
|
1665
|
+
}
|
|
1666
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1667
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: n("booking.service.heading") }),
|
|
1668
|
+
/* @__PURE__ */ s(
|
|
1669
|
+
Fa,
|
|
1670
|
+
{
|
|
1671
|
+
services: e,
|
|
1672
|
+
selectedServiceId: t,
|
|
1673
|
+
onSelect: a
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] });
|
|
1677
|
+
}
|
|
1678
|
+
function gt({ operators: e, value: t, onChange: a }) {
|
|
1679
|
+
const { t: i } = B(), n = [
|
|
1680
|
+
{ value: ve, label: i("booking.operator.all") },
|
|
1681
|
+
...e.map((o) => ({ value: o.id, label: o.name }))
|
|
1682
|
+
];
|
|
1683
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1684
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: i("booking.operator.heading") }),
|
|
1685
|
+
/* @__PURE__ */ s(
|
|
1686
|
+
De,
|
|
1687
|
+
{
|
|
1688
|
+
options: n,
|
|
1689
|
+
value: t ?? ve,
|
|
1690
|
+
onValueChange: (o) => a(o),
|
|
1691
|
+
placeholder: i("booking.operator.placeholder"),
|
|
1692
|
+
"aria-label": i("booking.operator.heading")
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1695
|
+
] });
|
|
1696
|
+
}
|
|
1697
|
+
function ft({
|
|
1698
|
+
customSlot: e
|
|
1699
|
+
}) {
|
|
1700
|
+
const { t } = B();
|
|
1701
|
+
return e ? /* @__PURE__ */ s(W, { children: e }) : /* @__PURE__ */ b(K, { variant: "warning", children: [
|
|
1702
|
+
/* @__PURE__ */ s(K.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
|
|
1703
|
+
/* @__PURE__ */ s(K.Description, { children: t("booking.onboardingIncomplete.description") })
|
|
1704
|
+
] });
|
|
1705
|
+
}
|
|
1706
|
+
function Ke({
|
|
1707
|
+
nextAvailableDate: e,
|
|
1708
|
+
onJump: t,
|
|
1709
|
+
locale: a
|
|
1710
|
+
}) {
|
|
1711
|
+
const { t: i } = B(), n = C(() => {
|
|
1712
|
+
try {
|
|
1713
|
+
return new Intl.DateTimeFormat(a, { dateStyle: "long" }).format(
|
|
1714
|
+
$(e)
|
|
1715
|
+
);
|
|
1716
|
+
} catch {
|
|
1717
|
+
return e;
|
|
1718
|
+
}
|
|
1719
|
+
}, [e, a]);
|
|
1720
|
+
return /* @__PURE__ */ b(K, { variant: "info", children: [
|
|
1721
|
+
/* @__PURE__ */ s(K.Description, { children: i("booking.nextAvailable.description", { date: n }) }),
|
|
1722
|
+
/* @__PURE__ */ s(K.Action, { children: /* @__PURE__ */ s(se, { intent: "secondary", size: "sm", onClick: t, children: i("booking.nextAvailable.cta") }) })
|
|
1723
|
+
] });
|
|
1724
|
+
}
|
|
1725
|
+
function Ha({
|
|
1726
|
+
snapshot: e,
|
|
1727
|
+
operators: t,
|
|
1728
|
+
specialties: a,
|
|
1729
|
+
services: i,
|
|
1730
|
+
locale: n,
|
|
1731
|
+
mode: o,
|
|
1732
|
+
showModify: u,
|
|
1733
|
+
onReset: p,
|
|
1734
|
+
onModify: c
|
|
1735
|
+
}) {
|
|
1736
|
+
const { t: l } = B(), m = (e.details.confirmationChannels ?? ["email"]).map(
|
|
1737
|
+
(I) => l(`booking.confirmation.channel.${I}`)
|
|
1738
|
+
), y = o === "demo" ? l("booking.success.descriptionDemo") : m.length > 1 ? l("booking.success.descriptionMultiple", {
|
|
1739
|
+
channels: m.join(" · ")
|
|
1740
|
+
}) : l("booking.success.descriptionSingle", { channel: m[0] }), S = C(() => {
|
|
1741
|
+
if (e.date)
|
|
1742
|
+
try {
|
|
1743
|
+
return new Intl.DateTimeFormat(n, {
|
|
1744
|
+
weekday: "long",
|
|
1745
|
+
day: "numeric",
|
|
1746
|
+
month: "long"
|
|
1747
|
+
}).format($(e.date));
|
|
1748
|
+
} catch {
|
|
1749
|
+
return e.date;
|
|
1750
|
+
}
|
|
1751
|
+
}, [e.date, n]), h = e.operatorId ? t.find((I) => I.id === e.operatorId) : void 0, w = e.specialtyId ? a.find((I) => I.id === e.specialtyId) : void 0, N = e.serviceId ? i.find((I) => I.id === e.serviceId) : void 0;
|
|
1752
|
+
return /* @__PURE__ */ b(
|
|
1753
|
+
"div",
|
|
1754
|
+
{
|
|
1755
|
+
"data-component": "booking-success",
|
|
1756
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
1757
|
+
children: [
|
|
1758
|
+
/* @__PURE__ */ b(K, { variant: "success", children: [
|
|
1759
|
+
/* @__PURE__ */ s(K.Title, { as: "h3", children: l("booking.success.heading") }),
|
|
1760
|
+
/* @__PURE__ */ s(K.Description, { children: y })
|
|
1761
|
+
] }),
|
|
1762
|
+
/* @__PURE__ */ s("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ b("dl", { className: "ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:m-0", children: [
|
|
1763
|
+
w ? /* @__PURE__ */ b(W, { children: [
|
|
1764
|
+
/* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summarySpecialty") }),
|
|
1765
|
+
/* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: w.label })
|
|
1766
|
+
] }) : null,
|
|
1767
|
+
N ? /* @__PURE__ */ b(W, { children: [
|
|
1768
|
+
/* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryService") }),
|
|
1769
|
+
/* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: N.label })
|
|
1770
|
+
] }) : null,
|
|
1771
|
+
S ? /* @__PURE__ */ b(W, { children: [
|
|
1772
|
+
/* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryDate") }),
|
|
1773
|
+
/* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: S })
|
|
1774
|
+
] }) : null,
|
|
1775
|
+
/* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryTime") }),
|
|
1776
|
+
/* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: e.slot.time }),
|
|
1777
|
+
h ? /* @__PURE__ */ b(W, { children: [
|
|
1778
|
+
/* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryProvider") }),
|
|
1779
|
+
/* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: h.name })
|
|
1780
|
+
] }) : null
|
|
1781
|
+
] }) }),
|
|
1782
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
1783
|
+
/* @__PURE__ */ s(se, { intent: "secondary", size: "md", onClick: p, children: l("booking.success.bookAnother") }),
|
|
1784
|
+
u ? /* @__PURE__ */ s(se, { intent: "ghost", size: "md", onClick: c, children: l("booking.success.modifyBooking") }) : null
|
|
1785
|
+
] })
|
|
1786
|
+
]
|
|
1787
|
+
}
|
|
1788
|
+
);
|
|
1789
|
+
}
|
|
1790
|
+
function ht({ customSlot: e }) {
|
|
1791
|
+
const { t } = B();
|
|
1792
|
+
return e ? /* @__PURE__ */ s(W, { children: e }) : /* @__PURE__ */ s(
|
|
1793
|
+
tt,
|
|
1794
|
+
{
|
|
1795
|
+
variant: "no-results",
|
|
1796
|
+
title: t("booking.emptyServices.title"),
|
|
1797
|
+
description: t("booking.emptyServices.description")
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
}
|
|
1801
|
+
function Ga(e) {
|
|
1802
|
+
const {
|
|
1803
|
+
cascade: t,
|
|
1804
|
+
inputs: a,
|
|
1805
|
+
value: i,
|
|
1806
|
+
onChange: n,
|
|
1807
|
+
onSubmit: o,
|
|
1808
|
+
emptyServicesSlot: u,
|
|
1809
|
+
onboardingIncompleteSlot: p,
|
|
1810
|
+
loadingDates: c,
|
|
1811
|
+
loadingSlots: l,
|
|
1812
|
+
onDateSelect: d,
|
|
1813
|
+
onWindowChange: m,
|
|
1814
|
+
datePickerStyle: y,
|
|
1815
|
+
submitting: S,
|
|
1816
|
+
locale: h,
|
|
1817
|
+
detailsProps: w
|
|
1818
|
+
} = e, { t: N } = B();
|
|
1819
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1820
|
+
t.gates.insurance ? /* @__PURE__ */ s(
|
|
1821
|
+
ut,
|
|
1822
|
+
{
|
|
1823
|
+
value: i.insuranceType,
|
|
1824
|
+
onChange: (I) => n(st(i, I))
|
|
1825
|
+
}
|
|
1826
|
+
) : null,
|
|
1827
|
+
t.gates.specialty ? /* @__PURE__ */ s(
|
|
1828
|
+
mt,
|
|
1829
|
+
{
|
|
1830
|
+
specialties: t.filtered.specialties,
|
|
1831
|
+
value: i.specialtyId,
|
|
1832
|
+
onChange: (I) => n(it(i, I))
|
|
1833
|
+
}
|
|
1834
|
+
) : null,
|
|
1835
|
+
t.gates.service ? t.filtered.services.length === 0 ? /* @__PURE__ */ s(ht, { customSlot: u }) : /* @__PURE__ */ s(
|
|
1836
|
+
pt,
|
|
1837
|
+
{
|
|
1838
|
+
services: t.filtered.services,
|
|
1839
|
+
value: i.serviceId,
|
|
1840
|
+
onChange: (I) => n(nt(i, I))
|
|
1841
|
+
}
|
|
1842
|
+
) : null,
|
|
1843
|
+
t.gates.onboardingIncomplete ? /* @__PURE__ */ s(ft, { customSlot: p }) : null,
|
|
1844
|
+
t.gates.operator ? /* @__PURE__ */ s(
|
|
1845
|
+
gt,
|
|
1846
|
+
{
|
|
1847
|
+
operators: t.filtered.operators,
|
|
1848
|
+
value: i.operatorId,
|
|
1849
|
+
onChange: (I) => n(ot(i, I))
|
|
1850
|
+
}
|
|
1851
|
+
) : null,
|
|
1852
|
+
t.gates.date ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1853
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: N("booking.date.heading") }),
|
|
1854
|
+
a.availableDates.length === 0 && a.nextAvailableDate ? /* @__PURE__ */ s(
|
|
1855
|
+
Ke,
|
|
1856
|
+
{
|
|
1857
|
+
nextAvailableDate: a.nextAvailableDate,
|
|
1858
|
+
onJump: () => n(Ae(i, a.nextAvailableDate)),
|
|
1859
|
+
locale: h
|
|
1860
|
+
}
|
|
1861
|
+
) : lt({
|
|
1862
|
+
inputs: a,
|
|
1863
|
+
value: i,
|
|
1864
|
+
onChange: n,
|
|
1865
|
+
onDateSelect: d,
|
|
1866
|
+
onWindowChange: m,
|
|
1867
|
+
loadingDates: c,
|
|
1868
|
+
loadingSlots: l,
|
|
1869
|
+
locale: h,
|
|
1870
|
+
datePickerStyle: y
|
|
1871
|
+
})
|
|
1872
|
+
] }) : null,
|
|
1873
|
+
t.gates.slot && i.date && y === "month-calendar" ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
1874
|
+
/* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: N("booking.slot.heading") }),
|
|
1875
|
+
ct({
|
|
1876
|
+
inputs: a,
|
|
1877
|
+
value: i,
|
|
1878
|
+
onChange: n,
|
|
1879
|
+
loadingSlots: l,
|
|
1880
|
+
locale: h,
|
|
1881
|
+
datePickerStyle: y
|
|
1882
|
+
})
|
|
1883
|
+
] }) : null,
|
|
1884
|
+
t.gates.details && t.selectedSlot ? /* @__PURE__ */ s(
|
|
1885
|
+
ze,
|
|
1886
|
+
{
|
|
1887
|
+
...w,
|
|
1888
|
+
value: i.details ?? {},
|
|
1889
|
+
onChange: (I) => n({ ...i, details: I }),
|
|
1890
|
+
onSubmit: o,
|
|
1891
|
+
submitting: S,
|
|
1892
|
+
defaultPhoneCountry: e.policy.country
|
|
1893
|
+
}
|
|
1894
|
+
) : null
|
|
1895
|
+
] });
|
|
1896
|
+
}
|
|
1897
|
+
function z(e, t, a = {}) {
|
|
1898
|
+
const {
|
|
1899
|
+
cascade: i,
|
|
1900
|
+
inputs: n,
|
|
1901
|
+
value: o,
|
|
1902
|
+
onChange: u,
|
|
1903
|
+
onSubmit: p,
|
|
1904
|
+
emptyServicesSlot: c,
|
|
1905
|
+
onboardingIncompleteSlot: l,
|
|
1906
|
+
loadingDates: d,
|
|
1907
|
+
loadingSlots: m,
|
|
1908
|
+
onDateSelect: y,
|
|
1909
|
+
onWindowChange: S,
|
|
1910
|
+
datePickerStyle: h,
|
|
1911
|
+
submitting: w,
|
|
1912
|
+
locale: N,
|
|
1913
|
+
detailsProps: I,
|
|
1914
|
+
policy: k
|
|
1915
|
+
} = t;
|
|
1916
|
+
switch (e) {
|
|
1917
|
+
case 1:
|
|
1918
|
+
return /* @__PURE__ */ s(
|
|
1919
|
+
ut,
|
|
1920
|
+
{
|
|
1921
|
+
value: o.insuranceType,
|
|
1922
|
+
onChange: (v) => u(st(o, v))
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
case 2:
|
|
1926
|
+
return /* @__PURE__ */ s(
|
|
1927
|
+
mt,
|
|
1928
|
+
{
|
|
1929
|
+
specialties: i.filtered.specialties,
|
|
1930
|
+
value: o.specialtyId,
|
|
1931
|
+
onChange: (v) => u(it(o, v))
|
|
1932
|
+
}
|
|
1933
|
+
);
|
|
1934
|
+
case 3:
|
|
1935
|
+
return i.filtered.services.length === 0 ? /* @__PURE__ */ s(ht, { customSlot: c }) : i.gates.onboardingIncomplete ? /* @__PURE__ */ s(ft, { customSlot: l }) : /* @__PURE__ */ s(
|
|
1936
|
+
pt,
|
|
1937
|
+
{
|
|
1938
|
+
services: i.filtered.services,
|
|
1939
|
+
value: o.serviceId,
|
|
1940
|
+
onChange: (v) => u(nt(o, v)),
|
|
1941
|
+
compact: a.compactService
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
case 4:
|
|
1945
|
+
return /* @__PURE__ */ s(
|
|
1946
|
+
gt,
|
|
1947
|
+
{
|
|
1948
|
+
operators: i.filtered.operators,
|
|
1949
|
+
value: o.operatorId,
|
|
1950
|
+
onChange: (v) => u(ot(o, v))
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
case 5:
|
|
1954
|
+
return n.availableDates.length === 0 && n.nextAvailableDate ? /* @__PURE__ */ s(
|
|
1955
|
+
Ke,
|
|
1956
|
+
{
|
|
1957
|
+
nextAvailableDate: n.nextAvailableDate,
|
|
1958
|
+
onJump: () => u(Ae(o, n.nextAvailableDate)),
|
|
1959
|
+
locale: N
|
|
1960
|
+
}
|
|
1961
|
+
) : lt({
|
|
1962
|
+
inputs: n,
|
|
1963
|
+
value: o,
|
|
1964
|
+
onChange: u,
|
|
1965
|
+
onDateSelect: y,
|
|
1966
|
+
onWindowChange: S,
|
|
1967
|
+
loadingDates: d,
|
|
1968
|
+
loadingSlots: m,
|
|
1969
|
+
locale: N,
|
|
1970
|
+
datePickerStyle: h
|
|
1971
|
+
});
|
|
1972
|
+
case 6:
|
|
1973
|
+
return ct({
|
|
1974
|
+
inputs: n,
|
|
1975
|
+
value: o,
|
|
1976
|
+
onChange: u,
|
|
1977
|
+
loadingSlots: m,
|
|
1978
|
+
locale: N,
|
|
1979
|
+
datePickerStyle: h
|
|
1980
|
+
});
|
|
1981
|
+
case 7:
|
|
1982
|
+
return i.selectedSlot ? /* @__PURE__ */ s(
|
|
1983
|
+
ze,
|
|
1984
|
+
{
|
|
1985
|
+
...I,
|
|
1986
|
+
value: o.details ?? {},
|
|
1987
|
+
onChange: (v) => u({ ...o, details: v }),
|
|
1988
|
+
onSubmit: p,
|
|
1989
|
+
submitting: w,
|
|
1990
|
+
defaultPhoneCountry: k.country
|
|
1991
|
+
}
|
|
1992
|
+
) : null;
|
|
1993
|
+
/* c8 ignore next 2 */
|
|
1994
|
+
default:
|
|
1995
|
+
return null;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function je() {
|
|
1999
|
+
const { t: e } = B();
|
|
2000
|
+
return C(
|
|
2001
|
+
() => ({
|
|
2002
|
+
1: e("booking.insurance.heading"),
|
|
2003
|
+
2: e("booking.specialty.heading"),
|
|
2004
|
+
3: e("booking.service.heading"),
|
|
2005
|
+
4: e("booking.operator.heading"),
|
|
2006
|
+
5: e("booking.date.heading"),
|
|
2007
|
+
6: e("booking.slot.heading"),
|
|
2008
|
+
7: e("booking.details.heading")
|
|
2009
|
+
}),
|
|
2010
|
+
[e]
|
|
2011
|
+
);
|
|
2012
|
+
}
|
|
2013
|
+
function Ua(e) {
|
|
2014
|
+
const { cascade: t, value: a, activeStep: i, setActiveStep: n, datePickerStyle: o } = e, u = je(), p = C(
|
|
2015
|
+
() => o === "four-day-grid" ? t.visibleSteps.filter((d) => d !== 6) : t.visibleSteps,
|
|
2016
|
+
[t.visibleSteps, o]
|
|
2017
|
+
), c = C(
|
|
2018
|
+
() => p.map((d) => ({
|
|
2019
|
+
label: u[d],
|
|
2020
|
+
summary: vt(d, a, t),
|
|
2021
|
+
status: be(d, a) && d < t.currentStep ? "completed" : void 0,
|
|
2022
|
+
content: z(d, e, { compactService: !0 })
|
|
2023
|
+
})),
|
|
2024
|
+
[p, a, u, t, e]
|
|
2025
|
+
), l = Math.max(0, t.visibleSteps.indexOf(i));
|
|
2026
|
+
return /* @__PURE__ */ s(
|
|
2027
|
+
_t,
|
|
2028
|
+
{
|
|
2029
|
+
activeStep: l,
|
|
2030
|
+
steps: c,
|
|
2031
|
+
onStepChange: (d) => {
|
|
2032
|
+
const m = t.visibleSteps[d];
|
|
2033
|
+
m && n(m);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
function be(e, t) {
|
|
2039
|
+
switch (e) {
|
|
2040
|
+
case 1:
|
|
2041
|
+
return t.insuranceType !== void 0;
|
|
2042
|
+
case 2:
|
|
2043
|
+
return t.specialtyId !== void 0;
|
|
2044
|
+
case 3:
|
|
2045
|
+
return t.serviceId !== void 0;
|
|
2046
|
+
case 4:
|
|
2047
|
+
return t.operatorId !== void 0;
|
|
2048
|
+
case 5:
|
|
2049
|
+
return t.date !== void 0;
|
|
2050
|
+
case 6:
|
|
2051
|
+
return t.slotKey !== void 0;
|
|
2052
|
+
case 7:
|
|
2053
|
+
return !1;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
function vt(e, t, a) {
|
|
2057
|
+
var i;
|
|
2058
|
+
if (be(e, t))
|
|
2059
|
+
switch (e) {
|
|
2060
|
+
case 1:
|
|
2061
|
+
return t.insuranceType;
|
|
2062
|
+
case 2: {
|
|
2063
|
+
const n = a.filtered.specialties.find(
|
|
2064
|
+
(o) => o.id === t.specialtyId
|
|
2065
|
+
);
|
|
2066
|
+
return n == null ? void 0 : n.label;
|
|
2067
|
+
}
|
|
2068
|
+
case 3: {
|
|
2069
|
+
const n = a.filtered.services.find(
|
|
2070
|
+
(o) => o.id === t.serviceId
|
|
2071
|
+
);
|
|
2072
|
+
return n == null ? void 0 : n.label;
|
|
2073
|
+
}
|
|
2074
|
+
case 4: {
|
|
2075
|
+
const n = $e(t);
|
|
2076
|
+
if (!n) return;
|
|
2077
|
+
const o = a.filtered.operators.find((u) => u.id === n);
|
|
2078
|
+
return o == null ? void 0 : o.name;
|
|
2079
|
+
}
|
|
2080
|
+
case 5:
|
|
2081
|
+
return t.date;
|
|
2082
|
+
case 6:
|
|
2083
|
+
return (i = a.selectedSlot) == null ? void 0 : i.time;
|
|
2084
|
+
case 7:
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
function Ya(e) {
|
|
2089
|
+
const { cascade: t, value: a, setActiveStep: i } = e, { t: n } = B(), o = je(), u = t.visibleSteps.filter(
|
|
2090
|
+
(c) => c === 1 || c === 2 || c === 3 || c === 4
|
|
2091
|
+
), p = u.some(
|
|
2092
|
+
(c) => !be(c, a)
|
|
2093
|
+
);
|
|
2094
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
2095
|
+
p ? u.filter((c) => !be(c, a)).slice(0, 1).map((c) => /* @__PURE__ */ s("div", { children: z(c, e, { compactService: !0 }) }, `csf-${c}`)) : /* @__PURE__ */ s(
|
|
2096
|
+
"div",
|
|
2097
|
+
{
|
|
2098
|
+
role: "group",
|
|
2099
|
+
"aria-label": n("booking.regionLabel"),
|
|
2100
|
+
className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
2101
|
+
children: u.map((c) => {
|
|
2102
|
+
const l = vt(c, a, t);
|
|
2103
|
+
return l ? /* @__PURE__ */ b(
|
|
2104
|
+
se,
|
|
2105
|
+
{
|
|
2106
|
+
intent: "tonal",
|
|
2107
|
+
size: "sm",
|
|
2108
|
+
onClick: () => i(c),
|
|
2109
|
+
children: [
|
|
2110
|
+
o[c],
|
|
2111
|
+
": ",
|
|
2112
|
+
l
|
|
2113
|
+
]
|
|
2114
|
+
},
|
|
2115
|
+
`csc-${c}`
|
|
2116
|
+
) : null;
|
|
2117
|
+
})
|
|
2118
|
+
}
|
|
2119
|
+
),
|
|
2120
|
+
!p && t.gates.date ? (
|
|
2121
|
+
// four-day-grid embeds slots inline with the day strip — the
|
|
2122
|
+
// historic 2-col date|slot split collapses to a single column
|
|
2123
|
+
// so the picker spans the full width instead of orphaning an
|
|
2124
|
+
// empty right cell.
|
|
2125
|
+
e.datePickerStyle === "four-day-grid" ? /* @__PURE__ */ s("div", { children: z(5, e) }) : /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
|
|
2126
|
+
/* @__PURE__ */ s("div", { className: "ds:min-w-0", children: z(5, e) }),
|
|
2127
|
+
/* @__PURE__ */ s("div", { className: "ds:min-w-0", children: a.date ? z(6, e) : null })
|
|
2128
|
+
] })
|
|
2129
|
+
) : null,
|
|
2130
|
+
t.gates.details ? /* @__PURE__ */ s("div", { children: z(7, e) }) : null
|
|
2131
|
+
] });
|
|
2132
|
+
}
|
|
2133
|
+
function Ja(e) {
|
|
2134
|
+
const { cascade: t } = e, a = t.visibleSteps.filter(
|
|
2135
|
+
(i) => i === 1 || i === 2 || i === 3 || i === 4
|
|
2136
|
+
);
|
|
2137
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
2138
|
+
/* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
|
|
2139
|
+
/* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: a.map((i) => /* @__PURE__ */ s("div", { children: z(i, e, { compactService: !0 }) }, `fbf-${i}`)) }),
|
|
2140
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
2141
|
+
t.gates.date ? z(5, e) : null,
|
|
2142
|
+
t.gates.slot && e.value.date ? z(6, e) : null
|
|
2143
|
+
] })
|
|
2144
|
+
] }),
|
|
2145
|
+
t.gates.details ? z(7, e) : null
|
|
2146
|
+
] });
|
|
2147
|
+
}
|
|
2148
|
+
function Za(e) {
|
|
2149
|
+
const { cascade: t, value: a, activeStep: i, setActiveStep: n, datePickerStyle: o } = e, { t: u } = B(), p = je(), c = C(
|
|
2150
|
+
() => o === "four-day-grid" ? t.visibleSteps.filter((h) => h !== 6) : t.visibleSteps,
|
|
2151
|
+
[t.visibleSteps, o]
|
|
2152
|
+
), l = Math.max(0, c.indexOf(i)), d = c.length, m = C(
|
|
2153
|
+
() => c.map((h) => ({ label: p[h] })),
|
|
2154
|
+
[c, p]
|
|
2155
|
+
), y = l > 0, S = l < d - 1 && be(i, a);
|
|
2156
|
+
return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
2157
|
+
/* @__PURE__ */ s(Tt, { activeStep: l, steps: m }),
|
|
2158
|
+
/* @__PURE__ */ s("div", { children: z(i, e, { compactService: !0 }) }),
|
|
2159
|
+
/* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
|
|
2160
|
+
/* @__PURE__ */ s(
|
|
2161
|
+
se,
|
|
2162
|
+
{
|
|
2163
|
+
intent: "ghost",
|
|
2164
|
+
size: "md",
|
|
2165
|
+
disabled: !y,
|
|
2166
|
+
onClick: () => {
|
|
2167
|
+
const h = c[l - 1];
|
|
2168
|
+
h && n(h);
|
|
2169
|
+
},
|
|
2170
|
+
children: u("booking.actions.back")
|
|
2171
|
+
}
|
|
2172
|
+
),
|
|
2173
|
+
i < 7 ? /* @__PURE__ */ s(
|
|
2174
|
+
se,
|
|
2175
|
+
{
|
|
2176
|
+
intent: "primary",
|
|
2177
|
+
size: "md",
|
|
2178
|
+
disabled: !S,
|
|
2179
|
+
onClick: () => {
|
|
2180
|
+
const h = c[l + 1];
|
|
2181
|
+
h && n(h);
|
|
2182
|
+
},
|
|
2183
|
+
children: u("booking.actions.next")
|
|
2184
|
+
}
|
|
2185
|
+
) : null
|
|
2186
|
+
] })
|
|
2187
|
+
] });
|
|
2188
|
+
}
|
|
2189
|
+
const Wa = [], Xa = [], Qa = Qe(
|
|
2190
|
+
({
|
|
2191
|
+
variant: e = "inline-list",
|
|
2192
|
+
country: t,
|
|
2193
|
+
// No default — the cascade engine treats `undefined` as "auto-on
|
|
2194
|
+
// when `specialties` has items" so consumers who pass specialty
|
|
2195
|
+
// data without the explicit flag still get the step.
|
|
2196
|
+
useSpecialties: a,
|
|
2197
|
+
allowOperatorSelection: i = !1,
|
|
2198
|
+
lockedOperatorId: n,
|
|
2199
|
+
autoSelectSingleService: o = !1,
|
|
2200
|
+
specialties: u,
|
|
2201
|
+
services: p,
|
|
2202
|
+
operators: c,
|
|
2203
|
+
availableDates: l,
|
|
2204
|
+
availableSlots: d,
|
|
2205
|
+
nextAvailableDate: m,
|
|
2206
|
+
requireCodiceFiscale: y,
|
|
2207
|
+
requireDateOfBirth: S,
|
|
2208
|
+
requireInsuranceNumber: h,
|
|
2209
|
+
showNote: w,
|
|
2210
|
+
showReturningPatientFlag: N,
|
|
2211
|
+
privacyPolicyUrl: I,
|
|
2212
|
+
termsUrl: k,
|
|
2213
|
+
validateCodiceFiscale: v,
|
|
2214
|
+
validateInsuranceNumber: r,
|
|
2215
|
+
confirmationChannels: O,
|
|
2216
|
+
defaultConfirmationChannels: A,
|
|
2217
|
+
value: f,
|
|
2218
|
+
onChange: x,
|
|
2219
|
+
onSubmit: _,
|
|
2220
|
+
onStepChange: D,
|
|
2221
|
+
onDateSelect: U,
|
|
2222
|
+
onWindowChange: E,
|
|
2223
|
+
datePickerStyle: R = "month-calendar",
|
|
2224
|
+
loadingDates: Y,
|
|
2225
|
+
loadingSlots: T,
|
|
2226
|
+
submitting: X,
|
|
2227
|
+
submitError: H,
|
|
2228
|
+
mode: re = "live",
|
|
2229
|
+
showModifyOnSuccess: Q = !0,
|
|
2230
|
+
surface: _e = "flat",
|
|
2231
|
+
emptyServicesSlot: J,
|
|
2232
|
+
onboardingIncompleteSlot: ie,
|
|
2233
|
+
"aria-label": de,
|
|
2234
|
+
id: le,
|
|
2235
|
+
className: Te,
|
|
2236
|
+
...Be
|
|
2237
|
+
}, ye) => {
|
|
2238
|
+
const { t: ce, i18n: ke } = B(), L = e ?? "inline-list", ee = ke.language ?? "en", g = u ?? Wa, M = c ?? Xa;
|
|
2239
|
+
G(() => {
|
|
2240
|
+
const F = Ca(f, {
|
|
2241
|
+
useSpecialties: a,
|
|
2242
|
+
lockedOperatorId: n,
|
|
2243
|
+
autoSelectSingleService: o,
|
|
2244
|
+
specialties: g,
|
|
2245
|
+
services: p
|
|
2246
|
+
});
|
|
2247
|
+
(F.specialtyId !== f.specialtyId || F.operatorId !== f.operatorId || F.serviceId !== f.serviceId) && x(F);
|
|
2248
|
+
}, [
|
|
2249
|
+
n,
|
|
2250
|
+
a,
|
|
2251
|
+
o,
|
|
2252
|
+
g,
|
|
2253
|
+
p
|
|
2254
|
+
]);
|
|
2255
|
+
const P = C(
|
|
2256
|
+
() => wa({
|
|
2257
|
+
country: t,
|
|
2258
|
+
useSpecialties: a,
|
|
2259
|
+
allowOperatorSelection: i,
|
|
2260
|
+
lockedOperatorId: n,
|
|
2261
|
+
specialties: g,
|
|
2262
|
+
services: p,
|
|
2263
|
+
operators: M,
|
|
2264
|
+
availableSlots: d,
|
|
2265
|
+
value: f
|
|
2266
|
+
}),
|
|
2267
|
+
[
|
|
2268
|
+
t,
|
|
2269
|
+
a,
|
|
2270
|
+
i,
|
|
2271
|
+
n,
|
|
2272
|
+
o,
|
|
2273
|
+
g,
|
|
2274
|
+
p,
|
|
2275
|
+
M,
|
|
2276
|
+
l,
|
|
2277
|
+
d,
|
|
2278
|
+
f
|
|
2279
|
+
]
|
|
2280
|
+
), [qe, ue] = j(
|
|
2281
|
+
P.currentStep
|
|
2282
|
+
), He = ae(P.currentStep);
|
|
2283
|
+
G(() => {
|
|
2284
|
+
P.currentStep > He.current && ue(P.currentStep), He.current = P.currentStep;
|
|
2285
|
+
}, [P.currentStep]);
|
|
2286
|
+
const [me, pe] = j("idle"), [Oe, Pe] = j(null), Ge = q(
|
|
2287
|
+
async (F) => {
|
|
2288
|
+
if (!P.selectedSlot) return;
|
|
2289
|
+
const Re = {
|
|
2290
|
+
slot: P.selectedSlot,
|
|
2291
|
+
value: {
|
|
2292
|
+
...f,
|
|
2293
|
+
details: F,
|
|
2294
|
+
operatorId: $e(f) ?? f.operatorId
|
|
2295
|
+
},
|
|
2296
|
+
details: F
|
|
2297
|
+
};
|
|
2298
|
+
pe("submitting");
|
|
2299
|
+
try {
|
|
2300
|
+
await _(Re), Pe({
|
|
2301
|
+
slot: P.selectedSlot,
|
|
2302
|
+
details: F,
|
|
2303
|
+
specialtyId: f.specialtyId,
|
|
2304
|
+
serviceId: f.serviceId,
|
|
2305
|
+
insuranceType: f.insuranceType,
|
|
2306
|
+
operatorId: $e(f),
|
|
2307
|
+
date: f.date
|
|
2308
|
+
}), pe("success");
|
|
2309
|
+
} catch {
|
|
2310
|
+
throw pe("error"), new Error("Booking submission failed");
|
|
2311
|
+
}
|
|
2312
|
+
},
|
|
2313
|
+
[P.selectedSlot, _, f]
|
|
2314
|
+
), ge = ae(null);
|
|
2315
|
+
xt(ye, () => ge.current, []);
|
|
2316
|
+
const fe = me === "success" ? 8 : P.currentStep, Ue = ae(null);
|
|
2317
|
+
G(() => {
|
|
2318
|
+
if (fe !== Ue.current && (Ue.current = fe, D == null || D(fe), fe === 8 && ge.current))
|
|
2319
|
+
try {
|
|
2320
|
+
ge.current.scrollIntoView({
|
|
2321
|
+
behavior: "smooth",
|
|
2322
|
+
block: "start"
|
|
2323
|
+
});
|
|
2324
|
+
} catch {
|
|
2325
|
+
ge.current.scrollIntoView();
|
|
2326
|
+
}
|
|
2327
|
+
}, [fe, D]);
|
|
2328
|
+
const Ee = C(
|
|
2329
|
+
() => ({
|
|
2330
|
+
getVariant: () => L,
|
|
2331
|
+
reset: () => {
|
|
2332
|
+
x({}), Pe(null), pe("idle"), ue(1);
|
|
2333
|
+
},
|
|
2334
|
+
goToStep: (F) => {
|
|
2335
|
+
ue(F);
|
|
2336
|
+
}
|
|
2337
|
+
}),
|
|
2338
|
+
[L, x]
|
|
2339
|
+
);
|
|
2340
|
+
Nt(ba, Ee, le);
|
|
2341
|
+
const bt = de ?? ce("booking.regionLabel"), yt = C(() => me !== "success" || !Oe ? null : /* @__PURE__ */ s(
|
|
2342
|
+
Ha,
|
|
2343
|
+
{
|
|
2344
|
+
snapshot: Oe,
|
|
2345
|
+
operators: M,
|
|
2346
|
+
specialties: g,
|
|
2347
|
+
services: p,
|
|
2348
|
+
locale: ee,
|
|
2349
|
+
mode: re,
|
|
2350
|
+
showModify: Q,
|
|
2351
|
+
onReset: () => Ee.reset(),
|
|
2352
|
+
onModify: () => {
|
|
2353
|
+
Pe(null), pe("idle"), ue(7);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
), [
|
|
2357
|
+
me,
|
|
2358
|
+
Oe,
|
|
2359
|
+
M,
|
|
2360
|
+
g,
|
|
2361
|
+
p,
|
|
2362
|
+
ee,
|
|
2363
|
+
re,
|
|
2364
|
+
Q,
|
|
2365
|
+
Ee
|
|
2366
|
+
]), kt = C(() => {
|
|
2367
|
+
if (me === "success") return null;
|
|
2368
|
+
const F = L === "accordion" ? Ua : L === "calendar" ? Ya : L === "flexible" ? Ja : L === "progress" ? Za : Ga, Re = {
|
|
2369
|
+
cascade: P,
|
|
2370
|
+
inputs: {
|
|
2371
|
+
specialties: g,
|
|
2372
|
+
services: p,
|
|
2373
|
+
operators: M,
|
|
2374
|
+
availableDates: l,
|
|
2375
|
+
availableSlots: d,
|
|
2376
|
+
nextAvailableDate: m
|
|
2377
|
+
},
|
|
2378
|
+
value: f,
|
|
2379
|
+
onChange: x,
|
|
2380
|
+
onSubmit: Ge,
|
|
2381
|
+
policy: { country: t, lockedOperatorId: n },
|
|
2382
|
+
detailsProps: {
|
|
2383
|
+
requireCodiceFiscale: y,
|
|
2384
|
+
requireDateOfBirth: S,
|
|
2385
|
+
requireInsuranceNumber: h,
|
|
2386
|
+
insuranceType: f.insuranceType,
|
|
2387
|
+
showNote: w,
|
|
2388
|
+
showReturningPatientFlag: N,
|
|
2389
|
+
privacyPolicyUrl: I,
|
|
2390
|
+
termsUrl: k,
|
|
2391
|
+
validateCodiceFiscale: v,
|
|
2392
|
+
validateInsuranceNumber: r,
|
|
2393
|
+
confirmationChannels: O,
|
|
2394
|
+
defaultConfirmationChannels: A,
|
|
2395
|
+
submitError: H
|
|
2396
|
+
},
|
|
2397
|
+
emptyServicesSlot: J,
|
|
2398
|
+
onboardingIncompleteSlot: ie,
|
|
2399
|
+
loadingDates: Y,
|
|
2400
|
+
loadingSlots: T,
|
|
2401
|
+
onDateSelect: U,
|
|
2402
|
+
onWindowChange: E,
|
|
2403
|
+
datePickerStyle: R,
|
|
2404
|
+
submitting: X,
|
|
2405
|
+
locale: ee,
|
|
2406
|
+
activeStep: qe,
|
|
2407
|
+
setActiveStep: ue
|
|
2408
|
+
};
|
|
2409
|
+
return /* @__PURE__ */ s(F, { ...Re });
|
|
2410
|
+
}, [
|
|
2411
|
+
me,
|
|
2412
|
+
L,
|
|
2413
|
+
P,
|
|
2414
|
+
g,
|
|
2415
|
+
p,
|
|
2416
|
+
M,
|
|
2417
|
+
l,
|
|
2418
|
+
d,
|
|
2419
|
+
m,
|
|
2420
|
+
f,
|
|
2421
|
+
x,
|
|
2422
|
+
Ge,
|
|
2423
|
+
t,
|
|
2424
|
+
n,
|
|
2425
|
+
y,
|
|
2426
|
+
S,
|
|
2427
|
+
h,
|
|
2428
|
+
H,
|
|
2429
|
+
w,
|
|
2430
|
+
N,
|
|
2431
|
+
I,
|
|
2432
|
+
k,
|
|
2433
|
+
v,
|
|
2434
|
+
r,
|
|
2435
|
+
O,
|
|
2436
|
+
A,
|
|
2437
|
+
J,
|
|
2438
|
+
ie,
|
|
2439
|
+
Y,
|
|
2440
|
+
T,
|
|
2441
|
+
U,
|
|
2442
|
+
E,
|
|
2443
|
+
R,
|
|
2444
|
+
X,
|
|
2445
|
+
ee,
|
|
2446
|
+
qe
|
|
2447
|
+
]);
|
|
2448
|
+
return /* @__PURE__ */ b(
|
|
2449
|
+
"div",
|
|
2450
|
+
{
|
|
2451
|
+
ref: ge,
|
|
2452
|
+
role: "region",
|
|
2453
|
+
"aria-label": bt,
|
|
2454
|
+
id: le,
|
|
2455
|
+
"data-component": "booking",
|
|
2456
|
+
"data-component-id": le,
|
|
2457
|
+
"data-variant": L,
|
|
2458
|
+
className: Ta({
|
|
2459
|
+
variant: L,
|
|
2460
|
+
surface: _e,
|
|
2461
|
+
className: Te
|
|
2462
|
+
}),
|
|
2463
|
+
...Be,
|
|
2464
|
+
children: [
|
|
2465
|
+
/* @__PURE__ */ b(
|
|
2466
|
+
"div",
|
|
2467
|
+
{
|
|
2468
|
+
className: [
|
|
2469
|
+
"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
|
|
2470
|
+
"ds:rounded-[var(--radius-md)]",
|
|
2471
|
+
"ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
|
|
2472
|
+
"ds:bg-[image:var(--gradient-hero-brand)]",
|
|
2473
|
+
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
2474
|
+
"ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
|
|
2475
|
+
].join(" "),
|
|
2476
|
+
children: [
|
|
2477
|
+
/* @__PURE__ */ s("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: ce("booking.regionLabel") }),
|
|
2478
|
+
/* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:m-0", children: ce("booking.headingSubtitle") })
|
|
2479
|
+
]
|
|
2480
|
+
}
|
|
2481
|
+
),
|
|
2482
|
+
yt ?? kt
|
|
2483
|
+
]
|
|
2484
|
+
}
|
|
2485
|
+
);
|
|
2486
|
+
}
|
|
2487
|
+
);
|
|
2488
|
+
Qa.displayName = "Booking";
|
|
2489
|
+
export {
|
|
2490
|
+
Qa as B,
|
|
2491
|
+
Fe as C,
|
|
2492
|
+
ve as O,
|
|
2493
|
+
ba as b
|
|
2494
|
+
};
|
|
2495
|
+
//# sourceMappingURL=booking-Db4BQ9eH.js.map
|