@flowengage/react-chatbot 5.0.27 → 5.0.28
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.
|
@@ -29965,11 +29965,11 @@ function kk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
29965
29965
|
});
|
|
29966
29966
|
}
|
|
29967
29967
|
function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
|
|
29968
|
-
let [h, v] = m("idle"), [y, b] = m(!1), [x, S] = m(!1), C = p(null), w = p(""), T = p(async () => {}), ee = p(!1), te = p(!1), ne = p(!1), re = p(!1), E = p("minimized"), ie = p(null), ae = p(null), oe = p(null), D = p(0), se = o((e = "minimized") => {
|
|
29968
|
+
let [h, v] = m("idle"), [y, b] = m(!1), [x, S] = m(!1), C = p(null), w = p(""), T = p(async () => {}), ee = p(!1), te = p(!1), ne = p(!1), re = p(!1), E = p("minimized"), ie = p(null), ae = p(null), oe = p(null), D = p(0), se = p(!1), ce = o((e = "minimized") => {
|
|
29969
29969
|
E.current = e, re.current = !0, queueMicrotask(() => {
|
|
29970
29970
|
ee.current || (ee.current = !0, T.current?.());
|
|
29971
29971
|
});
|
|
29972
|
-
}, [u]),
|
|
29972
|
+
}, [u]), le = o(async (e) => {
|
|
29973
29973
|
re.current = !0;
|
|
29974
29974
|
try {
|
|
29975
29975
|
await C.current?.endSession?.();
|
|
@@ -29999,10 +29999,10 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
29999
29999
|
l,
|
|
30000
30000
|
s
|
|
30001
30001
|
]);
|
|
30002
|
-
return T.current = () =>
|
|
30002
|
+
return T.current = () => le(E.current === "chat" ? t : n), c(() => {
|
|
30003
30003
|
te.current = y;
|
|
30004
30004
|
}, [y]), c(() => {
|
|
30005
|
-
f &&
|
|
30005
|
+
f && ce("chat");
|
|
30006
30006
|
}, [f]), c(() => {
|
|
30007
30007
|
let e = !1, i = null;
|
|
30008
30008
|
return (async () => {
|
|
@@ -30041,7 +30041,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30041
30041
|
apiBaseUrl: s || null,
|
|
30042
30042
|
getLastUserVoiceText: () => w.current,
|
|
30043
30043
|
requestEndSession: () => {
|
|
30044
|
-
se
|
|
30044
|
+
se.current = !0;
|
|
30045
30045
|
}
|
|
30046
30046
|
})), n = a ? je(a) : null, o = !!n?.transcript, c = !!(a && Ve(a)), d = typeof window < "u" ? window.location.pathname : "/", f = typeof document < "u" ? document.title : "", p = d === "/" || d === "", m = null;
|
|
30047
30047
|
try {
|
|
@@ -30073,11 +30073,17 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30073
30073
|
},
|
|
30074
30074
|
onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
|
|
30075
30075
|
onModeChange: ({ mode: t }) => {
|
|
30076
|
-
if (!e && (v(t === "speaking" ? "speaking" : "listening"), t === "listening"
|
|
30077
|
-
|
|
30078
|
-
|
|
30079
|
-
|
|
30080
|
-
}
|
|
30076
|
+
if (!e && (v(t === "speaking" ? "speaking" : "listening"), t === "listening")) {
|
|
30077
|
+
if (se.current) {
|
|
30078
|
+
se.current = !1, ce();
|
|
30079
|
+
return;
|
|
30080
|
+
}
|
|
30081
|
+
if (S && !x) {
|
|
30082
|
+
x = !0;
|
|
30083
|
+
try {
|
|
30084
|
+
C.current?.sendUserMessage?.("continue with the tour");
|
|
30085
|
+
} catch {}
|
|
30086
|
+
}
|
|
30081
30087
|
}
|
|
30082
30088
|
},
|
|
30083
30089
|
onMessage: (t) => {
|
|
@@ -30093,13 +30099,13 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30093
30099
|
e && Ae(a, e);
|
|
30094
30100
|
} catch {}
|
|
30095
30101
|
if (Ek(n, r)) {
|
|
30096
|
-
|
|
30102
|
+
ce("minimized");
|
|
30097
30103
|
return;
|
|
30098
30104
|
}
|
|
30099
30105
|
if (te.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (D.current += 1, D.current === 2) try {
|
|
30100
30106
|
C.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the flowengage_end_session tool to end the voice session. Do NOT ask again after that.");
|
|
30101
30107
|
} catch {}
|
|
30102
|
-
else D.current >= 5 &&
|
|
30108
|
+
else D.current >= 5 && ce("minimized");
|
|
30103
30109
|
}
|
|
30104
30110
|
},
|
|
30105
30111
|
onError: (t) => {
|
|
@@ -30112,7 +30118,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30112
30118
|
try {
|
|
30113
30119
|
C.current?.setMicMuted?.(!0);
|
|
30114
30120
|
} catch {}
|
|
30115
|
-
b(!0), v("error"),
|
|
30121
|
+
b(!0), v("error"), ce("chat");
|
|
30116
30122
|
}
|
|
30117
30123
|
},
|
|
30118
30124
|
onDisconnect: (t) => {
|
|
@@ -30129,7 +30135,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30129
30135
|
try {
|
|
30130
30136
|
C.current?.setMicMuted?.(!0);
|
|
30131
30137
|
} catch {}
|
|
30132
|
-
b(!0),
|
|
30138
|
+
b(!0), ce("chat");
|
|
30133
30139
|
}
|
|
30134
30140
|
});
|
|
30135
30141
|
if (e) {
|
|
@@ -30173,7 +30179,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30173
30179
|
r,
|
|
30174
30180
|
a,
|
|
30175
30181
|
s,
|
|
30176
|
-
|
|
30182
|
+
ce
|
|
30177
30183
|
]), c(() => {
|
|
30178
30184
|
if (!x) return;
|
|
30179
30185
|
let e = (e) => {
|
|
@@ -30359,7 +30365,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30359
30365
|
children: [
|
|
30360
30366
|
/* @__PURE__ */ _("button", {
|
|
30361
30367
|
onClick: () => {
|
|
30362
|
-
S(!1), E.current = "chat",
|
|
30368
|
+
S(!1), E.current = "chat", le(t);
|
|
30363
30369
|
},
|
|
30364
30370
|
style: {
|
|
30365
30371
|
display: "flex",
|
|
@@ -30388,7 +30394,7 @@ function Ak({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30388
30394
|
}),
|
|
30389
30395
|
/* @__PURE__ */ _("button", {
|
|
30390
30396
|
onClick: () => {
|
|
30391
|
-
S(!1), E.current = "minimized",
|
|
30397
|
+
S(!1), E.current = "minimized", le(n);
|
|
30392
30398
|
},
|
|
30393
30399
|
style: {
|
|
30394
30400
|
display: "flex",
|