@eshal-bot/chat-widget 0.2.55 → 0.2.56
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/{chat-widget-MarkdownRenderer-ZdeOxy4H.esm.js → chat-widget-MarkdownRenderer-Bc2bbcTo.esm.js} +6 -6
- package/dist/{chat-widget-index-CWsNv0xr.esm.js → chat-widget-index-dlp0htSy.esm.js} +3 -3
- package/dist/chat-widget-markdown-chunk.js +419 -0
- package/dist/chat-widget-markdown-chunk.min.js +1 -1
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +38 -8
- package/dist/chat-widget.min.js +4 -4
- package/dist/chat-widget.umd.js +7 -7
- package/package.json +1 -1
package/dist/chat-widget.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as default}from"./chat-widget-index-
|
|
1
|
+
export{S as default}from"./chat-widget-index-dlp0htSy.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
|
package/dist/chat-widget.js
CHANGED
|
@@ -13640,6 +13640,32 @@
|
|
|
13640
13640
|
}
|
|
13641
13641
|
const VERIFY_CARD = /"type"\s*:\s*"verification"/;
|
|
13642
13642
|
|
|
13643
|
+
/**
|
|
13644
|
+
* What the caller said after the answer that carried the card on screen, or
|
|
13645
|
+
* undefined while nothing has followed it. The call screen redraws its card
|
|
13646
|
+
* on every new line, so a card cannot keep its own "picked" state: an option
|
|
13647
|
+
* list tapped once came back live, ready for a second pick, until the agent's
|
|
13648
|
+
* next answer replaced it. Read from the lines, as the chat reads it from
|
|
13649
|
+
* history (MessageList), it locks the card on the caller's answer, tapped or
|
|
13650
|
+
* said. A verify card is left out: it stays live while the caller talks, until
|
|
13651
|
+
* its code is confirmed (waitsForCode).
|
|
13652
|
+
*/
|
|
13653
|
+
function voiceCardAnswer(lines) {
|
|
13654
|
+
let at = -1;
|
|
13655
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
13656
|
+
if (lines[i].role === "assistant" && lines[i].a2ui) {
|
|
13657
|
+
at = i;
|
|
13658
|
+
break;
|
|
13659
|
+
}
|
|
13660
|
+
}
|
|
13661
|
+
if (at === -1 || VERIFY_CARD.test(lines[at].a2ui)) return undefined;
|
|
13662
|
+
for (let i = at + 1; i < lines.length; i++) {
|
|
13663
|
+
const line = lines[i];
|
|
13664
|
+
if (line.role === "user" && !line.sendFailed && String(line.content || "").trim()) return String(line.content);
|
|
13665
|
+
}
|
|
13666
|
+
return undefined;
|
|
13667
|
+
}
|
|
13668
|
+
|
|
13643
13669
|
/** A verification code card (VerifyCard) whose code is not confirmed yet. */
|
|
13644
13670
|
function waitsForCode(line) {
|
|
13645
13671
|
return Boolean(line?.a2ui && VERIFY_CARD.test(line.a2ui) && !line.cardDone);
|
|
@@ -23867,6 +23893,7 @@
|
|
|
23867
23893
|
const lastAgent = latestLine(lines, "agent");
|
|
23868
23894
|
const lastCaller = latestLine(lines, "user");
|
|
23869
23895
|
const card = latestVoiceCard(lines);
|
|
23896
|
+
const cardAnswer = voiceCardAnswer(lines);
|
|
23870
23897
|
reactExports.useEffect(() => {
|
|
23871
23898
|
const el = scrollRef.current;
|
|
23872
23899
|
if (el) el.scrollTop = el.scrollHeight;
|
|
@@ -23938,13 +23965,16 @@
|
|
|
23938
23965
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(CardBoundary, {
|
|
23939
23966
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(reactExports.Suspense, {
|
|
23940
23967
|
fallback: null,
|
|
23941
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx(
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23945
|
-
|
|
23946
|
-
|
|
23947
|
-
|
|
23968
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(A2uiAnsweredContext.Provider, {
|
|
23969
|
+
value: cardAnswer,
|
|
23970
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(MarkdownRenderer, {
|
|
23971
|
+
content: card,
|
|
23972
|
+
isDark: isDark,
|
|
23973
|
+
isRtl: isRtl,
|
|
23974
|
+
fontFamily: fontFamily,
|
|
23975
|
+
provideCitations: false,
|
|
23976
|
+
onButtonClick: (value, _label, extra) => onCardAction?.(String(value ?? ""), extra)
|
|
23977
|
+
})
|
|
23948
23978
|
})
|
|
23949
23979
|
})
|
|
23950
23980
|
}, card)
|
|
@@ -25761,7 +25791,7 @@
|
|
|
25761
25791
|
* value by its own test (that constant sat at 0.1.113 while this package was
|
|
25762
25792
|
* at 0.2.2 precisely because nothing enforced it - EV-2431).
|
|
25763
25793
|
*/
|
|
25764
|
-
const WIDGET_VERSION = '0.2.
|
|
25794
|
+
const WIDGET_VERSION = '0.2.56';
|
|
25765
25795
|
|
|
25766
25796
|
/**
|
|
25767
25797
|
* API utility functions
|