@flowengage/react-chatbot 8.0.72 → 8.0.73
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.
|
@@ -8903,7 +8903,7 @@ async function Pm(e) {
|
|
|
8903
8903
|
let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p } = e, m = await Nm(t, n, r);
|
|
8904
8904
|
f?.({ emailOnFile: !!m.emailOnFile });
|
|
8905
8905
|
let h = { type: "Start" };
|
|
8906
|
-
e.greeting !== void 0 && (h.greeting = e.greeting || null);
|
|
8906
|
+
e.greeting !== void 0 && (h.greeting = e.greeting || null), e.greetingAlreadySpoken && (h.greetingAlreadySpoken = !0);
|
|
8907
8907
|
let g = await navigator.mediaDevices.getUserMedia({ audio: {
|
|
8908
8908
|
channelCount: 1,
|
|
8909
8909
|
echoCancellation: !0,
|
|
@@ -12982,8 +12982,13 @@ function Mg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12982
12982
|
let e = f || "";
|
|
12983
12983
|
x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to the ${w} page!`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
|
|
12984
12984
|
}
|
|
12985
|
-
let ee = !1, O = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, k = !1, ne = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, re = r && !p, A = !1, ie = re ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, oe = !1, _e = !1, Te = b && !!y && !de.current, De =
|
|
12985
|
+
let ee = !1, O = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, k = !1, ne = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, re = r && !p, A = !1, ie = re ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, oe = !1, _e = !1, Te = b && !!y && !de.current, De = !1;
|
|
12986
|
+
if (typeof window < "u" && window.speechSynthesis && x.greeting) try {
|
|
12987
|
+
window.speechSynthesis.cancel(), window.speechSynthesis.speak(new SpeechSynthesisUtterance(x.greeting)), De = !0;
|
|
12988
|
+
} catch {}
|
|
12989
|
+
let R = await Fm.startSession({
|
|
12986
12990
|
...x,
|
|
12991
|
+
greetingAlreadySpoken: De,
|
|
12987
12992
|
onConnect: ({ conversationId: e }) => {
|
|
12988
12993
|
Ce.current = e, F.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
12989
12994
|
},
|
|
@@ -13098,10 +13103,10 @@ function Mg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13098
13103
|
}
|
|
13099
13104
|
});
|
|
13100
13105
|
if (e) {
|
|
13101
|
-
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"),
|
|
13106
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), R.endSession().catch(() => {});
|
|
13102
13107
|
return;
|
|
13103
13108
|
}
|
|
13104
|
-
o =
|
|
13109
|
+
o = R, N.current = R, T("listening");
|
|
13105
13110
|
try {
|
|
13106
13111
|
let e = typeof window < "u" ? window.location.href : "", a = "[]";
|
|
13107
13112
|
try {
|
|
@@ -13113,7 +13118,7 @@ function Mg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13113
13118
|
n.length || (n = Array.from(document.body.querySelectorAll("h1, h2, h3")).filter((t) => !t.closest(e)).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200)), n.length && (o = [...new Set(n)].slice(0, 15).join(" | "));
|
|
13114
13119
|
} catch {}
|
|
13115
13120
|
let s = r && !p ? `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` : "";
|
|
13116
|
-
|
|
13121
|
+
R.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
13117
13122
|
} catch {}
|
|
13118
13123
|
if (typeof window < "u") {
|
|
13119
13124
|
let t = window.location.pathname, n = () => {
|