@eka-care/medassist-widget 0.1.86-1 → 0.1.86

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.
@@ -1 +1,222 @@
1
- import{c as d,u as e,k as _,t as z,p as C,r as j,v as A,B as b,s as H,d as S,A as V}from"./medassist-widget.js";import{C as q}from"./medassist-widget-check-BaHLRs-2.js";import{M as N}from"./medassist-widget-map-pin-Bx-5lPdC.js";import{FocusCarousel as B}from"./medassist-widget-FocusCarousel-BsLIZftX.js";const L=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{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",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],M=d("building-2",L),$=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],F=d("calendar",$),I=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Z=d("dollar-sign",I),D=[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{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",key:"1j6lzo"}]],E=d("euro",D),G=[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]],O=d("indian-rupee",G),P=[["path",{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",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],R=d("map",P),T=[["path",{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",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],W=d("ticket",T),J={voucher:W,pharmacy:M,hospital:M,map:R,location_pin:N,"location pin":N,check:q,calendar:F,rupee:O,dollar:Z,euro:E};function f({name:a,className:s,size:c=16}){const t=a==null?void 0:a.trim().toLowerCase().replace(/\s+/g,"_");if(!t)return null;const o=J[t];if(o)return e(o,{className:s,size:c,"aria-hidden":!0})}function w({card:a,onSelect:s,disabled:c=!1}){const{title:t,tags:o,icon:p,img:u,description:h,banner_text:m,items:l,primary_cta:n,secondary_cta:i}=a,k=r=>{var y,g;if(!c&&(r.link&&window.open(r.link,"_blank","noopener,noreferrer"),r.text||r.title)){let v=!1;(y=a==null?void 0:a.primary_cta)!=null&&y.tool_result&&(v=!0),s==null||s({message:r.text||r.title,selectedCard:a==null?void 0:a.title,selectedComponent:a,selected_id:a.card_id,...v?{tool_result:(g=a.primary_cta)==null?void 0:g.tool_result}:{}})}},x=!!u;return e(H,{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:[e(_,{className:`flex flex-row items-center justify-between gap-3 p-3 ${x?"bg-primary/[20%]":""}`,children:[e("div",{className:"min-w-0 flex-1 overflow-hidden",children:[t?e(z,{className:"text-base font-bold leading-tight tracking-tight truncate",children:t}):null,o?e("p",{className:"mt-1 text-sm text-muted-foreground truncate",children:o}):null]}),x?e("div",{className:"shrink-0",children:e("img",{src:u,alt:t!=null?t:"profile",className:"h-16 w-16 rounded-full object-cover border-2 border-background"})}):p?e("div",{className:"shrink-0 text-muted-foreground",children:e(f,{name:p,size:24,className:"text-primary"})}):null]}),e(C,{className:"flex-1 space-y-3 pt-3 overflow-hidden",children:[h?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:e(j,{children:h})}):null,m?e("div",{className:"rounded-full px-4 py-2 text-center text-sm font-semibold bg-primary/15 text-primary truncate",children:m}):null,l!=null&&l.length?e("div",{className:"flex flex-col gap-y-1",children:l.map((r,y)=>e("div",{className:"flex items-center gap-1.5 text-xs text-foreground min-w-0",children:[r.icon?e(f,{name:r.icon,size:12,className:"shrink-0 text-muted-foreground"}):null,e("span",{className:"truncate",children:r.text})]},y))}):null]}),n!=null&&n.title||i!=null&&i.title?e(A,{className:"flex justify-center flex-wrap gap-2 pt-0",children:[n&&e(b,{type:"button",variant:"default",size:"sm",className:`gap-1.5 truncate ${i?"":"w-full"}`,disabled:c,onClick:()=>k(n),children:[n.icon?e(f,{name:n.icon,size:14,className:"shrink-0"}):null,e("span",{className:"truncate",children:n.title})]}),i&&e(b,{type:"button",variant:"outline",size:"sm",className:"gap-1.5 truncate",disabled:c,onClick:()=>k(i),children:[i.icon?e(f,{name:i.icon,size:14,className:"shrink-0"}):null,e("span",{className:"truncate",children:i.title})]})]}):null]})}function K({cards:a,onSelect:s,disabled:c=!1,className:t,orientation:o="vertical"}){const[p,u]=S(!1),h=V(!1);if(!(a!=null&&a.length))return e("p",{className:"text-sm text-muted-foreground py-2",children:"No options available."});const m=async l=>{h.current||(h.current=!0,u(!0),await(s==null?void 0:s(l)))};return o!=="horizontal"?e("div",{className:t!=null?t:"flex flex-col gap-3 mt-3",children:a.map((l,n)=>e(w,{card:l,onSelect:m,disabled:c||p},l.card_id||n))}):e(B,{count:a.length,renderItem:l=>e(w,{card:a[l],onSelect:m,disabled:c||p})})}export{K as CardList};
1
+ import { c, u as e, k as M, t as b, p as w, r as C, v as z, B as x, s 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: p,
101
+ img: m,
102
+ description: h,
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(b, { 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
+ ) }) : p ? /* @__PURE__ */ e("div", { className: "shrink-0 text-muted-foreground", children: /* @__PURE__ */ e(y, { name: p, size: 24, className: "text-primary" }) }) : null
127
+ ] }),
128
+ /* @__PURE__ */ e(w, { className: "flex-1 space-y-3 pt-3 overflow-hidden", children: [
129
+ h ? /* @__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: h }) }) : 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 [p, m] = $(!1), h = 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
+ h.current || (h.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 || p
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 || p
215
+ }
216
+ )
217
+ }
218
+ );
219
+ }
220
+ export {
221
+ W as CardList
222
+ };