@elevenlabs/convai-widget-core 0.11.2 → 0.11.3
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/index.js +34 -22
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Conversation as Kg, postOverallFeedback as cc } from "@elevenlabs/clien
|
|
|
8
8
|
import { jsx as re, jsxs as Va, Fragment as Ul } from "preact/compat/jsx-runtime";
|
|
9
9
|
import { useMemo as nh, useCallback as tn, useContext as Zo, useRef as Jg, useEffect as rh } from "preact/hooks";
|
|
10
10
|
import { createContext as ih } from "preact";
|
|
11
|
-
const e1 = "0.11.
|
|
11
|
+
const e1 = "0.11.3";
|
|
12
12
|
function dt(e) {
|
|
13
13
|
return e ? e === "true" ? !0 : e === "false" ? !1 : null : null;
|
|
14
14
|
}
|
|
@@ -1758,39 +1758,51 @@ function K1(e, t) {
|
|
|
1758
1758
|
conversationIndex: e[0]?.conversationIndex ?? t.firstMessageConversationIndex ?? 0
|
|
1759
1759
|
});
|
|
1760
1760
|
const r = /* @__PURE__ */ new Map();
|
|
1761
|
-
for (const
|
|
1762
|
-
if (
|
|
1763
|
-
const
|
|
1761
|
+
for (const o of e)
|
|
1762
|
+
if (o.type === "agent_tool_request") {
|
|
1763
|
+
const l = r.get(o.eventId) ?? {
|
|
1764
1764
|
loading: 0,
|
|
1765
1765
|
error: 0,
|
|
1766
1766
|
success: 0
|
|
1767
1767
|
};
|
|
1768
|
-
|
|
1769
|
-
} else if (
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1768
|
+
l.loading++, r.set(o.eventId, l);
|
|
1769
|
+
} else if (o.type === "agent_tool_response") {
|
|
1770
|
+
const l = r.get(o.eventId);
|
|
1771
|
+
l && (l.loading--, o.isError ? l.error++ : l.success++);
|
|
1772
1772
|
}
|
|
1773
|
-
for (const
|
|
1774
|
-
if (
|
|
1773
|
+
for (const o of e) {
|
|
1774
|
+
if (o.type === "agent_tool_request" || o.type === "agent_tool_response" || o.type === "message" && o.role === "agent" && !o.message && !(t.showAgentStatus && o.eventId != null && r.has(o.eventId)) || !t.transcriptEnabled && o.type === "message" && !o.isText)
|
|
1775
1775
|
continue;
|
|
1776
|
-
const
|
|
1777
|
-
if (
|
|
1778
|
-
n[n.length - 1] =
|
|
1776
|
+
const l = n[n.length - 1];
|
|
1777
|
+
if (o.type === "message" && o.eventId != null && l?.type === "message" && l.eventId === o.eventId && l.role === o.role) {
|
|
1778
|
+
n[n.length - 1] = o;
|
|
1779
1779
|
continue;
|
|
1780
1780
|
}
|
|
1781
|
-
n.push(
|
|
1781
|
+
n.push(o);
|
|
1782
|
+
}
|
|
1783
|
+
const i = [], a = [];
|
|
1784
|
+
for (let o = 0; o < n.length; o++) {
|
|
1785
|
+
const l = n[o];
|
|
1786
|
+
l.type === "message" && l.eventId != null && (i.push(o), a.push(l));
|
|
1782
1787
|
}
|
|
1788
|
+
a.sort((o, l) => {
|
|
1789
|
+
const u = o.eventId, c = l.eventId;
|
|
1790
|
+
return u - c;
|
|
1791
|
+
});
|
|
1792
|
+
const s = [...n];
|
|
1793
|
+
for (let o = 0; o < i.length; o++)
|
|
1794
|
+
s[i[o]] = a[o];
|
|
1783
1795
|
if (t.showAgentStatus)
|
|
1784
|
-
for (let
|
|
1785
|
-
const
|
|
1786
|
-
if (
|
|
1796
|
+
for (let o = 0; o < s.length; o++) {
|
|
1797
|
+
const l = s[o];
|
|
1798
|
+
if (l.type !== "message" || l.role !== "agent" || l.eventId == null)
|
|
1787
1799
|
continue;
|
|
1788
|
-
const
|
|
1789
|
-
if (!
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1800
|
+
const u = r.get(l.eventId);
|
|
1801
|
+
if (!u) continue;
|
|
1802
|
+
const c = u.loading > 0 ? Br.LOADING : u.error > 0 ? Br.ERROR : Br.SUCCESS;
|
|
1803
|
+
s[o] = { ...l, toolStatus: c };
|
|
1792
1804
|
}
|
|
1793
|
-
return
|
|
1805
|
+
return s;
|
|
1794
1806
|
}
|
|
1795
1807
|
function Vl(e) {
|
|
1796
1808
|
return e && typeof e == "object" && "peek" in e;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.11.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.11.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevenlabs/convai-widget-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "The common library for the Conversational AI Widget.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"remark-parse": "^11.0.0",
|
|
59
59
|
"remark-rehype": "^11.1.2",
|
|
60
60
|
"tailwind-merge": "^3.4.0",
|
|
61
|
-
"@elevenlabs/client": "1.
|
|
61
|
+
"@elevenlabs/client": "1.2.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|