@flowengage/react-chatbot 8.0.16-test3 → 8.0.16-test5
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.
|
@@ -30087,7 +30087,7 @@ function gk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30087
30087
|
w.overrides = { agent: { firstMessage: h || (b ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to the ${ne} page!`) } }, b || console.log(`[FlowEngage] 🏠 Page-context override: "${ne}" for ${g}`);
|
|
30088
30088
|
}
|
|
30089
30089
|
else u && (w.overrides = { agent: { firstMessage: "" } });
|
|
30090
|
-
let re = !1, E = m ? `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, ie = !1, D = !m && !u ? "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, de = !1, ye = !!y,
|
|
30090
|
+
let re = !1, E = m ? `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, ie = !1, D = !m && !u ? "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, de = !1, ye = !1, ke = !!y, je = await ED.startSession({
|
|
30091
30091
|
...w,
|
|
30092
30092
|
onConnect: ({ conversationId: e }) => {
|
|
30093
30093
|
_e.current = e, ve.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
@@ -30103,6 +30103,12 @@ function gk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30103
30103
|
xe.current = !1, Oe();
|
|
30104
30104
|
return;
|
|
30105
30105
|
}
|
|
30106
|
+
if (ke && !ye) {
|
|
30107
|
+
ye = !0, re = !0, ie = !0;
|
|
30108
|
+
try {
|
|
30109
|
+
le.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
|
|
30110
|
+
} catch {}
|
|
30111
|
+
}
|
|
30106
30112
|
if (E && !re) {
|
|
30107
30113
|
re = !0;
|
|
30108
30114
|
try {
|
|
@@ -30133,12 +30139,7 @@ function gk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30133
30139
|
try {
|
|
30134
30140
|
Vn();
|
|
30135
30141
|
} catch {}
|
|
30136
|
-
|
|
30137
|
-
de = !0, ce.current = r, oe.current || (oe.current = !0, se.current = 0, te(!0), Me());
|
|
30138
|
-
try {
|
|
30139
|
-
le.current?.sendUserMessage?.(`[SYSTEM: Do NOT answer the visitor's question yet. First you MUST collect their email. An email text box is now visible below the conversation. Say EXACTLY: 'Before I answer that, could you please enter your email in the text box below?' Then stay completely silent — do NOT answer, navigate, search, or perform any task until you receive an EMAIL_SAVED message. Remember the visitor's question — "${r}" — and answer it fully right after EMAIL_SAVED.]`);
|
|
30140
|
-
} catch {}
|
|
30141
|
-
}
|
|
30142
|
+
ke && !de && !ae.current && (de = !0, ce.current = r, oe.current || (oe.current = !0, se.current = 0, te(!0), Me()));
|
|
30142
30143
|
}
|
|
30143
30144
|
if (l.current = [...l.current, {
|
|
30144
30145
|
sender: n,
|
|
@@ -30189,10 +30190,10 @@ function gk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30189
30190
|
}
|
|
30190
30191
|
});
|
|
30191
30192
|
if (e) {
|
|
30192
|
-
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"),
|
|
30193
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), je.endSession().catch(() => {});
|
|
30193
30194
|
return;
|
|
30194
30195
|
}
|
|
30195
|
-
o =
|
|
30196
|
+
o = je, le.current = je, x("listening");
|
|
30196
30197
|
try {
|
|
30197
30198
|
let e = typeof window < "u" ? window.location.href : "", r = "[]";
|
|
30198
30199
|
try {
|
|
@@ -30204,7 +30205,7 @@ function gk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30204
30205
|
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 && (a = [...new Set(n)].slice(0, 15).join(" | "));
|
|
30205
30206
|
} catch {}
|
|
30206
30207
|
let o = u && !m ? `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` : "";
|
|
30207
|
-
|
|
30208
|
+
je.sendContextualUpdate(`${o}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${a}. SiteId: ${i || "unknown"}. Forms: ${r}. 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.`);
|
|
30208
30209
|
} catch {}
|
|
30209
30210
|
if (typeof window < "u") {
|
|
30210
30211
|
let t = window.location.pathname, n = () => {
|
package/package.json
CHANGED