@flowengage/react-chatbot 6.0.26 → 6.0.30
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/README.md +44 -0
- package/dist/flowengage-embed.js +18 -17
- package/dist/flowengage-react-chatbot.cjs +12 -11
- package/dist/flowengage-react-chatbot.mjs +180 -207
- package/package.json +1 -1
|
@@ -506,7 +506,7 @@ var k = (e) => {
|
|
|
506
506
|
let l = new ArrayBuffer(t), u = new Uint8Array(l);
|
|
507
507
|
for (r = 0; r < n; r += 4) a = at[e.charCodeAt(r)], o = at[e.charCodeAt(r + 1)], s = at[e.charCodeAt(r + 2)], c = at[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
|
|
508
508
|
return l;
|
|
509
|
-
},
|
|
509
|
+
}, A = typeof ArrayBuffer == "function", ot = (e, t) => {
|
|
510
510
|
if (typeof e != "string") return {
|
|
511
511
|
type: "message",
|
|
512
512
|
data: ct(e, t)
|
|
@@ -519,7 +519,7 @@ var k = (e) => {
|
|
|
519
519
|
type: Je[n],
|
|
520
520
|
data: e.substring(1)
|
|
521
521
|
} : { type: Je[n] } : Ye;
|
|
522
|
-
}, st = (e, t) =>
|
|
522
|
+
}, st = (e, t) => A ? ct(k(e), t) : {
|
|
523
523
|
base64: !0,
|
|
524
524
|
data: e
|
|
525
525
|
}, ct = (e, t) => {
|
|
@@ -537,7 +537,7 @@ var k = (e) => {
|
|
|
537
537
|
}, dt = (e, t) => {
|
|
538
538
|
let n = e.split(lt), r = [];
|
|
539
539
|
for (let e = 0; e < n.length; e++) {
|
|
540
|
-
let i =
|
|
540
|
+
let i = ot(n[e], t);
|
|
541
541
|
if (r.push(i), i.type === "error") break;
|
|
542
542
|
}
|
|
543
543
|
return r;
|
|
@@ -594,7 +594,7 @@ function gt(e, t) {
|
|
|
594
594
|
} else {
|
|
595
595
|
if (mt(n) < i) break;
|
|
596
596
|
let e = ht(n, i);
|
|
597
|
-
s.enqueue(
|
|
597
|
+
s.enqueue(ot(a ? e : pt.decode(e), t)), r = 0;
|
|
598
598
|
}
|
|
599
599
|
if (i === 0 || i > e) {
|
|
600
600
|
s.enqueue(Ye);
|
|
@@ -707,7 +707,7 @@ var jt = class extends Error {
|
|
|
707
707
|
this.readyState = "open", this.writable = !0, super.emitReserved("open");
|
|
708
708
|
}
|
|
709
709
|
onData(e) {
|
|
710
|
-
let t =
|
|
710
|
+
let t = ot(e, this.socket.binaryType);
|
|
711
711
|
this.onPacket(t);
|
|
712
712
|
}
|
|
713
713
|
onPacket(e) {
|
|
@@ -2118,14 +2118,11 @@ function er() {
|
|
|
2118
2118
|
if (window.ng?.getComponent || document.querySelector("[ng-version]")) return "angular";
|
|
2119
2119
|
if (window.__sveltekit_data || document.querySelector("[data-sveltekit-hydrate]")) return "sveltekit";
|
|
2120
2120
|
if (document.querySelector("[data-astro-transition]")) return "astro";
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
if (!(e === "SCRIPT" || e === "NOSCRIPT" || e === "LINK" || e === "STYLE") && (t.querySelector?.("[data-reactroot]") || t._reactRootContainer || t.__vue_app__ || !(Array.from(t.childNodes).filter((e) => e.nodeType === 3).map((e) => e.textContent.trim()).join("").length > 200) && Object.getOwnPropertyNames(t).some((e) => e.startsWith("__reactFiber$") || e.startsWith("__reactContainer$")))) return "generic-spa";
|
|
2127
|
-
}
|
|
2128
|
-
return null;
|
|
2121
|
+
let e = Array.from(document.body.children).filter((e) => {
|
|
2122
|
+
let t = e.tagName?.toUpperCase();
|
|
2123
|
+
return !(t === "SCRIPT" || t === "NOSCRIPT" || t === "LINK" || t === "STYLE" || e.id === "flowengage-root");
|
|
2124
|
+
});
|
|
2125
|
+
return e.length === 1 && e[0].id && (e[0].querySelector("[data-reactroot]") || e[0]._reactRootContainer || e[0].__vue_app__) ? "generic-spa" : null;
|
|
2129
2126
|
}
|
|
2130
2127
|
var tr = "data-fe-swap-css";
|
|
2131
2128
|
function nr() {
|
|
@@ -2839,7 +2836,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2839
2836
|
let i = f(() => e ? {
|
|
2840
2837
|
...t || {},
|
|
2841
2838
|
siteId: e
|
|
2842
|
-
} : t || null, [e, t]), [a, s] = m(0), [l, u] = m("booting"), [d, h] = m(null), [_, v] = m(null), [y, b] = m(""), [x, S] = m([]), [C, w] = m(ve().isOpen), [T, te] = m(ve().activeScreen), [ne, re] = m(ve().isHumanHandled), [E, D] = m(ve().agentName), [se, de] = m(ve().agentHeadshot), [fe, pe] = m(() => be(i?.siteId)), [me, Se] = m(!1), [Ce, we] = m(!1), [Ee, De] = m("idle"), [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, Ne] = m(""), [Fe, Ie] = m(!1), [Le, Re] = m(0), [ze, Be] = m(0), [Ve, He] = m(!1), [O, Ue] = m(null), [qe, Je] = m(null), [Ye, Xe] = m("idle"), [Ze, Qe] = m(null), [$e, et] = m(!1), [tt, nt] = m(""), [rt, it] = m(!1), at = p(null), k = p(null),
|
|
2839
|
+
} : t || null, [e, t]), [a, s] = m(0), [l, u] = m("booting"), [d, h] = m(null), [_, v] = m(null), [y, b] = m(""), [x, S] = m([]), [C, w] = m(ve().isOpen), [T, te] = m(ve().activeScreen), [ne, re] = m(ve().isHumanHandled), [E, D] = m(ve().agentName), [se, de] = m(ve().agentHeadshot), [fe, pe] = m(() => be(i?.siteId)), [me, Se] = m(!1), [Ce, we] = m(!1), [Ee, De] = m("idle"), [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, Ne] = m(""), [Fe, Ie] = m(!1), [Le, Re] = m(0), [ze, Be] = m(0), [Ve, He] = m(!1), [O, Ue] = m(null), [qe, Je] = m(null), [Ye, Xe] = m("idle"), [Ze, Qe] = m(null), [$e, et] = m(!1), [tt, nt] = m(""), [rt, it] = m(!1), at = p(null), k = p(null), A = p(""), ot = p(!1), st = p(null), ct = p(null), lt = p(null), ut = p(null), dt = p(null), ft = p(null), pt = p([]), mt = p(null), ht = p(null), gt = p(null), j = p(!1), _t = p(!1), vt = p(""), yt = p(null), bt = p(null), xt = p([]), St = p(0), Ct = p(E), wt = p([]), Tt = p(!1), Et = p(!1), Dt = p(i), Ot = p({
|
|
2843
2840
|
notifyRouteChange: () => {},
|
|
2844
2841
|
cleanup: () => {}
|
|
2845
2842
|
}), kt = o((e = {}) => {
|
|
@@ -2904,7 +2901,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2904
2901
|
if (!(!t?.connected || !n || j.current)) {
|
|
2905
2902
|
j.current = !0, t.emit("call:connected", {
|
|
2906
2903
|
callId: n,
|
|
2907
|
-
chatId:
|
|
2904
|
+
chatId: A.current,
|
|
2908
2905
|
connectedAt: e
|
|
2909
2906
|
});
|
|
2910
2907
|
try {
|
|
@@ -2971,7 +2968,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2971
2968
|
if (!t || !n?.connected || !r || !e.callId) {
|
|
2972
2969
|
console.log("[FlowEngageProvider] deferring remote offer until peer/socket ready", {
|
|
2973
2970
|
callId: e.callId,
|
|
2974
|
-
chatId:
|
|
2971
|
+
chatId: A.current,
|
|
2975
2972
|
hasPeerConnection: !!t,
|
|
2976
2973
|
socketConnected: !!n?.connected,
|
|
2977
2974
|
hasOffer: !!r
|
|
@@ -2984,7 +2981,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2984
2981
|
})), pt.current.length > 0) {
|
|
2985
2982
|
console.log("[FlowEngageProvider] flushing queued agent ICE candidates after remote offer", {
|
|
2986
2983
|
callId: e.callId,
|
|
2987
|
-
chatId:
|
|
2984
|
+
chatId: A.current,
|
|
2988
2985
|
queuedCount: pt.current.length
|
|
2989
2986
|
});
|
|
2990
2987
|
for (let e of pt.current) await t.addIceCandidate(new RTCIceCandidate(e));
|
|
@@ -2994,7 +2991,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2994
2991
|
await t.setLocalDescription(i), n.emit("call:answer", {
|
|
2995
2992
|
callId: e.callId,
|
|
2996
2993
|
sdpAnswer: i.sdp,
|
|
2997
|
-
chatId:
|
|
2994
|
+
chatId: A.current
|
|
2998
2995
|
});
|
|
2999
2996
|
};
|
|
3000
2997
|
c(() => {
|
|
@@ -3020,8 +3017,8 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3020
3017
|
if (!e) return;
|
|
3021
3018
|
let a = t.siteId, o = he(a), s = Te(a), c = "";
|
|
3022
3019
|
try {
|
|
3023
|
-
let e =
|
|
3024
|
-
if (
|
|
3020
|
+
let e = ot.current, r = st.current;
|
|
3021
|
+
if (ot.current = !1, st.current = null, c = (await We({
|
|
3025
3022
|
apiBaseUrl: t.apiBaseUrl,
|
|
3026
3023
|
userId: n.userId,
|
|
3027
3024
|
siteId: a,
|
|
@@ -3034,7 +3031,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3034
3031
|
} catch (e) {
|
|
3035
3032
|
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ue(), _e(a, c);
|
|
3036
3033
|
}
|
|
3037
|
-
|
|
3034
|
+
A.current = c;
|
|
3038
3035
|
let l = Ke({
|
|
3039
3036
|
apiBaseUrl: t.apiBaseUrl,
|
|
3040
3037
|
userId: n.userId,
|
|
@@ -3180,7 +3177,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3180
3177
|
if (!lt.current || !lt.current.remoteDescription) {
|
|
3181
3178
|
console.log("[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready", {
|
|
3182
3179
|
callId: e.callId,
|
|
3183
|
-
chatId: e.chatId ||
|
|
3180
|
+
chatId: e.chatId || A.current,
|
|
3184
3181
|
queueSize: pt.current.length + 1
|
|
3185
3182
|
}), pt.current.push(t);
|
|
3186
3183
|
return;
|
|
@@ -3255,7 +3252,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3255
3252
|
a
|
|
3256
3253
|
]), c(() => () => {
|
|
3257
3254
|
if (Fe && !Tt.current && wt.current.length > 0) {
|
|
3258
|
-
let e =
|
|
3255
|
+
let e = A.current, t = wt.current, n = k.current;
|
|
3259
3256
|
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), Tt.current = !0);
|
|
3260
3257
|
}
|
|
3261
3258
|
}, [Fe, _]);
|
|
@@ -3265,7 +3262,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3265
3262
|
!e || !y || zt.current !== C && (C && zt.current !== null ? (e.updateChatStatus(y, "open").catch(() => {}), Bt.current = !0) : zt.current === !0 && e.updateChatStatus(y, "widget_closed").catch(() => {}), zt.current = C);
|
|
3266
3263
|
}, [C, y]), c(() => {
|
|
3267
3264
|
let e = () => {
|
|
3268
|
-
let e =
|
|
3265
|
+
let e = A.current, t = k.current;
|
|
3269
3266
|
!e || !t || typeof navigator > "u" || t.beaconWidgetClosed?.(e) || t.updateChatStatus(e, "widget_closed").catch(() => {});
|
|
3270
3267
|
};
|
|
3271
3268
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
@@ -3448,10 +3445,10 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3448
3445
|
}
|
|
3449
3446
|
}, qt = async (e) => {
|
|
3450
3447
|
let t = Nt(e);
|
|
3451
|
-
if (!t || !k.current || !
|
|
3448
|
+
if (!t || !k.current || !A.current) return t;
|
|
3452
3449
|
try {
|
|
3453
3450
|
await k.current.trackVisitor({
|
|
3454
|
-
chatId:
|
|
3451
|
+
chatId: A.current,
|
|
3455
3452
|
currentPagePath: typeof window < "u" && window.location.pathname || "/",
|
|
3456
3453
|
email: t
|
|
3457
3454
|
});
|
|
@@ -3611,7 +3608,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3611
3608
|
At
|
|
3612
3609
|
]), c(() => {
|
|
3613
3610
|
let e = () => {
|
|
3614
|
-
let e =
|
|
3611
|
+
let e = A.current, t = k.current;
|
|
3615
3612
|
if (!t || !e) return;
|
|
3616
3613
|
if (Et.current && wt.current.length > 0 && Pe(), !Tt.current && wt.current.length > 0 && (t.beaconSyncVoice(e, wt.current) || t.syncVoice(e, wt.current).catch(() => {}), Tt.current = !0), mt.current) {
|
|
3617
3614
|
t.beaconEndWebRTCCall(mt.current, e);
|
|
@@ -3626,9 +3623,9 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3626
3623
|
}, []);
|
|
3627
3624
|
let nn = o(() => {
|
|
3628
3625
|
let e = i?.siteId;
|
|
3629
|
-
ge(e),
|
|
3626
|
+
ge(e), ot.current = !0, st.current = null, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3630
3627
|
}, [i?.siteId]), rn = o((e) => {
|
|
3631
|
-
i?.siteId,
|
|
3628
|
+
i?.siteId, ot.current = !1, st.current = e, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3632
3629
|
}, [i?.siteId]), an = f(() => ({
|
|
3633
3630
|
status: l,
|
|
3634
3631
|
error: d,
|
|
@@ -29268,12 +29265,7 @@ function vk(e) {
|
|
|
29268
29265
|
let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
|
|
29269
29266
|
return t == null ? null : String(t).trim() || null;
|
|
29270
29267
|
}
|
|
29271
|
-
function yk(e) {
|
|
29272
|
-
if (!e || typeof e != "object") return null;
|
|
29273
|
-
let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
|
|
29274
|
-
return t == null ? null : String(t).trim() || null;
|
|
29275
|
-
}
|
|
29276
|
-
function bk(e, t, n) {
|
|
29268
|
+
function yk(e, t, n) {
|
|
29277
29269
|
if (!n?.skipScroll) try {
|
|
29278
29270
|
e.scrollIntoView({
|
|
29279
29271
|
block: "center",
|
|
@@ -29328,7 +29320,7 @@ function bk(e, t, n) {
|
|
|
29328
29320
|
} catch {}
|
|
29329
29321
|
return !0;
|
|
29330
29322
|
}
|
|
29331
|
-
function
|
|
29323
|
+
function bk() {
|
|
29332
29324
|
let e = {};
|
|
29333
29325
|
document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
|
|
29334
29326
|
if (t.id) return;
|
|
@@ -29343,11 +29335,11 @@ function xk() {
|
|
|
29343
29335
|
e[r] = !0, t.id = r;
|
|
29344
29336
|
});
|
|
29345
29337
|
}
|
|
29346
|
-
function
|
|
29338
|
+
function xk() {
|
|
29347
29339
|
let e = document.querySelector("main, [role='main'], article") || document.body;
|
|
29348
29340
|
return Array.from(e.querySelectorAll("h1, h2, h3")).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root")).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200).slice(0, 12);
|
|
29349
29341
|
}
|
|
29350
|
-
function
|
|
29342
|
+
function Sk(e) {
|
|
29351
29343
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
|
|
29352
29344
|
flowengage_navigate: async (n) => {
|
|
29353
29345
|
$("flowengage_navigate ▶ raw parameters:", n);
|
|
@@ -29378,7 +29370,7 @@ function Ck(e) {
|
|
|
29378
29370
|
siteId: t,
|
|
29379
29371
|
apiBaseUrl: e.apiBaseUrl
|
|
29380
29372
|
})) {
|
|
29381
|
-
let e = `Page "${a}" could not be verified.
|
|
29373
|
+
let e = `Page "${a}" could not be verified. Try a different URL from your known site pages, or ask the visitor to clarify which page they want.`;
|
|
29382
29374
|
return $("flowengage_navigate ✖ blocked", e), e;
|
|
29383
29375
|
}
|
|
29384
29376
|
try {
|
|
@@ -29406,10 +29398,10 @@ function Ck(e) {
|
|
|
29406
29398
|
let n = typeof window < "u" ? window.location.pathname : e, r = typeof window < "u" ? window.location.href : a, i = n === e, o = (n.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home";
|
|
29407
29399
|
$("flowengage_navigate → SPA nav complete. target:", e, "actual:", n);
|
|
29408
29400
|
let s = [], c = Date.now() + 8e3;
|
|
29409
|
-
for (; Date.now() < c && (await new Promise((e) => setTimeout(e, 250)), s =
|
|
29410
|
-
|
|
29411
|
-
let l = s.length ? s.join(" | ") : "none", u = s.length ? "
|
|
29412
|
-
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u}
|
|
29401
|
+
for (; Date.now() < c && (await new Promise((e) => setTimeout(e, 250)), s = xk(), !(s.length >= 1)););
|
|
29402
|
+
bk(), $("flowengage_navigate → page headings collected:", s);
|
|
29403
|
+
let l = s.length ? s.join(" | ") : "none", u = s.length ? "Use ONLY these exact heading strings for flowengage_highlight." : "No headings were collected from the live DOM — use your knowledge base heading strings for this page to call flowengage_highlight. Follow RULE 1: call each highlight BEFORE describing its section (transition → highlight → content).";
|
|
29404
|
+
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u} MANDATORY: call flowengage_highlight for EVERY section before describing it — never give a plain summary. Do NOT say "I have navigated you" or "I've taken you to" — start the highlighted walkthrough immediately.`) : (wr(), `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}") | Section headings: ${l}. ${u} MANDATORY: call flowengage_highlight for EVERY section before describing it — never give a plain summary. Describe THIS page only — do not mention the page you tried to navigate to.`);
|
|
29413
29405
|
} catch {}
|
|
29414
29406
|
return "OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, immediately introduce the new page and continue guiding the visitor — do not wait for the user to speak first.";
|
|
29415
29407
|
} catch (e) {
|
|
@@ -29431,15 +29423,15 @@ function Ck(e) {
|
|
|
29431
29423
|
if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
|
|
29432
29424
|
else return $("flowengage_highlight ✖ blocked — user navigated during speech", e), `NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call flowengage_highlight again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`;
|
|
29433
29425
|
}
|
|
29434
|
-
|
|
29426
|
+
bk();
|
|
29435
29427
|
let i = hr(n || null, r || null);
|
|
29436
29428
|
if (!i && r) {
|
|
29437
29429
|
let e = Date.now() + 600;
|
|
29438
|
-
for (; !i && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)),
|
|
29430
|
+
for (; !i && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), bk(), i = hr(null, r);
|
|
29439
29431
|
}
|
|
29440
29432
|
if (!i) {
|
|
29441
29433
|
$("flowengage_highlight ✖ no element for:", r || n);
|
|
29442
|
-
let e =
|
|
29434
|
+
let e = xk(), t = e.length ? `Page headings: ${e.join(" | ")}. Use one of these exact strings for section_text.` : "No headings found — skip highlight and continue.";
|
|
29443
29435
|
return `HIGHLIGHT_NOT_FOUND: "${r || n}" on the current page. ${t}`;
|
|
29444
29436
|
}
|
|
29445
29437
|
return xD(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". WALKTHROUGH: continue immediately to the next section — do NOT pause between sections.`;
|
|
@@ -29467,38 +29459,6 @@ function Ck(e) {
|
|
|
29467
29459
|
return $("flowengage_read_content ✖", e.message), `Could not read page content: ${e.message}`;
|
|
29468
29460
|
}
|
|
29469
29461
|
},
|
|
29470
|
-
flowengage_search: async (e) => {
|
|
29471
|
-
$("flowengage_search ▶", e);
|
|
29472
|
-
let r = yk(mk(e));
|
|
29473
|
-
if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
|
|
29474
|
-
if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
|
|
29475
|
-
if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
|
|
29476
|
-
CO(`Searching${r ? ` for "${r}"` : ""}…`, { spinner: !0 });
|
|
29477
|
-
try {
|
|
29478
|
-
let e = `${n}/api/site-tools/search`;
|
|
29479
|
-
$("flowengage_search → POST", e);
|
|
29480
|
-
let i = await fetch(e, {
|
|
29481
|
-
method: "POST",
|
|
29482
|
-
headers: { "Content-Type": "application/json" },
|
|
29483
|
-
body: JSON.stringify({
|
|
29484
|
-
siteId: t,
|
|
29485
|
-
query: r,
|
|
29486
|
-
currentUrl: typeof window < "u" ? window.location.href : ""
|
|
29487
|
-
})
|
|
29488
|
-
}), a = await i.json();
|
|
29489
|
-
if ($("flowengage_search · HTTP", i.status, "success:", a.success), !a.success) {
|
|
29490
|
-
let e = a.error || "Search failed.";
|
|
29491
|
-
return $("flowengage_search ✖", e), e;
|
|
29492
|
-
}
|
|
29493
|
-
let o = a.results || [];
|
|
29494
|
-
return $("flowengage_search ✓", `${o.length} result(s)`, o.slice(0, 3).map((e) => e?.url || e)), JSON.stringify(o);
|
|
29495
|
-
} catch (e) {
|
|
29496
|
-
let t = `Search error: ${e.message || "network"}`;
|
|
29497
|
-
return $("flowengage_search ✖", t), t;
|
|
29498
|
-
} finally {
|
|
29499
|
-
wO(600);
|
|
29500
|
-
}
|
|
29501
|
-
},
|
|
29502
29462
|
flowengage_page_content: async (e) => {
|
|
29503
29463
|
$("flowengage_page_content ▶", e);
|
|
29504
29464
|
let r = mk(e), i = r?.url || r?.page_url || "";
|
|
@@ -29534,12 +29494,12 @@ function Ck(e) {
|
|
|
29534
29494
|
flowengage_end_session: async () => ($("flowengage_end_session ▶"), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
|
|
29535
29495
|
flowengage_get_current_page: async () => {
|
|
29536
29496
|
if ($("flowengage_get_current_page ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
|
|
29537
|
-
let e = window.location.href, t = window.location.pathname, n = document.title || "", r =
|
|
29497
|
+
let e = window.location.href, t = window.location.pathname, n = document.title || "", r = xk(), i = r.length ? r.join(" | ") : "none";
|
|
29538
29498
|
return $("flowengage_get_current_page ✓", {
|
|
29539
29499
|
url: e,
|
|
29540
29500
|
path: t,
|
|
29541
29501
|
title: n
|
|
29542
|
-
}), $("flowengage_get_current_page → page headings collected:", r), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n} | Section headings: ${i}.
|
|
29502
|
+
}), $("flowengage_get_current_page → page headings collected:", r), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n} | Section headings: ${i}. Use ONLY these exact heading strings for flowengage_highlight — never invent or abbreviate section names.`;
|
|
29543
29503
|
},
|
|
29544
29504
|
flowengage_list_forms: async () => {
|
|
29545
29505
|
let e = XO(), t = ZO();
|
|
@@ -29565,12 +29525,12 @@ function Ck(e) {
|
|
|
29565
29525
|
CO(`Filling ${String(t)}...`, { spinner: !0 });
|
|
29566
29526
|
let a = YO(), o = ck(a, String(t), r);
|
|
29567
29527
|
if (o.length) {
|
|
29568
|
-
for (let [e, t] of o.entries()) jO(t), await LO(t),
|
|
29528
|
+
for (let [e, t] of o.entries()) jO(t), await LO(t), yk(t, r, { skipScroll: e > 0 }), MO(t), await HO(120);
|
|
29569
29529
|
i = o, n.push(String(t));
|
|
29570
29530
|
continue;
|
|
29571
29531
|
}
|
|
29572
29532
|
let s = dk(a, String(t));
|
|
29573
|
-
s ||= nk(a, String(t)), s ||= rk(a, String(t), r), s && (jO(s), await LO(s),
|
|
29533
|
+
s ||= nk(a, String(t)), s ||= rk(a, String(t), r), s && (jO(s), await LO(s), yk(s, r), MO(s), await HO(120), i = [s], n.push(String(t)));
|
|
29574
29534
|
}
|
|
29575
29535
|
if (!n.length) return $("flowengage_fill_form ✖ no matches"), "Could not match any fields. Call flowengage_list_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.";
|
|
29576
29536
|
let a = `OK_FILLED: ${n.join(", ")}`;
|
|
@@ -29627,7 +29587,6 @@ function Ck(e) {
|
|
|
29627
29587
|
return {
|
|
29628
29588
|
...a,
|
|
29629
29589
|
highlightOnPage: a.flowengage_highlight,
|
|
29630
|
-
searchSiteContent: a.flowengage_search,
|
|
29631
29590
|
getPageContent: a.flowengage_page_content,
|
|
29632
29591
|
endVoiceSession: a.flowengage_end_session,
|
|
29633
29592
|
listPageForms: a.flowengage_list_forms,
|
|
@@ -29637,7 +29596,7 @@ function Ck(e) {
|
|
|
29637
29596
|
}
|
|
29638
29597
|
//#endregion
|
|
29639
29598
|
//#region src/utils/wrapVoiceToolsForLogging.js
|
|
29640
|
-
function
|
|
29599
|
+
function Ck(e) {
|
|
29641
29600
|
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
|
|
29642
29601
|
let r = Rn();
|
|
29643
29602
|
r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
|
|
@@ -29654,7 +29613,7 @@ function wk(e) {
|
|
|
29654
29613
|
}
|
|
29655
29614
|
//#endregion
|
|
29656
29615
|
//#region src/components/FlowEngageWidget.jsx
|
|
29657
|
-
var
|
|
29616
|
+
var wk = {
|
|
29658
29617
|
blue: "#135bd8",
|
|
29659
29618
|
red: "#ef334b",
|
|
29660
29619
|
yellow: "#ffbd2e",
|
|
@@ -29662,7 +29621,7 @@ var Tk = {
|
|
|
29662
29621
|
highlight: "rgba(255,255,255,0.9)",
|
|
29663
29622
|
green: "#10b981"
|
|
29664
29623
|
};
|
|
29665
|
-
function
|
|
29624
|
+
function Tk(e) {
|
|
29666
29625
|
if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
|
|
29667
29626
|
let [t, n, r] = e;
|
|
29668
29627
|
return e.length >= 3 && r ? [
|
|
@@ -29676,12 +29635,12 @@ function Ek(e) {
|
|
|
29676
29635
|
"#f7f8fa"
|
|
29677
29636
|
].join(", ");
|
|
29678
29637
|
}
|
|
29679
|
-
function
|
|
29638
|
+
function Ek(e) {
|
|
29680
29639
|
if (!e || typeof e != "string") return "#1a1a1a";
|
|
29681
29640
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
29682
29641
|
return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
|
|
29683
29642
|
}
|
|
29684
|
-
function
|
|
29643
|
+
function Dk(t) {
|
|
29685
29644
|
let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
|
|
29686
29645
|
return e.useEffect(() => {
|
|
29687
29646
|
if (!i) {
|
|
@@ -29699,8 +29658,8 @@ function Ok(t) {
|
|
|
29699
29658
|
};
|
|
29700
29659
|
}, [i]), n;
|
|
29701
29660
|
}
|
|
29702
|
-
function
|
|
29703
|
-
let r =
|
|
29661
|
+
function Ok({ logo: t, style: n }) {
|
|
29662
|
+
let r = Dk(typeof t == "string" ? t : null);
|
|
29704
29663
|
if (!t) return null;
|
|
29705
29664
|
if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
|
|
29706
29665
|
src: r,
|
|
@@ -29725,7 +29684,7 @@ function kk({ logo: t, style: n }) {
|
|
|
29725
29684
|
children: i
|
|
29726
29685
|
}) : null;
|
|
29727
29686
|
}
|
|
29728
|
-
function
|
|
29687
|
+
function kk({ title: e }) {
|
|
29729
29688
|
return /* @__PURE__ */ g("div", {
|
|
29730
29689
|
style: {
|
|
29731
29690
|
width: "100%",
|
|
@@ -29743,18 +29702,18 @@ function Ak({ title: e }) {
|
|
|
29743
29702
|
children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
|
|
29744
29703
|
});
|
|
29745
29704
|
}
|
|
29746
|
-
function
|
|
29705
|
+
function Ak(e, t) {
|
|
29747
29706
|
let n = (t || "").trim();
|
|
29748
29707
|
return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
|
|
29749
29708
|
}
|
|
29750
|
-
function
|
|
29709
|
+
function jk({ orbColors: e, ...t }) {
|
|
29751
29710
|
return /* @__PURE__ */ g(lO, {
|
|
29752
29711
|
colors: e,
|
|
29753
29712
|
...t
|
|
29754
29713
|
});
|
|
29755
29714
|
}
|
|
29756
|
-
function
|
|
29757
|
-
let s = n ||
|
|
29715
|
+
function Mk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
|
|
29716
|
+
let s = n || wk.green, c = Ek(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
|
|
29758
29717
|
style: {
|
|
29759
29718
|
display: "flex",
|
|
29760
29719
|
alignItems: a ? "flex-end" : "center",
|
|
@@ -29875,7 +29834,7 @@ function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
29875
29834
|
delay: 0
|
|
29876
29835
|
},
|
|
29877
29836
|
style: { flexShrink: 0 },
|
|
29878
|
-
children: /* @__PURE__ */ g(
|
|
29837
|
+
children: /* @__PURE__ */ g(jk, {
|
|
29879
29838
|
size: l,
|
|
29880
29839
|
orbColors: t
|
|
29881
29840
|
})
|
|
@@ -29907,8 +29866,8 @@ function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
29907
29866
|
children: u
|
|
29908
29867
|
})] });
|
|
29909
29868
|
}
|
|
29910
|
-
function
|
|
29911
|
-
let c = n ||
|
|
29869
|
+
function Nk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
|
|
29870
|
+
let c = n || wk.green, l = Ek(c);
|
|
29912
29871
|
return /* @__PURE__ */ _(Dm.div, {
|
|
29913
29872
|
initial: {
|
|
29914
29873
|
scale: 50 / 350,
|
|
@@ -29979,7 +29938,7 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
29979
29938
|
children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
|
|
29980
29939
|
})
|
|
29981
29940
|
}),
|
|
29982
|
-
/* @__PURE__ */ g(
|
|
29941
|
+
/* @__PURE__ */ g(jk, {
|
|
29983
29942
|
size: 72,
|
|
29984
29943
|
orbColors: t
|
|
29985
29944
|
}),
|
|
@@ -30048,9 +30007,13 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
30048
30007
|
]
|
|
30049
30008
|
});
|
|
30050
30009
|
}
|
|
30051
|
-
function
|
|
30010
|
+
function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d }) {
|
|
30011
|
+
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
30052
30012
|
let [f, h] = m("idle"), [v, y] = m(!1), [b, x] = m(!1), S = p(null), C = p(""), w = p(async () => {}), T = p(!1), ee = p(!1), te = p(!1), ne = p(!1), re = p("minimized"), E = p(null), ie = p(null), ae = p(null), oe = p(0), D = p(!1), se = p("idle"), ce = p(!1), le = p(null), ue = p(null), de = p(!1), fe = o((e = "minimized") => {
|
|
30053
|
-
|
|
30013
|
+
console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
|
|
30014
|
+
destination: e,
|
|
30015
|
+
stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
|
|
30016
|
+
}), re.current = e, ne.current = !0, queueMicrotask(() => {
|
|
30054
30017
|
T.current || (T.current = !0, w.current?.());
|
|
30055
30018
|
});
|
|
30056
30019
|
}, [l]), pe = o(async (e) => {
|
|
@@ -30126,7 +30089,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30126
30089
|
}
|
|
30127
30090
|
Pe();
|
|
30128
30091
|
} });
|
|
30129
|
-
let t =
|
|
30092
|
+
let t = Ck(Sk({
|
|
30130
30093
|
siteId: i || null,
|
|
30131
30094
|
apiBaseUrl: a || null,
|
|
30132
30095
|
getLastUserVoiceText: () => C.current,
|
|
@@ -30156,8 +30119,8 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30156
30119
|
}, b = (p.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()), x = "";
|
|
30157
30120
|
m && m.includes("|") && (x = m.split("|").map((e) => e.trim()).filter(Boolean).reduce((e, t) => e.length <= t.length ? e : t));
|
|
30158
30121
|
let w = x || b || "this page";
|
|
30159
|
-
_ ? f ? (v.overrides = { agent: { firstMessage: `I've navigated you to the ${w} page. Let me walk you through what's here.` } }, console.log(`[FlowEngage] 🔄 Agent-nav resume: firstMessage set for "${w}" (${p})`)) : u ? v.overrides = { agent: { firstMessage: "I'm still here. Go ahead!" } } : g
|
|
30160
|
-
let ae = !1, pe = f ? `NAVIGATION RESUME — Your intro has been spoken. NOW — without waiting for the visitor to say anything — call flowengage_highlight for the first content section on this page, then speak one sentence about it. Continue
|
|
30122
|
+
_ ? f ? (v.overrides = { agent: { firstMessage: `I've navigated you to the ${w} page. Let me walk you through what's here.` } }, console.log(`[FlowEngage] 🔄 Agent-nav resume: firstMessage set for "${w}" (${p})`)) : u ? v.overrides = { agent: { firstMessage: "I'm still here. Go ahead!" } } : g ? v.overrides = { agent: { firstMessage: "Hi there! Let me give you a quick tour of what's available here." } } : (v.overrides = { agent: { firstMessage: `Welcome! You're on the ${w} page — let me walk you through the highlights.` } }, console.log(`[FlowEngage] 🏠 Page-context override: "${w}" for ${p}`)) : u && (v.overrides = { agent: { firstMessage: "" } });
|
|
30123
|
+
let ae = !1, pe = f ? `NAVIGATION RESUME — Your intro has been spoken. NOW — without waiting for the visitor to say anything — call flowengage_highlight for the first content section on this page, then speak one sentence about it. Continue with the top 3 sections only (highlight + one sentence each). Prior conversation context:\n${(i ? je(i) : null)?.transcript || ""}\n\n` : null, me = !1, he = !f && !u ? "AUTO-START — Your greeting has been spoken. NOW — without waiting for the visitor to say anything — call flowengage_get_current_page, then immediately highlight the top 3 sections and give a one-sentence summary for each. Keep it brisk — no filler, no questions until the walkthrough is done." : null, ge = await vD.startSession({
|
|
30161
30124
|
...v,
|
|
30162
30125
|
onConnect: ({ conversationId: e }) => {
|
|
30163
30126
|
E.current = e, ie.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
@@ -30179,6 +30142,12 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30179
30142
|
S.current?.sendUserMessage?.("continue with the tour");
|
|
30180
30143
|
} catch {}
|
|
30181
30144
|
}
|
|
30145
|
+
if (he && !me) {
|
|
30146
|
+
me = !0;
|
|
30147
|
+
try {
|
|
30148
|
+
S.current?.sendContextualUpdate?.(he);
|
|
30149
|
+
} catch {}
|
|
30150
|
+
}
|
|
30182
30151
|
ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
|
|
30183
30152
|
e || se.current !== "speaking" && (de.current || (ue.current = null, se.current = "listening", h("listening"), ce.current && !ee.current && (le.current && clearTimeout(le.current), le.current = setTimeout(() => {
|
|
30184
30153
|
if (!e && se.current === "listening" && !ee.current) try {
|
|
@@ -30200,7 +30169,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30200
30169
|
let e = vO(l.current);
|
|
30201
30170
|
e && Ae(i, e);
|
|
30202
30171
|
} catch {}
|
|
30203
|
-
if (
|
|
30172
|
+
if (Ak(n, r)) {
|
|
30204
30173
|
fe("minimized");
|
|
30205
30174
|
return;
|
|
30206
30175
|
}
|
|
@@ -30241,17 +30210,17 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30241
30210
|
}
|
|
30242
30211
|
});
|
|
30243
30212
|
if (e) {
|
|
30244
|
-
|
|
30213
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), ge.endSession().catch(() => {});
|
|
30245
30214
|
return;
|
|
30246
30215
|
}
|
|
30247
|
-
o =
|
|
30216
|
+
o = ge, S.current = ge, h("listening");
|
|
30248
30217
|
try {
|
|
30249
30218
|
let e = typeof window < "u" ? window.location.href : "", r = "[]";
|
|
30250
30219
|
try {
|
|
30251
|
-
r = await t.
|
|
30220
|
+
r = await t.flowengage_list_forms();
|
|
30252
30221
|
} catch {}
|
|
30253
30222
|
let a = u && !f ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript || ""}\n\n` : "";
|
|
30254
|
-
|
|
30223
|
+
ge.sendContextualUpdate(`${a}Page: ${e}. SiteId: ${i || "unknown"}. Forms: ${r}. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
30255
30224
|
} catch {}
|
|
30256
30225
|
if (typeof window < "u") {
|
|
30257
30226
|
let t = window.location.pathname, n = () => {
|
|
@@ -30293,7 +30262,11 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30293
30262
|
}, 0)));
|
|
30294
30263
|
}
|
|
30295
30264
|
})(), () => {
|
|
30296
|
-
|
|
30265
|
+
console.warn("[FlowEngage:VoiceDebug] ⚠️ useEffect CLEANUP fired — session will be killed", {
|
|
30266
|
+
agentId: r,
|
|
30267
|
+
siteId: i,
|
|
30268
|
+
apiBaseUrl: a
|
|
30269
|
+
}), e = !0, ne.current = !0;
|
|
30297
30270
|
try {
|
|
30298
30271
|
SD();
|
|
30299
30272
|
} catch {}
|
|
@@ -30301,15 +30274,15 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30301
30274
|
He(i);
|
|
30302
30275
|
} catch {}
|
|
30303
30276
|
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ar(), le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearTimeout(ue.current), null), ce.current = !1, de.current = !1, se.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
|
|
30304
|
-
let t = o || S.current, n = E.current,
|
|
30277
|
+
let t = o || S.current, n = E.current, f = ie.current;
|
|
30305
30278
|
if (t?.endSession?.().catch(() => {}), n && s && a) {
|
|
30306
|
-
let e =
|
|
30279
|
+
let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
|
|
30307
30280
|
chatId: s,
|
|
30308
30281
|
elevenLabsConversationId: n,
|
|
30309
30282
|
duration: e,
|
|
30310
30283
|
siteId: i
|
|
30311
|
-
}),
|
|
30312
|
-
typeof navigator < "u" && navigator.sendBeacon && navigator.sendBeacon(
|
|
30284
|
+
}), r = `${a}/api/voice/save-chat-recording`;
|
|
30285
|
+
typeof navigator < "u" && navigator.sendBeacon && navigator.sendBeacon(r, new Blob([t], { type: "application/json" })) || fetch(r, {
|
|
30313
30286
|
method: "POST",
|
|
30314
30287
|
headers: { "Content-Type": "application/json" },
|
|
30315
30288
|
body: t,
|
|
@@ -30376,7 +30349,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30376
30349
|
},
|
|
30377
30350
|
children: "Muted"
|
|
30378
30351
|
}),
|
|
30379
|
-
/* @__PURE__ */ g(
|
|
30352
|
+
/* @__PURE__ */ g(jk, {
|
|
30380
30353
|
size: 72,
|
|
30381
30354
|
voiceState: f,
|
|
30382
30355
|
isMuted: v,
|
|
@@ -30614,7 +30587,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30614
30587
|
]
|
|
30615
30588
|
});
|
|
30616
30589
|
}
|
|
30617
|
-
function
|
|
30590
|
+
function Fk({ orbColors: e }) {
|
|
30618
30591
|
return /* @__PURE__ */ g("div", {
|
|
30619
30592
|
style: {
|
|
30620
30593
|
flexShrink: 0,
|
|
@@ -30624,13 +30597,13 @@ function Ik({ orbColors: e }) {
|
|
|
30624
30597
|
alignItems: "center",
|
|
30625
30598
|
justifyContent: "center"
|
|
30626
30599
|
},
|
|
30627
|
-
children: /* @__PURE__ */ g(
|
|
30600
|
+
children: /* @__PURE__ */ g(jk, {
|
|
30628
30601
|
size: 36,
|
|
30629
30602
|
orbColors: e
|
|
30630
30603
|
})
|
|
30631
30604
|
});
|
|
30632
30605
|
}
|
|
30633
|
-
var
|
|
30606
|
+
var Ik = () => /* @__PURE__ */ g("div", {
|
|
30634
30607
|
style: {
|
|
30635
30608
|
display: "flex",
|
|
30636
30609
|
marginBottom: "12px",
|
|
@@ -30660,7 +30633,7 @@ var Lk = () => /* @__PURE__ */ g("div", {
|
|
|
30660
30633
|
} }, e))
|
|
30661
30634
|
})
|
|
30662
30635
|
});
|
|
30663
|
-
function
|
|
30636
|
+
function Lk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: D, setEmailInput: se, emailError: ce, emailCaptureSuccess: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, showPoweredBy: De, getVisitorChatHistory: Oe, resumeChat: ke, isSessionRestoring: Ae, isClosing: je }) {
|
|
30664
30637
|
let Me = l.length > 0, Ne = T || ee || w, Pe = !!ge, [Fe, Ie] = m(!1), [Le, Re] = m(!1), [ze, Be] = m([]), [Ve, He] = m(!1), O = p(null), [Ue, We] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Ge, Ke] = m(0);
|
|
30665
30638
|
c(() => {
|
|
30666
30639
|
if (!s) return;
|
|
@@ -30796,7 +30769,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30796
30769
|
justifyContent: "center",
|
|
30797
30770
|
height: "40px"
|
|
30798
30771
|
},
|
|
30799
|
-
children: i ? /* @__PURE__ */ g(
|
|
30772
|
+
children: i ? /* @__PURE__ */ g(Ok, {
|
|
30800
30773
|
logo: i,
|
|
30801
30774
|
style: {
|
|
30802
30775
|
height: "34px",
|
|
@@ -30809,7 +30782,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30809
30782
|
height: "40px",
|
|
30810
30783
|
flexShrink: 0
|
|
30811
30784
|
},
|
|
30812
|
-
children: /* @__PURE__ */ g(
|
|
30785
|
+
children: /* @__PURE__ */ g(kk, { title: e.chatTitle })
|
|
30813
30786
|
})
|
|
30814
30787
|
}), /* @__PURE__ */ g("div", {
|
|
30815
30788
|
style: {
|
|
@@ -31239,11 +31212,11 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31239
31212
|
isLoading: T,
|
|
31240
31213
|
isAgentTyping: d,
|
|
31241
31214
|
setReplyContext: de,
|
|
31242
|
-
TypingDots:
|
|
31215
|
+
TypingDots: Ik,
|
|
31243
31216
|
primaryColor: n,
|
|
31244
31217
|
agentHeadshot: y,
|
|
31245
31218
|
agentDisplayName: v || b,
|
|
31246
|
-
botAvatarNode: /* @__PURE__ */ g(
|
|
31219
|
+
botAvatarNode: /* @__PURE__ */ g(Fk, { orbColors: t })
|
|
31247
31220
|
}) : Ae ? /* @__PURE__ */ _("div", {
|
|
31248
31221
|
style: {
|
|
31249
31222
|
flex: 1,
|
|
@@ -31284,7 +31257,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31284
31257
|
padding: "28px 24px"
|
|
31285
31258
|
},
|
|
31286
31259
|
children: [
|
|
31287
|
-
/* @__PURE__ */ g(
|
|
31260
|
+
/* @__PURE__ */ g(jk, {
|
|
31288
31261
|
size: 94,
|
|
31289
31262
|
orbColors: t
|
|
31290
31263
|
}),
|
|
@@ -31426,14 +31399,14 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31426
31399
|
]
|
|
31427
31400
|
});
|
|
31428
31401
|
}
|
|
31429
|
-
function
|
|
31402
|
+
function Rk() {
|
|
31430
31403
|
let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: ee, callConnectedAt: te, isCallMuted: ne, webRTCError: re, language: E, chatId: ie, historyRef: ae, onMessageSync: oe, sendMessage: D, uploadChatFile: se, openWidget: ce, captureVisitorEmail: le, setVoiceMode: ue, endConversation: de, startNewChat: me, acceptCall: he, rejectCall: ge, endWebRTCCall: _e, toggleCallMute: ve, dismissCallError: ye, startTyping: be, stopTyping: xe, updateTypingDraft: Se, getVisitorChatHistory: Ce, resumeChat: we, isSessionRestoring: Te, openToChatCounter: Ee, voiceEndCounter: De } = Ln();
|
|
31431
31404
|
c(() => {
|
|
31432
31405
|
try {
|
|
31433
31406
|
pr();
|
|
31434
31407
|
} catch {}
|
|
31435
31408
|
}, []), c(() => {
|
|
31436
|
-
Ee && A !== "text_chat" && A !== "call_screen" && (ue?.(!1),
|
|
31409
|
+
Ee && A !== "voice_mode" && A !== "text_chat" && A !== "call_screen" && (ue?.(!1), ot("text_chat"));
|
|
31437
31410
|
}, [Ee]);
|
|
31438
31411
|
let Oe = t?.widgetSettings || {}, ke = n?.widgetSettings || {}, Ae = {
|
|
31439
31412
|
...Oe.branding || {},
|
|
@@ -31448,7 +31421,7 @@ function zk() {
|
|
|
31448
31421
|
small: 50,
|
|
31449
31422
|
medium: 64,
|
|
31450
31423
|
large: 80
|
|
31451
|
-
}, Ve = Be[Ne.orbSize] || Be.small, He = Ne.position || "bottom-right", O = Ae.fallbackAgentName || "Agent", Ue =
|
|
31424
|
+
}, Ve = Be[Ne.orbSize] || Be.small, He = Ne.position || "bottom-right", O = Ae.fallbackAgentName || "Agent", Ue = Tk(Le ?? Ne.chatBgColors), We = Ae.logo || Ae.logoUrl || null, Ge = E || "en", Ke = Oe.recommendations?.[Ge] || [], qe = (ke.recommendations?.[Ge] ?? Ke).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
31452
31425
|
id: e.key || `qr-${t}`,
|
|
31453
31426
|
label: e.label,
|
|
31454
31427
|
message: e.label,
|
|
@@ -31471,11 +31444,11 @@ function zk() {
|
|
|
31471
31444
|
]), rt = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, it = r.some((e) => e.sender === "user"), at = f(() => {
|
|
31472
31445
|
let e = r.findIndex((e) => e.sender === "user");
|
|
31473
31446
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
31474
|
-
}, [r]), k =
|
|
31447
|
+
}, [r]), k = !!(ke._dashboardLivePreview || Oe._dashboardLivePreview), [A, ot] = m(() => k ? "text_chat" : "entry_prompt"), [st, ct] = m(""), [lt, ut] = m(null), [dt, ft] = m(h || ""), [pt, mt] = m(""), [ht, gt] = m(!1), [j, _t] = m(0), [vt, yt] = m(null), [bt, xt] = m(null), [St, Ct] = m(""), [wt, Tt] = m(!1), [Et, Dt] = m(!1), [Ot, kt] = m(!1), At = p(null), jt = p(!1), Mt = !h && it && at && A !== "voice_mode";
|
|
31475
31448
|
d(() => {
|
|
31476
|
-
if (e !== "ready" ||
|
|
31477
|
-
if (
|
|
31478
|
-
|
|
31449
|
+
if (e !== "ready" || jt.current) return;
|
|
31450
|
+
if (jt.current = !0, !Ie) {
|
|
31451
|
+
ot("minimized_orb");
|
|
31479
31452
|
return;
|
|
31480
31453
|
}
|
|
31481
31454
|
let t = !1;
|
|
@@ -31484,22 +31457,22 @@ function zk() {
|
|
|
31484
31457
|
} catch {}
|
|
31485
31458
|
let n = Fe(), r = et ? je(et) : null, i = n || !!r?.transcript;
|
|
31486
31459
|
if (t) {
|
|
31487
|
-
ce?.({ notifyChatInitiated: !0 }), ue?.(!0),
|
|
31460
|
+
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31488
31461
|
return;
|
|
31489
31462
|
}
|
|
31490
31463
|
if (Re()) {
|
|
31491
|
-
ce?.({ notifyChatInitiated: !1 }),
|
|
31464
|
+
ce?.({ notifyChatInitiated: !1 }), ot("text_chat");
|
|
31492
31465
|
return;
|
|
31493
31466
|
}
|
|
31494
|
-
if (et) try {
|
|
31495
|
-
Me(et);
|
|
31496
|
-
} catch {}
|
|
31497
31467
|
if (i) {
|
|
31498
|
-
|
|
31468
|
+
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31499
31469
|
return;
|
|
31500
31470
|
}
|
|
31471
|
+
if (et) try {
|
|
31472
|
+
Me(et);
|
|
31473
|
+
} catch {}
|
|
31501
31474
|
if (fe(et)) {
|
|
31502
|
-
|
|
31475
|
+
ot("minimized_orb");
|
|
31503
31476
|
return;
|
|
31504
31477
|
}
|
|
31505
31478
|
}, [e, r]);
|
|
@@ -31508,55 +31481,55 @@ function zk() {
|
|
|
31508
31481
|
let e = window.matchMedia("(max-width: 640px)"), t = (e) => Pt(e.matches);
|
|
31509
31482
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
31510
31483
|
}, []), c(() => {
|
|
31511
|
-
|
|
31484
|
+
ft(h || ""), h && mt("");
|
|
31512
31485
|
}, [h]);
|
|
31513
31486
|
let Ft = o(() => {
|
|
31514
|
-
|
|
31487
|
+
xt(null), Ct("");
|
|
31515
31488
|
}, []), It = o((e) => {
|
|
31516
31489
|
let t = qD(e);
|
|
31517
31490
|
if (t) {
|
|
31518
|
-
|
|
31491
|
+
xt(null), Ct(t);
|
|
31519
31492
|
return;
|
|
31520
31493
|
}
|
|
31521
|
-
|
|
31494
|
+
xt(e), Ct("");
|
|
31522
31495
|
}, []);
|
|
31523
31496
|
c(() => {
|
|
31524
31497
|
if (!te || ee !== "connected") {
|
|
31525
|
-
|
|
31498
|
+
_t(0);
|
|
31526
31499
|
return;
|
|
31527
31500
|
}
|
|
31528
31501
|
let e = () => {
|
|
31529
31502
|
let e = new Date(te).getTime();
|
|
31530
|
-
isNaN(e) ||
|
|
31503
|
+
isNaN(e) || _t(Math.max(0, Math.floor((Date.now() - e) / 1e3)));
|
|
31531
31504
|
};
|
|
31532
31505
|
e();
|
|
31533
31506
|
let t = window.setInterval(e, 1e3);
|
|
31534
31507
|
return () => window.clearInterval(t);
|
|
31535
31508
|
}, [te, ee]);
|
|
31536
31509
|
let Lt = o(() => {
|
|
31537
|
-
|
|
31510
|
+
ot("call_screen"), Dt(!1);
|
|
31538
31511
|
}, []), Rt = o(() => {
|
|
31539
|
-
|
|
31512
|
+
ot("text_chat"), Dt(!0);
|
|
31540
31513
|
}, []);
|
|
31541
31514
|
c(() => {
|
|
31542
31515
|
let e = w?.callId || T || null;
|
|
31543
31516
|
if (!e) {
|
|
31544
|
-
|
|
31517
|
+
At.current = null;
|
|
31545
31518
|
return;
|
|
31546
31519
|
}
|
|
31547
31520
|
if (w?.callId || ee === "connecting" || ee === "connected") {
|
|
31548
|
-
if (A === "minimized_orb" &&
|
|
31549
|
-
|
|
31521
|
+
if (A === "minimized_orb" && Et && T && !w?.callId) {
|
|
31522
|
+
At.current = e;
|
|
31550
31523
|
return;
|
|
31551
31524
|
}
|
|
31552
|
-
!(!i || A === "minimized_orb" || A === "voice_mode") &&
|
|
31525
|
+
!(!i || A === "minimized_orb" || A === "voice_mode") && At.current === e || (console.log("[FlowEngageWidget] forcing call UI to front", {
|
|
31553
31526
|
forcedKey: e,
|
|
31554
31527
|
isOpen: i,
|
|
31555
31528
|
surface: A,
|
|
31556
31529
|
hasIncomingCall: !!w?.callId,
|
|
31557
31530
|
activeCallId: T,
|
|
31558
31531
|
callConnectionState: ee
|
|
31559
|
-
}),
|
|
31532
|
+
}), At.current = e, A === "voice_mode" && ue?.(!1), ce?.(), Lt());
|
|
31560
31533
|
}
|
|
31561
31534
|
}, [
|
|
31562
31535
|
T,
|
|
@@ -31568,31 +31541,31 @@ function zk() {
|
|
|
31568
31541
|
ue,
|
|
31569
31542
|
A
|
|
31570
31543
|
]), c(() => {
|
|
31571
|
-
!w && !T && A === "call_screen" &&
|
|
31544
|
+
!w && !T && A === "call_screen" && ot("text_chat");
|
|
31572
31545
|
}, [
|
|
31573
31546
|
w,
|
|
31574
31547
|
T,
|
|
31575
31548
|
A
|
|
31576
31549
|
]), c(() => {
|
|
31577
|
-
!T &&
|
|
31578
|
-
}, [T,
|
|
31550
|
+
!T && Et && Dt(!1);
|
|
31551
|
+
}, [T, Et]), c(() => {
|
|
31579
31552
|
if (!s || C) {
|
|
31580
31553
|
Se?.(""), xe?.();
|
|
31581
31554
|
return;
|
|
31582
31555
|
}
|
|
31583
|
-
if (!
|
|
31556
|
+
if (!st.trim() || bt) {
|
|
31584
31557
|
Se?.("");
|
|
31585
31558
|
let e = window.setTimeout(() => xe?.(), 100);
|
|
31586
31559
|
return () => window.clearTimeout(e);
|
|
31587
31560
|
}
|
|
31588
31561
|
be?.();
|
|
31589
|
-
let e = window.setTimeout(() => Se?.(
|
|
31562
|
+
let e = window.setTimeout(() => Se?.(st), 120), t = window.setTimeout(() => xe?.(), 1200);
|
|
31590
31563
|
return () => {
|
|
31591
31564
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
31592
31565
|
};
|
|
31593
31566
|
}, [
|
|
31594
|
-
|
|
31595
|
-
|
|
31567
|
+
st,
|
|
31568
|
+
bt,
|
|
31596
31569
|
s,
|
|
31597
31570
|
C,
|
|
31598
31571
|
be,
|
|
@@ -31605,39 +31578,39 @@ function zk() {
|
|
|
31605
31578
|
replyToSender: e.sender || null
|
|
31606
31579
|
} : null, Bt = async (e) => {
|
|
31607
31580
|
if (e.preventDefault(), C) return;
|
|
31608
|
-
if (
|
|
31609
|
-
let e =
|
|
31581
|
+
if (Mt) {
|
|
31582
|
+
let e = dt.trim().toLowerCase();
|
|
31610
31583
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
31611
|
-
|
|
31584
|
+
mt("Please enter a valid email so we can continue helping you.");
|
|
31612
31585
|
return;
|
|
31613
31586
|
}
|
|
31614
|
-
await le(e),
|
|
31587
|
+
await le(e), mt(""), gt(!0), setTimeout(() => gt(!1), 3e3);
|
|
31615
31588
|
return;
|
|
31616
31589
|
}
|
|
31617
|
-
let t = zt(
|
|
31618
|
-
if (!
|
|
31619
|
-
if (
|
|
31590
|
+
let t = zt(lt);
|
|
31591
|
+
if (!st.trim() && !bt) return;
|
|
31592
|
+
if (bt) {
|
|
31620
31593
|
try {
|
|
31621
|
-
|
|
31622
|
-
let e = await se(
|
|
31623
|
-
|
|
31594
|
+
Tt(!0), Ct("");
|
|
31595
|
+
let e = await se(bt), n = e?.data || e, r = st.trim() || `Shared file: ${YD(bt)}`;
|
|
31596
|
+
ct(""), ut(null), Ft(), await D(r, "", t, {
|
|
31624
31597
|
type: "file",
|
|
31625
31598
|
metadata: {
|
|
31626
31599
|
fileUrl: n?.fileUrl,
|
|
31627
|
-
fileName: n?.fileName ||
|
|
31628
|
-
fileType: n?.fileType ||
|
|
31629
|
-
fileSize: n?.fileSize ||
|
|
31600
|
+
fileName: n?.fileName || bt.name,
|
|
31601
|
+
fileType: n?.fileType || bt.type,
|
|
31602
|
+
fileSize: n?.fileSize || bt.size
|
|
31630
31603
|
}
|
|
31631
31604
|
});
|
|
31632
31605
|
} catch (e) {
|
|
31633
|
-
|
|
31606
|
+
Ct(e?.message || "Failed to upload the selected file.");
|
|
31634
31607
|
} finally {
|
|
31635
|
-
|
|
31608
|
+
Tt(!1);
|
|
31636
31609
|
}
|
|
31637
31610
|
return;
|
|
31638
31611
|
}
|
|
31639
|
-
let n =
|
|
31640
|
-
|
|
31612
|
+
let n = st.trim();
|
|
31613
|
+
ct(""), ut(null), await D(n, "", t);
|
|
31641
31614
|
}, Vt = o(() => {
|
|
31642
31615
|
r.length !== 0 && me?.();
|
|
31643
31616
|
}, [r.length, me]), Ht = (e) => {
|
|
@@ -31685,10 +31658,10 @@ function zk() {
|
|
|
31685
31658
|
right: "1.5rem",
|
|
31686
31659
|
bottom: "1.5rem"
|
|
31687
31660
|
}, Gt = o(() => {
|
|
31688
|
-
A !== "minimized_orb" && (
|
|
31689
|
-
|
|
31661
|
+
A !== "minimized_orb" && (kt(!0), setTimeout(() => {
|
|
31662
|
+
ot("minimized_orb"), kt(!1), T && Dt(!0);
|
|
31690
31663
|
}, 280));
|
|
31691
|
-
}, [T, A]), Kt = () =>
|
|
31664
|
+
}, [T, A]), Kt = () => ot("connection_modal"), qt = () => {
|
|
31692
31665
|
try {
|
|
31693
31666
|
let e = window.AudioContext || window.webkitAudioContext;
|
|
31694
31667
|
if (e) {
|
|
@@ -31696,9 +31669,9 @@ function zk() {
|
|
|
31696
31669
|
t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
|
|
31697
31670
|
}
|
|
31698
31671
|
} catch {}
|
|
31699
|
-
ce({ notifyChatInitiated: !0 }), ue?.(!0),
|
|
31672
|
+
ce({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31700
31673
|
}, Jt = () => {
|
|
31701
|
-
ce({ notifyChatInitiated: !0 }), ue?.(!1),
|
|
31674
|
+
ce({ notifyChatInitiated: !0 }), ue?.(!1), ot("text_chat");
|
|
31702
31675
|
}, Yt = () => {
|
|
31703
31676
|
ue?.(!1), Gt();
|
|
31704
31677
|
};
|
|
@@ -31712,7 +31685,7 @@ function zk() {
|
|
|
31712
31685
|
onWheel: (e) => e.stopPropagation(),
|
|
31713
31686
|
onTouchMove: (e) => e.stopPropagation(),
|
|
31714
31687
|
children: [
|
|
31715
|
-
A === "entry_prompt" && /* @__PURE__ */ g(
|
|
31688
|
+
A === "entry_prompt" && /* @__PURE__ */ g(Mk, {
|
|
31716
31689
|
copy: Qe,
|
|
31717
31690
|
orbColors: Le,
|
|
31718
31691
|
primaryColor: ze,
|
|
@@ -31723,7 +31696,7 @@ function zk() {
|
|
|
31723
31696
|
pe(et), Gt();
|
|
31724
31697
|
},
|
|
31725
31698
|
isMobile: Nt,
|
|
31726
|
-
isClosing:
|
|
31699
|
+
isClosing: Ot
|
|
31727
31700
|
}),
|
|
31728
31701
|
A === "minimized_orb" && /* @__PURE__ */ _(Dm.div, {
|
|
31729
31702
|
layoutId: "fe-main-orb",
|
|
@@ -31792,16 +31765,16 @@ function zk() {
|
|
|
31792
31765
|
marginTop: "2px",
|
|
31793
31766
|
whiteSpace: "nowrap"
|
|
31794
31767
|
},
|
|
31795
|
-
children: ee === "connected" ? `${Ht(
|
|
31768
|
+
children: ee === "connected" ? `${Ht(j)} with ${nt}` : `Tap to return to ${nt}`
|
|
31796
31769
|
})]
|
|
31797
31770
|
})]
|
|
31798
|
-
}), /* @__PURE__ */ g(
|
|
31771
|
+
}), /* @__PURE__ */ g(jk, {
|
|
31799
31772
|
size: Ve,
|
|
31800
31773
|
orbColors: Le,
|
|
31801
31774
|
onClick: T ? Lt : Ie ? Kt : Jt
|
|
31802
31775
|
})]
|
|
31803
31776
|
}),
|
|
31804
|
-
A === "connection_modal" && /* @__PURE__ */ g(
|
|
31777
|
+
A === "connection_modal" && /* @__PURE__ */ g(Nk, {
|
|
31805
31778
|
copy: Qe,
|
|
31806
31779
|
orbColors: Le,
|
|
31807
31780
|
primaryColor: ze,
|
|
@@ -31809,9 +31782,9 @@ function zk() {
|
|
|
31809
31782
|
onText: Jt,
|
|
31810
31783
|
onClose: Gt,
|
|
31811
31784
|
isMobile: Nt,
|
|
31812
|
-
isClosing:
|
|
31785
|
+
isClosing: Ot
|
|
31813
31786
|
}),
|
|
31814
|
-
A === "voice_mode" && /* @__PURE__ */ g(
|
|
31787
|
+
A === "voice_mode" && /* @__PURE__ */ g(Pk, {
|
|
31815
31788
|
orbColors: Le,
|
|
31816
31789
|
onEnterChat: Jt,
|
|
31817
31790
|
onEndChat: Yt,
|
|
@@ -31827,7 +31800,7 @@ function zk() {
|
|
|
31827
31800
|
incomingCall: w,
|
|
31828
31801
|
activeCallId: T,
|
|
31829
31802
|
callConnectionState: ee,
|
|
31830
|
-
callDurationSeconds:
|
|
31803
|
+
callDurationSeconds: j,
|
|
31831
31804
|
isCallMuted: ne,
|
|
31832
31805
|
agentName: nt,
|
|
31833
31806
|
agentHeadshot: rt,
|
|
@@ -31842,8 +31815,8 @@ function zk() {
|
|
|
31842
31815
|
orbColors: Le,
|
|
31843
31816
|
chatHistory: r
|
|
31844
31817
|
}),
|
|
31845
|
-
A === "text_chat" && /* @__PURE__ */ g(
|
|
31846
|
-
isClosing:
|
|
31818
|
+
A === "text_chat" && /* @__PURE__ */ g(Lk, {
|
|
31819
|
+
isClosing: Ot,
|
|
31847
31820
|
copy: Qe,
|
|
31848
31821
|
orbColors: Le,
|
|
31849
31822
|
primaryColor: ze,
|
|
@@ -31859,35 +31832,35 @@ function zk() {
|
|
|
31859
31832
|
agentName: nt,
|
|
31860
31833
|
agentHeadshot: rt,
|
|
31861
31834
|
fallbackAgentName: O,
|
|
31862
|
-
input:
|
|
31863
|
-
setInput:
|
|
31835
|
+
input: st,
|
|
31836
|
+
setInput: ct,
|
|
31864
31837
|
onSubmit: Bt,
|
|
31865
31838
|
isConversationEnded: C,
|
|
31866
31839
|
isLoading: b,
|
|
31867
31840
|
isRateLimited: x,
|
|
31868
31841
|
rateLimitMessage: S,
|
|
31869
|
-
selectedFile:
|
|
31842
|
+
selectedFile: bt,
|
|
31870
31843
|
onFileSelect: It,
|
|
31871
31844
|
onRemoveSelectedFile: Ft,
|
|
31872
|
-
attachmentError:
|
|
31873
|
-
isUploadingAttachment:
|
|
31874
|
-
requiresEmail:
|
|
31875
|
-
emailInput:
|
|
31876
|
-
setEmailInput:
|
|
31877
|
-
emailError:
|
|
31878
|
-
emailCaptureSuccess:
|
|
31879
|
-
replyContext:
|
|
31880
|
-
setReplyContext:
|
|
31845
|
+
attachmentError: St,
|
|
31846
|
+
isUploadingAttachment: wt,
|
|
31847
|
+
requiresEmail: Mt,
|
|
31848
|
+
emailInput: dt,
|
|
31849
|
+
setEmailInput: ft,
|
|
31850
|
+
emailError: pt,
|
|
31851
|
+
emailCaptureSuccess: ht,
|
|
31852
|
+
replyContext: lt,
|
|
31853
|
+
setReplyContext: ut,
|
|
31881
31854
|
webRTCError: re,
|
|
31882
|
-
micError:
|
|
31883
|
-
setMicError:
|
|
31855
|
+
micError: vt,
|
|
31856
|
+
setMicError: yt,
|
|
31884
31857
|
dismissCallError: ye,
|
|
31885
31858
|
activeCallId: T,
|
|
31886
31859
|
isCallMuted: ne,
|
|
31887
31860
|
toggleCallMute: ve,
|
|
31888
31861
|
endWebRTCCall: _e,
|
|
31889
31862
|
formatCallDuration: Ht,
|
|
31890
|
-
callDurationSeconds:
|
|
31863
|
+
callDurationSeconds: j,
|
|
31891
31864
|
onCollapse: Gt,
|
|
31892
31865
|
onStartVoice: qt,
|
|
31893
31866
|
onNewChat: Vt,
|
|
@@ -31905,7 +31878,7 @@ function zk() {
|
|
|
31905
31878
|
}
|
|
31906
31879
|
//#endregion
|
|
31907
31880
|
//#region src/components/ErrorBoundary.jsx
|
|
31908
|
-
var
|
|
31881
|
+
var zk = class extends e.Component {
|
|
31909
31882
|
constructor(e) {
|
|
31910
31883
|
super(e), this.state = { hasError: !1 };
|
|
31911
31884
|
}
|
|
@@ -31920,4 +31893,4 @@ var Bk = class extends e.Component {
|
|
|
31920
31893
|
}
|
|
31921
31894
|
};
|
|
31922
31895
|
//#endregion
|
|
31923
|
-
export { lO as AnimatedOrb,
|
|
31896
|
+
export { lO as AnimatedOrb, zk as ErrorBoundary, Rr as FlowEngageProvider, Rk as FlowEngageWidget, Ln as useFlowEngage };
|