@eka-care/medassist-widget-embed 0.2.11 → 0.2.13
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 +5 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/src/medassist-widget.css +0 -22
- package/dist/src/medassist-widget.js +53 -70
- package/dist/src/medassist-widget.js.map +1 -1
- package/iframe-helper.ts +2 -2
- package/iframe.ts +6 -1
- package/index.ts +1 -2
- package/package.json +1 -1
- package/src/medassist-widget.css +0 -22
- package/src/medassist-widget.js +53 -70
- package/src/medassist-widget.js.map +1 -1
- package/test.html +1 -0
package/dist/iframe.js
CHANGED
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
}
|
|
59
59
|
/** Fetch agent-config from API with timeout; aborts if pending > 10s */
|
|
60
60
|
async function fetchAgentConfig(baseUrl, agentId) {
|
|
61
|
-
var _a;
|
|
62
61
|
const url = `${baseUrl.replace(/\/$/, "")}/med-assist/agent-config/${agentId}`;
|
|
63
62
|
const controller = new AbortController();
|
|
64
63
|
const timeoutId = setTimeout(() => controller.abort(), API_FETCH_TIMEOUT_MS);
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
if (!res.ok)
|
|
73
72
|
return undefined;
|
|
74
73
|
const json = await res.json();
|
|
75
|
-
if ((json === null || json === void 0 ? void 0 : json.success) && (
|
|
74
|
+
if ((json === null || json === void 0 ? void 0 : json.success) && (json === null || json === void 0 ? void 0 : json.data))
|
|
76
75
|
return json.data;
|
|
77
76
|
return undefined;
|
|
78
77
|
}
|
|
@@ -213,10 +212,12 @@
|
|
|
213
212
|
throw new Error("renderMedAssist is not available on window");
|
|
214
213
|
}
|
|
215
214
|
let apiTheme;
|
|
215
|
+
let allowed;
|
|
216
216
|
if (agentConfig) {
|
|
217
217
|
title = (_b = agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.name) !== null && _b !== void 0 ? _b : title;
|
|
218
218
|
iconUrl = (_d = (_c = agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.theme) === null || _c === void 0 ? void 0 : _c.icon_img) !== null && _d !== void 0 ? _d : iconUrl;
|
|
219
219
|
apiTheme = mapAgentConfigThemeToWidgetTheme((_e = agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.theme) !== null && _e !== void 0 ? _e : undefined);
|
|
220
|
+
allowed = agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.allowed;
|
|
220
221
|
}
|
|
221
222
|
const config = {
|
|
222
223
|
title,
|
|
@@ -230,6 +231,8 @@
|
|
|
230
231
|
context: context ? JSON.parse(context) : undefined,
|
|
231
232
|
baseUrl,
|
|
232
233
|
displayMode: "full",
|
|
234
|
+
allowed,
|
|
235
|
+
showCloseButton: false,
|
|
233
236
|
theme: {
|
|
234
237
|
...(apiTheme !== null && apiTheme !== void 0 ? apiTheme : {}),
|
|
235
238
|
...(attributeTheme !== null && attributeTheme !== void 0 ? attributeTheme : {}),
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,gBAAgB,QAAO,iBAAiB,GAAG,IAahD,CAAC;AAEF,KAAK,iBAAiB,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAElE,QAAA,MAAM,cAAc,GAClB,OAAO,MAAM,GAAG,IAAI,KACnB,iBAAiB,GAAG,SAStB,CAAC;AAEF,QAAA,MAAM,QAAQ,0BAAqB,CAAC;AAGpC,QAAA,MAAM,yBAAyB,QAK3B,CAAC;AAEL,6FAA6F;AAC7F,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IACxC,KAAK,CAAC,EA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M,gBAAgB,QAAO,WAAW,GAAG,IAK1C,CAAC;AAiCF,QAAA,MAAM,aAAa,QASf,CAAC;AAEL,QAAA,MAAM,kBAAkB,QAmBpB,CAAC;AAEL,QAAA,MAAM,aAAa,QAA6C,CAAC;AACjE,QAAA,MAAM,cAAc,QAA8C,CAAC;AAEnE,QAAA,IAAI,mBAAmB,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAW,CAAC;AACrD,QAAA,IAAI,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAW,CAAC;AAExD,yFAAyF;AACzF,iBAAS,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAYlD;AAED,cAAM,qBAAsB,SAAQ,WAAW;IAC7C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,WAAW,CAAoB;;IAavC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iBAAiB,IAAI,IAAI;IASzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAmB5C,0FAA0F;IAC1F,OAAO,CAAC,mBAAmB;IAM3B,6FAA6F;IAC7F,OAAO,CAAC,sBAAsB;IAoC9B,OAAO,CAAC,2BAA2B;IAe5B,cAAc,IAAI,IAAI;IAgB7B,YAAY,IAAI,IAAI;IAiEpB,kBAAkB,IAAI,IAAI;IA6BpB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6G9B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBpC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA0ClC"}
|
package/dist/index.js
CHANGED
|
@@ -422,7 +422,7 @@ class MedAssistWidgetLoader extends HTMLElement {
|
|
|
422
422
|
const widgetConfig = {
|
|
423
423
|
title: initConfig.title || title,
|
|
424
424
|
iconUrl: initConfig.iconUrl || iconUrl,
|
|
425
|
-
allowed
|
|
425
|
+
allowed,
|
|
426
426
|
environment,
|
|
427
427
|
onClose: () => {
|
|
428
428
|
if (customOnClose && typeof customOnClose === "function") {
|
|
@@ -895,10 +895,6 @@ body {
|
|
|
895
895
|
display: grid;
|
|
896
896
|
}
|
|
897
897
|
|
|
898
|
-
.\!hidden {
|
|
899
|
-
display: none !important;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
898
|
.hidden {
|
|
903
899
|
display: none;
|
|
904
900
|
}
|
|
@@ -1424,11 +1420,6 @@ body {
|
|
|
1424
1420
|
border-color: rgb(247 181 0 / var(--tw-border-opacity));
|
|
1425
1421
|
}
|
|
1426
1422
|
|
|
1427
|
-
.border-\[\#FEE39B\] {
|
|
1428
|
-
--tw-border-opacity: 1;
|
|
1429
|
-
border-color: rgb(254 227 155 / var(--tw-border-opacity));
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
1423
|
.border-\[var\(--color-primary\)\] {
|
|
1433
1424
|
border-color: var(--color-primary);
|
|
1434
1425
|
}
|
|
@@ -1512,11 +1503,6 @@ body {
|
|
|
1512
1503
|
background-color: rgb(247 181 0 / var(--tw-bg-opacity));
|
|
1513
1504
|
}
|
|
1514
1505
|
|
|
1515
|
-
.bg-\[\#FFFBEB\] {
|
|
1516
|
-
--tw-bg-opacity: 1;
|
|
1517
|
-
background-color: rgb(255 251 235 / var(--tw-bg-opacity));
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
1506
|
.bg-\[opposite\] {
|
|
1521
1507
|
background-color: opposite;
|
|
1522
1508
|
}
|
|
@@ -2169,10 +2155,6 @@ body {
|
|
|
2169
2155
|
--tw-ring-color: rgb(232 228 255 / var(--tw-ring-opacity));
|
|
2170
2156
|
}
|
|
2171
2157
|
|
|
2172
|
-
.ring-primary {
|
|
2173
|
-
--tw-ring-color: hsl(var(--primary));
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
2158
|
.ring-primary\/10 {
|
|
2177
2159
|
--tw-ring-color: hsl(var(--primary) / var(--opacity-10));
|
|
2178
2160
|
}
|
|
@@ -2181,10 +2163,6 @@ body {
|
|
|
2181
2163
|
--tw-ring-color: hsl(var(--primary) / 0.2);
|
|
2182
2164
|
}
|
|
2183
2165
|
|
|
2184
|
-
.ring-offset-2 {
|
|
2185
|
-
--tw-ring-offset-width: 2px;
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2188
2166
|
.blur {
|
|
2189
2167
|
--tw-blur: blur(8px);
|
|
2190
2168
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
@@ -29871,6 +29871,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
29871
29871
|
);
|
|
29872
29872
|
function ProfileHeader({
|
|
29873
29873
|
onClose,
|
|
29874
|
+
showCloseButton = true,
|
|
29874
29875
|
title,
|
|
29875
29876
|
titleImg,
|
|
29876
29877
|
iconUrl,
|
|
@@ -29952,7 +29953,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
29952
29953
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MessageSquarePlus, { className: "w-8 h-8" })
|
|
29953
29954
|
}
|
|
29954
29955
|
),
|
|
29955
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29956
|
+
showCloseButton && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29956
29957
|
Button,
|
|
29957
29958
|
{
|
|
29958
29959
|
onClick: onClose,
|
|
@@ -30383,6 +30384,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
30383
30384
|
function WidgetContainer({
|
|
30384
30385
|
isOpen,
|
|
30385
30386
|
onClose,
|
|
30387
|
+
showCloseButton = true,
|
|
30386
30388
|
iconUrl,
|
|
30387
30389
|
onStartNewSession,
|
|
30388
30390
|
children,
|
|
@@ -30647,6 +30649,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
30647
30649
|
ProfileHeader,
|
|
30648
30650
|
{
|
|
30649
30651
|
onClose,
|
|
30652
|
+
showCloseButton,
|
|
30650
30653
|
title,
|
|
30651
30654
|
titleImg,
|
|
30652
30655
|
iconUrl,
|
|
@@ -31343,41 +31346,39 @@ var MedAssistWidget = (function(exports) {
|
|
|
31343
31346
|
} : {}
|
|
31344
31347
|
});
|
|
31345
31348
|
if (message || files && files.length > 0) {
|
|
31346
|
-
|
|
31347
|
-
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
...previousMessage[prevLastIndex],
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
tool_id: null,
|
|
31357
|
-
isResponded: true,
|
|
31358
|
-
...toolCalled && message != null && message.trim() !== "" && { selectedCtaAction: message.trim() }
|
|
31359
|
-
}
|
|
31360
|
-
};
|
|
31361
|
-
updateMessageInSession(
|
|
31362
|
-
sessionId,
|
|
31363
|
-
previousMessage[prevLastIndex].id || Date.now().toString(),
|
|
31364
|
-
previousMessage[prevLastIndex]
|
|
31365
|
-
);
|
|
31366
|
-
}
|
|
31367
|
-
if (hidden) return previousMessage;
|
|
31368
|
-
return [
|
|
31369
|
-
...previousMessage,
|
|
31370
|
-
{
|
|
31371
|
-
id: messageId || Date.now().toString(),
|
|
31372
|
-
content: message || "",
|
|
31373
|
-
files: files || [],
|
|
31374
|
-
role: MessageSender.USER,
|
|
31375
|
-
timestamp: formatMessageTimestamp(Date.now()),
|
|
31376
|
-
isStored: true
|
|
31349
|
+
setMessages((prev) => {
|
|
31350
|
+
const previousMessage = [...prev];
|
|
31351
|
+
const prevLastIndex = previousMessage.length - 1;
|
|
31352
|
+
if (isResponseFromTool && prevLastIndex >= 0 && previousMessage[prevLastIndex].toolEscalationData) {
|
|
31353
|
+
previousMessage[prevLastIndex] = {
|
|
31354
|
+
...previousMessage[prevLastIndex],
|
|
31355
|
+
toolEscalationData: {
|
|
31356
|
+
...previousMessage[prevLastIndex].toolEscalationData,
|
|
31357
|
+
tool_id: null,
|
|
31358
|
+
isResponded: true
|
|
31377
31359
|
}
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
|
|
31360
|
+
};
|
|
31361
|
+
updateMessageInSession(
|
|
31362
|
+
sessionId,
|
|
31363
|
+
previousMessage[lastIndex].id || Date.now().toString(),
|
|
31364
|
+
previousMessage[lastIndex]
|
|
31365
|
+
);
|
|
31366
|
+
}
|
|
31367
|
+
if (hidden) {
|
|
31368
|
+
return previousMessage;
|
|
31369
|
+
}
|
|
31370
|
+
return [
|
|
31371
|
+
...previousMessage,
|
|
31372
|
+
{
|
|
31373
|
+
id: messageId || Date.now().toString(),
|
|
31374
|
+
content: message || "",
|
|
31375
|
+
files: files || [],
|
|
31376
|
+
role: MessageSender.USER,
|
|
31377
|
+
timestamp: formatMessageTimestamp(Date.now()),
|
|
31378
|
+
isStored: true
|
|
31379
|
+
}
|
|
31380
|
+
];
|
|
31381
|
+
});
|
|
31381
31382
|
setIsWaitingForResponse(true);
|
|
31382
31383
|
}
|
|
31383
31384
|
};
|
|
@@ -31735,6 +31736,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
31735
31736
|
{
|
|
31736
31737
|
isOpen,
|
|
31737
31738
|
onClose: config.onClose,
|
|
31739
|
+
showCloseButton: config.showCloseButton,
|
|
31738
31740
|
title: config.title,
|
|
31739
31741
|
titleImg: config.theme?.titleImg,
|
|
31740
31742
|
iconUrl: config.iconUrl,
|
|
@@ -43128,8 +43130,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
43128
43130
|
function GenericCard({
|
|
43129
43131
|
card,
|
|
43130
43132
|
onSendMessage,
|
|
43131
|
-
disabled = false
|
|
43132
|
-
selectedCtaAction
|
|
43133
|
+
disabled = false
|
|
43133
43134
|
}) {
|
|
43134
43135
|
const {
|
|
43135
43136
|
title,
|
|
@@ -43145,16 +43146,12 @@ var MedAssistWidget = (function(exports) {
|
|
|
43145
43146
|
if (cta.link) {
|
|
43146
43147
|
window.open(cta.link, "_blank", "noopener,noreferrer");
|
|
43147
43148
|
}
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
onSendMessage?.(action);
|
|
43149
|
+
if (cta.text) {
|
|
43150
|
+
onSendMessage?.(cta.text, cta.action === "hidden_text" ? true : false);
|
|
43151
43151
|
}
|
|
43152
43152
|
};
|
|
43153
43153
|
const bannerTheme = banner?.theme ?? "success";
|
|
43154
43154
|
const bannerClass = BANNER_THEME_CLASSES[bannerTheme];
|
|
43155
|
-
const displayCtas = selectedCtaAction != null && selectedCtaAction.trim() !== "" ? ctas?.filter(
|
|
43156
|
-
(cta) => cta.action?.trim() === selectedCtaAction.trim()
|
|
43157
|
-
) ?? [] : ctas ?? [];
|
|
43158
43155
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-sm", children: [
|
|
43159
43156
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-3 pb-2", children: [
|
|
43160
43157
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -43194,25 +43191,21 @@ var MedAssistWidget = (function(exports) {
|
|
|
43194
43191
|
i
|
|
43195
43192
|
)) }) : null
|
|
43196
43193
|
] }),
|
|
43197
|
-
|
|
43194
|
+
ctas?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex justify-center flex-wrap gap-2 pt-0", children: ctas.map((cta, i) => {
|
|
43198
43195
|
const variant = cta.theme ? CTA_VARIANT[cta.theme] : "default";
|
|
43199
43196
|
const isOutline = i > 0 || cta.link && !cta.action;
|
|
43200
|
-
const isSelected = disabled && selectedCtaAction != null && cta.action?.trim() === selectedCtaAction.trim();
|
|
43201
43197
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
43202
43198
|
Button,
|
|
43203
43199
|
{
|
|
43204
43200
|
type: "button",
|
|
43205
|
-
variant: isOutline
|
|
43201
|
+
variant: isOutline ? "outline" : variant,
|
|
43206
43202
|
size: "sm",
|
|
43207
|
-
className:
|
|
43208
|
-
"gap-1.5",
|
|
43209
|
-
isSelected && "ring-2 ring-primary ring-offset-2"
|
|
43210
|
-
),
|
|
43203
|
+
className: "gap-1.5",
|
|
43211
43204
|
disabled,
|
|
43212
43205
|
onClick: () => handleCtaClick(cta),
|
|
43213
43206
|
children: [
|
|
43214
43207
|
cta.icon ? /* @__PURE__ */ jsxRuntimeExports.jsx(CardIcon, { name: cta.icon, size: 14, className: "shrink-0" }) : null,
|
|
43215
|
-
|
|
43208
|
+
cta.title
|
|
43216
43209
|
]
|
|
43217
43210
|
},
|
|
43218
43211
|
i
|
|
@@ -43224,27 +43217,17 @@ var MedAssistWidget = (function(exports) {
|
|
|
43224
43217
|
cards,
|
|
43225
43218
|
onSendMessage,
|
|
43226
43219
|
disabled = false,
|
|
43227
|
-
selectedCtaAction,
|
|
43228
43220
|
className
|
|
43229
43221
|
}) {
|
|
43230
43222
|
if (!cards?.length) {
|
|
43231
43223
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground py-2", children: "No options available." });
|
|
43232
43224
|
}
|
|
43233
|
-
|
|
43234
|
-
(card) => card.ctas?.some(
|
|
43235
|
-
(cta) => cta.action?.trim() === selectedCtaAction.trim()
|
|
43236
|
-
)
|
|
43237
|
-
) : cards;
|
|
43238
|
-
if (!displayCards.length) {
|
|
43239
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground py-2", children: "No options available." });
|
|
43240
|
-
}
|
|
43241
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className ?? "flex flex-col gap-3 mt-3", children: displayCards.map((card, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43225
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className ?? "flex flex-col gap-3 mt-3", children: cards.map((card, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43242
43226
|
GenericCard,
|
|
43243
43227
|
{
|
|
43244
43228
|
card,
|
|
43245
43229
|
onSendMessage,
|
|
43246
|
-
disabled
|
|
43247
|
-
selectedCtaAction
|
|
43230
|
+
disabled
|
|
43248
43231
|
},
|
|
43249
43232
|
index2
|
|
43250
43233
|
)) });
|
|
@@ -43335,8 +43318,9 @@ var MedAssistWidget = (function(exports) {
|
|
|
43335
43318
|
});
|
|
43336
43319
|
}
|
|
43337
43320
|
};
|
|
43321
|
+
const hasContentInCard = !!(content2?.trim() || files && files.length > 0 || toolCallStatus || progressMessage);
|
|
43338
43322
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
43339
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex", isUser ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43323
|
+
hasContentInCard && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex", isUser ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43340
43324
|
"div",
|
|
43341
43325
|
{
|
|
43342
43326
|
className: cn(
|
|
@@ -43364,7 +43348,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
43364
43348
|
]
|
|
43365
43349
|
}
|
|
43366
43350
|
),
|
|
43367
|
-
!isUser && !isStreaming && isLastMessage && userFeedback === distExports.USER_FEEDBACK.NONE && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 self-start mt-1", children: [
|
|
43351
|
+
!isUser && !isStreaming && isLastMessage && content2 && userFeedback === distExports.USER_FEEDBACK.NONE && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 self-start mt-1", children: [
|
|
43368
43352
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43369
43353
|
Button,
|
|
43370
43354
|
{
|
|
@@ -43409,7 +43393,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
43409
43393
|
] })
|
|
43410
43394
|
}
|
|
43411
43395
|
) }),
|
|
43412
|
-
|
|
43396
|
+
toolEscalationData?.details?.component && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end", children: [
|
|
43413
43397
|
toolEscalationData?.details?.component === distExports.SYNAPSE_COMPONENTS.PILL && toolEscalationData?.details?.input?.options && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 mt-3", children: toolEscalationData.details?.input?.options.map(
|
|
43414
43398
|
(choice, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43415
43399
|
Pills,
|
|
@@ -43464,16 +43448,15 @@ var MedAssistWidget = (function(exports) {
|
|
|
43464
43448
|
CardList,
|
|
43465
43449
|
{
|
|
43466
43450
|
cards: toolEscalationData.details.input.cards,
|
|
43467
|
-
onSendMessage: async (message) => {
|
|
43451
|
+
onSendMessage: async (message, hidden) => {
|
|
43468
43452
|
const messageId = Date.now().toString();
|
|
43469
43453
|
await onSendMessage({
|
|
43470
43454
|
message,
|
|
43471
43455
|
messageId,
|
|
43472
43456
|
toolCalled: true,
|
|
43473
|
-
hidden
|
|
43457
|
+
hidden
|
|
43474
43458
|
});
|
|
43475
43459
|
},
|
|
43476
|
-
selectedCtaAction: toolEscalationData?.selectedCtaAction,
|
|
43477
43460
|
disabled: toolEscalationData?.isResponded
|
|
43478
43461
|
}
|
|
43479
43462
|
)
|
|
@@ -43565,7 +43548,7 @@ var MedAssistWidget = (function(exports) {
|
|
|
43565
43548
|
"div",
|
|
43566
43549
|
{
|
|
43567
43550
|
className: cn(
|
|
43568
|
-
"mx-4 mb-3 px-2 py-1
|
|
43551
|
+
"mx-4 mb-3 px-2 py-1 bg-surface border border-[#F7B500] rounded-lg",
|
|
43569
43552
|
className
|
|
43570
43553
|
),
|
|
43571
43554
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|