@flowengage/react-chatbot 6.0.25 → 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.
@@ -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
- if (window.__vite_plugin_react_preamble_installed__) return "vite-react-spa";
2122
- let e = Array.from(document.body.children);
2123
- for (let t of e) {
2124
- if (t.id === "flowengage-root") continue;
2125
- let e = t.tagName?.toUpperCase();
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() {
@@ -30122,8 +30119,8 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30122
30119
  }, b = (p.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()), x = "";
30123
30120
  m && m.includes("|") && (x = m.split("|").map((e) => e.trim()).filter(Boolean).reduce((e, t) => e.length <= t.length ? e : t));
30124
30121
  let w = x || b || "this page";
30125
- _ ? 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! I see you are currently on the ${w} page. Are you looking for something specific here?` } }, console.log(`[FlowEngage] 🏠 Page-context override: "${w}" for ${p}`)) : u && (v.overrides = { agent: { firstMessage: "" } });
30126
- 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 section by section (highlight + one sentence each) until you have covered the key content. Prior conversation context:\n${(i ? je(i) : null)?.transcript || ""}\n\n` : null, me = await vD.startSession({
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({
30127
30124
  ...v,
30128
30125
  onConnect: ({ conversationId: e }) => {
30129
30126
  E.current = e, ie.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
@@ -30145,6 +30142,12 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30145
30142
  S.current?.sendUserMessage?.("continue with the tour");
30146
30143
  } catch {}
30147
30144
  }
30145
+ if (he && !me) {
30146
+ me = !0;
30147
+ try {
30148
+ S.current?.sendContextualUpdate?.(he);
30149
+ } catch {}
30150
+ }
30148
30151
  ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
30149
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(() => {
30150
30153
  if (!e && se.current === "listening" && !ee.current) try {
@@ -30207,17 +30210,17 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30207
30210
  }
30208
30211
  });
30209
30212
  if (e) {
30210
- console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), me.endSession().catch(() => {});
30213
+ console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), ge.endSession().catch(() => {});
30211
30214
  return;
30212
30215
  }
30213
- o = me, S.current = me, h("listening");
30216
+ o = ge, S.current = ge, h("listening");
30214
30217
  try {
30215
30218
  let e = typeof window < "u" ? window.location.href : "", r = "[]";
30216
30219
  try {
30217
30220
  r = await t.flowengage_list_forms();
30218
30221
  } catch {}
30219
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` : "";
30220
- me.sendContextualUpdate(`${a}Page: ${e}. SiteId: ${i || "unknown"}. Forms: ${r}. Voice: call end_voice_session or say you are ending the session to stop.`);
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.`);
30221
30224
  } catch {}
30222
30225
  if (typeof window < "u") {
30223
30226
  let t = window.location.pathname, n = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "6.0.25",
3
+ "version": "6.0.30",
4
4
  "description": "Embeddable AI chat widget for React — powered by FlowEngage. Drop it in with a single siteId.",
5
5
  "keywords": [
6
6
  "chatbot",