@flowengage/react-chatbot 5.0.62 → 5.0.63
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.
|
@@ -29357,7 +29357,36 @@ function wk() {
|
|
|
29357
29357
|
e[r] = !0, t.id = r;
|
|
29358
29358
|
});
|
|
29359
29359
|
}
|
|
29360
|
-
|
|
29360
|
+
var Tk = [], Ek = 2.5;
|
|
29361
|
+
function Dk(e) {
|
|
29362
|
+
if (!e || Tk.length === 0) return;
|
|
29363
|
+
let t = e.toLowerCase(), n = [];
|
|
29364
|
+
for (let r of Tk) {
|
|
29365
|
+
let i = r.label.toLowerCase().split(/\s+/), a = -1, o = i.length >= 3 ? 3 : i.length;
|
|
29366
|
+
for (let e = Math.min(5, i.length); e >= o; e--) {
|
|
29367
|
+
let n = i.slice(0, e).join(" "), r = t.indexOf(n);
|
|
29368
|
+
if (r >= 0) {
|
|
29369
|
+
a = r;
|
|
29370
|
+
break;
|
|
29371
|
+
}
|
|
29372
|
+
}
|
|
29373
|
+
let s = a > 0 ? e.slice(0, a).split(/\s+/).filter(Boolean).length : 0;
|
|
29374
|
+
n.push({
|
|
29375
|
+
el: r.el,
|
|
29376
|
+
label: r.label,
|
|
29377
|
+
delay: Math.round(s / Ek * 1e3)
|
|
29378
|
+
});
|
|
29379
|
+
}
|
|
29380
|
+
Tk.length = 0, n.sort((e, t) => e.delay - t.delay);
|
|
29381
|
+
for (let e = 1; e < n.length; e++) n[e].delay < n[e - 1].delay + 400 && (n[e].delay = n[e - 1].delay + 400);
|
|
29382
|
+
for (let { el: e, label: t, delay: r } of n) setTimeout(() => {
|
|
29383
|
+
CD(e), $(`highlight ✓ word-sync +${r}ms`, t);
|
|
29384
|
+
}, r);
|
|
29385
|
+
}
|
|
29386
|
+
function Ok() {
|
|
29387
|
+
Tk.length = 0;
|
|
29388
|
+
}
|
|
29389
|
+
function kk(e) {
|
|
29361
29390
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
|
|
29362
29391
|
flowengage_navigate: async (n) => {
|
|
29363
29392
|
$("flowengage_navigate ▶ raw parameters:", n);
|
|
@@ -29435,7 +29464,10 @@ function Tk(e) {
|
|
|
29435
29464
|
let t = _k(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = r || n || "";
|
|
29436
29465
|
wk();
|
|
29437
29466
|
let a = hr(n || null, r || null);
|
|
29438
|
-
return !a && r && (await new Promise((e) => setTimeout(e, 500)), wk(), a = hr(null, r)), a ? (
|
|
29467
|
+
return !a && r && (await new Promise((e) => setTimeout(e, 500)), wk(), a = hr(null, r)), a ? (Tk.push({
|
|
29468
|
+
el: a,
|
|
29469
|
+
label: i
|
|
29470
|
+
}), $("flowengage_highlight ◷ queued for word-sync", i), `OK_HIGHLIGHT: "${i}" queued. Continue speaking — highlights are timed automatically.`) : ($("flowengage_highlight ✖ no element for:", i), `HIGHLIGHT_NOT_FOUND: "${i}" — section not found. Do NOT apologize or mention this. Continue speaking naturally. Try a shorter phrase (first 2-3 words) next time.`);
|
|
29439
29471
|
},
|
|
29440
29472
|
flowengage_read_content: async (e) => {
|
|
29441
29473
|
$("flowengage_read_content ▶", e);
|
|
@@ -29630,7 +29662,7 @@ function Tk(e) {
|
|
|
29630
29662
|
}
|
|
29631
29663
|
//#endregion
|
|
29632
29664
|
//#region src/utils/wrapVoiceToolsForLogging.js
|
|
29633
|
-
function
|
|
29665
|
+
function Ak(e) {
|
|
29634
29666
|
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
|
|
29635
29667
|
let r = Rn();
|
|
29636
29668
|
r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
|
|
@@ -29647,7 +29679,7 @@ function Ek(e) {
|
|
|
29647
29679
|
}
|
|
29648
29680
|
//#endregion
|
|
29649
29681
|
//#region src/components/FlowEngageWidget.jsx
|
|
29650
|
-
var
|
|
29682
|
+
var jk = {
|
|
29651
29683
|
blue: "#135bd8",
|
|
29652
29684
|
red: "#ef334b",
|
|
29653
29685
|
yellow: "#ffbd2e",
|
|
@@ -29655,7 +29687,7 @@ var Dk = {
|
|
|
29655
29687
|
highlight: "rgba(255,255,255,0.9)",
|
|
29656
29688
|
green: "#10b981"
|
|
29657
29689
|
};
|
|
29658
|
-
function
|
|
29690
|
+
function Mk(e) {
|
|
29659
29691
|
if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
|
|
29660
29692
|
let [t, n, r] = e;
|
|
29661
29693
|
return e.length >= 3 && r ? [
|
|
@@ -29669,12 +29701,12 @@ function Ok(e) {
|
|
|
29669
29701
|
"#f7f8fa"
|
|
29670
29702
|
].join(", ");
|
|
29671
29703
|
}
|
|
29672
|
-
function
|
|
29704
|
+
function Nk(e) {
|
|
29673
29705
|
if (!e || typeof e != "string") return "#1a1a1a";
|
|
29674
29706
|
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;
|
|
29675
29707
|
return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
|
|
29676
29708
|
}
|
|
29677
|
-
function
|
|
29709
|
+
function Pk({ logo: t, style: n }) {
|
|
29678
29710
|
if (!t) return null;
|
|
29679
29711
|
if (typeof t == "string") return /* @__PURE__ */ g("img", {
|
|
29680
29712
|
src: t,
|
|
@@ -29699,7 +29731,7 @@ function Ak({ logo: t, style: n }) {
|
|
|
29699
29731
|
children: r
|
|
29700
29732
|
}) : null;
|
|
29701
29733
|
}
|
|
29702
|
-
function
|
|
29734
|
+
function Fk({ title: e }) {
|
|
29703
29735
|
return /* @__PURE__ */ g("div", {
|
|
29704
29736
|
style: {
|
|
29705
29737
|
width: "100%",
|
|
@@ -29717,18 +29749,18 @@ function jk({ title: e }) {
|
|
|
29717
29749
|
children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
|
|
29718
29750
|
});
|
|
29719
29751
|
}
|
|
29720
|
-
function
|
|
29752
|
+
function Ik(e, t) {
|
|
29721
29753
|
let n = (t || "").trim();
|
|
29722
29754
|
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;
|
|
29723
29755
|
}
|
|
29724
|
-
function
|
|
29756
|
+
function Lk({ orbColors: e, ...t }) {
|
|
29725
29757
|
return /* @__PURE__ */ g(dO, {
|
|
29726
29758
|
colors: e,
|
|
29727
29759
|
...t
|
|
29728
29760
|
});
|
|
29729
29761
|
}
|
|
29730
|
-
function
|
|
29731
|
-
let s = n ||
|
|
29762
|
+
function Rk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
|
|
29763
|
+
let s = n || jk.green, c = Nk(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
|
|
29732
29764
|
style: {
|
|
29733
29765
|
display: "flex",
|
|
29734
29766
|
alignItems: a ? "flex-end" : "center",
|
|
@@ -29849,7 +29881,7 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
29849
29881
|
delay: 0
|
|
29850
29882
|
},
|
|
29851
29883
|
style: { flexShrink: 0 },
|
|
29852
|
-
children: /* @__PURE__ */ g(
|
|
29884
|
+
children: /* @__PURE__ */ g(Lk, {
|
|
29853
29885
|
size: l,
|
|
29854
29886
|
orbColors: t
|
|
29855
29887
|
})
|
|
@@ -29881,8 +29913,8 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
29881
29913
|
children: u
|
|
29882
29914
|
})] });
|
|
29883
29915
|
}
|
|
29884
|
-
function
|
|
29885
|
-
let c = n ||
|
|
29916
|
+
function zk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
|
|
29917
|
+
let c = n || jk.green, l = Nk(c);
|
|
29886
29918
|
return /* @__PURE__ */ _(Dm.div, {
|
|
29887
29919
|
initial: {
|
|
29888
29920
|
scale: 50 / 350,
|
|
@@ -29953,7 +29985,7 @@ function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
29953
29985
|
children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
|
|
29954
29986
|
})
|
|
29955
29987
|
}),
|
|
29956
|
-
/* @__PURE__ */ g(
|
|
29988
|
+
/* @__PURE__ */ g(Lk, {
|
|
29957
29989
|
size: 72,
|
|
29958
29990
|
orbColors: t
|
|
29959
29991
|
}),
|
|
@@ -30022,17 +30054,20 @@ function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
30022
30054
|
]
|
|
30023
30055
|
});
|
|
30024
30056
|
}
|
|
30025
|
-
function
|
|
30026
|
-
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 = p("idle"), le = p(!1), ue = p(null), de = p(null), fe = p(!1), pe = o((e = "minimized") => {
|
|
30057
|
+
function Bk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
|
|
30058
|
+
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 = p("idle"), le = p(!1), ue = p(null), de = p(null), fe = p(!1), pe = p(""), me = o((e = "minimized") => {
|
|
30027
30059
|
E.current = e, re.current = !0, queueMicrotask(() => {
|
|
30028
30060
|
ee.current || (ee.current = !0, T.current?.());
|
|
30029
30061
|
});
|
|
30030
|
-
}, [u]),
|
|
30062
|
+
}, [u]), he = o(async (e) => {
|
|
30031
30063
|
re.current = !0;
|
|
30032
30064
|
try {
|
|
30033
30065
|
wD();
|
|
30034
30066
|
} catch {}
|
|
30035
|
-
|
|
30067
|
+
try {
|
|
30068
|
+
Ok();
|
|
30069
|
+
} catch {}
|
|
30070
|
+
if (pe.current = "", a) try {
|
|
30036
30071
|
Ve(a);
|
|
30037
30072
|
} catch {}
|
|
30038
30073
|
try {
|
|
@@ -30063,10 +30098,10 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30063
30098
|
l,
|
|
30064
30099
|
s
|
|
30065
30100
|
]);
|
|
30066
|
-
return T.current = () =>
|
|
30101
|
+
return T.current = () => he(E.current === "chat" ? t : n), c(() => {
|
|
30067
30102
|
te.current = y;
|
|
30068
30103
|
}, [y]), c(() => {
|
|
30069
|
-
f &&
|
|
30104
|
+
f && me("chat");
|
|
30070
30105
|
}, [f]), c(() => {
|
|
30071
30106
|
let e = !1, i = null, o = null, c = null;
|
|
30072
30107
|
return (async () => {
|
|
@@ -30104,7 +30139,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30104
30139
|
}
|
|
30105
30140
|
Ne();
|
|
30106
30141
|
} });
|
|
30107
|
-
let t =
|
|
30142
|
+
let t = Ak(kk({
|
|
30108
30143
|
siteId: a || null,
|
|
30109
30144
|
apiBaseUrl: s || null,
|
|
30110
30145
|
getLastUserVoiceText: () => w.current,
|
|
@@ -30134,7 +30169,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30134
30169
|
m && m.includes("|") && (x = m.split("|").map((e) => e.trim()).filter(Boolean).reduce((e, t) => e.length <= t.length ? e : t));
|
|
30135
30170
|
let S = x || y || "this page";
|
|
30136
30171
|
g ? f ? (_.overrides = { agent: { firstMessage: `I've navigated you to the ${S} page. Let me walk you through what's here.` } }, console.log(`[FlowEngage] 🔄 Agent-nav resume: firstMessage set for "${S}" (${p})`)) : d ? _.overrides = { agent: { firstMessage: "I'm still here. Go ahead!" } } : h || (_.overrides = { agent: { firstMessage: `Hi! I see you are currently on the ${S} page. Are you looking for something specific here?` } }, console.log(`[FlowEngage] 🏠 Page-context override: "${S}" for ${p}`)) : d && (_.overrides = { agent: { firstMessage: "" } });
|
|
30137
|
-
let T = !1, oe = 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 section by section (highlight + one sentence each) until you have covered the key content. Prior conversation context:\n${(a ? je(a) : null)?.transcript || ""}\n\n` : null,
|
|
30172
|
+
let T = !1, oe = 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 section by section (highlight + one sentence each) until you have covered the key content. Prior conversation context:\n${(a ? je(a) : null)?.transcript || ""}\n\n` : null, he = await vD.startSession({
|
|
30138
30173
|
..._,
|
|
30139
30174
|
onConnect: ({ conversationId: e }) => {
|
|
30140
30175
|
ie.current = e, ae.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
@@ -30143,11 +30178,11 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30143
30178
|
onModeChange: ({ mode: t }) => {
|
|
30144
30179
|
if (!e) {
|
|
30145
30180
|
if (t === "speaking") {
|
|
30146
|
-
de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null);
|
|
30181
|
+
de.current &&= (clearTimeout(de.current), null), v("speaking"), ce.current = "speaking", le.current = !0, fe.current = !1, ue.current &&= (clearTimeout(ue.current), null), pe.current &&= (Dk(pe.current), "");
|
|
30147
30182
|
return;
|
|
30148
30183
|
}
|
|
30149
30184
|
if (ce.current = "listening", se.current) {
|
|
30150
|
-
se.current = !1,
|
|
30185
|
+
se.current = !1, me();
|
|
30151
30186
|
return;
|
|
30152
30187
|
}
|
|
30153
30188
|
if (oe && !T) {
|
|
@@ -30169,7 +30204,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30169
30204
|
if (e) return;
|
|
30170
30205
|
let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
|
|
30171
30206
|
if (r) {
|
|
30172
|
-
if (n === "user" && (w.current = r, fe.current = !0, de.current &&= (clearTimeout(de.current), null), ue.current &&= (clearTimeout(ue.current), null)), u.current = [...u.current, {
|
|
30207
|
+
if (n === "bot" && (ce.current === "speaking" ? Dk(r) : pe.current = r), n === "user" && (w.current = r, fe.current = !0, de.current &&= (clearTimeout(de.current), null), ue.current &&= (clearTimeout(ue.current), null)), u.current = [...u.current, {
|
|
30173
30208
|
sender: n,
|
|
30174
30209
|
message: r,
|
|
30175
30210
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -30177,14 +30212,14 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30177
30212
|
let e = bO(u.current);
|
|
30178
30213
|
e && Ae(a, e);
|
|
30179
30214
|
} catch {}
|
|
30180
|
-
if (
|
|
30181
|
-
|
|
30215
|
+
if (Ik(n, r)) {
|
|
30216
|
+
me("minimized");
|
|
30182
30217
|
return;
|
|
30183
30218
|
}
|
|
30184
30219
|
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 {
|
|
30185
30220
|
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.");
|
|
30186
30221
|
} catch {}
|
|
30187
|
-
else D.current >= 5 &&
|
|
30222
|
+
else D.current >= 5 && me("minimized");
|
|
30188
30223
|
}
|
|
30189
30224
|
},
|
|
30190
30225
|
onError: (t) => {
|
|
@@ -30197,7 +30232,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30197
30232
|
try {
|
|
30198
30233
|
C.current?.setMicMuted?.(!0);
|
|
30199
30234
|
} catch {}
|
|
30200
|
-
b(!0), v("error"),
|
|
30235
|
+
b(!0), v("error"), me("chat");
|
|
30201
30236
|
}
|
|
30202
30237
|
},
|
|
30203
30238
|
onDisconnect: (t) => {
|
|
@@ -30214,21 +30249,21 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30214
30249
|
try {
|
|
30215
30250
|
C.current?.setMicMuted?.(!0);
|
|
30216
30251
|
} catch {}
|
|
30217
|
-
b(!0),
|
|
30252
|
+
b(!0), me("chat");
|
|
30218
30253
|
}
|
|
30219
30254
|
});
|
|
30220
30255
|
if (e) {
|
|
30221
|
-
|
|
30256
|
+
he.endSession().catch(() => {});
|
|
30222
30257
|
return;
|
|
30223
30258
|
}
|
|
30224
|
-
i =
|
|
30259
|
+
i = he, C.current = he, v("listening");
|
|
30225
30260
|
try {
|
|
30226
30261
|
let e = typeof window < "u" ? window.location.href : "", r = "[]";
|
|
30227
30262
|
try {
|
|
30228
30263
|
r = await t.list_page_forms();
|
|
30229
30264
|
} catch {}
|
|
30230
30265
|
let i = d && !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` : "";
|
|
30231
|
-
|
|
30266
|
+
he.sendContextualUpdate(`${i}Page: ${e}. SiteId: ${a || "unknown"}. Forms: ${r}. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
30232
30267
|
} catch {}
|
|
30233
30268
|
if (typeof window < "u") {
|
|
30234
30269
|
let t = window.location.pathname, n = () => {
|
|
@@ -30287,7 +30322,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30287
30322
|
r,
|
|
30288
30323
|
a,
|
|
30289
30324
|
s,
|
|
30290
|
-
|
|
30325
|
+
me
|
|
30291
30326
|
]), c(() => {
|
|
30292
30327
|
if (!x) return;
|
|
30293
30328
|
let e = (e) => {
|
|
@@ -30341,7 +30376,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30341
30376
|
},
|
|
30342
30377
|
children: "Muted"
|
|
30343
30378
|
}),
|
|
30344
|
-
/* @__PURE__ */ g(
|
|
30379
|
+
/* @__PURE__ */ g(Lk, {
|
|
30345
30380
|
size: 72,
|
|
30346
30381
|
voiceState: h,
|
|
30347
30382
|
isMuted: y,
|
|
@@ -30473,7 +30508,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30473
30508
|
children: [
|
|
30474
30509
|
/* @__PURE__ */ _("button", {
|
|
30475
30510
|
onClick: () => {
|
|
30476
|
-
S(!1), E.current = "chat",
|
|
30511
|
+
S(!1), E.current = "chat", he(t);
|
|
30477
30512
|
},
|
|
30478
30513
|
style: {
|
|
30479
30514
|
display: "flex",
|
|
@@ -30502,7 +30537,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30502
30537
|
}),
|
|
30503
30538
|
/* @__PURE__ */ _("button", {
|
|
30504
30539
|
onClick: () => {
|
|
30505
|
-
S(!1), E.current = "minimized",
|
|
30540
|
+
S(!1), E.current = "minimized", he(n);
|
|
30506
30541
|
},
|
|
30507
30542
|
style: {
|
|
30508
30543
|
display: "flex",
|
|
@@ -30579,7 +30614,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
|
|
|
30579
30614
|
]
|
|
30580
30615
|
});
|
|
30581
30616
|
}
|
|
30582
|
-
function
|
|
30617
|
+
function Vk({ orbColors: e }) {
|
|
30583
30618
|
return /* @__PURE__ */ g("div", {
|
|
30584
30619
|
style: {
|
|
30585
30620
|
flexShrink: 0,
|
|
@@ -30589,13 +30624,13 @@ function Lk({ orbColors: e }) {
|
|
|
30589
30624
|
alignItems: "center",
|
|
30590
30625
|
justifyContent: "center"
|
|
30591
30626
|
},
|
|
30592
|
-
children: /* @__PURE__ */ g(
|
|
30627
|
+
children: /* @__PURE__ */ g(Lk, {
|
|
30593
30628
|
size: 36,
|
|
30594
30629
|
orbColors: e
|
|
30595
30630
|
})
|
|
30596
30631
|
});
|
|
30597
30632
|
}
|
|
30598
|
-
var
|
|
30633
|
+
var Hk = () => /* @__PURE__ */ g("div", {
|
|
30599
30634
|
style: {
|
|
30600
30635
|
display: "flex",
|
|
30601
30636
|
marginBottom: "12px",
|
|
@@ -30625,7 +30660,7 @@ var Rk = () => /* @__PURE__ */ g("div", {
|
|
|
30625
30660
|
} }, e))
|
|
30626
30661
|
})
|
|
30627
30662
|
});
|
|
30628
|
-
function
|
|
30663
|
+
function Uk({ 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, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: O }) {
|
|
30629
30664
|
let Ne = l.length > 0, Pe = T || ee || w, Fe = !!ge, [Ie, Le] = m(!1), [Re, ze] = m(!1), [Be, Ve] = m([]), [He, Ue] = m(!1), [We, Ge] = m(null), [Ke, qe] = m([]), Je = p(null), Ye = async () => {
|
|
30630
30665
|
Le(!1), ze(!0), Ue(!0), Ge(null);
|
|
30631
30666
|
try {
|
|
@@ -30750,7 +30785,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30750
30785
|
justifyContent: "center",
|
|
30751
30786
|
height: "40px"
|
|
30752
30787
|
},
|
|
30753
|
-
children: i ? /* @__PURE__ */ g(
|
|
30788
|
+
children: i ? /* @__PURE__ */ g(Pk, {
|
|
30754
30789
|
logo: i,
|
|
30755
30790
|
style: {
|
|
30756
30791
|
height: "34px",
|
|
@@ -30763,7 +30798,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30763
30798
|
height: "40px",
|
|
30764
30799
|
flexShrink: 0
|
|
30765
30800
|
},
|
|
30766
|
-
children: /* @__PURE__ */ g(
|
|
30801
|
+
children: /* @__PURE__ */ g(Fk, { title: e.chatTitle })
|
|
30767
30802
|
})
|
|
30768
30803
|
}), /* @__PURE__ */ g("div", {
|
|
30769
30804
|
style: {
|
|
@@ -31251,11 +31286,11 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31251
31286
|
isLoading: T,
|
|
31252
31287
|
isAgentTyping: d,
|
|
31253
31288
|
setReplyContext: de,
|
|
31254
|
-
TypingDots:
|
|
31289
|
+
TypingDots: Hk,
|
|
31255
31290
|
primaryColor: n,
|
|
31256
31291
|
agentHeadshot: y,
|
|
31257
31292
|
agentDisplayName: v || b,
|
|
31258
|
-
botAvatarNode: /* @__PURE__ */ g(
|
|
31293
|
+
botAvatarNode: /* @__PURE__ */ g(Vk, { orbColors: t })
|
|
31259
31294
|
}) : Me ? /* @__PURE__ */ _("div", {
|
|
31260
31295
|
style: {
|
|
31261
31296
|
flex: 1,
|
|
@@ -31296,7 +31331,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31296
31331
|
padding: "28px 24px"
|
|
31297
31332
|
},
|
|
31298
31333
|
children: [
|
|
31299
|
-
/* @__PURE__ */ g(
|
|
31334
|
+
/* @__PURE__ */ g(Lk, {
|
|
31300
31335
|
size: 94,
|
|
31301
31336
|
orbColors: t
|
|
31302
31337
|
}),
|
|
@@ -31437,7 +31472,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31437
31472
|
]
|
|
31438
31473
|
});
|
|
31439
31474
|
}
|
|
31440
|
-
function
|
|
31475
|
+
function Wk() {
|
|
31441
31476
|
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, getVisitorChatThread: we, resumeChat: Te, isSessionRestoring: Ee, openToChatCounter: De, voiceEndCounter: Oe } = Ln();
|
|
31442
31477
|
c(() => {
|
|
31443
31478
|
try {
|
|
@@ -31455,7 +31490,7 @@ function Bk() {
|
|
|
31455
31490
|
}, Fe = {
|
|
31456
31491
|
...ke.features || {},
|
|
31457
31492
|
...Ae.features || {}
|
|
31458
|
-
}, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He =
|
|
31493
|
+
}, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He = Mk(Re ?? Ne.chatBgColors), Ue = O.logo || O.logoUrl || null, We = E || "en", Ge = ke.recommendations?.[We] || [], Ke = (Ae.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
31459
31494
|
id: e.key || `qr-${t}`,
|
|
31460
31495
|
label: e.label,
|
|
31461
31496
|
message: e.label,
|
|
@@ -31719,7 +31754,7 @@ function Bk() {
|
|
|
31719
31754
|
onWheel: (e) => e.stopPropagation(),
|
|
31720
31755
|
onTouchMove: (e) => e.stopPropagation(),
|
|
31721
31756
|
children: [
|
|
31722
|
-
A === "entry_prompt" && /* @__PURE__ */ g(
|
|
31757
|
+
A === "entry_prompt" && /* @__PURE__ */ g(Rk, {
|
|
31723
31758
|
copy: Ze,
|
|
31724
31759
|
orbColors: Re,
|
|
31725
31760
|
primaryColor: ze,
|
|
@@ -31802,13 +31837,13 @@ function Bk() {
|
|
|
31802
31837
|
children: ee === "connected" ? `${Ht(_t)} with ${nt}` : `Tap to return to ${nt}`
|
|
31803
31838
|
})]
|
|
31804
31839
|
})]
|
|
31805
|
-
}), /* @__PURE__ */ g(
|
|
31840
|
+
}), /* @__PURE__ */ g(Lk, {
|
|
31806
31841
|
size: 50,
|
|
31807
31842
|
orbColors: Re,
|
|
31808
31843
|
onClick: T && Dt ? Lt : Ie ? Kt : Jt
|
|
31809
31844
|
})]
|
|
31810
31845
|
}),
|
|
31811
|
-
A === "connection_modal" && /* @__PURE__ */ g(
|
|
31846
|
+
A === "connection_modal" && /* @__PURE__ */ g(zk, {
|
|
31812
31847
|
copy: Ze,
|
|
31813
31848
|
orbColors: Re,
|
|
31814
31849
|
primaryColor: ze,
|
|
@@ -31818,7 +31853,7 @@ function Bk() {
|
|
|
31818
31853
|
isMobile: Nt,
|
|
31819
31854
|
isClosing: kt
|
|
31820
31855
|
}),
|
|
31821
|
-
A === "voice_mode" && /* @__PURE__ */ g(
|
|
31856
|
+
A === "voice_mode" && /* @__PURE__ */ g(Bk, {
|
|
31822
31857
|
orbColors: Re,
|
|
31823
31858
|
onEnterChat: Jt,
|
|
31824
31859
|
onEndChat: Yt,
|
|
@@ -31850,7 +31885,7 @@ function Bk() {
|
|
|
31850
31885
|
orbColors: Re,
|
|
31851
31886
|
chatHistory: r
|
|
31852
31887
|
}),
|
|
31853
|
-
A === "text_chat" && /* @__PURE__ */ g(
|
|
31888
|
+
A === "text_chat" && /* @__PURE__ */ g(Uk, {
|
|
31854
31889
|
isClosing: kt,
|
|
31855
31890
|
copy: Ze,
|
|
31856
31891
|
orbColors: Re,
|
|
@@ -31915,7 +31950,7 @@ function Bk() {
|
|
|
31915
31950
|
}
|
|
31916
31951
|
//#endregion
|
|
31917
31952
|
//#region src/components/ErrorBoundary.jsx
|
|
31918
|
-
var
|
|
31953
|
+
var Gk = class extends e.Component {
|
|
31919
31954
|
constructor(e) {
|
|
31920
31955
|
super(e), this.state = { hasError: !1 };
|
|
31921
31956
|
}
|
|
@@ -31930,4 +31965,4 @@ var Vk = class extends e.Component {
|
|
|
31930
31965
|
}
|
|
31931
31966
|
};
|
|
31932
31967
|
//#endregion
|
|
31933
|
-
export { dO as AnimatedOrb,
|
|
31968
|
+
export { dO as AnimatedOrb, Gk as ErrorBoundary, Rr as FlowEngageProvider, Wk as FlowEngageWidget, Ln as useFlowEngage };
|