@eka-care/medassist-widget-embed 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe.js +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/src/medassist-widget.css +41 -82
- package/dist/src/medassist-widget.js +229 -163
- package/dist/src/medassist-widget.js.map +1 -1
- package/iframe.ts +5 -1
- package/index.ts +6 -1
- package/package.json +1 -1
- package/src/medassist-widget.css +41 -82
- package/src/medassist-widget.js +229 -163
- package/src/medassist-widget.js.map +1 -1
- package/test.html +1 -1
package/src/medassist-widget.js
CHANGED
|
@@ -26043,12 +26043,12 @@ var MedAssistWidget = (function(exports) {
|
|
|
26043
26043
|
Component.displayName = toPascalCase(iconName);
|
|
26044
26044
|
return Component;
|
|
26045
26045
|
};
|
|
26046
|
-
const __iconNode$
|
|
26046
|
+
const __iconNode$k = [
|
|
26047
26047
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
26048
26048
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
26049
26049
|
];
|
|
26050
|
-
const ArrowRight = createLucideIcon("arrow-right", __iconNode$
|
|
26051
|
-
const __iconNode$
|
|
26050
|
+
const ArrowRight = createLucideIcon("arrow-right", __iconNode$k);
|
|
26051
|
+
const __iconNode$j = [
|
|
26052
26052
|
["path", { d: "M10 12h4", key: "a56b0p" }],
|
|
26053
26053
|
["path", { d: "M10 8h4", key: "1sr2af" }],
|
|
26054
26054
|
["path", { d: "M14 21v-3a2 2 0 0 0-4 0v3", key: "1rgiei" }],
|
|
@@ -26061,28 +26061,28 @@ var MedAssistWidget = (function(exports) {
|
|
|
26061
26061
|
],
|
|
26062
26062
|
["path", { d: "M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16", key: "16ra0t" }]
|
|
26063
26063
|
];
|
|
26064
|
-
const Building2 = createLucideIcon("building-2", __iconNode$
|
|
26065
|
-
const __iconNode$
|
|
26064
|
+
const Building2 = createLucideIcon("building-2", __iconNode$j);
|
|
26065
|
+
const __iconNode$i = [
|
|
26066
26066
|
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
26067
26067
|
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
26068
26068
|
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
26069
26069
|
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
26070
26070
|
];
|
|
26071
|
-
const Calendar = createLucideIcon("calendar", __iconNode$
|
|
26072
|
-
const __iconNode$
|
|
26073
|
-
const Check = createLucideIcon("check", __iconNode$
|
|
26074
|
-
const __iconNode$
|
|
26075
|
-
const ChevronDown = createLucideIcon("chevron-down", __iconNode$
|
|
26076
|
-
const __iconNode$
|
|
26077
|
-
const ChevronLeft = createLucideIcon("chevron-left", __iconNode$
|
|
26078
|
-
const __iconNode$
|
|
26079
|
-
const ChevronRight = createLucideIcon("chevron-right", __iconNode$
|
|
26080
|
-
const __iconNode$
|
|
26071
|
+
const Calendar = createLucideIcon("calendar", __iconNode$i);
|
|
26072
|
+
const __iconNode$h = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
26073
|
+
const Check = createLucideIcon("check", __iconNode$h);
|
|
26074
|
+
const __iconNode$g = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
26075
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$g);
|
|
26076
|
+
const __iconNode$f = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
26077
|
+
const ChevronLeft = createLucideIcon("chevron-left", __iconNode$f);
|
|
26078
|
+
const __iconNode$e = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
26079
|
+
const ChevronRight = createLucideIcon("chevron-right", __iconNode$e);
|
|
26080
|
+
const __iconNode$d = [
|
|
26081
26081
|
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
|
|
26082
26082
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
26083
26083
|
];
|
|
26084
|
-
const Clock = createLucideIcon("clock", __iconNode$
|
|
26085
|
-
const __iconNode$
|
|
26084
|
+
const Clock = createLucideIcon("clock", __iconNode$d);
|
|
26085
|
+
const __iconNode$c = [
|
|
26086
26086
|
[
|
|
26087
26087
|
"path",
|
|
26088
26088
|
{
|
|
@@ -26095,8 +26095,8 @@ var MedAssistWidget = (function(exports) {
|
|
|
26095
26095
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
26096
26096
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
26097
26097
|
];
|
|
26098
|
-
const FileText = createLucideIcon("file-text", __iconNode$
|
|
26099
|
-
const __iconNode$
|
|
26098
|
+
const FileText = createLucideIcon("file-text", __iconNode$c);
|
|
26099
|
+
const __iconNode$b = [
|
|
26100
26100
|
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
26101
26101
|
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
26102
26102
|
["path", { d: "M2 5h12", key: "or177f" }],
|
|
@@ -26104,15 +26104,15 @@ var MedAssistWidget = (function(exports) {
|
|
|
26104
26104
|
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
26105
26105
|
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
26106
26106
|
];
|
|
26107
|
-
const Languages = createLucideIcon("languages", __iconNode$
|
|
26108
|
-
const __iconNode$
|
|
26107
|
+
const Languages = createLucideIcon("languages", __iconNode$b);
|
|
26108
|
+
const __iconNode$a = [
|
|
26109
26109
|
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
26110
26110
|
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
26111
26111
|
];
|
|
26112
|
-
const Link = createLucideIcon("link", __iconNode$
|
|
26113
|
-
const __iconNode$
|
|
26114
|
-
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$
|
|
26115
|
-
const __iconNode$
|
|
26112
|
+
const Link = createLucideIcon("link", __iconNode$a);
|
|
26113
|
+
const __iconNode$9 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
26114
|
+
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$9);
|
|
26115
|
+
const __iconNode$8 = [
|
|
26116
26116
|
[
|
|
26117
26117
|
"path",
|
|
26118
26118
|
{
|
|
@@ -26122,7 +26122,19 @@ var MedAssistWidget = (function(exports) {
|
|
|
26122
26122
|
],
|
|
26123
26123
|
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
|
|
26124
26124
|
];
|
|
26125
|
-
const MapPin = createLucideIcon("map-pin", __iconNode$
|
|
26125
|
+
const MapPin = createLucideIcon("map-pin", __iconNode$8);
|
|
26126
|
+
const __iconNode$7 = [
|
|
26127
|
+
[
|
|
26128
|
+
"path",
|
|
26129
|
+
{
|
|
26130
|
+
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",
|
|
26131
|
+
key: "169xi5"
|
|
26132
|
+
}
|
|
26133
|
+
],
|
|
26134
|
+
["path", { d: "M15 5.764v15", key: "1pn4in" }],
|
|
26135
|
+
["path", { d: "M9 3.236v15", key: "1uimfh" }]
|
|
26136
|
+
];
|
|
26137
|
+
const Map$1 = createLucideIcon("map", __iconNode$7);
|
|
26126
26138
|
const __iconNode$6 = [
|
|
26127
26139
|
[
|
|
26128
26140
|
"path",
|
|
@@ -27490,7 +27502,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
27490
27502
|
PILL: "pills",
|
|
27491
27503
|
MULTI: "multi",
|
|
27492
27504
|
DOCTOR_CARD: "doctor_card",
|
|
27493
|
-
|
|
27505
|
+
CARD: "card"
|
|
27494
27506
|
};
|
|
27495
27507
|
var SYNAPSE_TOOL_CALLBACK_NAME;
|
|
27496
27508
|
(function(SYNAPSE_TOOL_CALLBACK_NAME2) {
|
|
@@ -27613,7 +27625,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
27613
27625
|
try {
|
|
27614
27626
|
const { profile, intent, user_location, referer, ...extraContext } = context || {};
|
|
27615
27627
|
const sessionRequest = {
|
|
27616
|
-
user_id: userId,
|
|
27628
|
+
...userId && { user_id: userId },
|
|
27617
27629
|
...profile && { user_context: profile },
|
|
27618
27630
|
...(intent || Object.keys(extraContext).length > 0) && {
|
|
27619
27631
|
session_context: {
|
|
@@ -29160,7 +29172,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
29160
29172
|
* Create a new session
|
|
29161
29173
|
*/
|
|
29162
29174
|
async createNewSession() {
|
|
29163
|
-
return await this.resourceManager.createSession(this.config.userId
|
|
29175
|
+
return await this.resourceManager.createSession(this.config.userId, this.config.context);
|
|
29164
29176
|
}
|
|
29165
29177
|
/**
|
|
29166
29178
|
* Set up event handlers for connection and messages
|
|
@@ -30659,7 +30671,8 @@ var MedAssistWidget = (function(exports) {
|
|
|
30659
30671
|
isMobile,
|
|
30660
30672
|
placeholder: chatComposer.placeholder,
|
|
30661
30673
|
recordingStatus: chatComposer.recordingStatus,
|
|
30662
|
-
theme: mergedTheme
|
|
30674
|
+
theme: mergedTheme,
|
|
30675
|
+
allowed: chatComposer.allowed
|
|
30663
30676
|
}
|
|
30664
30677
|
) }),
|
|
30665
30678
|
sessionId && environment === "development" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-6 flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-[8px] text-text-secondary font-mono opacity-50", children: [
|
|
@@ -30741,6 +30754,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
30741
30754
|
updateMessageInSession,
|
|
30742
30755
|
setInitialMessage,
|
|
30743
30756
|
userId,
|
|
30757
|
+
setUserId,
|
|
30744
30758
|
fileUploadPerSession,
|
|
30745
30759
|
setFileUploadPerSession
|
|
30746
30760
|
} = useMedAssistStore();
|
|
@@ -30967,6 +30981,9 @@ var MedAssistWidget = (function(exports) {
|
|
|
30967
30981
|
session
|
|
30968
30982
|
);
|
|
30969
30983
|
}
|
|
30984
|
+
if (session?.user_id) {
|
|
30985
|
+
setUserId(session.user_id);
|
|
30986
|
+
}
|
|
30970
30987
|
setUpEventListeners();
|
|
30971
30988
|
} catch (error) {
|
|
30972
30989
|
console.error("useChat: Error starting session", error);
|
|
@@ -31551,8 +31568,6 @@ var MedAssistWidget = (function(exports) {
|
|
|
31551
31568
|
setError,
|
|
31552
31569
|
// initialMessage,
|
|
31553
31570
|
sessionId,
|
|
31554
|
-
setUserId,
|
|
31555
|
-
userId,
|
|
31556
31571
|
setContext
|
|
31557
31572
|
} = useMedAssistStore();
|
|
31558
31573
|
const {
|
|
@@ -31581,10 +31596,6 @@ var MedAssistWidget = (function(exports) {
|
|
|
31581
31596
|
return;
|
|
31582
31597
|
}
|
|
31583
31598
|
setAgentId(agentId);
|
|
31584
|
-
if (!userId) {
|
|
31585
|
-
const uuid = crypto?.randomUUID?.() || Date.now().toString();
|
|
31586
|
-
setUserId(uuid);
|
|
31587
|
-
}
|
|
31588
31599
|
if (config?.context && Object.keys(config?.context || {}).length) {
|
|
31589
31600
|
setContext(config.context);
|
|
31590
31601
|
}
|
|
@@ -31733,7 +31744,8 @@ var MedAssistWidget = (function(exports) {
|
|
|
31733
31744
|
attachmentFiles,
|
|
31734
31745
|
isDisabled: isComposerDisabled,
|
|
31735
31746
|
placeholder: composerPlaceholder,
|
|
31736
|
-
recordingStatus
|
|
31747
|
+
recordingStatus,
|
|
31748
|
+
allowed: config.allowed
|
|
31737
31749
|
},
|
|
31738
31750
|
children: !loading && /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetContentFallback, {}), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex-1 flex flex-col min-h-0 overflow-hidden relative synapse-chat-window", config.theme?.backgroundImage ? "" : "bg-surface"), children: [
|
|
31739
31751
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -32000,11 +32012,14 @@ var MedAssistWidget = (function(exports) {
|
|
|
32000
32012
|
placeholder,
|
|
32001
32013
|
isMobile,
|
|
32002
32014
|
recordingStatus,
|
|
32003
|
-
theme
|
|
32015
|
+
theme,
|
|
32016
|
+
allowed
|
|
32004
32017
|
}) {
|
|
32005
32018
|
const fileInputRef = reactExports.useRef(null);
|
|
32006
32019
|
const textareaRef = reactExports.useRef(null);
|
|
32007
32020
|
const showSendButton = value.trim().length > 0 || hasAttachment;
|
|
32021
|
+
const showMic = allowed === void 0 || allowed.includes("audio");
|
|
32022
|
+
const showFileAttachment = allowed === void 0 || allowed.includes("file");
|
|
32008
32023
|
const isMicDisabled = (isDisabled || recordingStatus !== AudioRecordingStatus.IDLE) && !isRecording;
|
|
32009
32024
|
const micButtonClasses = cn(
|
|
32010
32025
|
"rounded-full transition-all duration-200 ",
|
|
@@ -32080,7 +32095,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
32080
32095
|
}
|
|
32081
32096
|
),
|
|
32082
32097
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
|
|
32083
|
-
recordingStatus === AudioRecordingStatus.IDLE && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
32098
|
+
showFileAttachment && recordingStatus === AudioRecordingStatus.IDLE && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
32084
32099
|
Button,
|
|
32085
32100
|
{
|
|
32086
32101
|
type: "button",
|
|
@@ -32146,7 +32161,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
32146
32161
|
"aria-label": "Stop recording",
|
|
32147
32162
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Square, { className: "w-4 h-4" })
|
|
32148
32163
|
}
|
|
32149
|
-
) : !showSendButton && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
32164
|
+
) : showMic && !showSendButton && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
32150
32165
|
Button,
|
|
32151
32166
|
{
|
|
32152
32167
|
type: "button",
|
|
@@ -43028,128 +43043,178 @@ var MedAssistWidget = (function(exports) {
|
|
|
43028
43043
|
] })
|
|
43029
43044
|
] });
|
|
43030
43045
|
}
|
|
43031
|
-
|
|
43032
|
-
|
|
43033
|
-
|
|
43034
|
-
|
|
43035
|
-
|
|
43036
|
-
|
|
43037
|
-
|
|
43038
|
-
|
|
43039
|
-
|
|
43046
|
+
const CARD_ICONS = {
|
|
43047
|
+
voucher: Ticket,
|
|
43048
|
+
pharmacy: Building2,
|
|
43049
|
+
hospital: Building2,
|
|
43050
|
+
map: Map$1,
|
|
43051
|
+
location_pin: MapPin,
|
|
43052
|
+
"location pin": MapPin,
|
|
43053
|
+
check: Check,
|
|
43054
|
+
calendar: Calendar
|
|
43055
|
+
};
|
|
43056
|
+
const ICON_CDN_BASE = "https://cdn.jsdelivr.net/npm/lucide-static@0.263.1/icons";
|
|
43057
|
+
function CardIcon({
|
|
43058
|
+
name: name2,
|
|
43059
|
+
className,
|
|
43060
|
+
size = 16
|
|
43040
43061
|
}) {
|
|
43041
|
-
const
|
|
43042
|
-
|
|
43043
|
-
const
|
|
43044
|
-
|
|
43045
|
-
|
|
43062
|
+
const key = name2?.trim().toLowerCase().replace(/\s+/g, "_");
|
|
43063
|
+
if (!key) return null;
|
|
43064
|
+
const IconComponent = CARD_ICONS[key];
|
|
43065
|
+
if (IconComponent) {
|
|
43066
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { className, size, "aria-hidden": true });
|
|
43067
|
+
}
|
|
43068
|
+
if (/^https?:\/\//i.test(name2) || name2.startsWith("//")) {
|
|
43069
|
+
const src = name2.startsWith("//") ? `https:${name2}` : name2;
|
|
43070
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43071
|
+
"img",
|
|
43072
|
+
{
|
|
43073
|
+
src,
|
|
43074
|
+
alt: "",
|
|
43075
|
+
className,
|
|
43076
|
+
width: size,
|
|
43077
|
+
height: size,
|
|
43078
|
+
"aria-hidden": true,
|
|
43079
|
+
onError: (e) => {
|
|
43080
|
+
e.target.style.display = "none";
|
|
43081
|
+
}
|
|
43082
|
+
}
|
|
43083
|
+
);
|
|
43084
|
+
}
|
|
43085
|
+
const kebab2 = key.replace(/_/g, "-");
|
|
43086
|
+
const cdnUrl = `${ICON_CDN_BASE}/${kebab2}.svg`;
|
|
43046
43087
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43047
|
-
|
|
43088
|
+
"img",
|
|
43048
43089
|
{
|
|
43049
|
-
|
|
43050
|
-
|
|
43051
|
-
|
|
43052
|
-
|
|
43053
|
-
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
|
|
43057
|
-
|
|
43058
|
-
{
|
|
43059
|
-
className: cn(
|
|
43060
|
-
"font-semibold leading-tight",
|
|
43061
|
-
isCustom ? "text-base text-white" : "text-foreground text-sm"
|
|
43062
|
-
),
|
|
43063
|
-
children: pharmacy.name || "Pharmacy"
|
|
43064
|
-
}
|
|
43065
|
-
),
|
|
43066
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43067
|
-
"div",
|
|
43068
|
-
{
|
|
43069
|
-
className: cn(
|
|
43070
|
-
"shrink-0 rounded-lg p-1.5",
|
|
43071
|
-
isCustom ? "bg-[var(--accent-400)]/20 text-[var(--accent-300)]" : "bg-accent/10 text-[var(--color-primary)]"
|
|
43072
|
-
),
|
|
43073
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Building2, { className: "h-4 w-4", "aria-hidden": true })
|
|
43074
|
-
}
|
|
43075
|
-
)
|
|
43076
|
-
] }),
|
|
43077
|
-
subtitle ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43078
|
-
"p",
|
|
43079
|
-
{
|
|
43080
|
-
className: cn(
|
|
43081
|
-
"text-xs mb-3",
|
|
43082
|
-
isCustom ? "text-[var(--white-600)]" : "text-muted-foreground"
|
|
43083
|
-
),
|
|
43084
|
-
children: subtitle
|
|
43085
|
-
}
|
|
43086
|
-
) : null,
|
|
43087
|
-
pharmacy.offer ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43088
|
-
"div",
|
|
43089
|
-
{
|
|
43090
|
-
className: cn(
|
|
43091
|
-
"inline-flex items-center rounded-full px-3 py-1 text-xs font-medium mb-4",
|
|
43092
|
-
isCustom ? "bg-emerald-900/80 text-emerald-300" : "bg-emerald-100 text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-300"
|
|
43093
|
-
),
|
|
43094
|
-
children: pharmacy.offer
|
|
43095
|
-
}
|
|
43096
|
-
) : null,
|
|
43097
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
43098
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
43099
|
-
Button,
|
|
43100
|
-
{
|
|
43101
|
-
type: "button",
|
|
43102
|
-
size: "sm",
|
|
43103
|
-
className: cn(
|
|
43104
|
-
"rounded-lg gap-1.5 font-medium",
|
|
43105
|
-
isCustom ? "bg-[var(--accent-400)] text-[var(--accent-1000)] hover:bg-[var(--accent-300)]" : "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
43106
|
-
),
|
|
43107
|
-
onClick: () => onGetVoucher?.(pharmacy),
|
|
43108
|
-
children: [
|
|
43109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Ticket, { className: "h-4 w-4", "aria-hidden": true }),
|
|
43110
|
-
"Get voucher"
|
|
43111
|
-
]
|
|
43112
|
-
}
|
|
43113
|
-
),
|
|
43114
|
-
hasLink && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
43115
|
-
Button,
|
|
43116
|
-
{
|
|
43117
|
-
type: "button",
|
|
43118
|
-
variant: "outline",
|
|
43119
|
-
size: "sm",
|
|
43120
|
-
className: cn(
|
|
43121
|
-
"rounded-lg gap-1.5",
|
|
43122
|
-
isCustom ? "border-[var(--white-300)] text-[var(--white-900)] hover:bg-[var(--white-100)]" : "border-border bg-background text-foreground hover:bg-accent"
|
|
43123
|
-
),
|
|
43124
|
-
onClick: () => pharmacy.link && window.open(pharmacy.link, "_blank", "noopener,noreferrer"),
|
|
43125
|
-
children: [
|
|
43126
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MapPin, { className: "h-4 w-4", "aria-hidden": true }),
|
|
43127
|
-
"View on maps"
|
|
43128
|
-
]
|
|
43129
|
-
}
|
|
43130
|
-
)
|
|
43131
|
-
] })
|
|
43132
|
-
] })
|
|
43090
|
+
src: cdnUrl,
|
|
43091
|
+
alt: "",
|
|
43092
|
+
className,
|
|
43093
|
+
width: size,
|
|
43094
|
+
height: size,
|
|
43095
|
+
"aria-hidden": true,
|
|
43096
|
+
onError: (e) => {
|
|
43097
|
+
e.target.style.display = "none";
|
|
43098
|
+
}
|
|
43133
43099
|
}
|
|
43134
43100
|
);
|
|
43135
43101
|
}
|
|
43136
|
-
|
|
43137
|
-
|
|
43138
|
-
|
|
43139
|
-
|
|
43102
|
+
const BANNER_THEME_CLASSES = {
|
|
43103
|
+
success: "bg-emerald-100 text-emerald-800",
|
|
43104
|
+
warning: "bg-amber-100 text-amber-800",
|
|
43105
|
+
danger: "bg-red-100 text-red-800",
|
|
43106
|
+
primary: "bg-primary/15 text-primary"
|
|
43107
|
+
};
|
|
43108
|
+
const CTA_VARIANT = {
|
|
43109
|
+
primary: "default",
|
|
43110
|
+
success: "default",
|
|
43111
|
+
warning: "default",
|
|
43112
|
+
danger: "destructive"
|
|
43113
|
+
};
|
|
43114
|
+
function GenericCard({
|
|
43115
|
+
card,
|
|
43116
|
+
onSendMessage,
|
|
43117
|
+
disabled = false
|
|
43118
|
+
}) {
|
|
43119
|
+
const {
|
|
43120
|
+
title,
|
|
43121
|
+
tags,
|
|
43122
|
+
icon,
|
|
43123
|
+
description,
|
|
43124
|
+
banner,
|
|
43125
|
+
items,
|
|
43126
|
+
ctas
|
|
43127
|
+
} = card;
|
|
43128
|
+
const handleCtaClick = (cta) => {
|
|
43129
|
+
if (disabled) return;
|
|
43130
|
+
if (cta.link) {
|
|
43131
|
+
window.open(cta.link, "_blank", "noopener,noreferrer");
|
|
43132
|
+
}
|
|
43133
|
+
const action = cta.action?.trim();
|
|
43134
|
+
if (action) {
|
|
43135
|
+
onSendMessage?.(action);
|
|
43136
|
+
}
|
|
43137
|
+
};
|
|
43138
|
+
const bannerTheme = banner?.theme ?? "success";
|
|
43139
|
+
const bannerClass = BANNER_THEME_CLASSES[bannerTheme];
|
|
43140
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-sm", children: [
|
|
43141
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-3 pb-2", children: [
|
|
43142
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
43143
|
+
title ? /* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base font-bold leading-tight tracking-tight", children: title }) : null,
|
|
43144
|
+
tags?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: tags.join(" • ") }) : null
|
|
43145
|
+
] }),
|
|
43146
|
+
icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 text-muted-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CardIcon, { name: icon, size: 24, className: "text-primary" }) }) : null
|
|
43147
|
+
] }),
|
|
43148
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-3 pt-0", children: [
|
|
43149
|
+
description ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-foreground leading-snug", children: description }) : null,
|
|
43150
|
+
banner?.text ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43151
|
+
"div",
|
|
43152
|
+
{
|
|
43153
|
+
className: cn(
|
|
43154
|
+
"rounded-full px-4 py-2 text-center text-sm font-semibold",
|
|
43155
|
+
bannerClass
|
|
43156
|
+
),
|
|
43157
|
+
children: banner.text
|
|
43158
|
+
}
|
|
43159
|
+
) : null,
|
|
43160
|
+
items?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: items.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
43161
|
+
"div",
|
|
43162
|
+
{
|
|
43163
|
+
className: "flex items-center gap-1.5 text-xs text-foreground",
|
|
43164
|
+
children: [
|
|
43165
|
+
item.icon ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43166
|
+
CardIcon,
|
|
43167
|
+
{
|
|
43168
|
+
name: item.icon,
|
|
43169
|
+
size: 12,
|
|
43170
|
+
className: "shrink-0 text-muted-foreground"
|
|
43171
|
+
}
|
|
43172
|
+
) : null,
|
|
43173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.text })
|
|
43174
|
+
]
|
|
43175
|
+
},
|
|
43176
|
+
i
|
|
43177
|
+
)) }) : null
|
|
43178
|
+
] }),
|
|
43179
|
+
ctas?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex justify-center flex-wrap gap-2 pt-0", children: ctas.map((cta, i) => {
|
|
43180
|
+
const variant = cta.theme ? CTA_VARIANT[cta.theme] : "default";
|
|
43181
|
+
const isOutline = i > 0 || cta.link && !cta.action;
|
|
43182
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
43183
|
+
Button,
|
|
43184
|
+
{
|
|
43185
|
+
type: "button",
|
|
43186
|
+
variant: isOutline ? "outline" : variant,
|
|
43187
|
+
size: "sm",
|
|
43188
|
+
className: "gap-1.5",
|
|
43189
|
+
disabled,
|
|
43190
|
+
onClick: () => handleCtaClick(cta),
|
|
43191
|
+
children: [
|
|
43192
|
+
cta.icon ? /* @__PURE__ */ jsxRuntimeExports.jsx(CardIcon, { name: cta.icon, size: 14, className: "shrink-0" }) : null,
|
|
43193
|
+
cta.title
|
|
43194
|
+
]
|
|
43195
|
+
},
|
|
43196
|
+
i
|
|
43197
|
+
);
|
|
43198
|
+
}) }) : null
|
|
43199
|
+
] });
|
|
43200
|
+
}
|
|
43201
|
+
function CardList({
|
|
43202
|
+
cards,
|
|
43203
|
+
onSendMessage,
|
|
43204
|
+
disabled = false,
|
|
43140
43205
|
className
|
|
43141
43206
|
}) {
|
|
43142
|
-
if (!
|
|
43143
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground py-2", children: "No
|
|
43207
|
+
if (!cards?.length) {
|
|
43208
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground py-2", children: "No options available." });
|
|
43144
43209
|
}
|
|
43145
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className ?? "
|
|
43146
|
-
|
|
43210
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className ?? "flex flex-col gap-3 mt-3", children: cards.map((card, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43211
|
+
GenericCard,
|
|
43147
43212
|
{
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
|
|
43213
|
+
card,
|
|
43214
|
+
onSendMessage,
|
|
43215
|
+
disabled
|
|
43151
43216
|
},
|
|
43152
|
-
|
|
43217
|
+
index2
|
|
43153
43218
|
)) });
|
|
43154
43219
|
}
|
|
43155
43220
|
function ChatMessage({
|
|
@@ -43169,13 +43234,6 @@ var MedAssistWidget = (function(exports) {
|
|
|
43169
43234
|
const [selectedValues, setSelectedValues] = reactExports.useState([]);
|
|
43170
43235
|
const [userFeedback, setUserFeedback] = reactExports.useState(distExports.USER_FEEDBACK.NONE);
|
|
43171
43236
|
const { isStreaming } = useMedAssistStore();
|
|
43172
|
-
const [hasBackgroundImage, setHasBackgroundImage] = reactExports.useState(false);
|
|
43173
|
-
reactExports.useEffect(() => {
|
|
43174
|
-
const container = document.querySelector(".synapse-chat-widget-container");
|
|
43175
|
-
if (container) {
|
|
43176
|
-
setHasBackgroundImage(container.classList.contains("theme-with-background"));
|
|
43177
|
-
}
|
|
43178
|
-
}, []);
|
|
43179
43237
|
const handlePillClick = async (choice) => {
|
|
43180
43238
|
const messageId = Date.now().toString();
|
|
43181
43239
|
await onSendMessage({
|
|
@@ -43370,13 +43428,21 @@ var MedAssistWidget = (function(exports) {
|
|
|
43370
43428
|
disabled: toolEscalationData?.isResponded
|
|
43371
43429
|
}
|
|
43372
43430
|
) }) : null,
|
|
43373
|
-
toolEscalationData?.details?.component === distExports.SYNAPSE_COMPONENTS.
|
|
43374
|
-
|
|
43431
|
+
toolEscalationData?.details?.component === distExports.SYNAPSE_COMPONENTS.CARD && toolEscalationData?.details?.input?.cards && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43432
|
+
CardList,
|
|
43375
43433
|
{
|
|
43376
|
-
|
|
43377
|
-
|
|
43434
|
+
cards: toolEscalationData.details.input.cards,
|
|
43435
|
+
onSendMessage: async (message) => {
|
|
43436
|
+
const messageId = Date.now().toString();
|
|
43437
|
+
await onSendMessage({
|
|
43438
|
+
message,
|
|
43439
|
+
messageId,
|
|
43440
|
+
toolCalled: true
|
|
43441
|
+
});
|
|
43442
|
+
},
|
|
43443
|
+
disabled: toolEscalationData?.isResponded
|
|
43378
43444
|
}
|
|
43379
|
-
)
|
|
43445
|
+
)
|
|
43380
43446
|
] })
|
|
43381
43447
|
] });
|
|
43382
43448
|
}
|