@eka-care/medassist-widget 0.1.83 → 0.1.84
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/README.md +2 -2
- package/dist/medassist-widget-CardList-DCmadzzk.js +222 -0
- package/dist/medassist-widget-DoctorCard-B9Zb-zvl.js +447 -0
- package/dist/medassist-widget-FocusCarousel-BsLIZftX.js +90 -0
- package/dist/medassist-widget-MediaCard-wTRSvQWH.js +85 -0
- package/dist/medassist-widget-MultiSelect-BnExX-Ty.js +414 -0
- package/dist/medassist-widget-VoiceAgentScreen-BK0p37RC.js +419 -0
- package/dist/medassist-widget-check-BaHLRs-2.js +5 -0
- package/dist/medassist-widget-chevron-right-CKYbGWbY.js +7 -0
- package/dist/medassist-widget-html2canvas.esm-CphxV6YW.js +4835 -0
- package/dist/medassist-widget-map-pin-Bx-5lPdC.js +14 -0
- package/dist/medassist-widget.css +1 -1
- package/dist/medassist-widget.js +13010 -67
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm install @eka-care/medassist-widget
|
|
|
13
13
|
```html
|
|
14
14
|
<link
|
|
15
15
|
rel="stylesheet"
|
|
16
|
-
href="https://
|
|
16
|
+
href="https://cdn.jsdelivr.net/npm/@eka-care/medassist-widget@latest/dist/medassist-widget.css" />
|
|
17
17
|
|
|
18
18
|
<div id="medassist-widget"></div>
|
|
19
19
|
|
|
20
|
-
<script src="https://
|
|
20
|
+
<script src="https://cdn.jsdelivr.net/npm/@eka-care/medassist-widget@latest/dist/medassist-widget.js"></script>
|
|
21
21
|
<script>
|
|
22
22
|
window.renderMedAssist(
|
|
23
23
|
document.getElementById("medassist-widget"),
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { c, u as e, k as M, v as w, r as b, s as C, w as z, B as x, t as S, d as $, A as j } from "./medassist-widget.js";
|
|
2
|
+
import { C as A } from "./medassist-widget-check-BaHLRs-2.js";
|
|
3
|
+
import { M as v } from "./medassist-widget-map-pin-Bx-5lPdC.js";
|
|
4
|
+
import { FocusCarousel as I } from "./medassist-widget-FocusCarousel-BsLIZftX.js";
|
|
5
|
+
const H = [
|
|
6
|
+
["path", { d: "M10 12h4", key: "a56b0p" }],
|
|
7
|
+
["path", { d: "M10 8h4", key: "1sr2af" }],
|
|
8
|
+
["path", { d: "M14 21v-3a2 2 0 0 0-4 0v3", key: "1rgiei" }],
|
|
9
|
+
[
|
|
10
|
+
"path",
|
|
11
|
+
{
|
|
12
|
+
d: "M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",
|
|
13
|
+
key: "secmi2"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
["path", { d: "M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16", key: "16ra0t" }]
|
|
17
|
+
], N = c("building-2", H);
|
|
18
|
+
const B = [
|
|
19
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
20
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
21
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
22
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
23
|
+
], V = c("calendar", B);
|
|
24
|
+
const q = [
|
|
25
|
+
["line", { x1: "12", x2: "12", y1: "2", y2: "22", key: "7eqyqh" }],
|
|
26
|
+
["path", { d: "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6", key: "1b0p4s" }]
|
|
27
|
+
], D = c("dollar-sign", q);
|
|
28
|
+
const L = [
|
|
29
|
+
["path", { d: "M4 10h12", key: "1y6xl8" }],
|
|
30
|
+
["path", { d: "M4 14h9", key: "1loblj" }],
|
|
31
|
+
[
|
|
32
|
+
"path",
|
|
33
|
+
{
|
|
34
|
+
d: "M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",
|
|
35
|
+
key: "1j6lzo"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
], R = c("euro", L);
|
|
39
|
+
const T = [
|
|
40
|
+
["path", { d: "M6 3h12", key: "ggurg9" }],
|
|
41
|
+
["path", { d: "M6 8h12", key: "6g4wlu" }],
|
|
42
|
+
["path", { d: "m6 13 8.5 8", key: "u1kupk" }],
|
|
43
|
+
["path", { d: "M6 13h3", key: "wdp6ag" }],
|
|
44
|
+
["path", { d: "M9 13c6.667 0 6.667-10 0-10", key: "1nkvk2" }]
|
|
45
|
+
], F = c("indian-rupee", T);
|
|
46
|
+
const P = [
|
|
47
|
+
[
|
|
48
|
+
"path",
|
|
49
|
+
{
|
|
50
|
+
d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",
|
|
51
|
+
key: "169xi5"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
["path", { d: "M15 5.764v15", key: "1pn4in" }],
|
|
55
|
+
["path", { d: "M9 3.236v15", key: "1uimfh" }]
|
|
56
|
+
], E = c("map", P);
|
|
57
|
+
const G = [
|
|
58
|
+
[
|
|
59
|
+
"path",
|
|
60
|
+
{
|
|
61
|
+
d: "M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",
|
|
62
|
+
key: "qn84l0"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
["path", { d: "M13 5v2", key: "dyzc3o" }],
|
|
66
|
+
["path", { d: "M13 17v2", key: "1ont0d" }],
|
|
67
|
+
["path", { d: "M13 11v2", key: "1wjjxi" }]
|
|
68
|
+
], O = c("ticket", G), Z = {
|
|
69
|
+
voucher: O,
|
|
70
|
+
pharmacy: N,
|
|
71
|
+
hospital: N,
|
|
72
|
+
map: E,
|
|
73
|
+
location_pin: v,
|
|
74
|
+
"location pin": v,
|
|
75
|
+
check: A,
|
|
76
|
+
calendar: V,
|
|
77
|
+
rupee: F,
|
|
78
|
+
dollar: D,
|
|
79
|
+
euro: R
|
|
80
|
+
};
|
|
81
|
+
function y({
|
|
82
|
+
name: t,
|
|
83
|
+
className: d,
|
|
84
|
+
size: l = 16
|
|
85
|
+
}) {
|
|
86
|
+
const r = t?.trim().toLowerCase().replace(/\s+/g, "_");
|
|
87
|
+
if (!r) return null;
|
|
88
|
+
const i = Z[r];
|
|
89
|
+
if (i)
|
|
90
|
+
return /* @__PURE__ */ e(i, { className: d, size: l, "aria-hidden": !0 });
|
|
91
|
+
}
|
|
92
|
+
function _({
|
|
93
|
+
card: t,
|
|
94
|
+
onSelect: d,
|
|
95
|
+
disabled: l = !1
|
|
96
|
+
}) {
|
|
97
|
+
const {
|
|
98
|
+
title: r,
|
|
99
|
+
tags: i,
|
|
100
|
+
icon: h,
|
|
101
|
+
img: m,
|
|
102
|
+
description: p,
|
|
103
|
+
banner_text: u,
|
|
104
|
+
items: n,
|
|
105
|
+
primary_cta: o,
|
|
106
|
+
secondary_cta: s
|
|
107
|
+
} = t, k = (a) => {
|
|
108
|
+
if (!l && (a.link && window.open(a.link, "_blank", "noopener,noreferrer"), a.text || a.title)) {
|
|
109
|
+
let f = !1;
|
|
110
|
+
t?.primary_cta?.tool_result && (f = !0), d?.({ message: a.text || a.title, selectedCard: t?.title, selectedComponent: t, selected_id: t.card_id, ...f ? { tool_result: t.primary_cta?.tool_result } : {} });
|
|
111
|
+
}
|
|
112
|
+
}, g = !!m;
|
|
113
|
+
return /* @__PURE__ */ e(S, { className: "w-full h-full flex flex-col overflow-hidden rounded-xl border border-black-200 dark:border-white-200 bg-elicitationBg text-card-foreground shadow-none", children: [
|
|
114
|
+
/* @__PURE__ */ e(M, { className: `flex flex-row items-center justify-between gap-3 p-3 ${g ? "bg-primary/[20%]" : ""}`, children: [
|
|
115
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
116
|
+
r ? /* @__PURE__ */ e(w, { className: "text-base font-bold leading-tight tracking-tight truncate", children: r }) : null,
|
|
117
|
+
i ? /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground truncate", children: i }) : null
|
|
118
|
+
] }),
|
|
119
|
+
g ? /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(
|
|
120
|
+
"img",
|
|
121
|
+
{
|
|
122
|
+
src: m,
|
|
123
|
+
alt: r ?? "profile",
|
|
124
|
+
className: "h-16 w-16 rounded-full object-cover border-2 border-background"
|
|
125
|
+
}
|
|
126
|
+
) }) : h ? /* @__PURE__ */ e("div", { className: "shrink-0 text-muted-foreground", children: /* @__PURE__ */ e(y, { name: h, size: 24, className: "text-primary" }) }) : null
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ e(b, { className: "flex-1 space-y-3 pt-3 overflow-hidden", children: [
|
|
129
|
+
p ? /* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-snug prose prose-sm max-w-none prose-strong:font-semibold prose-p:my-0 break-words", children: /* @__PURE__ */ e(C, { children: p }) }) : null,
|
|
130
|
+
u ? /* @__PURE__ */ e("div", { className: "rounded-full px-4 py-2 text-center text-sm font-semibold bg-primary/15 text-primary truncate", children: u }) : null,
|
|
131
|
+
n?.length ? /* @__PURE__ */ e("div", { className: "flex flex-col gap-y-1", children: n.map((a, f) => /* @__PURE__ */ e(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: "flex items-center gap-1.5 text-xs text-foreground min-w-0",
|
|
135
|
+
children: [
|
|
136
|
+
a.icon ? /* @__PURE__ */ e(
|
|
137
|
+
y,
|
|
138
|
+
{
|
|
139
|
+
name: a.icon,
|
|
140
|
+
size: 12,
|
|
141
|
+
className: "shrink-0 text-muted-foreground"
|
|
142
|
+
}
|
|
143
|
+
) : null,
|
|
144
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: a.text })
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
f
|
|
148
|
+
)) }) : null
|
|
149
|
+
] }),
|
|
150
|
+
o?.title || s?.title ? /* @__PURE__ */ e(z, { className: "flex justify-center flex-wrap gap-2 pt-0", children: [
|
|
151
|
+
o && /* @__PURE__ */ e(
|
|
152
|
+
x,
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
variant: "default",
|
|
156
|
+
size: "sm",
|
|
157
|
+
className: `gap-1.5 truncate ${s ? "" : "w-full"}`,
|
|
158
|
+
disabled: l,
|
|
159
|
+
onClick: () => k(o),
|
|
160
|
+
children: [
|
|
161
|
+
o.icon ? /* @__PURE__ */ e(y, { name: o.icon, size: 14, className: "shrink-0" }) : null,
|
|
162
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: o.title })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
s && /* @__PURE__ */ e(
|
|
167
|
+
x,
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
variant: "outline",
|
|
171
|
+
size: "sm",
|
|
172
|
+
className: "gap-1.5 truncate",
|
|
173
|
+
disabled: l,
|
|
174
|
+
onClick: () => k(s),
|
|
175
|
+
children: [
|
|
176
|
+
s.icon ? /* @__PURE__ */ e(y, { name: s.icon, size: 14, className: "shrink-0" }) : null,
|
|
177
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: s.title })
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }) : null
|
|
182
|
+
] });
|
|
183
|
+
}
|
|
184
|
+
function W({
|
|
185
|
+
cards: t,
|
|
186
|
+
onSelect: d,
|
|
187
|
+
disabled: l = !1,
|
|
188
|
+
className: r,
|
|
189
|
+
orientation: i = "vertical"
|
|
190
|
+
}) {
|
|
191
|
+
const [h, m] = $(!1), p = j(!1);
|
|
192
|
+
if (!t?.length)
|
|
193
|
+
return /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground py-2", children: "No options available." });
|
|
194
|
+
const u = async (n) => {
|
|
195
|
+
p.current || (p.current = !0, m(!0), await d?.(n));
|
|
196
|
+
};
|
|
197
|
+
return i !== "horizontal" ? /* @__PURE__ */ e("div", { className: r ?? "flex flex-col gap-3 mt-3", children: t.map((n, o) => /* @__PURE__ */ e(
|
|
198
|
+
_,
|
|
199
|
+
{
|
|
200
|
+
card: n,
|
|
201
|
+
onSelect: u,
|
|
202
|
+
disabled: l || h
|
|
203
|
+
},
|
|
204
|
+
n.card_id || o
|
|
205
|
+
)) }) : /* @__PURE__ */ e(
|
|
206
|
+
I,
|
|
207
|
+
{
|
|
208
|
+
count: t.length,
|
|
209
|
+
renderItem: (n) => /* @__PURE__ */ e(
|
|
210
|
+
_,
|
|
211
|
+
{
|
|
212
|
+
card: t[n],
|
|
213
|
+
onSelect: u,
|
|
214
|
+
disabled: l || h
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
W as CardList
|
|
222
|
+
};
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { c as k, d as m, A as E, y as L, u as e, i as h, C as q, T as B, q as z, _ as te, j as ae, m as re, k as ne, l as ie, n as le, o as se, p as oe, S as ce, r as de, s as me, B as N, t as he } from "./medassist-widget.js";
|
|
2
|
+
import { C as pe } from "./medassist-widget-check-BaHLRs-2.js";
|
|
3
|
+
import { M as P } from "./medassist-widget-map-pin-Bx-5lPdC.js";
|
|
4
|
+
import { C as ue, a as fe } from "./medassist-widget-chevron-right-CKYbGWbY.js";
|
|
5
|
+
const xe = [
|
|
6
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
7
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
8
|
+
], ge = k("arrow-right", xe);
|
|
9
|
+
const ye = [
|
|
10
|
+
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
|
|
11
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
12
|
+
], be = k("clock", ye);
|
|
13
|
+
const ve = [
|
|
14
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
15
|
+
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
16
|
+
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
17
|
+
], we = k("ellipsis", ve);
|
|
18
|
+
const Ne = [
|
|
19
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
20
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
21
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
22
|
+
], ke = k("external-link", Ne);
|
|
23
|
+
const Ce = [
|
|
24
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
25
|
+
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
26
|
+
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
27
|
+
], _e = k("info", Ce);
|
|
28
|
+
const Me = [
|
|
29
|
+
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
30
|
+
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
31
|
+
["path", { d: "M2 5h12", key: "or177f" }],
|
|
32
|
+
["path", { d: "M7 2h1", key: "1t2jsx" }],
|
|
33
|
+
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
34
|
+
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
35
|
+
], Se = k("languages", Me);
|
|
36
|
+
function $e({
|
|
37
|
+
value: l,
|
|
38
|
+
onValueChange: a,
|
|
39
|
+
placeholder: d = "Select an option",
|
|
40
|
+
className: u,
|
|
41
|
+
triggerClassName: S,
|
|
42
|
+
contentClassName: C,
|
|
43
|
+
disabled: s = !1,
|
|
44
|
+
options: b = [],
|
|
45
|
+
size: I = "default",
|
|
46
|
+
icon: $
|
|
47
|
+
}) {
|
|
48
|
+
const [n, y] = m(!1), f = E(null), x = E(null), g = b.find((o) => o.value === l);
|
|
49
|
+
L(() => {
|
|
50
|
+
const o = (p) => {
|
|
51
|
+
n && p.key === "Escape" && (y(!1), x.current?.focus());
|
|
52
|
+
};
|
|
53
|
+
return document.addEventListener("keydown", o), () => {
|
|
54
|
+
document.removeEventListener("keydown", o);
|
|
55
|
+
};
|
|
56
|
+
}, [n]);
|
|
57
|
+
const v = (o) => {
|
|
58
|
+
a?.(o), y(!1), x.current?.focus();
|
|
59
|
+
}, _ = () => {
|
|
60
|
+
s || y(!n);
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ e("div", { className: h("relative w-full", u), children: [
|
|
63
|
+
/* @__PURE__ */ e(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
ref: x,
|
|
67
|
+
type: "button",
|
|
68
|
+
onClick: _,
|
|
69
|
+
disabled: s,
|
|
70
|
+
className: h(
|
|
71
|
+
'border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*="text-"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 overflow-hidden',
|
|
72
|
+
I === "default" ? "min-h-9" : "min-h-8",
|
|
73
|
+
S
|
|
74
|
+
),
|
|
75
|
+
"aria-expanded": n,
|
|
76
|
+
"aria-haspopup": "listbox",
|
|
77
|
+
children: [
|
|
78
|
+
$,
|
|
79
|
+
/* @__PURE__ */ e(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: h(
|
|
83
|
+
"flex-1 text-left min-w-0 overflow-hidden break-words line-clamp-2",
|
|
84
|
+
!g && "text-muted-foreground"
|
|
85
|
+
),
|
|
86
|
+
children: g ? g.label : d
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ e(
|
|
90
|
+
q,
|
|
91
|
+
{
|
|
92
|
+
className: h(
|
|
93
|
+
"size-4 opacity-50 pointer-events-none shrink-0 transition-transform duration-200",
|
|
94
|
+
n && "rotate-180"
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
n && /* @__PURE__ */ e(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
ref: f,
|
|
105
|
+
className: h(
|
|
106
|
+
"bg-surface text-foreground animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 relative z-50 max-h-[136px] min-w-[8rem] w-full overflow-x-hidden overflow-y-auto overscroll-contain rounded-md shadow-md mt-1",
|
|
107
|
+
C
|
|
108
|
+
),
|
|
109
|
+
role: "listbox",
|
|
110
|
+
children: /* @__PURE__ */ e("div", { className: "p-1", children: b.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-muted-foreground text-center", children: "No options available" }) : b.map((o) => {
|
|
111
|
+
const p = o.value === l;
|
|
112
|
+
return /* @__PURE__ */ e(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
onClick: () => v(o.value),
|
|
116
|
+
className: h(
|
|
117
|
+
"relative flex w-full cursor-pointer items-center gap-1 rounded-sm py-2.5 px-3 text-sm outline-none select-none transition-colors duration-150",
|
|
118
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
119
|
+
"focus-visible:bg-accent focus-visible:text-accent-foreground",
|
|
120
|
+
"active:bg-accent/80",
|
|
121
|
+
p && "bg-accent/50 text-foreground",
|
|
122
|
+
s && "pointer-events-none opacity-50 cursor-not-allowed"
|
|
123
|
+
),
|
|
124
|
+
role: "option",
|
|
125
|
+
"aria-selected": p,
|
|
126
|
+
tabIndex: s ? -1 : 0,
|
|
127
|
+
onKeyDown: (w) => {
|
|
128
|
+
(w.key === "Enter" || w.key === " ") && (w.preventDefault(), s || v(o.value));
|
|
129
|
+
},
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ e("span", { className: "flex-1 text-left min-w-0 break-words line-clamp-2", children: o.label }),
|
|
132
|
+
p && /* @__PURE__ */ e("span", { className: "absolute right-3 flex size-4 items-center justify-center shrink-0 pointer-events-none", children: /* @__PURE__ */ e(pe, { className: "size-4 text-foreground" }) })
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
o.value
|
|
136
|
+
);
|
|
137
|
+
}) })
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
function Le({ doctor: l, doctorDetails: a, onSelect: d, disabled: u, isActive: S = !0 }) {
|
|
143
|
+
const C = B(() => {
|
|
144
|
+
if (a?.hospitals?.[0]?.hospital_id)
|
|
145
|
+
return a?.hospitals?.[0]?.hospital_id;
|
|
146
|
+
}, [a?.hospitals]), [s, b] = m(C), [I, $] = m(!1), [n, y] = m(null), [f, x] = m(null), [g, v] = m(0), [_, o] = m(!1), [p, w] = m(!1), [M, R] = m(!1), [T, F] = m(!1), [j, G] = m(!1), O = E(!1), H = E(null);
|
|
147
|
+
L(() => {
|
|
148
|
+
b(C);
|
|
149
|
+
}, [C]);
|
|
150
|
+
const r = l.availability ?? [], K = z(async () => {
|
|
151
|
+
if (!M && (w(!0), !r.length && d && a)) {
|
|
152
|
+
R(!0);
|
|
153
|
+
try {
|
|
154
|
+
await d({ ...l, hospital_id: s });
|
|
155
|
+
} finally {
|
|
156
|
+
R(!1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, [p, M, d, a, r.length, s]), J = z(
|
|
160
|
+
(t) => {
|
|
161
|
+
a && (b(t), y(null), x(null), v(0), O.current = !1, d?.({ ...l, hospital_id: t }));
|
|
162
|
+
},
|
|
163
|
+
[l, d, a]
|
|
164
|
+
);
|
|
165
|
+
L(() => {
|
|
166
|
+
S || w(!1);
|
|
167
|
+
}, [S]), L(() => {
|
|
168
|
+
if (!p || !r.length || O.current) return;
|
|
169
|
+
O.current = !0;
|
|
170
|
+
const t = l.preferred_date || r[0]?.date;
|
|
171
|
+
t && (y((c) => c ?? t), r.find((c) => c.date === t)?.slots?.length || d?.({ ...l, hospital_id: s, preferred_date: t }));
|
|
172
|
+
}, [r, p]);
|
|
173
|
+
const V = B(
|
|
174
|
+
() => r.find((t) => t.date === n)?.slots ?? [],
|
|
175
|
+
[r, n]
|
|
176
|
+
);
|
|
177
|
+
te(() => {
|
|
178
|
+
const t = H.current;
|
|
179
|
+
t && (t.scrollTop = 0, F(t.scrollHeight > t.clientHeight + 2));
|
|
180
|
+
}, [n, V.length]);
|
|
181
|
+
const Q = z(() => {
|
|
182
|
+
const t = H.current;
|
|
183
|
+
t && F(t.scrollTop + t.clientHeight < t.scrollHeight - 4);
|
|
184
|
+
}, []), U = () => {
|
|
185
|
+
H.current?.scrollBy({ top: 120, behavior: "smooth" });
|
|
186
|
+
}, W = B(() => {
|
|
187
|
+
if (!r.length) return [];
|
|
188
|
+
const t = Math.min(g + 3, r.length);
|
|
189
|
+
return r.slice(g, t).map((i) => {
|
|
190
|
+
if (i.date)
|
|
191
|
+
return { ...i, ...ae(i.date) };
|
|
192
|
+
});
|
|
193
|
+
}, [r, g]), X = g > 0, Y = g < Math.max(0, (r || []).length - 3), Z = z(
|
|
194
|
+
async (t) => {
|
|
195
|
+
y(t), x(null);
|
|
196
|
+
const i = r.find((c) => c.date === t);
|
|
197
|
+
if (!(i?.slots?.length || Array.isArray(i?.slots) && i?.slots.length === 0)) {
|
|
198
|
+
$(!0);
|
|
199
|
+
try {
|
|
200
|
+
await d?.({ ...l, hospital_id: s, preferred_date: t });
|
|
201
|
+
} catch {
|
|
202
|
+
} finally {
|
|
203
|
+
$(!1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[l, s, d, r]
|
|
208
|
+
), A = B(() => {
|
|
209
|
+
const t = r.find((i) => i.date === n);
|
|
210
|
+
return re(l.cta, t?.cta);
|
|
211
|
+
}, [r, n, l.cta]), D = () => {
|
|
212
|
+
if (_) return;
|
|
213
|
+
const t = A?.text, i = !!t;
|
|
214
|
+
if (!i && (!f || !n)) return;
|
|
215
|
+
o(!0);
|
|
216
|
+
const c = n && f ? ` on ${n} at ${f}.` : "";
|
|
217
|
+
d?.(
|
|
218
|
+
{ ...l, hospital_id: s, preferred_date: n ?? void 0, preferred_slot_time: f ?? void 0 },
|
|
219
|
+
`${t || `I want to book an appointment with Dr. ${a?.name}`}${c}`,
|
|
220
|
+
A?.tool_result,
|
|
221
|
+
!i
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
return a ? /* @__PURE__ */ e(he, { className: "max-w-md h-full rounded-xl border border-black-200 dark:border-white-200 shadow-none p-0 bg-elicitationBg overflow-hidden", children: [
|
|
225
|
+
/* @__PURE__ */ e(ne, { className: "flex flex-row items-center gap-3 bg-primary/[20%] rounded-t-xl p-2 border-b border-border-subtle overflow-hidden", children: [
|
|
226
|
+
/* @__PURE__ */ e(ie, { className: "h-12 w-12 ring-2 ring-primary/20 flex-shrink-0", children: [
|
|
227
|
+
a.profile_pic && /* @__PURE__ */ e(le, { src: a.profile_pic, alt: `${a.name} profile photo`, crossOrigin: "anonymous" }),
|
|
228
|
+
/* @__PURE__ */ e(se, { className: "bg-secondary text-primary", children: oe(a.name) })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: [
|
|
231
|
+
/* @__PURE__ */ e("h3", { className: "font-bold text-slate-900 leading-tight", style: { fontSize: "0.95rem" }, children: [
|
|
232
|
+
/* @__PURE__ */ e("span", { children: a.name }),
|
|
233
|
+
a.profile_link && /* @__PURE__ */ e(
|
|
234
|
+
"a",
|
|
235
|
+
{
|
|
236
|
+
href: a.profile_link,
|
|
237
|
+
target: "_blank",
|
|
238
|
+
rel: "noreferrer",
|
|
239
|
+
"aria-label": "View profile",
|
|
240
|
+
className: "inline-block align-middle ml-2 text-primary hover:text-primary/70 transition-colors",
|
|
241
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5 inline", "aria-hidden": !0 })
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ e(
|
|
246
|
+
"p",
|
|
247
|
+
{
|
|
248
|
+
className: "mt-0.5 text-xs text-slate-600 line-clamp-1 hover:line-clamp-none hover:whitespace-normal cursor-help",
|
|
249
|
+
title: `${a.specialty}${a.experience ? ` • ${a.experience}` : ""}`,
|
|
250
|
+
children: [
|
|
251
|
+
a.specialty,
|
|
252
|
+
a.experience && /* @__PURE__ */ e(ce, { children: [
|
|
253
|
+
" • ",
|
|
254
|
+
a.experience
|
|
255
|
+
] })
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
] })
|
|
260
|
+
] }),
|
|
261
|
+
/* @__PURE__ */ e(de, { className: "px-3 py-2", children: [
|
|
262
|
+
/* @__PURE__ */ e("div", { className: "grid gap-1 pb-2 border-b border-border-subtle", children: [
|
|
263
|
+
a.timings && /* @__PURE__ */ e("div", { className: "flex items-start gap-2 min-w-0", children: [
|
|
264
|
+
/* @__PURE__ */ e(be, { className: "h-3.5 w-3.5 text-primary mt-0.5 flex-shrink-0", "aria-hidden": !0 }),
|
|
265
|
+
/* @__PURE__ */ e("span", { className: "text-text-secondary text-xs line-clamp-1 min-w-0", children: a.timings })
|
|
266
|
+
] }),
|
|
267
|
+
a.languages && /* @__PURE__ */ e("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
268
|
+
/* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5 text-primary flex-shrink-0", "aria-hidden": !0 }),
|
|
269
|
+
/* @__PURE__ */ e("span", { className: "text-text-secondary text-xs line-clamp-1 min-w-0", children: a.languages })
|
|
270
|
+
] }),
|
|
271
|
+
a.hospitals?.length > 1 && s ? /* @__PURE__ */ e(
|
|
272
|
+
$e,
|
|
273
|
+
{
|
|
274
|
+
options: a.hospitals.map((t) => ({ value: t.hospital_id, label: t.name || "" })),
|
|
275
|
+
placeholder: "Select Hospital",
|
|
276
|
+
disabled: u,
|
|
277
|
+
onValueChange: J,
|
|
278
|
+
value: s,
|
|
279
|
+
triggerClassName: "h-8 text-xs px-3 rounded-lg border-border text-primary font-medium",
|
|
280
|
+
icon: /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5 text-primary flex-shrink-0", "aria-hidden": !0 })
|
|
281
|
+
}
|
|
282
|
+
) : /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
283
|
+
/* @__PURE__ */ e(P, { className: "h-3.5 w-3.5 text-primary flex-shrink-0", "aria-hidden": !0 }),
|
|
284
|
+
/* @__PURE__ */ e("span", { className: "text-text-secondary text-xs line-clamp-1 min-w-0", children: a.hospitals?.[0]?.name || "" })
|
|
285
|
+
] }),
|
|
286
|
+
a.info && /* @__PURE__ */ e("div", { className: "flex items-start gap-2 min-w-0", children: [
|
|
287
|
+
/* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5 text-primary flex-shrink-0", "aria-hidden": !0 }),
|
|
288
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: [
|
|
289
|
+
/* @__PURE__ */ e(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
className: h(
|
|
293
|
+
"text-text-secondary text-xs leading-snug prose prose-sm max-w-none prose-strong:font-semibold prose-p:my-0 break-words overflow-hidden",
|
|
294
|
+
!j && "line-clamp-1"
|
|
295
|
+
),
|
|
296
|
+
children: /* @__PURE__ */ e(me, { children: a.info })
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ e(
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
onClick: () => G((t) => !t),
|
|
304
|
+
"aria-expanded": j,
|
|
305
|
+
className: "mt-0.5 flex items-center gap-1 text-[11px] font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ e(we, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
308
|
+
j ? "View less" : "View more"
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
] })
|
|
313
|
+
] })
|
|
314
|
+
] }),
|
|
315
|
+
p ? M ? /* @__PURE__ */ e("p", { className: "pt-3 text-sm text-text-secondary text-center", children: "Loading..." }) : r.length > 0 ? /* @__PURE__ */ e("div", { className: "pt-3", children: [
|
|
316
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: [
|
|
317
|
+
/* @__PURE__ */ e(
|
|
318
|
+
N,
|
|
319
|
+
{
|
|
320
|
+
type: "button",
|
|
321
|
+
variant: "outline",
|
|
322
|
+
size: "icon",
|
|
323
|
+
onClick: () => {
|
|
324
|
+
v((t) => Math.max(0, t - 3)), x(null);
|
|
325
|
+
},
|
|
326
|
+
disabled: u || !X,
|
|
327
|
+
"aria-label": "Previous 3 days",
|
|
328
|
+
className: "h-8 w-8 flex-shrink-0 rounded-md border-primary/20 bg-surface text-primary hover:bg-surface-secondary disabled:opacity-50",
|
|
329
|
+
children: /* @__PURE__ */ e(ue, { className: "h-4 w-4" })
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ e("div", { className: "flex-1 grid grid-cols-3 gap-1 min-w-0", children: W.map((t, i) => {
|
|
333
|
+
if (!t || !t.date) return null;
|
|
334
|
+
const c = n === t.date, ee = (t?.slots || []).length > 0;
|
|
335
|
+
return /* @__PURE__ */ e(
|
|
336
|
+
N,
|
|
337
|
+
{
|
|
338
|
+
type: "button",
|
|
339
|
+
variant: "outline",
|
|
340
|
+
onClick: () => t.date && Z(t.date),
|
|
341
|
+
disabled: u,
|
|
342
|
+
"aria-current": c ? "date" : void 0,
|
|
343
|
+
className: h(
|
|
344
|
+
"flex flex-col items-center justify-center h-12 rounded-lg border-2 p-2 gap-0.5 min-w-0 transition-all",
|
|
345
|
+
c ? "border-primary border-2 ring-2 ring-primary/20 bg-primary/[20%] shadow-sm hover:text-accent-foreground" : ee ? "border-primary/30 bg-elicitationBg hover:bg-primary/10 hover:text-accent-foreground hover:border-primary/40" : "border-border bg-elicitationBg opacity-60 hover:bg-primary/10 hover:text-accent-foreground hover:border-primary/30"
|
|
346
|
+
),
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ e("span", { className: h("text-[10px] tracking-wide w-full text-center font-medium"), children: t.weekday }),
|
|
349
|
+
/* @__PURE__ */ e("span", { className: h("text-xs font-bold w-full text-center"), children: t.dayNum })
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
`${t.date}-${i}`
|
|
353
|
+
);
|
|
354
|
+
}) }),
|
|
355
|
+
/* @__PURE__ */ e(
|
|
356
|
+
N,
|
|
357
|
+
{
|
|
358
|
+
type: "button",
|
|
359
|
+
variant: "outline",
|
|
360
|
+
size: "icon",
|
|
361
|
+
onClick: () => {
|
|
362
|
+
v((t) => Math.min(Math.max(0, r.length - 3), t + 3)), x(null);
|
|
363
|
+
},
|
|
364
|
+
disabled: u || !Y,
|
|
365
|
+
"aria-label": "Next 3 days",
|
|
366
|
+
className: "h-8 w-8 flex-shrink-0 rounded-md border-primary/20 bg-surface text-primary hover:bg-surface-secondary disabled:opacity-50",
|
|
367
|
+
children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" })
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
] }),
|
|
371
|
+
n && /* @__PURE__ */ e("div", { className: "mt-2", children: V.length > 0 ? /* @__PURE__ */ e("div", { className: "relative", children: [
|
|
372
|
+
/* @__PURE__ */ e(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
ref: H,
|
|
376
|
+
onScroll: Q,
|
|
377
|
+
className: "grid grid-cols-3 gap-2 overflow-y-auto overscroll-contain",
|
|
378
|
+
style: { maxHeight: "108px" },
|
|
379
|
+
children: V.map((t, i) => {
|
|
380
|
+
if (!t) return null;
|
|
381
|
+
const c = f === t;
|
|
382
|
+
return /* @__PURE__ */ e(
|
|
383
|
+
N,
|
|
384
|
+
{
|
|
385
|
+
type: "button",
|
|
386
|
+
variant: "outline",
|
|
387
|
+
onClick: () => x(t),
|
|
388
|
+
"aria-pressed": c,
|
|
389
|
+
disabled: u,
|
|
390
|
+
className: h(
|
|
391
|
+
"h-9 rounded-lg px-2 text-xs font-medium transition-all",
|
|
392
|
+
c ? "border-primary bg-primary/20 text-primary shadow-sm hover:bg-primary/10" : "border-border bg-elicitationBg text-text-primary hover:bg-primary/10 hover:border-primary/30"
|
|
393
|
+
),
|
|
394
|
+
children: /* @__PURE__ */ e("span", { children: t })
|
|
395
|
+
},
|
|
396
|
+
t || `slot-${i}`
|
|
397
|
+
);
|
|
398
|
+
})
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
T && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-elicitationBg via-elicitationBg to-transparent pointer-events-none flex items-end justify-center pb-1", children: /* @__PURE__ */ e(
|
|
402
|
+
"button",
|
|
403
|
+
{
|
|
404
|
+
type: "button",
|
|
405
|
+
onClick: U,
|
|
406
|
+
className: "pointer-events-auto flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ e(q, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
409
|
+
"More slots"
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
) })
|
|
413
|
+
] }) : I ? /* @__PURE__ */ e("p", { className: "text-sm text-text-secondary px-1", children: "Fetching slots..." }) : /* @__PURE__ */ e("p", { className: "text-sm text-text-secondary px-1", children: "No slots available." }) }),
|
|
414
|
+
/* @__PURE__ */ e(
|
|
415
|
+
N,
|
|
416
|
+
{
|
|
417
|
+
type: "button",
|
|
418
|
+
onClick: D,
|
|
419
|
+
disabled: u || _ || !A?.text && !f,
|
|
420
|
+
"aria-disabled": !f || _,
|
|
421
|
+
className: `w-full h-10 gap-2 bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-60 shadow-sm font-semibold ${T ? "" : " mt-2"}`,
|
|
422
|
+
children: [
|
|
423
|
+
A?.title || "Book appointment",
|
|
424
|
+
/* @__PURE__ */ e(ge, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] }) : /* @__PURE__ */ e("p", { className: "pt-3 text-sm text-text-secondary text-center", children: "No slots available." }) : /* @__PURE__ */ e("div", { className: "pt-3", children: /* @__PURE__ */ e(
|
|
429
|
+
N,
|
|
430
|
+
{
|
|
431
|
+
type: "button",
|
|
432
|
+
variant: "outline",
|
|
433
|
+
onClick: K,
|
|
434
|
+
disabled: u || M,
|
|
435
|
+
className: "w-full h-8 gap-1.5 text-xs border-primary/40 text-primary hover:bg-primary/10 disabled:opacity-60 font-medium rounded-lg",
|
|
436
|
+
children: [
|
|
437
|
+
M ? "Loading..." : "Show available slots",
|
|
438
|
+
/* @__PURE__ */ e(q, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
) })
|
|
442
|
+
] })
|
|
443
|
+
] }) : null;
|
|
444
|
+
}
|
|
445
|
+
export {
|
|
446
|
+
Le as DoctorCard
|
|
447
|
+
};
|