@flowengage/react-chatbot 8.0.106 → 8.0.108

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.
@@ -12351,17 +12351,28 @@ function t_() {
12351
12351
  let n = t[r + 1], o = jn(n);
12352
12352
  o && n.tagName === e.tagName && o.length < 60 && (e.nextElementSibling === n || e.parentElement === n.parentElement) && (a = `${i} ${o}`, r++);
12353
12353
  }
12354
- a.length > 2 && a.length < 200 && n.push(a), r++;
12354
+ a.length > 2 && a.length < 200 && n.push({
12355
+ text: a,
12356
+ level: Number(e.tagName.slice(1)) || 6
12357
+ }), r++;
12355
12358
  }
12356
12359
  return n;
12357
12360
  }, t = document.querySelector("main, [role='main']") || document.body, n = e(t.querySelectorAll("h1, h2, h3, h4, h5"));
12358
12361
  n.length || (n = e(document.body.querySelectorAll("h1, h2, h3, h4, h5")));
12359
- let r = [...new Set(n)].slice(0, 30), i = Array.from(t.querySelectorAll("h1")).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), a = null;
12360
- if (i.length === 1) {
12361
- let e = jn(i[0]);
12362
- e && r[0] && r[0].toLowerCase().trim() === e.toLowerCase().trim() && (a = r[0]);
12363
- }
12364
- let o = "";
12362
+ let r = /* @__PURE__ */ new Set(), i = [];
12363
+ for (let e of n) if (!(!e || r.has(e.text)) && (r.add(e.text), i.push(e), i.length >= 30)) break;
12364
+ let a = i.map((e) => e.text), o = [];
12365
+ for (let e = 0; e < i.length; e++) {
12366
+ let t = 0;
12367
+ for (let n = e + 1; n < i.length && !(i[n].level <= i[e].level); n++) t += 1;
12368
+ t >= 3 && o.push(i[e].text);
12369
+ }
12370
+ let s = Array.from(t.querySelectorAll("h1")).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), c = null;
12371
+ if (s.length === 1) {
12372
+ let e = jn(s[0]);
12373
+ e && a[0] && a[0].toLowerCase().trim() === e.toLowerCase().trim() && (c = a[0]);
12374
+ }
12375
+ let l = "";
12365
12376
  try {
12366
12377
  let e = t.querySelector("h1, h2, h3, h4, h5");
12367
12378
  if (e) {
@@ -12371,13 +12382,14 @@ function t_() {
12371
12382
  r.querySelectorAll("p, li").forEach((e) => {
12372
12383
  let t = e.textContent.replace(/\s+/g, " ").trim();
12373
12384
  t.length > 20 && i.push(t);
12374
- }), o = i.join(" ").slice(0, 600);
12385
+ }), l = i.join(" ").slice(0, 600);
12375
12386
  }
12376
12387
  } catch {}
12377
12388
  return {
12378
- headings: r,
12379
- pageTitleHeading: a,
12380
- introText: o
12389
+ headings: a,
12390
+ pageTitleHeading: c,
12391
+ introText: l,
12392
+ containerHeadings: o
12381
12393
  };
12382
12394
  }
12383
12395
  function n_(e) {
@@ -12913,8 +12925,8 @@ function r_(e) {
12913
12925
  var i_ = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12914
12926
  function a_() {
12915
12927
  try {
12916
- let { headings: e, pageTitleHeading: t } = t_();
12917
- return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !i_.test(e.trim()));
12928
+ let { headings: e, pageTitleHeading: t, containerHeadings: n } = t_(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !i_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
12929
+ return a.length ? a : i;
12918
12930
  } catch {
12919
12931
  return [];
12920
12932
  }
@@ -13565,7 +13577,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13565
13577
  return;
13566
13578
  }
13567
13579
  if (t === "user-speaking") {
13568
- if (Pe.current &&= (clearTimeout(Pe.current), null), R.current === "speaking") return;
13580
+ if (ae.current && !ie.current && Re(), Pe.current &&= (clearTimeout(Pe.current), null), R.current === "speaking") return;
13569
13581
  try {
13570
13582
  On();
13571
13583
  } catch {}
@@ -13586,7 +13598,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13586
13598
  if (Oe && !Ce && !ie.current && !fe.current) {
13587
13599
  Ce = !0, A = !0, ne = !0;
13588
13600
  try {
13589
- P.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.");
13601
+ P.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. The app itself speaks the email request out loudyou must NOT say it, and you must NOT answer. Stay completely silent from now until you receive an EMAIL_SAVED message: produce no speech and call no tools, no matter what the visitor says. Remember their question. On EMAIL_SAVED, thank them briefly and answer that remembered question in full.");
13590
13602
  } catch {}
13591
13603
  }
13592
13604
  if (ee && !A) {
@@ -15451,7 +15463,7 @@ function C_() {
15451
15463
  voiceFirstMessage: F.voiceFirstMessage || null,
15452
15464
  captureVisitorEmail: ie,
15453
15465
  emailRequired: !h,
15454
- emailCaptureEnabled: I.disableEmailCapture !== !0,
15466
+ emailCaptureEnabled: we.emailCapture !== !1 && I.disableEmailCapture !== !0,
15455
15467
  listeningLabel: I.voiceListeningLabel || "Listening...",
15456
15468
  thinkingLabel: I.voiceThinkingLabel || "Thinking...",
15457
15469
  enterChatModeLabel: I.voiceEnterChatLabel || "Enter Chat Mode",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "8.0.106",
3
+ "version": "8.0.108",
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",