@chronowl/widget 1.0.0
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/LICENSE +21 -0
- package/dist/ChronOwlWidget.d.ts +22 -0
- package/dist/components/atoms/Badge.d.ts +10 -0
- package/dist/components/atoms/Button.d.ts +10 -0
- package/dist/components/atoms/Card.d.ts +9 -0
- package/dist/components/atoms/Divider.d.ts +9 -0
- package/dist/components/atoms/Icon.d.ts +10 -0
- package/dist/components/atoms/Input.d.ts +10 -0
- package/dist/components/atoms/Label.d.ts +9 -0
- package/dist/components/atoms/Spinner.d.ts +9 -0
- package/dist/components/atoms/Typography.d.ts +10 -0
- package/dist/components/atoms/index.d.ts +9 -0
- package/dist/components/hooks/useAvailability.d.ts +11 -0
- package/dist/components/hooks/useBooking.d.ts +12 -0
- package/dist/components/hooks/useForm.d.ts +19 -0
- package/dist/components/hooks/useServices.d.ts +10 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/molecules/AvailabilitySlot.d.ts +9 -0
- package/dist/components/molecules/ButtonGroup.d.ts +9 -0
- package/dist/components/molecules/ConfirmationBadge.d.ts +9 -0
- package/dist/components/molecules/DateSelector.d.ts +10 -0
- package/dist/components/molecules/EmptyState.d.ts +9 -0
- package/dist/components/molecules/FormGroup.d.ts +10 -0
- package/dist/components/molecules/InputWithIcon.d.ts +9 -0
- package/dist/components/molecules/LoadingState.d.ts +9 -0
- package/dist/components/molecules/ServiceCard.d.ts +10 -0
- package/dist/components/molecules/TimeSelector.d.ts +9 -0
- package/dist/components/molecules/index.d.ts +10 -0
- package/dist/components/organisms/AvailabilityGrid.d.ts +9 -0
- package/dist/components/organisms/BookingForm.d.ts +10 -0
- package/dist/components/organisms/Calendar.d.ts +10 -0
- package/dist/components/organisms/ConfirmationModal.d.ts +10 -0
- package/dist/components/organisms/ErrorModal.d.ts +9 -0
- package/dist/components/organisms/Footer.d.ts +9 -0
- package/dist/components/organisms/Header.d.ts +10 -0
- package/dist/components/organisms/ServiceList.d.ts +9 -0
- package/dist/components/organisms/Stepper.d.ts +10 -0
- package/dist/components/organisms/TimeSlotSelector.d.ts +10 -0
- package/dist/components/organisms/index.d.ts +10 -0
- package/dist/components/pages/BookingPage.d.ts +17 -0
- package/dist/components/pages/ConfirmationPage.d.ts +16 -0
- package/dist/components/pages/ErrorPage.d.ts +14 -0
- package/dist/components/pages/index.d.ts +3 -0
- package/dist/components/templates/BookingPageTemplate.d.ts +11 -0
- package/dist/components/templates/CenteredLayout.d.ts +9 -0
- package/dist/components/templates/MainLayout.d.ts +11 -0
- package/dist/components/templates/index.d.ts +3 -0
- package/dist/constants/api.d.ts +14 -0
- package/dist/constants/design.d.ts +56 -0
- package/dist/favicon.svg +21 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +2053 -0
- package/dist/style.css +1 -0
- package/dist/tokens/borders.d.ts +14 -0
- package/dist/tokens/colors.d.ts +56 -0
- package/dist/tokens/elevation.d.ts +15 -0
- package/dist/tokens/index.d.ts +12 -0
- package/dist/tokens/motion.d.ts +38 -0
- package/dist/tokens/spacing.d.ts +28 -0
- package/dist/tokens/typography.d.ts +107 -0
- package/dist/types/api.d.ts +43 -0
- package/dist/types/booking.d.ts +50 -0
- package/dist/types/components.d.ts +242 -0
- package/dist/utils/api.d.ts +10 -0
- package/dist/utils/helpers.d.ts +3 -0
- package/dist/utils/validators.d.ts +6 -0
- package/package.json +55 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2053 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as U, useState as p, useMemo as J, useId as he, useRef as ee, useEffect as I, useCallback as N } from "react";
|
|
3
|
+
const fe = {
|
|
4
|
+
"display-lg": "text-display-lg",
|
|
5
|
+
"display-md": "text-display-md",
|
|
6
|
+
"display-sm": "text-display-sm",
|
|
7
|
+
"headline-lg": "text-headline-lg",
|
|
8
|
+
"headline-md": "text-headline-md",
|
|
9
|
+
"headline-sm": "text-headline-sm",
|
|
10
|
+
"title-lg": "text-title-lg",
|
|
11
|
+
"title-md": "text-title-md",
|
|
12
|
+
"title-sm": "text-title-sm",
|
|
13
|
+
"body-lg": "text-body-lg",
|
|
14
|
+
"body-md": "text-body-md",
|
|
15
|
+
"body-sm": "text-body-sm",
|
|
16
|
+
"label-lg": "text-label-lg",
|
|
17
|
+
"label-md": "text-label-md",
|
|
18
|
+
"label-sm": "text-label-sm"
|
|
19
|
+
}, ve = {
|
|
20
|
+
"display-lg": "h1",
|
|
21
|
+
"display-md": "h1",
|
|
22
|
+
"display-sm": "h2",
|
|
23
|
+
"headline-lg": "h2",
|
|
24
|
+
"headline-md": "h3",
|
|
25
|
+
"headline-sm": "h4",
|
|
26
|
+
"title-lg": "h5",
|
|
27
|
+
"title-md": "h6",
|
|
28
|
+
"title-sm": "h6",
|
|
29
|
+
"body-lg": "p",
|
|
30
|
+
"body-md": "p",
|
|
31
|
+
"body-sm": "p",
|
|
32
|
+
"label-lg": "span",
|
|
33
|
+
"label-md": "span",
|
|
34
|
+
"label-sm": "small"
|
|
35
|
+
}, pe = {
|
|
36
|
+
left: "text-left",
|
|
37
|
+
center: "text-center",
|
|
38
|
+
right: "text-right"
|
|
39
|
+
};
|
|
40
|
+
function d({
|
|
41
|
+
variant: r = "body-md",
|
|
42
|
+
as: a,
|
|
43
|
+
color: n,
|
|
44
|
+
truncate: t = !1,
|
|
45
|
+
align: i,
|
|
46
|
+
children: l,
|
|
47
|
+
className: o = "",
|
|
48
|
+
...c
|
|
49
|
+
}) {
|
|
50
|
+
const u = a || ve[r];
|
|
51
|
+
return /* @__PURE__ */ e(
|
|
52
|
+
u,
|
|
53
|
+
{
|
|
54
|
+
className: [
|
|
55
|
+
"font-sans",
|
|
56
|
+
fe[r],
|
|
57
|
+
i ? pe[i] : "",
|
|
58
|
+
t ? "truncate" : "",
|
|
59
|
+
o
|
|
60
|
+
].filter(Boolean).join(" "),
|
|
61
|
+
style: n ? { color: n } : void 0,
|
|
62
|
+
...c,
|
|
63
|
+
children: l
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const ge = {
|
|
68
|
+
sm: "h-8 px-3 text-label-md min-w-[44px]",
|
|
69
|
+
md: "h-10 px-5 text-label-lg min-w-[44px]",
|
|
70
|
+
lg: "h-12 px-6 text-label-lg min-w-[44px]"
|
|
71
|
+
}, be = {
|
|
72
|
+
filled: {
|
|
73
|
+
primary: "bg-primary text-primary-on hover:bg-tertiary active:bg-tertiary shadow-elevation-1 hover:shadow-elevation-2",
|
|
74
|
+
secondary: "bg-secondary text-secondary-on hover:bg-secondary-container active:bg-secondary-container shadow-elevation-1",
|
|
75
|
+
error: "bg-error text-error-on hover:bg-red-800 active:bg-red-900 shadow-elevation-1",
|
|
76
|
+
success: "bg-success text-success-on hover:bg-green-700 active:bg-green-800 shadow-elevation-1",
|
|
77
|
+
warning: "bg-warning text-warning-on hover:bg-yellow-600 active:bg-yellow-700 shadow-elevation-1"
|
|
78
|
+
},
|
|
79
|
+
tonal: {
|
|
80
|
+
primary: "bg-primary-container text-primary-on-container hover:bg-secondary-container",
|
|
81
|
+
secondary: "bg-secondary-container text-secondary-on-container hover:bg-secondary",
|
|
82
|
+
error: "bg-error-container text-error-on-container hover:bg-red-200",
|
|
83
|
+
success: "bg-success-container text-success-on-container hover:bg-green-200",
|
|
84
|
+
warning: "bg-warning-container text-warning-on-container hover:bg-yellow-200"
|
|
85
|
+
},
|
|
86
|
+
outlined: {
|
|
87
|
+
primary: "border border-primary text-primary hover:bg-primary-container",
|
|
88
|
+
secondary: "border border-neutral-variant text-neutral hover:bg-surface-variant",
|
|
89
|
+
error: "border border-error text-error hover:bg-error-container",
|
|
90
|
+
success: "border border-success text-success hover:bg-success-container",
|
|
91
|
+
warning: "border border-warning text-warning hover:bg-warning-container"
|
|
92
|
+
},
|
|
93
|
+
text: {
|
|
94
|
+
primary: "text-primary hover:bg-primary-container",
|
|
95
|
+
secondary: "text-neutral hover:bg-surface-variant",
|
|
96
|
+
error: "text-error hover:bg-error-container",
|
|
97
|
+
success: "text-success hover:bg-success-container",
|
|
98
|
+
warning: "text-warning hover:bg-warning-container"
|
|
99
|
+
}
|
|
100
|
+
}, S = U(
|
|
101
|
+
({
|
|
102
|
+
variant: r = "filled",
|
|
103
|
+
color: a = "primary",
|
|
104
|
+
size: n = "md",
|
|
105
|
+
fullWidth: t = !1,
|
|
106
|
+
loading: i = !1,
|
|
107
|
+
icon: l,
|
|
108
|
+
iconPosition: o = "start",
|
|
109
|
+
disabled: c,
|
|
110
|
+
children: u,
|
|
111
|
+
className: f = "",
|
|
112
|
+
...y
|
|
113
|
+
}, m) => {
|
|
114
|
+
var D;
|
|
115
|
+
const b = c || i, k = "inline-flex items-center justify-center gap-2 font-sans font-bold rounded-full transition-all duration-medium-1 ease-standard focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary select-none cursor-pointer", z = b ? "opacity-40 pointer-events-none cursor-not-allowed" : "", g = t ? "w-full" : "", j = [
|
|
116
|
+
k,
|
|
117
|
+
ge[n],
|
|
118
|
+
((D = be[r]) == null ? void 0 : D[a]) ?? "",
|
|
119
|
+
z,
|
|
120
|
+
g,
|
|
121
|
+
f
|
|
122
|
+
].filter(Boolean).join(" ");
|
|
123
|
+
return /* @__PURE__ */ e("button", { ref: m, className: j, disabled: b, ...y, children: i ? /* @__PURE__ */ s(
|
|
124
|
+
"svg",
|
|
125
|
+
{
|
|
126
|
+
className: "animate-spin h-4 w-4",
|
|
127
|
+
viewBox: "0 0 24 24",
|
|
128
|
+
fill: "none",
|
|
129
|
+
"aria-hidden": "true",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
"circle",
|
|
133
|
+
{
|
|
134
|
+
className: "opacity-25",
|
|
135
|
+
cx: "12",
|
|
136
|
+
cy: "12",
|
|
137
|
+
r: "10",
|
|
138
|
+
stroke: "currentColor",
|
|
139
|
+
strokeWidth: "4"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ e(
|
|
143
|
+
"path",
|
|
144
|
+
{
|
|
145
|
+
className: "opacity-75",
|
|
146
|
+
fill: "currentColor",
|
|
147
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
) : /* @__PURE__ */ s(q, { children: [
|
|
153
|
+
l && o === "start" && /* @__PURE__ */ e("span", { className: "inline-flex shrink-0", children: l }),
|
|
154
|
+
u && /* @__PURE__ */ e("span", { children: u }),
|
|
155
|
+
l && o === "end" && /* @__PURE__ */ e("span", { className: "inline-flex shrink-0", children: l })
|
|
156
|
+
] }) });
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
S.displayName = "Button";
|
|
160
|
+
const xe = {
|
|
161
|
+
sm: 16,
|
|
162
|
+
md: 20,
|
|
163
|
+
lg: 24
|
|
164
|
+
}, ye = {
|
|
165
|
+
calendar: "M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z",
|
|
166
|
+
clock: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z",
|
|
167
|
+
check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
168
|
+
close: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",
|
|
169
|
+
"chevron-left": "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z",
|
|
170
|
+
"chevron-right": "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z",
|
|
171
|
+
"chevron-down": "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",
|
|
172
|
+
search: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",
|
|
173
|
+
user: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",
|
|
174
|
+
mail: "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",
|
|
175
|
+
phone: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",
|
|
176
|
+
notes: "M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z",
|
|
177
|
+
alert: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",
|
|
178
|
+
info: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",
|
|
179
|
+
star: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",
|
|
180
|
+
location: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",
|
|
181
|
+
edit: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z",
|
|
182
|
+
trash: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",
|
|
183
|
+
"arrow-left": "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",
|
|
184
|
+
"arrow-right": "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z",
|
|
185
|
+
spinner: "M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z",
|
|
186
|
+
owl: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-1-3h6l-1 3H10zm5-5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-6 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm3-5c-2.76 0-5 1.12-5 2.5h10C17 8.12 14.76 7 12 7z"
|
|
187
|
+
};
|
|
188
|
+
function v({ name: r, size: a = "md", color: n, className: t = "", ...i }) {
|
|
189
|
+
const l = xe[a], o = ye[r];
|
|
190
|
+
return /* @__PURE__ */ e(
|
|
191
|
+
"svg",
|
|
192
|
+
{
|
|
193
|
+
width: l,
|
|
194
|
+
height: l,
|
|
195
|
+
viewBox: "0 0 24 24",
|
|
196
|
+
fill: n || "currentColor",
|
|
197
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
className: t,
|
|
200
|
+
...i,
|
|
201
|
+
children: /* @__PURE__ */ e("path", { d: o })
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
function V({ title: r = "ChronOwl", subtitle: a, onBack: n, actions: t }) {
|
|
206
|
+
return /* @__PURE__ */ s("header", { className: "flex items-center gap-3 px-4 py-3 bg-surface border-b border-neutral-variant/30", children: [
|
|
207
|
+
n && /* @__PURE__ */ e(
|
|
208
|
+
S,
|
|
209
|
+
{
|
|
210
|
+
variant: "text",
|
|
211
|
+
size: "sm",
|
|
212
|
+
onClick: n,
|
|
213
|
+
"aria-label": "Volver",
|
|
214
|
+
className: "shrink-0 -ml-2",
|
|
215
|
+
children: /* @__PURE__ */ e(v, { name: "arrow-left", size: "md" })
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
219
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 rounded-full bg-primary flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(v, { name: "owl", size: "sm", color: "#FFFFFF" }) }),
|
|
220
|
+
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
221
|
+
/* @__PURE__ */ e(d, { variant: "title-md", as: "h1", truncate: !0, className: "text-surface-on", children: r }),
|
|
222
|
+
a && /* @__PURE__ */ e(d, { variant: "body-sm", as: "p", truncate: !0, className: "text-surface-on-variant", children: a })
|
|
223
|
+
] })
|
|
224
|
+
] }),
|
|
225
|
+
t && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 shrink-0", children: t })
|
|
226
|
+
] });
|
|
227
|
+
}
|
|
228
|
+
function Ne({ steps: r, currentStep: a, onStepClick: n }) {
|
|
229
|
+
return /* @__PURE__ */ e("nav", { "aria-label": "Progreso de reserva", className: "px-4 py-3", children: /* @__PURE__ */ e("ol", { className: "flex items-center w-full", children: r.map((t, i) => {
|
|
230
|
+
const l = i < a, o = i === a, c = n && l;
|
|
231
|
+
return /* @__PURE__ */ s(
|
|
232
|
+
"li",
|
|
233
|
+
{
|
|
234
|
+
className: [
|
|
235
|
+
"flex items-center",
|
|
236
|
+
i < r.length - 1 ? "flex-1" : ""
|
|
237
|
+
].join(" "),
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ s(
|
|
240
|
+
"button",
|
|
241
|
+
{
|
|
242
|
+
type: "button",
|
|
243
|
+
disabled: !c,
|
|
244
|
+
onClick: () => c && n(i),
|
|
245
|
+
"aria-current": o ? "step" : void 0,
|
|
246
|
+
className: [
|
|
247
|
+
"flex items-center gap-2 group",
|
|
248
|
+
c ? "cursor-pointer" : "cursor-default",
|
|
249
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary rounded"
|
|
250
|
+
].join(" "),
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ e(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
className: [
|
|
256
|
+
"flex items-center justify-center w-7 h-7 rounded-full text-label-sm font-bold shrink-0",
|
|
257
|
+
"transition-all duration-medium-1 ease-standard",
|
|
258
|
+
l ? "bg-primary text-primary-on" : o ? "bg-primary text-primary-on ring-2 ring-primary/30 ring-offset-2" : "bg-surface-variant text-surface-on-variant"
|
|
259
|
+
].join(" "),
|
|
260
|
+
children: l ? "✓" : i + 1
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ e(
|
|
264
|
+
d,
|
|
265
|
+
{
|
|
266
|
+
variant: "label-md",
|
|
267
|
+
as: "span",
|
|
268
|
+
className: [
|
|
269
|
+
"hidden sm:inline",
|
|
270
|
+
o ? "text-primary font-bold" : l ? "text-surface-on" : "text-surface-on-variant"
|
|
271
|
+
].join(" "),
|
|
272
|
+
children: t
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
i < r.length - 1 && /* @__PURE__ */ e(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
className: [
|
|
282
|
+
"flex-1 h-0.5 mx-2",
|
|
283
|
+
"transition-colors duration-medium-1 ease-standard",
|
|
284
|
+
l ? "bg-primary" : "bg-neutral-variant/40"
|
|
285
|
+
].join(" ")
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
t
|
|
291
|
+
);
|
|
292
|
+
}) }) });
|
|
293
|
+
}
|
|
294
|
+
function _({ companyName: r, poweredBy: a = !0 }) {
|
|
295
|
+
return /* @__PURE__ */ e("footer", { className: "px-4 py-3 border-t border-neutral-variant/30 bg-surface", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
296
|
+
r && /* @__PURE__ */ s(d, { variant: "body-sm", className: "text-surface-on-variant", children: [
|
|
297
|
+
"© ",
|
|
298
|
+
r
|
|
299
|
+
] }),
|
|
300
|
+
a && /* @__PURE__ */ s("div", { className: "flex items-center gap-1 ml-auto", children: [
|
|
301
|
+
/* @__PURE__ */ e(v, { name: "owl", size: "sm", color: "#7F8C8D" }),
|
|
302
|
+
/* @__PURE__ */ e(d, { variant: "label-sm", className: "text-surface-on-variant", children: "Powered by ChronOwl" })
|
|
303
|
+
] })
|
|
304
|
+
] }) });
|
|
305
|
+
}
|
|
306
|
+
function we({
|
|
307
|
+
steps: r,
|
|
308
|
+
currentStep: a,
|
|
309
|
+
onStepClick: n,
|
|
310
|
+
onBack: t,
|
|
311
|
+
title: i = "ChronOwl",
|
|
312
|
+
children: l,
|
|
313
|
+
footer: o
|
|
314
|
+
}) {
|
|
315
|
+
return /* @__PURE__ */ s("div", { className: "chronowl-widget flex flex-col w-full max-w-[480px] mx-auto min-h-[400px] max-h-[90vh] bg-surface rounded-xl shadow-elevation-3 overflow-hidden font-sans", children: [
|
|
316
|
+
/* @__PURE__ */ s("div", { className: "shrink-0", children: [
|
|
317
|
+
/* @__PURE__ */ e(
|
|
318
|
+
V,
|
|
319
|
+
{
|
|
320
|
+
title: i,
|
|
321
|
+
subtitle: "Reserva tu cita",
|
|
322
|
+
onBack: a > 0 ? t : void 0
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ e(Ne, { steps: r, currentStep: a, onStepClick: n })
|
|
326
|
+
] }),
|
|
327
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-y-auto px-4 py-4", children: l }),
|
|
328
|
+
/* @__PURE__ */ e("div", { className: "shrink-0", children: o || /* @__PURE__ */ e(_, { poweredBy: !0 }) })
|
|
329
|
+
] });
|
|
330
|
+
}
|
|
331
|
+
const Se = {
|
|
332
|
+
0: "shadow-elevation-0",
|
|
333
|
+
1: "shadow-elevation-1",
|
|
334
|
+
2: "shadow-elevation-2",
|
|
335
|
+
3: "shadow-elevation-3",
|
|
336
|
+
4: "shadow-elevation-4",
|
|
337
|
+
5: "shadow-elevation-5"
|
|
338
|
+
}, Ce = {
|
|
339
|
+
sm: "p-3",
|
|
340
|
+
md: "p-4",
|
|
341
|
+
lg: "p-6"
|
|
342
|
+
};
|
|
343
|
+
function ze({
|
|
344
|
+
elevation: r = 1,
|
|
345
|
+
outlined: a = !1,
|
|
346
|
+
padding: n = "md",
|
|
347
|
+
children: t,
|
|
348
|
+
className: i = "",
|
|
349
|
+
...l
|
|
350
|
+
}) {
|
|
351
|
+
return /* @__PURE__ */ e(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
className: [
|
|
355
|
+
"bg-surface rounded-md font-sans",
|
|
356
|
+
"transition-shadow duration-medium-1 ease-standard",
|
|
357
|
+
a ? "border border-neutral-variant" : Se[r],
|
|
358
|
+
Ce[n],
|
|
359
|
+
i
|
|
360
|
+
].filter(Boolean).join(" "),
|
|
361
|
+
...l,
|
|
362
|
+
children: t
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
function Fe({ service: r, selected: a = !1, onSelect: n }) {
|
|
367
|
+
return /* @__PURE__ */ e(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: () => n(r),
|
|
372
|
+
"aria-pressed": a,
|
|
373
|
+
className: "w-full text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary rounded-md",
|
|
374
|
+
children: /* @__PURE__ */ e(
|
|
375
|
+
ze,
|
|
376
|
+
{
|
|
377
|
+
elevation: a ? 2 : 1,
|
|
378
|
+
className: [
|
|
379
|
+
"transition-all duration-medium-1 ease-standard cursor-pointer",
|
|
380
|
+
"hover:shadow-elevation-2",
|
|
381
|
+
a ? "ring-2 ring-primary bg-primary-container" : "hover:bg-surface-variant"
|
|
382
|
+
].join(" "),
|
|
383
|
+
children: /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-3", children: [
|
|
384
|
+
/* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
|
|
385
|
+
/* @__PURE__ */ e(
|
|
386
|
+
d,
|
|
387
|
+
{
|
|
388
|
+
variant: "title-sm",
|
|
389
|
+
className: a ? "text-primary-on-container" : "text-surface-on",
|
|
390
|
+
children: r.name
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
/* @__PURE__ */ e(
|
|
394
|
+
d,
|
|
395
|
+
{
|
|
396
|
+
variant: "body-sm",
|
|
397
|
+
className: [
|
|
398
|
+
"mt-1",
|
|
399
|
+
a ? "text-primary-on-container/70" : "text-surface-on-variant"
|
|
400
|
+
].join(" "),
|
|
401
|
+
truncate: !0,
|
|
402
|
+
children: r.description
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3 mt-2", children: [
|
|
406
|
+
/* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1 text-body-sm text-surface-on-variant", children: [
|
|
407
|
+
/* @__PURE__ */ e(v, { name: "clock", size: "sm" }),
|
|
408
|
+
r.duration,
|
|
409
|
+
" min"
|
|
410
|
+
] }),
|
|
411
|
+
r.category && /* @__PURE__ */ e("span", { className: "text-body-sm text-surface-on-variant", children: r.category })
|
|
412
|
+
] })
|
|
413
|
+
] }),
|
|
414
|
+
/* @__PURE__ */ s("div", { className: "text-right shrink-0", children: [
|
|
415
|
+
/* @__PURE__ */ s(d, { variant: "title-md", className: "text-primary", children: [
|
|
416
|
+
r.currency,
|
|
417
|
+
r.price
|
|
418
|
+
] }),
|
|
419
|
+
a && /* @__PURE__ */ e("span", { className: "inline-flex mt-1", children: /* @__PURE__ */ e(v, { name: "check", size: "sm", color: "#2C3E50" }) })
|
|
420
|
+
] })
|
|
421
|
+
] })
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
const ke = {
|
|
428
|
+
sm: "h-4 w-4 border-2",
|
|
429
|
+
md: "h-6 w-6 border-2",
|
|
430
|
+
lg: "h-10 w-10 border-3"
|
|
431
|
+
};
|
|
432
|
+
function re({ size: r = "md", color: a, className: n = "", ...t }) {
|
|
433
|
+
return /* @__PURE__ */ e(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
role: "progressbar",
|
|
437
|
+
"aria-label": "Cargando",
|
|
438
|
+
className: [
|
|
439
|
+
"inline-block rounded-full border-solid border-current border-r-transparent animate-spin",
|
|
440
|
+
ke[r],
|
|
441
|
+
n
|
|
442
|
+
].filter(Boolean).join(" "),
|
|
443
|
+
style: a ? { borderColor: a, borderRightColor: "transparent" } : void 0,
|
|
444
|
+
...t
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
function K({ message: r = "Cargando...", size: a = "md" }) {
|
|
449
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-12 gap-4", children: [
|
|
450
|
+
/* @__PURE__ */ e(re, { size: a }),
|
|
451
|
+
/* @__PURE__ */ e(d, { variant: "body-md", className: "text-surface-on-variant", children: r })
|
|
452
|
+
] });
|
|
453
|
+
}
|
|
454
|
+
function ae({ icon: r = "calendar", title: a, description: n, action: t }) {
|
|
455
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center", children: [
|
|
456
|
+
/* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-surface-variant flex items-center justify-center mb-4", children: /* @__PURE__ */ e(v, { name: r, size: "lg", color: "#7F8C8D" }) }),
|
|
457
|
+
/* @__PURE__ */ e(d, { variant: "title-md", className: "text-surface-on mb-2", children: a }),
|
|
458
|
+
n && /* @__PURE__ */ e(d, { variant: "body-md", className: "text-surface-on-variant mb-6 max-w-xs", children: n }),
|
|
459
|
+
t && /* @__PURE__ */ e(S, { variant: "tonal", onClick: t.onClick, children: t.label })
|
|
460
|
+
] });
|
|
461
|
+
}
|
|
462
|
+
function Ee({
|
|
463
|
+
services: r,
|
|
464
|
+
selectedServiceId: a,
|
|
465
|
+
onSelectService: n,
|
|
466
|
+
loading: t = !1
|
|
467
|
+
}) {
|
|
468
|
+
return t ? /* @__PURE__ */ e(K, { message: "Cargando servicios..." }) : r.length === 0 ? /* @__PURE__ */ e(
|
|
469
|
+
ae,
|
|
470
|
+
{
|
|
471
|
+
icon: "info",
|
|
472
|
+
title: "Sin servicios disponibles",
|
|
473
|
+
description: "No hay servicios configurados en este momento."
|
|
474
|
+
}
|
|
475
|
+
) : /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
476
|
+
/* @__PURE__ */ e(d, { variant: "title-sm", className: "mb-3 px-1 text-surface-on", children: "Selecciona un servicio" }),
|
|
477
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-3", children: r.map((i) => /* @__PURE__ */ e(
|
|
478
|
+
Fe,
|
|
479
|
+
{
|
|
480
|
+
service: i,
|
|
481
|
+
selected: i.id === a,
|
|
482
|
+
onSelect: n
|
|
483
|
+
},
|
|
484
|
+
i.id
|
|
485
|
+
)) })
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
488
|
+
const Le = ["Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"], Q = [
|
|
489
|
+
"Enero",
|
|
490
|
+
"Febrero",
|
|
491
|
+
"Marzo",
|
|
492
|
+
"Abril",
|
|
493
|
+
"Mayo",
|
|
494
|
+
"Junio",
|
|
495
|
+
"Julio",
|
|
496
|
+
"Agosto",
|
|
497
|
+
"Septiembre",
|
|
498
|
+
"Octubre",
|
|
499
|
+
"Noviembre",
|
|
500
|
+
"Diciembre"
|
|
501
|
+
];
|
|
502
|
+
function X(r) {
|
|
503
|
+
return `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
|
|
504
|
+
}
|
|
505
|
+
function Z(r, a) {
|
|
506
|
+
return r.getFullYear() === a.getFullYear() && r.getMonth() === a.getMonth() && r.getDate() === a.getDate();
|
|
507
|
+
}
|
|
508
|
+
function Me({
|
|
509
|
+
selectedDate: r,
|
|
510
|
+
onSelectDate: a,
|
|
511
|
+
minDate: n,
|
|
512
|
+
maxDate: t,
|
|
513
|
+
disabledDates: i = [],
|
|
514
|
+
availableDates: l = []
|
|
515
|
+
}) {
|
|
516
|
+
const o = /* @__PURE__ */ new Date(), [c, u] = p((r == null ? void 0 : r.getMonth()) ?? o.getMonth()), [f, y] = p((r == null ? void 0 : r.getFullYear()) ?? o.getFullYear()), m = J(() => new Set(i), [i]), b = J(() => new Set(l), [l]), k = new Date(f, c + 1, 0).getDate(), z = (new Date(f, c, 1).getDay() + 6) % 7, g = () => {
|
|
517
|
+
c === 0 ? (u(11), y(f - 1)) : u(c - 1);
|
|
518
|
+
}, j = () => {
|
|
519
|
+
c === 11 ? (u(0), y(f + 1)) : u(c + 1);
|
|
520
|
+
}, D = (h) => {
|
|
521
|
+
const C = new Date(f, c, h), L = X(C);
|
|
522
|
+
if (m.has(L) || n && C < new Date(n.getFullYear(), n.getMonth(), n.getDate()) || t && C > t) return !0;
|
|
523
|
+
const M = new Date(o.getFullYear(), o.getMonth(), o.getDate());
|
|
524
|
+
return C < M;
|
|
525
|
+
}, x = (h) => {
|
|
526
|
+
if (b.size === 0) return !0;
|
|
527
|
+
const C = X(new Date(f, c, h));
|
|
528
|
+
return b.has(C);
|
|
529
|
+
}, w = [];
|
|
530
|
+
for (let h = 0; h < z; h++) w.push(null);
|
|
531
|
+
for (let h = 1; h <= k; h++) w.push(h);
|
|
532
|
+
return /* @__PURE__ */ s("div", { className: "w-full max-w-[320px] mx-auto", children: [
|
|
533
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-3", children: [
|
|
534
|
+
/* @__PURE__ */ e(S, { variant: "text", size: "sm", onClick: g, "aria-label": "Mes anterior", children: /* @__PURE__ */ e(v, { name: "chevron-left", size: "md" }) }),
|
|
535
|
+
/* @__PURE__ */ s(d, { variant: "title-sm", className: "text-surface-on", children: [
|
|
536
|
+
Q[c],
|
|
537
|
+
" ",
|
|
538
|
+
f
|
|
539
|
+
] }),
|
|
540
|
+
/* @__PURE__ */ e(S, { variant: "text", size: "sm", onClick: j, "aria-label": "Mes siguiente", children: /* @__PURE__ */ e(v, { name: "chevron-right", size: "md" }) })
|
|
541
|
+
] }),
|
|
542
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-0.5 mb-1", children: Le.map((h) => /* @__PURE__ */ e("div", { className: "text-center text-label-sm text-surface-on-variant py-1", children: h }, h)) }),
|
|
543
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-0.5", children: w.map((h, C) => {
|
|
544
|
+
if (h === null) return /* @__PURE__ */ e("div", {}, `empty-${C}`);
|
|
545
|
+
const L = new Date(f, c, h), M = D(h), B = x(h) && !M, T = r ? Z(L, r) : !1, R = Z(L, o);
|
|
546
|
+
return /* @__PURE__ */ e(
|
|
547
|
+
"button",
|
|
548
|
+
{
|
|
549
|
+
type: "button",
|
|
550
|
+
disabled: M,
|
|
551
|
+
onClick: () => B && a(L),
|
|
552
|
+
"aria-pressed": T,
|
|
553
|
+
"aria-label": `${h} de ${Q[c]}${M ? ", no disponible" : ""}`,
|
|
554
|
+
className: [
|
|
555
|
+
"aspect-square flex items-center justify-center rounded-full",
|
|
556
|
+
"text-body-sm font-sans min-h-[36px] min-w-[36px]",
|
|
557
|
+
"transition-all duration-short-2 ease-standard",
|
|
558
|
+
"focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",
|
|
559
|
+
T ? "bg-primary text-primary-on font-bold" : R && !M ? "border border-primary text-primary font-bold" : B ? "text-surface-on hover:bg-primary-container cursor-pointer" : "text-surface-on-variant opacity-30 cursor-not-allowed"
|
|
560
|
+
].join(" "),
|
|
561
|
+
children: h
|
|
562
|
+
},
|
|
563
|
+
h
|
|
564
|
+
);
|
|
565
|
+
}) })
|
|
566
|
+
] });
|
|
567
|
+
}
|
|
568
|
+
function je({
|
|
569
|
+
selectedDate: r,
|
|
570
|
+
onSelectDate: a,
|
|
571
|
+
minDate: n,
|
|
572
|
+
maxDate: t,
|
|
573
|
+
disabledDates: i,
|
|
574
|
+
availableDates: l
|
|
575
|
+
}) {
|
|
576
|
+
return /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
577
|
+
/* @__PURE__ */ e(d, { variant: "title-sm", className: "mb-3 px-1 text-surface-on", children: "Selecciona una fecha" }),
|
|
578
|
+
/* @__PURE__ */ e("div", { className: "bg-surface rounded-md shadow-elevation-1 p-4", children: /* @__PURE__ */ e(
|
|
579
|
+
Me,
|
|
580
|
+
{
|
|
581
|
+
selectedDate: r,
|
|
582
|
+
onSelectDate: a,
|
|
583
|
+
minDate: n,
|
|
584
|
+
maxDate: t,
|
|
585
|
+
disabledDates: i,
|
|
586
|
+
availableDates: l
|
|
587
|
+
}
|
|
588
|
+
) }),
|
|
589
|
+
r && /* @__PURE__ */ s(d, { variant: "body-sm", className: "mt-2 px-1 text-surface-on-variant text-center", children: [
|
|
590
|
+
"Fecha seleccionada:",
|
|
591
|
+
" ",
|
|
592
|
+
/* @__PURE__ */ e("span", { className: "font-bold text-primary", children: r.toLocaleDateString("es-ES", {
|
|
593
|
+
weekday: "long",
|
|
594
|
+
day: "numeric",
|
|
595
|
+
month: "long"
|
|
596
|
+
}) })
|
|
597
|
+
] })
|
|
598
|
+
] });
|
|
599
|
+
}
|
|
600
|
+
function De({
|
|
601
|
+
slots: r,
|
|
602
|
+
selectedSlotId: a,
|
|
603
|
+
onSelectSlot: n,
|
|
604
|
+
columns: t = 4
|
|
605
|
+
}) {
|
|
606
|
+
const i = r.filter((c) => parseInt(c.startTime.split(":")[0], 10) < 12), l = r.filter((c) => parseInt(c.startTime.split(":")[0], 10) >= 12), o = (c) => /* @__PURE__ */ e(
|
|
607
|
+
"div",
|
|
608
|
+
{
|
|
609
|
+
className: "grid gap-2",
|
|
610
|
+
style: { gridTemplateColumns: `repeat(${t}, 1fr)` },
|
|
611
|
+
children: c.map((u) => {
|
|
612
|
+
const f = u.id === a;
|
|
613
|
+
return /* @__PURE__ */ e(
|
|
614
|
+
"button",
|
|
615
|
+
{
|
|
616
|
+
type: "button",
|
|
617
|
+
disabled: !u.available,
|
|
618
|
+
onClick: () => u.available && n(u),
|
|
619
|
+
"aria-pressed": f,
|
|
620
|
+
className: [
|
|
621
|
+
"py-2 px-2 rounded-sm text-label-lg font-sans text-center",
|
|
622
|
+
"transition-all duration-short-2 ease-standard",
|
|
623
|
+
"min-h-[44px] min-w-[44px]",
|
|
624
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
625
|
+
f ? "bg-primary text-primary-on shadow-elevation-1" : u.available ? "bg-surface border border-neutral-variant/40 text-surface-on hover:bg-primary-container hover:border-primary/30" : "bg-surface-variant text-surface-on-variant opacity-30 cursor-not-allowed"
|
|
626
|
+
].join(" "),
|
|
627
|
+
children: u.startTime
|
|
628
|
+
},
|
|
629
|
+
u.id
|
|
630
|
+
);
|
|
631
|
+
})
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
return /* @__PURE__ */ s("div", { className: "w-full space-y-4", children: [
|
|
635
|
+
i.length > 0 && /* @__PURE__ */ s("div", { children: [
|
|
636
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "mb-2 text-surface-on-variant", children: "Mañana" }),
|
|
637
|
+
o(i)
|
|
638
|
+
] }),
|
|
639
|
+
l.length > 0 && /* @__PURE__ */ s("div", { children: [
|
|
640
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "mb-2 text-surface-on-variant", children: "Tarde" }),
|
|
641
|
+
o(l)
|
|
642
|
+
] })
|
|
643
|
+
] });
|
|
644
|
+
}
|
|
645
|
+
const $ = U(
|
|
646
|
+
({
|
|
647
|
+
label: r,
|
|
648
|
+
error: a,
|
|
649
|
+
helperText: n,
|
|
650
|
+
leadingIcon: t,
|
|
651
|
+
trailingIcon: i,
|
|
652
|
+
fullWidth: l = !0,
|
|
653
|
+
className: o = "",
|
|
654
|
+
id: c,
|
|
655
|
+
...u
|
|
656
|
+
}, f) => {
|
|
657
|
+
const y = he(), m = c ?? y, b = !!a, k = [
|
|
658
|
+
"relative",
|
|
659
|
+
l ? "w-full" : "inline-flex"
|
|
660
|
+
].join(" "), z = [
|
|
661
|
+
"peer w-full h-12 px-4 rounded-xs bg-surface border font-sans text-body-lg",
|
|
662
|
+
"text-surface-on placeholder-transparent",
|
|
663
|
+
"transition-all duration-medium-1 ease-standard",
|
|
664
|
+
"focus:outline-none focus:ring-2",
|
|
665
|
+
t ? "pl-11" : "",
|
|
666
|
+
i ? "pr-11" : "",
|
|
667
|
+
b ? "border-error focus:ring-error focus:border-error" : "border-neutral-variant focus:ring-primary focus:border-primary",
|
|
668
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
669
|
+
o
|
|
670
|
+
].filter(Boolean).join(" "), g = [
|
|
671
|
+
"absolute left-4 top-1/2 -translate-y-1/2 text-body-lg font-sans pointer-events-none",
|
|
672
|
+
"transition-all duration-medium-1 ease-standard origin-left",
|
|
673
|
+
"peer-focus:top-0 peer-focus:text-label-sm peer-focus:bg-surface peer-focus:px-1 peer-focus:-translate-y-1/2 peer-focus:scale-90",
|
|
674
|
+
"peer-[:not(:placeholder-shown)]:top-0 peer-[:not(:placeholder-shown)]:text-label-sm peer-[:not(:placeholder-shown)]:bg-surface peer-[:not(:placeholder-shown)]:px-1 peer-[:not(:placeholder-shown)]:-translate-y-1/2 peer-[:not(:placeholder-shown)]:scale-90",
|
|
675
|
+
t ? "left-11" : "",
|
|
676
|
+
b ? "text-error peer-focus:text-error" : "text-surface-on-variant peer-focus:text-primary"
|
|
677
|
+
].filter(Boolean).join(" ");
|
|
678
|
+
return /* @__PURE__ */ s("div", { className: k, children: [
|
|
679
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
680
|
+
t && /* @__PURE__ */ e("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-surface-on-variant", children: t }),
|
|
681
|
+
/* @__PURE__ */ e(
|
|
682
|
+
"input",
|
|
683
|
+
{
|
|
684
|
+
ref: f,
|
|
685
|
+
id: m,
|
|
686
|
+
className: z,
|
|
687
|
+
placeholder: r || " ",
|
|
688
|
+
"aria-invalid": b,
|
|
689
|
+
"aria-describedby": a ? `${m}-error` : n ? `${m}-helper` : void 0,
|
|
690
|
+
...u
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
r && /* @__PURE__ */ e("label", { htmlFor: m, className: g, children: r }),
|
|
694
|
+
i && /* @__PURE__ */ e("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-surface-on-variant", children: i })
|
|
695
|
+
] }),
|
|
696
|
+
(a || n) && /* @__PURE__ */ e(
|
|
697
|
+
"p",
|
|
698
|
+
{
|
|
699
|
+
id: a ? `${m}-error` : `${m}-helper`,
|
|
700
|
+
className: [
|
|
701
|
+
"mt-1 px-4 text-body-sm",
|
|
702
|
+
b ? "text-error" : "text-surface-on-variant"
|
|
703
|
+
].join(" "),
|
|
704
|
+
children: a || n
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
] });
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
$.displayName = "Input";
|
|
711
|
+
function Be(r) {
|
|
712
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);
|
|
713
|
+
}
|
|
714
|
+
function Te(r) {
|
|
715
|
+
return /^[\d\s\-+()]{7,20}$/.test(r);
|
|
716
|
+
}
|
|
717
|
+
function ar(r, a = "es-ES") {
|
|
718
|
+
return r.toLocaleDateString(a, {
|
|
719
|
+
weekday: "long",
|
|
720
|
+
day: "numeric",
|
|
721
|
+
month: "long",
|
|
722
|
+
year: "numeric"
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
function nr(r, a = "es-ES") {
|
|
726
|
+
return r.toLocaleDateString(a, {
|
|
727
|
+
weekday: "short",
|
|
728
|
+
day: "numeric",
|
|
729
|
+
month: "short"
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
function $e(r) {
|
|
733
|
+
return `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
|
|
734
|
+
}
|
|
735
|
+
function He({ onSubmit: r, loading: a = !1, initialValues: n }) {
|
|
736
|
+
const [t, i] = p((n == null ? void 0 : n.clientName) ?? ""), [l, o] = p((n == null ? void 0 : n.clientEmail) ?? ""), [c, u] = p((n == null ? void 0 : n.clientPhone) ?? ""), [f, y] = p((n == null ? void 0 : n.notes) ?? ""), [m, b] = p({}), k = () => {
|
|
737
|
+
const g = {};
|
|
738
|
+
return t.trim() || (g.clientName = "El nombre es requerido"), l.trim() ? Be(l) || (g.clientEmail = "Email no válido") : g.clientEmail = "El email es requerido", c.trim() ? Te(c) || (g.clientPhone = "Teléfono no válido") : g.clientPhone = "El teléfono es requerido", b(g), Object.keys(g).length === 0;
|
|
739
|
+
};
|
|
740
|
+
return /* @__PURE__ */ s("form", { onSubmit: (g) => {
|
|
741
|
+
g.preventDefault(), k() && r({
|
|
742
|
+
clientName: t.trim(),
|
|
743
|
+
clientEmail: l.trim(),
|
|
744
|
+
clientPhone: c.trim(),
|
|
745
|
+
notes: f.trim() || void 0
|
|
746
|
+
});
|
|
747
|
+
}, noValidate: !0, className: "w-full", children: [
|
|
748
|
+
/* @__PURE__ */ e(d, { variant: "title-sm", className: "mb-4 text-surface-on", children: "Tus datos" }),
|
|
749
|
+
/* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
750
|
+
/* @__PURE__ */ e(
|
|
751
|
+
$,
|
|
752
|
+
{
|
|
753
|
+
label: "Nombre completo",
|
|
754
|
+
type: "text",
|
|
755
|
+
value: t,
|
|
756
|
+
onChange: (g) => i(g.target.value),
|
|
757
|
+
error: m.clientName,
|
|
758
|
+
leadingIcon: /* @__PURE__ */ e(v, { name: "user", size: "sm" }),
|
|
759
|
+
autoComplete: "name",
|
|
760
|
+
maxLength: 100,
|
|
761
|
+
required: !0
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ e(
|
|
765
|
+
$,
|
|
766
|
+
{
|
|
767
|
+
label: "Email",
|
|
768
|
+
type: "email",
|
|
769
|
+
value: l,
|
|
770
|
+
onChange: (g) => o(g.target.value),
|
|
771
|
+
error: m.clientEmail,
|
|
772
|
+
leadingIcon: /* @__PURE__ */ e(v, { name: "mail", size: "sm" }),
|
|
773
|
+
autoComplete: "email",
|
|
774
|
+
maxLength: 254,
|
|
775
|
+
required: !0
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
/* @__PURE__ */ e(
|
|
779
|
+
$,
|
|
780
|
+
{
|
|
781
|
+
label: "Teléfono",
|
|
782
|
+
type: "tel",
|
|
783
|
+
value: c,
|
|
784
|
+
onChange: (g) => u(g.target.value),
|
|
785
|
+
error: m.clientPhone,
|
|
786
|
+
leadingIcon: /* @__PURE__ */ e(v, { name: "phone", size: "sm" }),
|
|
787
|
+
autoComplete: "tel",
|
|
788
|
+
maxLength: 20,
|
|
789
|
+
required: !0
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
/* @__PURE__ */ e(
|
|
793
|
+
$,
|
|
794
|
+
{
|
|
795
|
+
label: "Notas (opcional)",
|
|
796
|
+
type: "text",
|
|
797
|
+
value: f,
|
|
798
|
+
onChange: (g) => y(g.target.value),
|
|
799
|
+
leadingIcon: /* @__PURE__ */ e(v, { name: "notes", size: "sm" }),
|
|
800
|
+
maxLength: 500
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
] }),
|
|
804
|
+
/* @__PURE__ */ e(
|
|
805
|
+
S,
|
|
806
|
+
{
|
|
807
|
+
type: "submit",
|
|
808
|
+
variant: "filled",
|
|
809
|
+
color: "primary",
|
|
810
|
+
size: "lg",
|
|
811
|
+
fullWidth: !0,
|
|
812
|
+
loading: a,
|
|
813
|
+
className: "mt-6",
|
|
814
|
+
children: "Confirmar reserva"
|
|
815
|
+
}
|
|
816
|
+
)
|
|
817
|
+
] });
|
|
818
|
+
}
|
|
819
|
+
function A({
|
|
820
|
+
orientation: r = "horizontal",
|
|
821
|
+
inset: a = !1,
|
|
822
|
+
className: n = "",
|
|
823
|
+
...t
|
|
824
|
+
}) {
|
|
825
|
+
const i = r === "horizontal";
|
|
826
|
+
return /* @__PURE__ */ e(
|
|
827
|
+
"hr",
|
|
828
|
+
{
|
|
829
|
+
role: "separator",
|
|
830
|
+
"aria-orientation": r,
|
|
831
|
+
className: [
|
|
832
|
+
"border-0 bg-neutral-variant",
|
|
833
|
+
i ? "h-px w-full" : "w-px h-full",
|
|
834
|
+
a && i ? "mx-4" : "",
|
|
835
|
+
a && !i ? "my-4" : "",
|
|
836
|
+
n
|
|
837
|
+
].filter(Boolean).join(" "),
|
|
838
|
+
...t
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
const Ie = {
|
|
843
|
+
confirmed: "bg-success-container text-success-on-container",
|
|
844
|
+
pending: "bg-warning-container text-warning-on-container",
|
|
845
|
+
cancelled: "bg-error-container text-error-on-container",
|
|
846
|
+
completed: "bg-primary-container text-primary-on-container",
|
|
847
|
+
info: "bg-secondary-container text-secondary-on-container"
|
|
848
|
+
}, Ae = {
|
|
849
|
+
sm: "text-label-sm px-2 py-0.5",
|
|
850
|
+
md: "text-label-md px-3 py-1",
|
|
851
|
+
lg: "text-label-lg px-4 py-1.5"
|
|
852
|
+
};
|
|
853
|
+
function We({
|
|
854
|
+
variant: r,
|
|
855
|
+
size: a = "md",
|
|
856
|
+
icon: n,
|
|
857
|
+
children: t,
|
|
858
|
+
className: i = "",
|
|
859
|
+
...l
|
|
860
|
+
}) {
|
|
861
|
+
return /* @__PURE__ */ s(
|
|
862
|
+
"span",
|
|
863
|
+
{
|
|
864
|
+
className: [
|
|
865
|
+
"inline-flex items-center gap-1.5 font-sans font-bold rounded-full whitespace-nowrap",
|
|
866
|
+
Ie[r],
|
|
867
|
+
Ae[a],
|
|
868
|
+
i
|
|
869
|
+
].filter(Boolean).join(" "),
|
|
870
|
+
...l,
|
|
871
|
+
children: [
|
|
872
|
+
n && /* @__PURE__ */ e("span", { className: "inline-flex shrink-0", children: n }),
|
|
873
|
+
t
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
const Pe = {
|
|
879
|
+
confirmed: "check",
|
|
880
|
+
pending: "clock",
|
|
881
|
+
cancelled: "close",
|
|
882
|
+
completed: "check",
|
|
883
|
+
info: "info"
|
|
884
|
+
};
|
|
885
|
+
function ne({ status: r, label: a }) {
|
|
886
|
+
return /* @__PURE__ */ e(We, { variant: r, icon: /* @__PURE__ */ e(v, { name: Pe[r], size: "sm" }), children: a });
|
|
887
|
+
}
|
|
888
|
+
function Oe({
|
|
889
|
+
open: r,
|
|
890
|
+
onClose: a,
|
|
891
|
+
confirmation: n,
|
|
892
|
+
onNewBooking: t
|
|
893
|
+
}) {
|
|
894
|
+
const i = ee(null);
|
|
895
|
+
return I(() => {
|
|
896
|
+
const l = i.current;
|
|
897
|
+
l && (r ? l.showModal() : l.close());
|
|
898
|
+
}, [r]), I(() => {
|
|
899
|
+
const l = i.current;
|
|
900
|
+
if (!l) return;
|
|
901
|
+
const o = () => a();
|
|
902
|
+
return l.addEventListener("close", o), () => l.removeEventListener("close", o);
|
|
903
|
+
}, [a]), n ? /* @__PURE__ */ e(
|
|
904
|
+
"dialog",
|
|
905
|
+
{
|
|
906
|
+
ref: i,
|
|
907
|
+
className: [
|
|
908
|
+
"w-[90vw] max-w-md rounded-xl bg-surface shadow-elevation-5 p-0",
|
|
909
|
+
"backdrop:bg-scrim/40 backdrop:backdrop-blur-sm",
|
|
910
|
+
"animate-in fade-in slide-in-from-bottom-4"
|
|
911
|
+
].join(" "),
|
|
912
|
+
"aria-labelledby": "confirmation-title",
|
|
913
|
+
children: /* @__PURE__ */ s("div", { className: "p-6", children: [
|
|
914
|
+
/* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-success-container flex items-center justify-center", children: /* @__PURE__ */ e(v, { name: "check", size: "lg", color: "#27AE60" }) }) }),
|
|
915
|
+
/* @__PURE__ */ e(
|
|
916
|
+
d,
|
|
917
|
+
{
|
|
918
|
+
variant: "headline-sm",
|
|
919
|
+
as: "h2",
|
|
920
|
+
align: "center",
|
|
921
|
+
id: "confirmation-title",
|
|
922
|
+
className: "text-surface-on mb-1",
|
|
923
|
+
children: "¡Reserva confirmada!"
|
|
924
|
+
}
|
|
925
|
+
),
|
|
926
|
+
/* @__PURE__ */ e(d, { variant: "body-md", align: "center", className: "text-surface-on-variant mb-4", children: "Tu cita ha sido agendada exitosamente." }),
|
|
927
|
+
/* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e(ne, { status: n.status, label: "Confirmada" }) }),
|
|
928
|
+
/* @__PURE__ */ e(A, { className: "my-4" }),
|
|
929
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
930
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
931
|
+
/* @__PURE__ */ e(v, { name: "star", size: "sm", color: "#7F8C8D" }),
|
|
932
|
+
/* @__PURE__ */ s("div", { children: [
|
|
933
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-surface-on-variant", children: "Servicio" }),
|
|
934
|
+
/* @__PURE__ */ e(d, { variant: "body-md", className: "text-surface-on", children: n.service.name })
|
|
935
|
+
] })
|
|
936
|
+
] }),
|
|
937
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
938
|
+
/* @__PURE__ */ e(v, { name: "calendar", size: "sm", color: "#7F8C8D" }),
|
|
939
|
+
/* @__PURE__ */ s("div", { children: [
|
|
940
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-surface-on-variant", children: "Fecha" }),
|
|
941
|
+
/* @__PURE__ */ e(d, { variant: "body-md", className: "text-surface-on", children: new Date(n.date).toLocaleDateString("es-ES", {
|
|
942
|
+
weekday: "long",
|
|
943
|
+
day: "numeric",
|
|
944
|
+
month: "long",
|
|
945
|
+
year: "numeric"
|
|
946
|
+
}) })
|
|
947
|
+
] })
|
|
948
|
+
] }),
|
|
949
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
950
|
+
/* @__PURE__ */ e(v, { name: "clock", size: "sm", color: "#7F8C8D" }),
|
|
951
|
+
/* @__PURE__ */ s("div", { children: [
|
|
952
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-surface-on-variant", children: "Hora" }),
|
|
953
|
+
/* @__PURE__ */ s(d, { variant: "body-md", className: "text-surface-on", children: [
|
|
954
|
+
n.timeSlot.startTime,
|
|
955
|
+
" - ",
|
|
956
|
+
n.timeSlot.endTime
|
|
957
|
+
] })
|
|
958
|
+
] })
|
|
959
|
+
] }),
|
|
960
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
961
|
+
/* @__PURE__ */ e(v, { name: "user", size: "sm", color: "#7F8C8D" }),
|
|
962
|
+
/* @__PURE__ */ s("div", { children: [
|
|
963
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-surface-on-variant", children: "Cliente" }),
|
|
964
|
+
/* @__PURE__ */ e(d, { variant: "body-md", className: "text-surface-on", children: n.clientName }),
|
|
965
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", className: "text-surface-on-variant", children: n.clientEmail })
|
|
966
|
+
] })
|
|
967
|
+
] })
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ e(A, { className: "my-4" }),
|
|
970
|
+
/* @__PURE__ */ s(d, { variant: "body-sm", align: "center", className: "text-surface-on-variant mb-4", children: [
|
|
971
|
+
"ID de reserva: ",
|
|
972
|
+
/* @__PURE__ */ e("span", { className: "font-bold", children: n.id })
|
|
973
|
+
] }),
|
|
974
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
975
|
+
/* @__PURE__ */ e(S, { variant: "filled", fullWidth: !0, onClick: a, children: "Cerrar" }),
|
|
976
|
+
t && /* @__PURE__ */ e(S, { variant: "tonal", fullWidth: !0, onClick: t, children: "Nueva reserva" })
|
|
977
|
+
] })
|
|
978
|
+
] })
|
|
979
|
+
}
|
|
980
|
+
) : null;
|
|
981
|
+
}
|
|
982
|
+
function Re({
|
|
983
|
+
open: r,
|
|
984
|
+
onClose: a,
|
|
985
|
+
title: n = "Ha ocurrido un error",
|
|
986
|
+
message: t,
|
|
987
|
+
onRetry: i
|
|
988
|
+
}) {
|
|
989
|
+
const l = ee(null);
|
|
990
|
+
return I(() => {
|
|
991
|
+
const o = l.current;
|
|
992
|
+
o && (r ? o.showModal() : o.close());
|
|
993
|
+
}, [r]), I(() => {
|
|
994
|
+
const o = l.current;
|
|
995
|
+
if (!o) return;
|
|
996
|
+
const c = () => a();
|
|
997
|
+
return o.addEventListener("close", c), () => o.removeEventListener("close", c);
|
|
998
|
+
}, [a]), /* @__PURE__ */ e(
|
|
999
|
+
"dialog",
|
|
1000
|
+
{
|
|
1001
|
+
ref: l,
|
|
1002
|
+
className: [
|
|
1003
|
+
"w-[90vw] max-w-sm rounded-xl bg-surface shadow-elevation-5 p-0",
|
|
1004
|
+
"backdrop:bg-scrim/40 backdrop:backdrop-blur-sm"
|
|
1005
|
+
].join(" "),
|
|
1006
|
+
"aria-labelledby": "error-title",
|
|
1007
|
+
children: /* @__PURE__ */ s("div", { className: "p-6", children: [
|
|
1008
|
+
/* @__PURE__ */ e("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ e("div", { className: "w-14 h-14 rounded-full bg-error-container flex items-center justify-center", children: /* @__PURE__ */ e(v, { name: "alert", size: "lg", color: "#C0392B" }) }) }),
|
|
1009
|
+
/* @__PURE__ */ e(
|
|
1010
|
+
d,
|
|
1011
|
+
{
|
|
1012
|
+
variant: "title-lg",
|
|
1013
|
+
as: "h2",
|
|
1014
|
+
align: "center",
|
|
1015
|
+
id: "error-title",
|
|
1016
|
+
className: "text-surface-on mb-2",
|
|
1017
|
+
children: n
|
|
1018
|
+
}
|
|
1019
|
+
),
|
|
1020
|
+
/* @__PURE__ */ e(d, { variant: "body-md", align: "center", className: "text-surface-on-variant mb-6", children: t }),
|
|
1021
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
1022
|
+
i && /* @__PURE__ */ e(S, { variant: "filled", fullWidth: !0, onClick: i, children: "Reintentar" }),
|
|
1023
|
+
/* @__PURE__ */ e(S, { variant: i ? "tonal" : "filled", fullWidth: !0, onClick: a, children: "Cerrar" })
|
|
1024
|
+
] })
|
|
1025
|
+
] })
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
const Ye = ["Servicio", "Fecha y hora", "Datos", "Confirmación"], qe = {
|
|
1030
|
+
service: 0,
|
|
1031
|
+
datetime: 1,
|
|
1032
|
+
form: 2,
|
|
1033
|
+
confirmation: 3
|
|
1034
|
+
};
|
|
1035
|
+
function Ue({
|
|
1036
|
+
services: r,
|
|
1037
|
+
onFetchSlots: a,
|
|
1038
|
+
onSubmitBooking: n,
|
|
1039
|
+
companyName: t = "ChronOwl",
|
|
1040
|
+
title: i = t
|
|
1041
|
+
}) {
|
|
1042
|
+
const [l, o] = p("service"), [c, u] = p(null), [f, y] = p(), [m, b] = p(null), [k, z] = p([]), [g, j] = p(!1), [D, x] = p(!1), [w, h] = p(null), [C, L] = p(!1), [M, B] = p(null), T = qe[l], R = N(() => {
|
|
1043
|
+
l === "datetime" ? (o("service"), y(void 0), b(null), z([])) : l === "form" && o("datetime");
|
|
1044
|
+
}, [l]), ie = N((F) => {
|
|
1045
|
+
const H = ["service", "datetime", "form", "confirmation"];
|
|
1046
|
+
F < T && o(H[F]);
|
|
1047
|
+
}, [T]), se = N((F) => {
|
|
1048
|
+
u(F);
|
|
1049
|
+
}, []), le = N(() => {
|
|
1050
|
+
c && (o("datetime"), y(void 0), b(null), z([]));
|
|
1051
|
+
}, [c]), oe = N(
|
|
1052
|
+
async (F) => {
|
|
1053
|
+
if (y(F), b(null), !c) return;
|
|
1054
|
+
const H = `${F.getFullYear()}-${String(F.getMonth() + 1).padStart(2, "0")}-${String(F.getDate()).padStart(2, "0")}`;
|
|
1055
|
+
j(!0);
|
|
1056
|
+
try {
|
|
1057
|
+
const Y = await a(c.id, H);
|
|
1058
|
+
z(Y);
|
|
1059
|
+
} catch {
|
|
1060
|
+
B("No se pudieron cargar los horarios. Intenta de nuevo."), z([]);
|
|
1061
|
+
} finally {
|
|
1062
|
+
j(!1);
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
[c, a]
|
|
1066
|
+
), ce = N((F) => {
|
|
1067
|
+
b(F);
|
|
1068
|
+
}, []), de = N(() => {
|
|
1069
|
+
f && m && o("form");
|
|
1070
|
+
}, [f, m]), me = N(
|
|
1071
|
+
async (F) => {
|
|
1072
|
+
if (!c || !f || !m) return;
|
|
1073
|
+
const H = `${f.getFullYear()}-${String(f.getMonth() + 1).padStart(2, "0")}-${String(f.getDate()).padStart(2, "0")}`, Y = {
|
|
1074
|
+
serviceId: c.id,
|
|
1075
|
+
date: H,
|
|
1076
|
+
timeSlotId: m.id,
|
|
1077
|
+
...F
|
|
1078
|
+
};
|
|
1079
|
+
x(!0);
|
|
1080
|
+
try {
|
|
1081
|
+
const ue = await n(Y);
|
|
1082
|
+
h(ue), L(!0), o("confirmation");
|
|
1083
|
+
} catch {
|
|
1084
|
+
B("No se pudo completar la reserva. Por favor, intenta de nuevo.");
|
|
1085
|
+
} finally {
|
|
1086
|
+
x(!1);
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
[c, f, m, n]
|
|
1090
|
+
), G = N(() => {
|
|
1091
|
+
o("service"), u(null), y(void 0), b(null), z([]), h(null), L(!1);
|
|
1092
|
+
}, []);
|
|
1093
|
+
return /* @__PURE__ */ s(q, { children: [
|
|
1094
|
+
/* @__PURE__ */ e(
|
|
1095
|
+
we,
|
|
1096
|
+
{
|
|
1097
|
+
steps: Ye,
|
|
1098
|
+
currentStep: T,
|
|
1099
|
+
onStepClick: ie,
|
|
1100
|
+
onBack: R,
|
|
1101
|
+
title: i,
|
|
1102
|
+
footer: void 0,
|
|
1103
|
+
children: (() => {
|
|
1104
|
+
switch (l) {
|
|
1105
|
+
case "service":
|
|
1106
|
+
return /* @__PURE__ */ s("div", { children: [
|
|
1107
|
+
/* @__PURE__ */ e(
|
|
1108
|
+
Ee,
|
|
1109
|
+
{
|
|
1110
|
+
services: r,
|
|
1111
|
+
selectedServiceId: c == null ? void 0 : c.id,
|
|
1112
|
+
onSelectService: se
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
c && /* @__PURE__ */ e("div", { className: "mt-6", children: /* @__PURE__ */ e(
|
|
1116
|
+
S,
|
|
1117
|
+
{
|
|
1118
|
+
variant: "filled",
|
|
1119
|
+
fullWidth: !0,
|
|
1120
|
+
size: "lg",
|
|
1121
|
+
onClick: le,
|
|
1122
|
+
icon: /* @__PURE__ */ e(v, { name: "arrow-right", size: "sm" }),
|
|
1123
|
+
iconPosition: "end",
|
|
1124
|
+
children: "Continuar"
|
|
1125
|
+
}
|
|
1126
|
+
) })
|
|
1127
|
+
] });
|
|
1128
|
+
case "datetime":
|
|
1129
|
+
return /* @__PURE__ */ s("div", { className: "space-y-6", children: [
|
|
1130
|
+
c && /* @__PURE__ */ s("div", { className: "bg-primary-container rounded-sm px-4 py-3", children: [
|
|
1131
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-primary-on-container/70", children: "Servicio seleccionado" }),
|
|
1132
|
+
/* @__PURE__ */ s(d, { variant: "title-sm", className: "text-primary-on-container", children: [
|
|
1133
|
+
c.name,
|
|
1134
|
+
" — ",
|
|
1135
|
+
c.currency,
|
|
1136
|
+
c.price
|
|
1137
|
+
] })
|
|
1138
|
+
] }),
|
|
1139
|
+
/* @__PURE__ */ e(
|
|
1140
|
+
je,
|
|
1141
|
+
{
|
|
1142
|
+
selectedDate: f,
|
|
1143
|
+
onSelectDate: oe
|
|
1144
|
+
}
|
|
1145
|
+
),
|
|
1146
|
+
f && /* @__PURE__ */ s(q, { children: [
|
|
1147
|
+
/* @__PURE__ */ e(A, {}),
|
|
1148
|
+
g ? /* @__PURE__ */ e(K, { message: "Buscando horarios...", size: "sm" }) : /* @__PURE__ */ e(
|
|
1149
|
+
De,
|
|
1150
|
+
{
|
|
1151
|
+
slots: k,
|
|
1152
|
+
selectedSlotId: m == null ? void 0 : m.id,
|
|
1153
|
+
onSelectSlot: ce,
|
|
1154
|
+
columns: 4
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
] }),
|
|
1158
|
+
m && /* @__PURE__ */ e("div", { className: "mt-4", children: /* @__PURE__ */ e(
|
|
1159
|
+
S,
|
|
1160
|
+
{
|
|
1161
|
+
variant: "filled",
|
|
1162
|
+
fullWidth: !0,
|
|
1163
|
+
size: "lg",
|
|
1164
|
+
onClick: de,
|
|
1165
|
+
icon: /* @__PURE__ */ e(v, { name: "arrow-right", size: "sm" }),
|
|
1166
|
+
iconPosition: "end",
|
|
1167
|
+
children: "Continuar"
|
|
1168
|
+
}
|
|
1169
|
+
) })
|
|
1170
|
+
] });
|
|
1171
|
+
case "form":
|
|
1172
|
+
return /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
1173
|
+
c && f && m && /* @__PURE__ */ s("div", { className: "bg-primary-container rounded-sm px-4 py-3 space-y-1", children: [
|
|
1174
|
+
/* @__PURE__ */ e(d, { variant: "label-md", className: "text-primary-on-container/70", children: "Resumen de tu reserva" }),
|
|
1175
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
1176
|
+
/* @__PURE__ */ e(v, { name: "star", size: "sm", color: "#2C3E50" }),
|
|
1177
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", className: "text-primary-on-container", children: c.name })
|
|
1178
|
+
] }),
|
|
1179
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
1180
|
+
/* @__PURE__ */ e(v, { name: "calendar", size: "sm", color: "#2C3E50" }),
|
|
1181
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", className: "text-primary-on-container", children: f.toLocaleDateString("es-ES", {
|
|
1182
|
+
weekday: "short",
|
|
1183
|
+
day: "numeric",
|
|
1184
|
+
month: "short"
|
|
1185
|
+
}) })
|
|
1186
|
+
] }),
|
|
1187
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
1188
|
+
/* @__PURE__ */ e(v, { name: "clock", size: "sm", color: "#2C3E50" }),
|
|
1189
|
+
/* @__PURE__ */ s(d, { variant: "body-sm", className: "text-primary-on-container", children: [
|
|
1190
|
+
m.startTime,
|
|
1191
|
+
" - ",
|
|
1192
|
+
m.endTime
|
|
1193
|
+
] })
|
|
1194
|
+
] })
|
|
1195
|
+
] }),
|
|
1196
|
+
/* @__PURE__ */ e(A, {}),
|
|
1197
|
+
/* @__PURE__ */ e(He, { onSubmit: me, loading: D })
|
|
1198
|
+
] });
|
|
1199
|
+
case "confirmation":
|
|
1200
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-8", children: [
|
|
1201
|
+
/* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-success-container flex items-center justify-center mb-4", children: /* @__PURE__ */ e(v, { name: "check", size: "lg", color: "#27AE60" }) }),
|
|
1202
|
+
/* @__PURE__ */ e(d, { variant: "headline-sm", align: "center", className: "text-surface-on mb-2", children: "¡Reserva confirmada!" }),
|
|
1203
|
+
/* @__PURE__ */ e(d, { variant: "body-md", align: "center", className: "text-surface-on-variant mb-6", children: "Revisa tu email para los detalles." }),
|
|
1204
|
+
/* @__PURE__ */ e(S, { variant: "tonal", onClick: G, children: "Nueva reserva" })
|
|
1205
|
+
] });
|
|
1206
|
+
}
|
|
1207
|
+
})()
|
|
1208
|
+
}
|
|
1209
|
+
),
|
|
1210
|
+
/* @__PURE__ */ e(
|
|
1211
|
+
Oe,
|
|
1212
|
+
{
|
|
1213
|
+
open: C,
|
|
1214
|
+
onClose: () => L(!1),
|
|
1215
|
+
confirmation: w,
|
|
1216
|
+
onNewBooking: G
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ e(
|
|
1220
|
+
Re,
|
|
1221
|
+
{
|
|
1222
|
+
open: !!M,
|
|
1223
|
+
onClose: () => B(null),
|
|
1224
|
+
message: M ?? "",
|
|
1225
|
+
onRetry: () => B(null)
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
] });
|
|
1229
|
+
}
|
|
1230
|
+
function tr({
|
|
1231
|
+
services: r,
|
|
1232
|
+
onFetchSlots: a,
|
|
1233
|
+
onSubmitBooking: n,
|
|
1234
|
+
theme: t = "light",
|
|
1235
|
+
companyName: i,
|
|
1236
|
+
className: l = ""
|
|
1237
|
+
}) {
|
|
1238
|
+
return /* @__PURE__ */ e(
|
|
1239
|
+
"div",
|
|
1240
|
+
{
|
|
1241
|
+
className: [
|
|
1242
|
+
"chronowl-root w-full max-w-[480px]",
|
|
1243
|
+
t === "dark" ? "chronowl-dark" : "chronowl-light",
|
|
1244
|
+
l
|
|
1245
|
+
].filter(Boolean).join(" "),
|
|
1246
|
+
style: { width: "100%", maxWidth: 480 },
|
|
1247
|
+
"data-theme": t,
|
|
1248
|
+
children: /* @__PURE__ */ e(
|
|
1249
|
+
Ue,
|
|
1250
|
+
{
|
|
1251
|
+
services: r,
|
|
1252
|
+
onFetchSlots: a,
|
|
1253
|
+
onSubmitBooking: n,
|
|
1254
|
+
companyName: i
|
|
1255
|
+
}
|
|
1256
|
+
)
|
|
1257
|
+
}
|
|
1258
|
+
);
|
|
1259
|
+
}
|
|
1260
|
+
function Ve({ htmlFor: r, required: a, children: n, className: t = "", ...i }) {
|
|
1261
|
+
return /* @__PURE__ */ s(
|
|
1262
|
+
"label",
|
|
1263
|
+
{
|
|
1264
|
+
htmlFor: r,
|
|
1265
|
+
className: [
|
|
1266
|
+
"block text-label-lg text-surface-on font-sans mb-1",
|
|
1267
|
+
t
|
|
1268
|
+
].filter(Boolean).join(" "),
|
|
1269
|
+
...i,
|
|
1270
|
+
children: [
|
|
1271
|
+
n,
|
|
1272
|
+
a && /* @__PURE__ */ e("span", { className: "text-error ml-0.5", "aria-label": "requerido", children: "*" })
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
function ir({
|
|
1278
|
+
label: r,
|
|
1279
|
+
htmlFor: a,
|
|
1280
|
+
error: n,
|
|
1281
|
+
helperText: t,
|
|
1282
|
+
required: i,
|
|
1283
|
+
children: l
|
|
1284
|
+
}) {
|
|
1285
|
+
return /* @__PURE__ */ s("div", { className: "mb-4 w-full", children: [
|
|
1286
|
+
/* @__PURE__ */ e(Ve, { htmlFor: a, required: i, children: r }),
|
|
1287
|
+
l,
|
|
1288
|
+
n && /* @__PURE__ */ e(d, { variant: "body-sm", className: "mt-1 px-1 text-error", children: n }),
|
|
1289
|
+
!n && t && /* @__PURE__ */ e(d, { variant: "body-sm", className: "mt-1 px-1 text-surface-on-variant", children: t })
|
|
1290
|
+
] });
|
|
1291
|
+
}
|
|
1292
|
+
function sr({
|
|
1293
|
+
slots: r,
|
|
1294
|
+
selectedSlotId: a,
|
|
1295
|
+
onSelectSlot: n,
|
|
1296
|
+
loading: t = !1
|
|
1297
|
+
}) {
|
|
1298
|
+
return t ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-8", children: [
|
|
1299
|
+
/* @__PURE__ */ e(re, { size: "md" }),
|
|
1300
|
+
/* @__PURE__ */ e(d, { variant: "body-md", className: "ml-3 text-surface-on-variant", children: "Cargando horarios..." })
|
|
1301
|
+
] }) : r.length === 0 ? /* @__PURE__ */ e(d, { variant: "body-md", className: "text-center py-8 text-surface-on-variant", children: "No hay horarios disponibles para esta fecha." }) : /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
1302
|
+
/* @__PURE__ */ e(d, { variant: "title-sm", className: "mb-3 text-surface-on", children: "Selecciona un horario" }),
|
|
1303
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 sm:grid-cols-4 gap-2", children: r.map((i) => {
|
|
1304
|
+
const l = i.id === a, o = i.available;
|
|
1305
|
+
return /* @__PURE__ */ e(
|
|
1306
|
+
"button",
|
|
1307
|
+
{
|
|
1308
|
+
type: "button",
|
|
1309
|
+
disabled: !o,
|
|
1310
|
+
onClick: () => o && n(i),
|
|
1311
|
+
"aria-pressed": l,
|
|
1312
|
+
"aria-label": `${i.startTime} - ${i.endTime}${o ? "" : ", no disponible"}`,
|
|
1313
|
+
className: [
|
|
1314
|
+
"py-2.5 px-3 rounded-sm text-label-lg font-sans text-center",
|
|
1315
|
+
"transition-all duration-medium-1 ease-standard",
|
|
1316
|
+
"min-h-[44px] min-w-[44px]",
|
|
1317
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
1318
|
+
l ? "bg-primary text-primary-on shadow-elevation-1" : o ? "bg-surface-variant text-surface-on hover:bg-primary-container hover:text-primary-on-container" : "bg-surface-variant text-surface-on-variant opacity-40 cursor-not-allowed"
|
|
1319
|
+
].join(" "),
|
|
1320
|
+
children: i.startTime
|
|
1321
|
+
},
|
|
1322
|
+
i.id
|
|
1323
|
+
);
|
|
1324
|
+
}) })
|
|
1325
|
+
] });
|
|
1326
|
+
}
|
|
1327
|
+
function _e({ slot: r, selected: a = !1, onSelect: n }) {
|
|
1328
|
+
return /* @__PURE__ */ s(
|
|
1329
|
+
"button",
|
|
1330
|
+
{
|
|
1331
|
+
type: "button",
|
|
1332
|
+
disabled: !r.available,
|
|
1333
|
+
onClick: () => r.available && n(r),
|
|
1334
|
+
"aria-pressed": a,
|
|
1335
|
+
"aria-label": `${r.startTime} a ${r.endTime}${r.available ? "" : ", no disponible"}`,
|
|
1336
|
+
className: [
|
|
1337
|
+
"flex flex-col items-center justify-center py-3 px-4 rounded-sm",
|
|
1338
|
+
"min-h-[56px] min-w-[44px]",
|
|
1339
|
+
"transition-all duration-medium-1 ease-standard",
|
|
1340
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
1341
|
+
a ? "bg-primary text-primary-on shadow-elevation-1" : r.available ? "bg-surface-variant text-surface-on hover:bg-primary-container hover:text-primary-on-container border border-transparent hover:border-primary/20" : "bg-surface-variant text-surface-on-variant opacity-40 cursor-not-allowed line-through"
|
|
1342
|
+
].join(" "),
|
|
1343
|
+
children: [
|
|
1344
|
+
/* @__PURE__ */ e(d, { variant: "label-lg", as: "span", className: "inherit", children: r.startTime }),
|
|
1345
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", as: "span", className: "opacity-70", children: r.endTime })
|
|
1346
|
+
]
|
|
1347
|
+
}
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
const Ke = U(
|
|
1351
|
+
({ icon: r, iconPosition: a = "start", ...n }, t) => /* @__PURE__ */ e(
|
|
1352
|
+
$,
|
|
1353
|
+
{
|
|
1354
|
+
ref: t,
|
|
1355
|
+
leadingIcon: a === "start" ? r : void 0,
|
|
1356
|
+
trailingIcon: a === "end" ? r : void 0,
|
|
1357
|
+
...n
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
);
|
|
1361
|
+
Ke.displayName = "InputWithIcon";
|
|
1362
|
+
function lr({
|
|
1363
|
+
children: r,
|
|
1364
|
+
orientation: a = "horizontal",
|
|
1365
|
+
fullWidth: n = !1
|
|
1366
|
+
}) {
|
|
1367
|
+
return /* @__PURE__ */ e(
|
|
1368
|
+
"div",
|
|
1369
|
+
{
|
|
1370
|
+
className: [
|
|
1371
|
+
"flex gap-3",
|
|
1372
|
+
a === "vertical" ? "flex-col" : "flex-row items-center",
|
|
1373
|
+
n ? "w-full [&>*]:flex-1" : ""
|
|
1374
|
+
].filter(Boolean).join(" "),
|
|
1375
|
+
role: "group",
|
|
1376
|
+
children: r
|
|
1377
|
+
}
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
function or({
|
|
1381
|
+
slots: r,
|
|
1382
|
+
selectedSlotId: a,
|
|
1383
|
+
onSelectSlot: n,
|
|
1384
|
+
loading: t = !1
|
|
1385
|
+
}) {
|
|
1386
|
+
if (t)
|
|
1387
|
+
return /* @__PURE__ */ e(K, { message: "Buscando horarios disponibles..." });
|
|
1388
|
+
const i = r.filter((l) => l.available);
|
|
1389
|
+
return r.length === 0 || i.length === 0 ? /* @__PURE__ */ e(
|
|
1390
|
+
ae,
|
|
1391
|
+
{
|
|
1392
|
+
icon: "clock",
|
|
1393
|
+
title: "Sin horarios disponibles",
|
|
1394
|
+
description: "No hay horarios disponibles para la fecha seleccionada. Intenta con otra fecha."
|
|
1395
|
+
}
|
|
1396
|
+
) : /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
1397
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-3 px-1", children: [
|
|
1398
|
+
/* @__PURE__ */ e(d, { variant: "title-sm", className: "text-surface-on", children: "Horarios disponibles" }),
|
|
1399
|
+
/* @__PURE__ */ s(d, { variant: "label-sm", className: "text-surface-on-variant", children: [
|
|
1400
|
+
i.length,
|
|
1401
|
+
" disponible",
|
|
1402
|
+
i.length !== 1 ? "s" : ""
|
|
1403
|
+
] })
|
|
1404
|
+
] }),
|
|
1405
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2", children: r.map((l) => /* @__PURE__ */ e(
|
|
1406
|
+
_e,
|
|
1407
|
+
{
|
|
1408
|
+
slot: l,
|
|
1409
|
+
selected: l.id === a,
|
|
1410
|
+
onSelect: n
|
|
1411
|
+
},
|
|
1412
|
+
l.id
|
|
1413
|
+
)) })
|
|
1414
|
+
] });
|
|
1415
|
+
}
|
|
1416
|
+
function te({ header: r, footer: a, children: n }) {
|
|
1417
|
+
return /* @__PURE__ */ s("div", { className: "chronowl-widget flex flex-col w-full max-w-[480px] mx-auto min-h-[400px] max-h-[90vh] bg-surface rounded-xl shadow-elevation-3 overflow-hidden font-sans", children: [
|
|
1418
|
+
r && /* @__PURE__ */ e("div", { className: "shrink-0", children: r }),
|
|
1419
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-y-auto px-4 py-4", children: n }),
|
|
1420
|
+
a && /* @__PURE__ */ e("div", { className: "shrink-0", children: a })
|
|
1421
|
+
] });
|
|
1422
|
+
}
|
|
1423
|
+
function cr({ children: r, maxWidth: a = "480px" }) {
|
|
1424
|
+
return /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-screen p-4 bg-scrim/40", children: /* @__PURE__ */ e(
|
|
1425
|
+
"div",
|
|
1426
|
+
{
|
|
1427
|
+
className: "w-full bg-surface rounded-xl shadow-elevation-5 overflow-hidden font-sans",
|
|
1428
|
+
style: { maxWidth: a },
|
|
1429
|
+
children: r
|
|
1430
|
+
}
|
|
1431
|
+
) });
|
|
1432
|
+
}
|
|
1433
|
+
function dr({
|
|
1434
|
+
confirmation: r,
|
|
1435
|
+
onNewBooking: a,
|
|
1436
|
+
onClose: n,
|
|
1437
|
+
companyName: t
|
|
1438
|
+
}) {
|
|
1439
|
+
return /* @__PURE__ */ e(
|
|
1440
|
+
te,
|
|
1441
|
+
{
|
|
1442
|
+
header: /* @__PURE__ */ e(V, { title: "ChronOwl", subtitle: "Reserva confirmada" }),
|
|
1443
|
+
footer: /* @__PURE__ */ e(_, { companyName: t, poweredBy: !0 }),
|
|
1444
|
+
children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center py-4", children: [
|
|
1445
|
+
/* @__PURE__ */ e("div", { className: "w-20 h-20 rounded-full bg-success-container flex items-center justify-center mb-5 animate-bounce", children: /* @__PURE__ */ e(v, { name: "check", size: "lg", color: "#27AE60" }) }),
|
|
1446
|
+
/* @__PURE__ */ e(d, { variant: "headline-sm", align: "center", className: "text-surface-on mb-1", children: "¡Reserva confirmada!" }),
|
|
1447
|
+
/* @__PURE__ */ e(d, { variant: "body-md", align: "center", className: "text-surface-on-variant mb-4", children: "Tu cita ha sido agendada exitosamente." }),
|
|
1448
|
+
/* @__PURE__ */ e(ne, { status: r.status, label: "Confirmada" }),
|
|
1449
|
+
/* @__PURE__ */ e(A, { className: "my-5 w-full" }),
|
|
1450
|
+
/* @__PURE__ */ s("div", { className: "w-full space-y-4 bg-surface-variant rounded-md p-4", children: [
|
|
1451
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
1452
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 rounded-full bg-primary-container flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(v, { name: "star", size: "sm", color: "#2C3E50" }) }),
|
|
1453
|
+
/* @__PURE__ */ s("div", { children: [
|
|
1454
|
+
/* @__PURE__ */ e(d, { variant: "label-sm", className: "text-surface-on-variant", children: "Servicio" }),
|
|
1455
|
+
/* @__PURE__ */ e(d, { variant: "body-lg", className: "text-surface-on font-bold", children: r.service.name }),
|
|
1456
|
+
/* @__PURE__ */ s(d, { variant: "body-sm", className: "text-surface-on-variant", children: [
|
|
1457
|
+
r.service.duration,
|
|
1458
|
+
" min — ",
|
|
1459
|
+
r.service.currency,
|
|
1460
|
+
r.service.price
|
|
1461
|
+
] })
|
|
1462
|
+
] })
|
|
1463
|
+
] }),
|
|
1464
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
1465
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 rounded-full bg-primary-container flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(v, { name: "calendar", size: "sm", color: "#2C3E50" }) }),
|
|
1466
|
+
/* @__PURE__ */ s("div", { children: [
|
|
1467
|
+
/* @__PURE__ */ e(d, { variant: "label-sm", className: "text-surface-on-variant", children: "Fecha y hora" }),
|
|
1468
|
+
/* @__PURE__ */ e(d, { variant: "body-lg", className: "text-surface-on font-bold", children: new Date(r.date).toLocaleDateString("es-ES", {
|
|
1469
|
+
weekday: "long",
|
|
1470
|
+
day: "numeric",
|
|
1471
|
+
month: "long",
|
|
1472
|
+
year: "numeric"
|
|
1473
|
+
}) }),
|
|
1474
|
+
/* @__PURE__ */ s(d, { variant: "body-sm", className: "text-surface-on-variant", children: [
|
|
1475
|
+
r.timeSlot.startTime,
|
|
1476
|
+
" - ",
|
|
1477
|
+
r.timeSlot.endTime
|
|
1478
|
+
] })
|
|
1479
|
+
] })
|
|
1480
|
+
] }),
|
|
1481
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
1482
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 rounded-full bg-primary-container flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(v, { name: "user", size: "sm", color: "#2C3E50" }) }),
|
|
1483
|
+
/* @__PURE__ */ s("div", { children: [
|
|
1484
|
+
/* @__PURE__ */ e(d, { variant: "label-sm", className: "text-surface-on-variant", children: "Cliente" }),
|
|
1485
|
+
/* @__PURE__ */ e(d, { variant: "body-lg", className: "text-surface-on font-bold", children: r.clientName }),
|
|
1486
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", className: "text-surface-on-variant", children: r.clientEmail })
|
|
1487
|
+
] })
|
|
1488
|
+
] })
|
|
1489
|
+
] }),
|
|
1490
|
+
/* @__PURE__ */ s(d, { variant: "body-sm", align: "center", className: "text-surface-on-variant mt-4", children: [
|
|
1491
|
+
"ID de reserva: ",
|
|
1492
|
+
/* @__PURE__ */ e("span", { className: "font-bold font-mono", children: r.id })
|
|
1493
|
+
] }),
|
|
1494
|
+
/* @__PURE__ */ e(d, { variant: "body-sm", align: "center", className: "text-surface-on-variant mt-1 mb-6", children: "Te hemos enviado un email de confirmación." }),
|
|
1495
|
+
/* @__PURE__ */ s("div", { className: "w-full space-y-2", children: [
|
|
1496
|
+
a && /* @__PURE__ */ e(S, { variant: "filled", fullWidth: !0, size: "lg", onClick: a, children: "Nueva reserva" }),
|
|
1497
|
+
n && /* @__PURE__ */ e(S, { variant: "tonal", fullWidth: !0, size: "lg", onClick: n, children: "Cerrar" })
|
|
1498
|
+
] })
|
|
1499
|
+
] })
|
|
1500
|
+
}
|
|
1501
|
+
);
|
|
1502
|
+
}
|
|
1503
|
+
function mr({
|
|
1504
|
+
title: r = "Sin disponibilidad",
|
|
1505
|
+
message: a = "No hay horarios disponibles en este momento. Por favor, intenta más tarde.",
|
|
1506
|
+
onRetry: n,
|
|
1507
|
+
onBack: t,
|
|
1508
|
+
companyName: i
|
|
1509
|
+
}) {
|
|
1510
|
+
return /* @__PURE__ */ e(
|
|
1511
|
+
te,
|
|
1512
|
+
{
|
|
1513
|
+
header: /* @__PURE__ */ e(V, { title: "ChronOwl", onBack: t }),
|
|
1514
|
+
footer: /* @__PURE__ */ e(_, { companyName: i, poweredBy: !0 }),
|
|
1515
|
+
children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-12 px-4", children: [
|
|
1516
|
+
/* @__PURE__ */ e("div", { className: "w-20 h-20 rounded-full bg-error-container flex items-center justify-center mb-5", children: /* @__PURE__ */ e(v, { name: "alert", size: "lg", color: "#C0392B" }) }),
|
|
1517
|
+
/* @__PURE__ */ e(d, { variant: "headline-sm", align: "center", className: "text-surface-on mb-2", children: r }),
|
|
1518
|
+
/* @__PURE__ */ e(d, { variant: "body-md", align: "center", className: "text-surface-on-variant mb-8 max-w-xs", children: a }),
|
|
1519
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-8 opacity-30", children: [
|
|
1520
|
+
/* @__PURE__ */ e(v, { name: "calendar", size: "lg", color: "#7F8C8D" }),
|
|
1521
|
+
/* @__PURE__ */ e(v, { name: "close", size: "md", color: "#C0392B" }),
|
|
1522
|
+
/* @__PURE__ */ e(v, { name: "clock", size: "lg", color: "#7F8C8D" })
|
|
1523
|
+
] }),
|
|
1524
|
+
/* @__PURE__ */ s("div", { className: "w-full max-w-xs space-y-3", children: [
|
|
1525
|
+
n && /* @__PURE__ */ e(
|
|
1526
|
+
S,
|
|
1527
|
+
{
|
|
1528
|
+
variant: "filled",
|
|
1529
|
+
fullWidth: !0,
|
|
1530
|
+
size: "lg",
|
|
1531
|
+
onClick: n,
|
|
1532
|
+
icon: /* @__PURE__ */ e(v, { name: "spinner", size: "sm" }),
|
|
1533
|
+
iconPosition: "start",
|
|
1534
|
+
children: "Reintentar"
|
|
1535
|
+
}
|
|
1536
|
+
),
|
|
1537
|
+
t && /* @__PURE__ */ e(
|
|
1538
|
+
S,
|
|
1539
|
+
{
|
|
1540
|
+
variant: "tonal",
|
|
1541
|
+
fullWidth: !0,
|
|
1542
|
+
size: "lg",
|
|
1543
|
+
onClick: t,
|
|
1544
|
+
icon: /* @__PURE__ */ e(v, { name: "arrow-left", size: "sm" }),
|
|
1545
|
+
iconPosition: "start",
|
|
1546
|
+
children: "Volver al inicio"
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1549
|
+
] })
|
|
1550
|
+
] })
|
|
1551
|
+
}
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
const ur = {
|
|
1555
|
+
// Primarios - Azul Nocturno
|
|
1556
|
+
primary: "#2C3E50",
|
|
1557
|
+
onPrimary: "#FFFFFF",
|
|
1558
|
+
primaryContainer: "#E8F4F8",
|
|
1559
|
+
onPrimaryContainer: "#2C3E50",
|
|
1560
|
+
// Secundarios - Luz de Luna
|
|
1561
|
+
secondary: "#E8F4F8",
|
|
1562
|
+
onSecondary: "#2C3E50",
|
|
1563
|
+
secondaryContainer: "#D1E8F0",
|
|
1564
|
+
onSecondaryContainer: "#1A252F",
|
|
1565
|
+
// Terciario - Azul Profundo
|
|
1566
|
+
tertiary: "#1A252F",
|
|
1567
|
+
onTertiary: "#FFFFFF",
|
|
1568
|
+
tertiaryContainer: "#34495E",
|
|
1569
|
+
onTertiaryContainer: "#E8F4F8",
|
|
1570
|
+
// Neutral - Gris Nocturno
|
|
1571
|
+
neutral: "#7F8C8D",
|
|
1572
|
+
onNeutral: "#FFFFFF",
|
|
1573
|
+
neutralVariant: "#BDC3C7",
|
|
1574
|
+
onNeutralVariant: "#2C3E50",
|
|
1575
|
+
// Surface
|
|
1576
|
+
surface: "#FFFFFF",
|
|
1577
|
+
onSurface: "#2C3E50",
|
|
1578
|
+
surfaceVariant: "#F0F3F5",
|
|
1579
|
+
onSurfaceVariant: "#7F8C8D",
|
|
1580
|
+
surfaceDim: "#E0E3E5",
|
|
1581
|
+
surfaceBright: "#FFFFFF",
|
|
1582
|
+
surfaceContainerLowest: "#FFFFFF",
|
|
1583
|
+
surfaceContainerLow: "#F8F9FA",
|
|
1584
|
+
surfaceContainer: "#F0F3F5",
|
|
1585
|
+
surfaceContainerHigh: "#E8EBEE",
|
|
1586
|
+
surfaceContainerHighest: "#E0E3E5",
|
|
1587
|
+
// Outline
|
|
1588
|
+
outline: "#BDC3C7",
|
|
1589
|
+
outlineVariant: "#E0E3E5",
|
|
1590
|
+
// Error
|
|
1591
|
+
error: "#C0392B",
|
|
1592
|
+
onError: "#FFFFFF",
|
|
1593
|
+
errorContainer: "#FADBD8",
|
|
1594
|
+
onErrorContainer: "#78281F",
|
|
1595
|
+
// Warning
|
|
1596
|
+
warning: "#F39C12",
|
|
1597
|
+
onWarning: "#FFFFFF",
|
|
1598
|
+
warningContainer: "#FEF5E7",
|
|
1599
|
+
onWarningContainer: "#7E5109",
|
|
1600
|
+
// Success
|
|
1601
|
+
success: "#27AE60",
|
|
1602
|
+
onSuccess: "#FFFFFF",
|
|
1603
|
+
successContainer: "#D5F5E3",
|
|
1604
|
+
onSuccessContainer: "#1E8449",
|
|
1605
|
+
// Inverse
|
|
1606
|
+
inverseSurface: "#2C3E50",
|
|
1607
|
+
inverseOnSurface: "#FFFFFF",
|
|
1608
|
+
inversePrimary: "#A3C4D4",
|
|
1609
|
+
// Overlay/Scrim
|
|
1610
|
+
scrim: "#000000",
|
|
1611
|
+
shadow: "#000000"
|
|
1612
|
+
}, hr = {
|
|
1613
|
+
displayLarge: {
|
|
1614
|
+
fontSize: "57px",
|
|
1615
|
+
lineHeight: "64px",
|
|
1616
|
+
fontWeight: 700,
|
|
1617
|
+
letterSpacing: "-0.25px"
|
|
1618
|
+
},
|
|
1619
|
+
displayMedium: {
|
|
1620
|
+
fontSize: "45px",
|
|
1621
|
+
lineHeight: "52px",
|
|
1622
|
+
fontWeight: 700,
|
|
1623
|
+
letterSpacing: "0px"
|
|
1624
|
+
},
|
|
1625
|
+
displaySmall: {
|
|
1626
|
+
fontSize: "36px",
|
|
1627
|
+
lineHeight: "44px",
|
|
1628
|
+
fontWeight: 700,
|
|
1629
|
+
letterSpacing: "0px"
|
|
1630
|
+
},
|
|
1631
|
+
headlineLarge: {
|
|
1632
|
+
fontSize: "32px",
|
|
1633
|
+
lineHeight: "40px",
|
|
1634
|
+
fontWeight: 700,
|
|
1635
|
+
letterSpacing: "0px"
|
|
1636
|
+
},
|
|
1637
|
+
headlineMedium: {
|
|
1638
|
+
fontSize: "28px",
|
|
1639
|
+
lineHeight: "36px",
|
|
1640
|
+
fontWeight: 700,
|
|
1641
|
+
letterSpacing: "0px"
|
|
1642
|
+
},
|
|
1643
|
+
headlineSmall: {
|
|
1644
|
+
fontSize: "24px",
|
|
1645
|
+
lineHeight: "32px",
|
|
1646
|
+
fontWeight: 700,
|
|
1647
|
+
letterSpacing: "0px"
|
|
1648
|
+
},
|
|
1649
|
+
titleLarge: {
|
|
1650
|
+
fontSize: "22px",
|
|
1651
|
+
lineHeight: "28px",
|
|
1652
|
+
fontWeight: 700,
|
|
1653
|
+
letterSpacing: "0px"
|
|
1654
|
+
},
|
|
1655
|
+
titleMedium: {
|
|
1656
|
+
fontSize: "18px",
|
|
1657
|
+
lineHeight: "24px",
|
|
1658
|
+
fontWeight: 700,
|
|
1659
|
+
letterSpacing: "0.15px"
|
|
1660
|
+
},
|
|
1661
|
+
titleSmall: {
|
|
1662
|
+
fontSize: "14px",
|
|
1663
|
+
lineHeight: "20px",
|
|
1664
|
+
fontWeight: 700,
|
|
1665
|
+
letterSpacing: "0.1px"
|
|
1666
|
+
},
|
|
1667
|
+
bodyLarge: {
|
|
1668
|
+
fontSize: "16px",
|
|
1669
|
+
lineHeight: "24px",
|
|
1670
|
+
fontWeight: 400,
|
|
1671
|
+
letterSpacing: "0.15px"
|
|
1672
|
+
},
|
|
1673
|
+
bodyMedium: {
|
|
1674
|
+
fontSize: "14px",
|
|
1675
|
+
lineHeight: "20px",
|
|
1676
|
+
fontWeight: 400,
|
|
1677
|
+
letterSpacing: "0.25px"
|
|
1678
|
+
},
|
|
1679
|
+
bodySmall: {
|
|
1680
|
+
fontSize: "12px",
|
|
1681
|
+
lineHeight: "16px",
|
|
1682
|
+
fontWeight: 400,
|
|
1683
|
+
letterSpacing: "0.4px"
|
|
1684
|
+
},
|
|
1685
|
+
labelLarge: {
|
|
1686
|
+
fontSize: "14px",
|
|
1687
|
+
lineHeight: "20px",
|
|
1688
|
+
fontWeight: 700,
|
|
1689
|
+
letterSpacing: "0.1px"
|
|
1690
|
+
},
|
|
1691
|
+
labelMedium: {
|
|
1692
|
+
fontSize: "12px",
|
|
1693
|
+
lineHeight: "16px",
|
|
1694
|
+
fontWeight: 700,
|
|
1695
|
+
letterSpacing: "0.5px"
|
|
1696
|
+
},
|
|
1697
|
+
labelSmall: {
|
|
1698
|
+
fontSize: "11px",
|
|
1699
|
+
lineHeight: "16px",
|
|
1700
|
+
fontWeight: 700,
|
|
1701
|
+
letterSpacing: "0.5px"
|
|
1702
|
+
}
|
|
1703
|
+
}, fr = "'Inter', 'Roboto', system-ui, sans-serif", vr = {
|
|
1704
|
+
size0: "0px",
|
|
1705
|
+
size1: "4px",
|
|
1706
|
+
size2: "8px",
|
|
1707
|
+
size3: "12px",
|
|
1708
|
+
size4: "16px",
|
|
1709
|
+
size5: "24px",
|
|
1710
|
+
size6: "32px",
|
|
1711
|
+
size7: "40px",
|
|
1712
|
+
size8: "48px"
|
|
1713
|
+
}, pr = {
|
|
1714
|
+
size0: 0,
|
|
1715
|
+
size1: 4,
|
|
1716
|
+
size2: 8,
|
|
1717
|
+
size3: 12,
|
|
1718
|
+
size4: 16,
|
|
1719
|
+
size5: 24,
|
|
1720
|
+
size6: 32,
|
|
1721
|
+
size7: 40,
|
|
1722
|
+
size8: 48
|
|
1723
|
+
}, gr = {
|
|
1724
|
+
level0: "none",
|
|
1725
|
+
level1: "0 1px 3px rgba(44, 62, 80, 0.12)",
|
|
1726
|
+
level2: "0 3px 6px rgba(44, 62, 80, 0.16)",
|
|
1727
|
+
level3: "0 6px 10px rgba(44, 62, 80, 0.2)",
|
|
1728
|
+
level4: "0 8px 16px rgba(44, 62, 80, 0.24)",
|
|
1729
|
+
level5: "0 12px 28px rgba(44, 62, 80, 0.3)"
|
|
1730
|
+
}, Ge = {
|
|
1731
|
+
short1: "50ms",
|
|
1732
|
+
short2: "100ms",
|
|
1733
|
+
medium1: "200ms",
|
|
1734
|
+
medium2: "300ms",
|
|
1735
|
+
long1: "400ms",
|
|
1736
|
+
long2: "500ms"
|
|
1737
|
+
}, Je = {
|
|
1738
|
+
standard: "cubic-bezier(0.2, 0, 0, 1)",
|
|
1739
|
+
emphasized: "cubic-bezier(0.2, 0, 0, 1)",
|
|
1740
|
+
decelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)",
|
|
1741
|
+
accelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)"
|
|
1742
|
+
}, br = { duration: Ge, easing: Je }, xr = {
|
|
1743
|
+
extraSmall: "4px",
|
|
1744
|
+
small: "8px",
|
|
1745
|
+
medium: "12px",
|
|
1746
|
+
large: "16px",
|
|
1747
|
+
extraLarge: "28px",
|
|
1748
|
+
full: "999px"
|
|
1749
|
+
}, W = {
|
|
1750
|
+
services: (r) => `/api/services/${r}`,
|
|
1751
|
+
availability: (r, a, n) => `/api/availability/${r}/${a}/${n}`,
|
|
1752
|
+
bookings: "/api/bookings",
|
|
1753
|
+
bookingDetail: (r, a) => `/api/bookings/${r}/${a}`,
|
|
1754
|
+
cancelBooking: (r, a) => `/api/bookings/${r}/${a}/cancel`
|
|
1755
|
+
}, Qe = "", Xe = 3e4;
|
|
1756
|
+
let E = {
|
|
1757
|
+
baseUrl: Qe,
|
|
1758
|
+
saasId: ""
|
|
1759
|
+
};
|
|
1760
|
+
function yr(r) {
|
|
1761
|
+
if (r.baseUrl !== void 0) {
|
|
1762
|
+
const a = r.baseUrl;
|
|
1763
|
+
a && !a.startsWith("https://") && !a.includes("localhost") && !a.includes("127.0.0.1") && console.warn("[ChronOwl] La URL del API no usa HTTPS. Las API keys se enviarán en texto plano.");
|
|
1764
|
+
}
|
|
1765
|
+
E = { ...E, ...r };
|
|
1766
|
+
}
|
|
1767
|
+
async function P(r, a) {
|
|
1768
|
+
if (!E.baseUrl)
|
|
1769
|
+
throw new Error('[ChronOwl] API URL no configurada. Llama a configureApi({ baseUrl: "..." }) primero.');
|
|
1770
|
+
const n = `${E.baseUrl}${r}`, t = {
|
|
1771
|
+
"Content-Type": "application/json"
|
|
1772
|
+
};
|
|
1773
|
+
E.apiKey && (t["x-api-key"] = E.apiKey);
|
|
1774
|
+
const i = new AbortController(), l = setTimeout(() => i.abort(), Xe);
|
|
1775
|
+
try {
|
|
1776
|
+
const o = await fetch(n, {
|
|
1777
|
+
...a,
|
|
1778
|
+
headers: { ...t, ...a == null ? void 0 : a.headers },
|
|
1779
|
+
signal: i.signal
|
|
1780
|
+
}), c = await o.json();
|
|
1781
|
+
if (!o.ok || !c.success)
|
|
1782
|
+
throw new Error(c.error || `Error ${o.status}`);
|
|
1783
|
+
return c.data;
|
|
1784
|
+
} catch (o) {
|
|
1785
|
+
throw o.name === "AbortError" ? new Error("La solicitud tardó demasiado. Intenta de nuevo.") : o;
|
|
1786
|
+
} finally {
|
|
1787
|
+
clearTimeout(l);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
const O = {
|
|
1791
|
+
async getServices(r) {
|
|
1792
|
+
const a = r || E.saasId;
|
|
1793
|
+
return P(W.services(a));
|
|
1794
|
+
},
|
|
1795
|
+
async getAvailability(r, a, n) {
|
|
1796
|
+
const t = n || E.saasId;
|
|
1797
|
+
return P(W.availability(t, r, a));
|
|
1798
|
+
},
|
|
1799
|
+
async createBooking(r) {
|
|
1800
|
+
return P(W.bookings, {
|
|
1801
|
+
method: "POST",
|
|
1802
|
+
body: JSON.stringify({ ...r, saasId: r.saasId || E.saasId })
|
|
1803
|
+
});
|
|
1804
|
+
},
|
|
1805
|
+
async cancelBooking(r, a) {
|
|
1806
|
+
const n = a || E.saasId;
|
|
1807
|
+
return P(W.cancelBooking(n, r), {
|
|
1808
|
+
method: "PATCH"
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
function Nr(r) {
|
|
1813
|
+
const [a, n] = p([]), [t, i] = p(!0), [l, o] = p(null), c = N(async () => {
|
|
1814
|
+
i(!0), o(null);
|
|
1815
|
+
try {
|
|
1816
|
+
const u = await O.getServices(r);
|
|
1817
|
+
n(u);
|
|
1818
|
+
} catch (u) {
|
|
1819
|
+
o(u instanceof Error ? u.message : "Error al cargar servicios");
|
|
1820
|
+
} finally {
|
|
1821
|
+
i(!1);
|
|
1822
|
+
}
|
|
1823
|
+
}, [r]);
|
|
1824
|
+
return I(() => {
|
|
1825
|
+
r && c();
|
|
1826
|
+
}, [r, c]), { services: a, loading: t, error: l, refetch: c };
|
|
1827
|
+
}
|
|
1828
|
+
function wr(r) {
|
|
1829
|
+
const [a, n] = p([]), [t, i] = p(!1), [l, o] = p(null), c = N(
|
|
1830
|
+
async (f, y) => {
|
|
1831
|
+
i(!0), o(null);
|
|
1832
|
+
try {
|
|
1833
|
+
const m = $e(y), b = await O.getAvailability(f, m, r);
|
|
1834
|
+
n(b);
|
|
1835
|
+
} catch (m) {
|
|
1836
|
+
o(m instanceof Error ? m.message : "Error al cargar horarios"), n([]);
|
|
1837
|
+
} finally {
|
|
1838
|
+
i(!1);
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
[r]
|
|
1842
|
+
), u = N(() => {
|
|
1843
|
+
n([]), o(null);
|
|
1844
|
+
}, []);
|
|
1845
|
+
return { slots: a, loading: t, error: l, fetchSlots: c, clearSlots: u };
|
|
1846
|
+
}
|
|
1847
|
+
function Sr(r) {
|
|
1848
|
+
const [a, n] = p(null), [t, i] = p(!1), [l, o] = p(null), c = N(
|
|
1849
|
+
async (y) => {
|
|
1850
|
+
i(!0), o(null);
|
|
1851
|
+
try {
|
|
1852
|
+
const m = await O.createBooking({ ...y, saasId: r });
|
|
1853
|
+
return n(m), m;
|
|
1854
|
+
} catch (m) {
|
|
1855
|
+
const b = m instanceof Error ? m.message : "Error al crear reserva";
|
|
1856
|
+
return o(b), null;
|
|
1857
|
+
} finally {
|
|
1858
|
+
i(!1);
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
[r]
|
|
1862
|
+
), u = N(
|
|
1863
|
+
async (y) => {
|
|
1864
|
+
i(!0), o(null);
|
|
1865
|
+
try {
|
|
1866
|
+
await O.cancelBooking(y, r), n(null);
|
|
1867
|
+
} catch (m) {
|
|
1868
|
+
o(m instanceof Error ? m.message : "Error al cancelar reserva");
|
|
1869
|
+
} finally {
|
|
1870
|
+
i(!1);
|
|
1871
|
+
}
|
|
1872
|
+
},
|
|
1873
|
+
[r]
|
|
1874
|
+
), f = N(() => {
|
|
1875
|
+
n(null), o(null);
|
|
1876
|
+
}, []);
|
|
1877
|
+
return { booking: a, loading: t, error: l, createBooking: c, cancelBooking: u, reset: f };
|
|
1878
|
+
}
|
|
1879
|
+
function Cr({
|
|
1880
|
+
initialValues: r,
|
|
1881
|
+
validationRules: a = {},
|
|
1882
|
+
onSubmit: n
|
|
1883
|
+
}) {
|
|
1884
|
+
const [t, i] = p(r), [l, o] = p({}), [c, u] = p({}), [f, y] = p(!1), m = N(
|
|
1885
|
+
(x, w) => {
|
|
1886
|
+
const h = a[x];
|
|
1887
|
+
if (h) return h(w, t);
|
|
1888
|
+
},
|
|
1889
|
+
[a, t]
|
|
1890
|
+
), b = N(() => {
|
|
1891
|
+
const x = {};
|
|
1892
|
+
let w = !0;
|
|
1893
|
+
for (const h of Object.keys(t)) {
|
|
1894
|
+
const C = m(h, t[h]);
|
|
1895
|
+
C && (x[h] = C, w = !1);
|
|
1896
|
+
}
|
|
1897
|
+
return o(x), w;
|
|
1898
|
+
}, [t, m]), k = N(
|
|
1899
|
+
(x, w) => {
|
|
1900
|
+
if (i((h) => ({ ...h, [x]: w })), c[x]) {
|
|
1901
|
+
const h = m(x, w);
|
|
1902
|
+
o((C) => ({ ...C, [x]: h }));
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
[c, m]
|
|
1906
|
+
), z = N(
|
|
1907
|
+
(x) => {
|
|
1908
|
+
u((h) => ({ ...h, [x]: !0 }));
|
|
1909
|
+
const w = m(x, t[x]);
|
|
1910
|
+
o((h) => ({ ...h, [x]: w }));
|
|
1911
|
+
},
|
|
1912
|
+
[t, m]
|
|
1913
|
+
), g = N(async () => {
|
|
1914
|
+
const x = {};
|
|
1915
|
+
for (const w of Object.keys(t))
|
|
1916
|
+
x[w] = !0;
|
|
1917
|
+
if (u(x), !!b()) {
|
|
1918
|
+
y(!0);
|
|
1919
|
+
try {
|
|
1920
|
+
await n(t);
|
|
1921
|
+
} finally {
|
|
1922
|
+
y(!1);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
}, [t, b, n]), j = N(() => {
|
|
1926
|
+
i(r), o({}), u({});
|
|
1927
|
+
}, [r]), D = Object.values(l).every((x) => !x);
|
|
1928
|
+
return { values: t, errors: l, touched: c, isValid: D, isSubmitting: f, handleChange: k, handleBlur: z, handleSubmit: g, reset: j };
|
|
1929
|
+
}
|
|
1930
|
+
function zr(...r) {
|
|
1931
|
+
return r.filter(Boolean).join(" ");
|
|
1932
|
+
}
|
|
1933
|
+
function Fr(r, a = "$") {
|
|
1934
|
+
return `${a}${r.toLocaleString()}`;
|
|
1935
|
+
}
|
|
1936
|
+
function kr(r) {
|
|
1937
|
+
if (r < 60) return `${r} min`;
|
|
1938
|
+
const a = Math.floor(r / 60), n = r % 60;
|
|
1939
|
+
return n > 0 ? `${a}h ${n}min` : `${a}h`;
|
|
1940
|
+
}
|
|
1941
|
+
const Er = ["Servicio", "Fecha y hora", "Datos", "Confirmación"], Lr = {
|
|
1942
|
+
xs: 320,
|
|
1943
|
+
sm: 480,
|
|
1944
|
+
md: 768,
|
|
1945
|
+
lg: 1024,
|
|
1946
|
+
xl: 1200
|
|
1947
|
+
}, Mr = {
|
|
1948
|
+
es: {
|
|
1949
|
+
steps: ["Servicio", "Fecha y hora", "Datos", "Confirmación"],
|
|
1950
|
+
selectService: "Selecciona un servicio",
|
|
1951
|
+
selectDate: "Selecciona una fecha",
|
|
1952
|
+
selectTime: "Selecciona un horario",
|
|
1953
|
+
yourData: "Tus datos",
|
|
1954
|
+
confirm: "Confirmar reserva",
|
|
1955
|
+
continue: "Continuar",
|
|
1956
|
+
back: "Volver",
|
|
1957
|
+
close: "Cerrar",
|
|
1958
|
+
newBooking: "Nueva reserva",
|
|
1959
|
+
loading: "Cargando...",
|
|
1960
|
+
noSlots: "No hay horarios disponibles",
|
|
1961
|
+
noServices: "No hay servicios disponibles",
|
|
1962
|
+
bookingConfirmed: "Reserva confirmada",
|
|
1963
|
+
bookingError: "Error al crear la reserva",
|
|
1964
|
+
required: "Este campo es requerido",
|
|
1965
|
+
invalidEmail: "Email no válido",
|
|
1966
|
+
poweredBy: "Powered by ChronOwl"
|
|
1967
|
+
},
|
|
1968
|
+
en: {
|
|
1969
|
+
steps: ["Service", "Date & Time", "Details", "Confirmation"],
|
|
1970
|
+
selectService: "Select a service",
|
|
1971
|
+
selectDate: "Select a date",
|
|
1972
|
+
selectTime: "Select a time slot",
|
|
1973
|
+
yourData: "Your details",
|
|
1974
|
+
confirm: "Confirm booking",
|
|
1975
|
+
continue: "Continue",
|
|
1976
|
+
back: "Back",
|
|
1977
|
+
close: "Close",
|
|
1978
|
+
newBooking: "New booking",
|
|
1979
|
+
loading: "Loading...",
|
|
1980
|
+
noSlots: "No available time slots",
|
|
1981
|
+
noServices: "No services available",
|
|
1982
|
+
bookingConfirmed: "Booking confirmed",
|
|
1983
|
+
bookingError: "Error creating booking",
|
|
1984
|
+
required: "This field is required",
|
|
1985
|
+
invalidEmail: "Invalid email",
|
|
1986
|
+
poweredBy: "Powered by ChronOwl"
|
|
1987
|
+
}
|
|
1988
|
+
};
|
|
1989
|
+
export {
|
|
1990
|
+
W as API_ENDPOINTS,
|
|
1991
|
+
or as AvailabilityGrid,
|
|
1992
|
+
_e as AvailabilitySlot,
|
|
1993
|
+
Er as BOOKING_STEPS,
|
|
1994
|
+
Lr as BREAKPOINTS,
|
|
1995
|
+
We as Badge,
|
|
1996
|
+
He as BookingForm,
|
|
1997
|
+
Ue as BookingPage,
|
|
1998
|
+
we as BookingPageTemplate,
|
|
1999
|
+
S as Button,
|
|
2000
|
+
lr as ButtonGroup,
|
|
2001
|
+
je as Calendar,
|
|
2002
|
+
ze as Card,
|
|
2003
|
+
cr as CenteredLayout,
|
|
2004
|
+
tr as ChronOwlWidget,
|
|
2005
|
+
ne as ConfirmationBadge,
|
|
2006
|
+
Oe as ConfirmationModal,
|
|
2007
|
+
dr as ConfirmationPage,
|
|
2008
|
+
Me as DateSelector,
|
|
2009
|
+
A as Divider,
|
|
2010
|
+
ae as EmptyState,
|
|
2011
|
+
Re as ErrorModal,
|
|
2012
|
+
mr as ErrorPage,
|
|
2013
|
+
_ as Footer,
|
|
2014
|
+
ir as FormGroup,
|
|
2015
|
+
V as Header,
|
|
2016
|
+
v as Icon,
|
|
2017
|
+
$ as Input,
|
|
2018
|
+
Ke as InputWithIcon,
|
|
2019
|
+
Mr as LOCALE,
|
|
2020
|
+
Ve as Label,
|
|
2021
|
+
K as LoadingState,
|
|
2022
|
+
te as MainLayout,
|
|
2023
|
+
Fe as ServiceCard,
|
|
2024
|
+
Ee as ServiceList,
|
|
2025
|
+
re as Spinner,
|
|
2026
|
+
Ne as Stepper,
|
|
2027
|
+
sr as TimeSelector,
|
|
2028
|
+
De as TimeSlotSelector,
|
|
2029
|
+
d as Typography,
|
|
2030
|
+
O as chronowlApi,
|
|
2031
|
+
zr as cn,
|
|
2032
|
+
ur as colors,
|
|
2033
|
+
yr as configureApi,
|
|
2034
|
+
xr as corners,
|
|
2035
|
+
$e as dateToString,
|
|
2036
|
+
tr as default,
|
|
2037
|
+
Ge as duration,
|
|
2038
|
+
Je as easing,
|
|
2039
|
+
gr as elevation,
|
|
2040
|
+
fr as fontFamily,
|
|
2041
|
+
Fr as formatCurrency,
|
|
2042
|
+
ar as formatDate,
|
|
2043
|
+
nr as formatDateShort,
|
|
2044
|
+
kr as formatDuration,
|
|
2045
|
+
br as motion,
|
|
2046
|
+
vr as spacing,
|
|
2047
|
+
pr as spacingValues,
|
|
2048
|
+
hr as typescale,
|
|
2049
|
+
wr as useAvailability,
|
|
2050
|
+
Sr as useBooking,
|
|
2051
|
+
Cr as useForm,
|
|
2052
|
+
Nr as useServices
|
|
2053
|
+
};
|