@flowengage/react-chatbot 7.0.9 → 7.0.10

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.
@@ -28926,16 +28926,22 @@ function ZO() {
28926
28926
  }), e;
28927
28927
  }
28928
28928
  function QO() {
28929
- return ZO().map((e, t) => ({
28930
- formIndex: 0,
28931
- fieldIndex: t,
28932
- tag: e.tagName,
28933
- type: e.type || "text",
28934
- name: e.name || null,
28935
- id: e.id || null,
28936
- label: XO(e),
28937
- placeholder: e.placeholder || null
28938
- }));
28929
+ return ZO().map((e, t) => {
28930
+ let n = {
28931
+ formIndex: 0,
28932
+ fieldIndex: t,
28933
+ tag: e.tagName,
28934
+ type: e.type || "text",
28935
+ name: e.name || null,
28936
+ id: e.id || null,
28937
+ label: XO(e),
28938
+ placeholder: e.placeholder || null
28939
+ };
28940
+ return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
28941
+ value: e.value,
28942
+ text: e.text.trim()
28943
+ })), n.currentValue = e.value || null), n;
28944
+ });
28939
28945
  }
28940
28946
  function $O() {
28941
28947
  let e = [];
@@ -29405,6 +29411,9 @@ function wk(e) {
29405
29411
  for (; Date.now() < t && !(typeof window < "u" && window.location.pathname === e);) await new Promise((e) => setTimeout(e, 80));
29406
29412
  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
29413
  $("fwh-navigate-mvp → SPA nav complete. target:", e, "actual:", n);
29414
+ try {
29415
+ typeof window < "u" && window.scrollTo(0, 0);
29416
+ } catch {}
29408
29417
  let s = [], c = Date.now() + 12e3;
29409
29418
  for (; Date.now() < c && (await new Promise((e) => setTimeout(e, 300)), s = Ck(), !(s.length >= 1)););
29410
29419
  Sk(), $("fwh-navigate-mvp → page headings collected:", s);
@@ -29555,6 +29564,58 @@ function wk(e) {
29555
29564
  return $("fwh-search-mvp ✖", e.message), "Search failed. Use fwh-read-content-mvp to read the current page instead.";
29556
29565
  }
29557
29566
  },
29567
+ "fwh-list-nav-links-mvp": async () => {
29568
+ if ($("fwh-list-nav-links-mvp ▶"), typeof window > "u") return "Cannot read navigation (no browser context).";
29569
+ let e = /* @__PURE__ */ new Map(), t = [], n = [
29570
+ "nav a",
29571
+ "[role='navigation'] a",
29572
+ "header a",
29573
+ ".navbar a",
29574
+ ".nav a",
29575
+ ".menu a",
29576
+ ".navigation a",
29577
+ ".header a",
29578
+ "[class*='nav'] a",
29579
+ "[class*='menu'] a",
29580
+ "[class*='header'] a"
29581
+ ];
29582
+ if (JO((t) => {
29583
+ for (let r of n) try {
29584
+ t.querySelectorAll(r).forEach((t) => {
29585
+ if (KO(t)) return;
29586
+ let n = t.getAttribute("href"), r = (t.textContent || "").replace(/\s+/g, " ").trim();
29587
+ if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
29588
+ try {
29589
+ let e = qO(t);
29590
+ if (e.display === "none" || e.visibility === "hidden") return;
29591
+ } catch {}
29592
+ let i = r.toLowerCase() + "|" + n;
29593
+ e.has(i) || e.set(i, {
29594
+ text: r,
29595
+ href: n
29596
+ });
29597
+ });
29598
+ } catch {}
29599
+ t.querySelectorAll("select").forEach((t) => {
29600
+ if (KO(t)) return;
29601
+ let n = XO(t);
29602
+ /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
29603
+ if (!r.value || r.disabled) return;
29604
+ let i = r.text.trim();
29605
+ if (!i) return;
29606
+ let a = i.toLowerCase() + "|" + r.value;
29607
+ e.has(a) || e.set(a, {
29608
+ text: i,
29609
+ href: r.value,
29610
+ isSelectOption: !0,
29611
+ selectLabel: n || t.name || "dropdown"
29612
+ });
29613
+ });
29614
+ });
29615
+ }), e.forEach((e) => t.push(e)), !t.length) return "NAV_LINKS: No navigation links found on this page. Use fwh-read-content-mvp to read page content or fwh-search-mvp to search the site.";
29616
+ let r = t.slice(0, 50).map((e, t) => `${t + 1}. "${e.text}"${e.isSelectOption ? ` (dropdown option in "${e.selectLabel}")` : ""} → ${e.href}`).join("\n");
29617
+ return $("fwh-list-nav-links-mvp ✓", `${t.length} links`), `NAV_LINKS (${t.length} total, showing up to 50):\n${r}\n\nIMPORTANT: Use the EXACT text shown above when reading link names to the visitor. Do NOT rename, abbreviate, or invent options not listed here. To navigate, call fwh-navigate-mvp with the href value.`;
29618
+ },
29558
29619
  "fwh-end-session-mvp": async () => ($("fwh-end-session-mvp ▶"), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
29559
29620
  "fwh-get-current-page-mvp": async () => {
29560
29621
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
@@ -30297,7 +30358,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30297
30358
  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(" | "));
30298
30359
  } catch {}
30299
30360
  let o = u && !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` : "";
30300
- ve.sendContextualUpdate(`${o}CURRENT PAGE: ${e} | Section headings: ${a}. SiteId: ${i || "unknown"}. Forms: ${r}. The visitor is ALREADY on this page — do NOT offer to navigate there. Voice: call end_voice_session or say you are ending the session to stop.`);
30361
+ ve.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: If the visitor requests a walkthrough, you MUST call fwh-get-current-page-mvp first (zero speech) to get the exact highlightable headings — do NOT use these approximate headings for highlighting. Voice: call end_voice_session or say you are ending the session to stop.`);
30301
30362
  } catch {}
30302
30363
  if (typeof window < "u") {
30303
30364
  let t = window.location.pathname, n = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "7.0.9",
3
+ "version": "7.0.10",
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",