@flowengage/react-chatbot 8.0.127 → 8.0.129

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.
@@ -4142,7 +4142,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
4142
4142
  }
4143
4143
  S(pi(p)), Array.isArray(f.cart_actions) && f.cart_actions.length && w(f.cart_actions), M(!!f.is_human_handled), A(f.is_human_handled ? "agent" : "ai"), I(!1), we(!1), await U.current.updateChatStatus(y, "messageSent");
4144
4144
  } catch (e) {
4145
- S((e) => e.filter((e) => e.id !== d && !e.isStreaming)), I(!1), we(!1), e.status === 429 ? (Ee(!0), Oe(e.message), window.setTimeout(() => {
4145
+ S((e) => e.filter((e) => !e.isStreaming).map((e) => e.id === d ? {
4146
+ ...e,
4147
+ isPending: !1,
4148
+ failed: !0
4149
+ } : e)), I(!1), we(!1), e.status === 429 ? (Ee(!0), Oe(e.message), window.setTimeout(() => {
4146
4150
  Ee(!1), Oe("");
4147
4151
  }, ee)) : h(e);
4148
4152
  }
@@ -10523,7 +10527,7 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10523
10527
  e.map((e) => {
10524
10528
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
10525
10529
  if (e.type === "nav_pref_choice") return /* @__PURE__ */ g(Rg, { siteId: d?.siteId }, e.id || e.messageId);
10526
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || l, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, v = xg(e.replyToContent || e.replyContext?.message || ""), S = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
10530
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.failed, p = e.type === "file" && e.metadata?.fileUrl, m = e.agent_name || e.agentName || e.metadata?.agentName || l, v = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, S = xg(e.replyToContent || e.replyContext?.message || ""), C = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
10527
10531
  return t ? /* @__PURE__ */ g("div", {
10528
10532
  style: {
10529
10533
  display: "flex",
@@ -10569,8 +10573,8 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10569
10573
  marginTop: !c && (r || o) ? "22px" : "0px"
10570
10574
  },
10571
10575
  children: r ? u || /* @__PURE__ */ g(hg, { size: 16 }) : /* @__PURE__ */ g(Lg, {
10572
- src: m || "",
10573
- name: p,
10576
+ src: v || "",
10577
+ name: m,
10574
10578
  imgStyle: {
10575
10579
  width: "100%",
10576
10580
  height: "100%",
@@ -10623,12 +10627,12 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10623
10627
  color: n ? "#fff" : "#111827",
10624
10628
  fontSize: "14px",
10625
10629
  fontWeight: 400,
10626
- opacity: c ? .55 : 1,
10630
+ opacity: c || e.failed ? .55 : 1,
10627
10631
  transition: "opacity 0.3s ease",
10628
10632
  wordBreak: "break-word",
10629
10633
  width: "fit-content"
10630
10634
  },
10631
- children: [v && /* @__PURE__ */ _("div", {
10635
+ children: [S && /* @__PURE__ */ _("div", {
10632
10636
  style: {
10633
10637
  marginBottom: "8px",
10634
10638
  borderRadius: "14px",
@@ -10643,7 +10647,7 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10643
10647
  marginBottom: "2px",
10644
10648
  fontWeight: 600
10645
10649
  },
10646
- children: S
10650
+ children: C
10647
10651
  }), /* @__PURE__ */ g("div", {
10648
10652
  style: {
10649
10653
  display: "-webkit-box",
@@ -10651,9 +10655,9 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10651
10655
  WebkitBoxOrient: "vertical",
10652
10656
  overflow: "hidden"
10653
10657
  },
10654
- children: v
10658
+ children: S
10655
10659
  })]
10656
- }), f ? (() => {
10660
+ }), p ? (() => {
10657
10661
  let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Pg(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
10658
10662
  color: "#ef4444",
10659
10663
  label: "PDF"
@@ -10859,6 +10863,13 @@ function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10859
10863
  fontStyle: "italic"
10860
10864
  },
10861
10865
  children: "sending…"
10866
+ }) : f ? /* @__PURE__ */ g("span", {
10867
+ style: {
10868
+ fontSize: "10px",
10869
+ color: "#dc2626",
10870
+ fontWeight: 500
10871
+ },
10872
+ children: "Not sent — tap send to try again"
10862
10873
  }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("span", {
10863
10874
  style: {
10864
10875
  fontSize: "10px",
@@ -13739,14 +13750,14 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13739
13750
  let a = i ? `Here is this section's full content — describe it from THIS text only, and do not call any tool:\n"""${i}"""\n` : "read the section's content silently first (fwh-read-content-mvp) if you don't already have it. ";
13740
13751
  R.current?.sendUserMessage?.(`Describe the section titled "${r}" in 3-4 sentences, starting with ${n === 0 ? "Starting with" : "Next —"} ${r}. Describe ONLY this section. If this section contains named sub-items (steps, checklist entries, cards, plans, FAQs, team members), name EVERY one of them in order with a short phrase each — never skip or collapse them into a summary; ` + a + "This section is ON THE PAGE THE VISITOR IS ALREADY ON — do NOT call fwh-navigate-mvp, do not go to a product/detail page, and do not offer to, even if this section's name also matches a page name. Do not mention any other section, do not ask whether to continue, then stop.", { suppressQuestion: !0 });
13741
13752
  };
13742
- let L = p(0), R = p(null), Se = p(null), Ce = p(""), we = p(async () => {}), Oe = p(!1), Ae = p(!1), je = p(!1), Me = p(!1), Ne = p("minimized"), Fe = p(null), Ie = p(null), z = p(null), Re = p(0), ze = p(!1), Be = p("idle"), Ve = p(null), B = p(null), He = p(!1), Ue = p(null), V = o((e = "minimized") => {
13753
+ let L = p(0), R = p(null), Se = p(null), Ce = p(""), we = p(async () => {}), Oe = p(!1), Ae = p(!1), je = p(!1), Me = p(!1), Ne = p("minimized"), Fe = p(null), Ie = p(null), z = p(null), Re = p(0), ze = p(!1), Be = p("idle"), Ve = p(null), B = p(!1), He = p(null), Ue = o((e = "minimized") => {
13743
13754
  console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
13744
13755
  destination: e,
13745
13756
  stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
13746
13757
  }), Ne.current = e, Me.current = !0, queueMicrotask(() => {
13747
13758
  Oe.current || (Oe.current = !0, we.current?.());
13748
13759
  });
13749
- }, [l]), We = o(() => {
13760
+ }, [l]), V = o(() => {
13750
13761
  ue.current &&= (clearTimeout(ue.current), null);
13751
13762
  }, []);
13752
13763
  c(() => {
@@ -13754,29 +13765,29 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13754
13765
  se.current = !1;
13755
13766
  return;
13756
13767
  }
13757
- if (se.current = !0, F.current = !1, ie(!1), We(), pe.current) {
13768
+ if (se.current = !0, F.current = !1, ie(!1), V(), pe.current) {
13758
13769
  pe.current = !1, R.current?.setMicMuted?.(!1);
13759
13770
  let e = fe.current;
13760
13771
  fe.current = "", R.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && R.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
13761
13772
  }
13762
13773
  R.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
13763
- }, [x, We]);
13764
- let Ge = /(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i, Ke = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, qe = /^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i, Je = /(would you like (me )?to take you|shall i take you|want me to take you|would you like to (go|explore|visit|see)|take you there)/i, Ye = /^((uh+|um+|oh|ah|so|well)[,.\s]+)*(cool|nice|great|awesome|wow|lovely|perfect|got it|gotcha|i see|understood|makes sense|interesting|right|alright|sounds good|mm+-?hmm+|hmm+|k)[\s.!,]*$/i, Xe = (e) => String(e || "").replace(/[\s.,!?]*((uh+|um+|er+|hmm+|mm+)[\s.,!?]*)+$/i, "").trim(), Ze = o(() => {
13765
- We(), ue.current = setTimeout(() => {
13774
+ }, [x, V]);
13775
+ let We = /(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i, Ge = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, Ke = /^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i, qe = /(would you like (me )?to take you|shall i take you|want me to take you|would you like to (go|explore|visit|see)|take you there)/i, Je = /^((uh+|um+|oh|ah|so|well)[,.\s]+)*(cool|nice|great|awesome|wow|lovely|perfect|got it|gotcha|i see|understood|makes sense|interesting|right|alright|sounds good|mm+-?hmm+|hmm+|k)[\s.!,]*$/i, Ye = (e) => String(e || "").replace(/[\s.,!?]*((uh+|um+|er+|hmm+|mm+)[\s.,!?]*)+$/i, "").trim(), Xe = o(() => {
13776
+ V(), ue.current = setTimeout(() => {
13766
13777
  if (!(!F.current || se.current)) if (de.current < 3) {
13767
13778
  de.current += 1;
13768
13779
  try {
13769
13780
  R.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
13770
13781
  } catch {}
13771
- Ze();
13782
+ Xe();
13772
13783
  } else {
13773
13784
  try {
13774
13785
  R.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
13775
13786
  } catch {}
13776
- F.current = !1, ie(!1), We(), ze.current = !0;
13787
+ F.current = !1, ie(!1), V(), ze.current = !0;
13777
13788
  }
13778
13789
  }, 1e4);
13779
- }, [We]), H = o(async (e) => {
13790
+ }, [V]), Ze = o(async (e) => {
13780
13791
  Me.current = !0;
13781
13792
  try {
13782
13793
  Pn();
@@ -13815,10 +13826,10 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13815
13826
  s,
13816
13827
  a
13817
13828
  ]);
13818
- we.current = () => H(Ne.current === "chat" ? t : n), c(() => {
13829
+ we.current = () => Ze(Ne.current === "chat" ? t : n), c(() => {
13819
13830
  Ae.current = k;
13820
13831
  }, [k]), c(() => {
13821
- h && V("chat");
13832
+ h && Ue("chat");
13822
13833
  }, [h]), c(() => {
13823
13834
  let e = !1, o = null, c = null, p = null;
13824
13835
  return (async () => {
@@ -13863,7 +13874,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13863
13874
  ze.current = !0;
13864
13875
  },
13865
13876
  requestEmailCollection: () => {
13866
- S && (se.current || F.current || (F.current = !0, de.current = 0, ie(!0), Ze()));
13877
+ S && (se.current || F.current || (F.current = !0, de.current = 0, ie(!0), Xe()));
13867
13878
  }
13868
13879
  })), n = i ? Ee(i) : null, r = !!n?.transcript, u = i ? Le(i) : null, m = !!u, h = typeof window < "u" ? window.location.pathname : "/", g = typeof document < "u" ? document.title : "", _ = h.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i, "") || "/", b = _ === "/" || _ === "", C = {
13869
13880
  apiBaseUrl: a,
@@ -13905,13 +13916,13 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13905
13916
  },
13906
13917
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
13907
13918
  onSessionInfo: ({ emailOnFile: e }) => {
13908
- _e.current = !!e, e && (se.current = !0, F.current = !1, ie(!1), We(), console.log("[FlowEngage] email already on file per server — gate disabled"));
13919
+ _e.current = !!e, e && (se.current = !0, F.current = !1, ie(!1), V(), console.log("[FlowEngage] email already on file per server — gate disabled"));
13909
13920
  },
13910
13921
  onAgentTurnEnd: () => {
13911
13922
  e || he.current && (ge.current || pe.current || setTimeout(() => xe.current?.(), 250));
13912
13923
  },
13913
13924
  onSessionEnding: () => {
13914
- e || V("minimized");
13925
+ e || Ue("minimized");
13915
13926
  },
13916
13927
  onPanel: ({ title: t, items: n }) => {
13917
13928
  e || Kh(n, {
@@ -13923,11 +13934,11 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13923
13934
  onModeChange: ({ mode: t, tentative: n }) => {
13924
13935
  if (!e) {
13925
13936
  if (t === "speaking") {
13926
- Ve.current &&= (clearTimeout(Ve.current), null), Ue.current &&= (clearTimeout(Ue.current), null), O("speaking"), Be.current = "speaking", He.current = !1;
13937
+ Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), O("speaking"), Be.current = "speaking", B.current = !1;
13927
13938
  return;
13928
13939
  }
13929
13940
  if (t === "user-speaking") {
13930
- if (F.current && !se.current && Ze(), Ue.current &&= (clearTimeout(Ue.current), null), Be.current === "speaking") return;
13941
+ if (F.current && !se.current && Xe(), He.current &&= (clearTimeout(He.current), null), Be.current === "speaking") return;
13931
13942
  try {
13932
13943
  Pn();
13933
13944
  } catch {}
@@ -13935,14 +13946,14 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13935
13946
  return;
13936
13947
  }
13937
13948
  if (t === "thinking") {
13938
- if (Ve.current &&= (clearTimeout(Ve.current), null), Ue.current &&= (clearTimeout(Ue.current), null), Be.current === "speaking") return;
13939
- O("thinking"), Be.current = "thinking", n && (Ue.current = setTimeout(() => {
13940
- Ue.current = null, !(e || Be.current !== "thinking") && (Be.current = "listening", O("listening"));
13949
+ if (Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), Be.current === "speaking") return;
13950
+ O("thinking"), Be.current = "thinking", n && (He.current = setTimeout(() => {
13951
+ He.current = null, !(e || Be.current !== "thinking") && (Be.current = "listening", O("listening"));
13941
13952
  }, 4e3));
13942
13953
  return;
13943
13954
  }
13944
13955
  if (Be.current = "listening", ze.current) {
13945
- ze.current = !1, V();
13956
+ ze.current = !1, Ue();
13946
13957
  return;
13947
13958
  }
13948
13959
  if (le && !P && !se.current && !_e.current) {
@@ -13970,7 +13981,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13970
13981
  } catch {}
13971
13982
  }
13972
13983
  Ve.current && clearTimeout(Ve.current), Ve.current = setTimeout(() => {
13973
- e || Be.current !== "speaking" && (He.current || (Ve.current = null, Be.current = "listening", O("listening")));
13984
+ e || Be.current !== "speaking" && (B.current || (Ve.current = null, Be.current = "listening", O("listening")));
13974
13985
  }, 1200);
13975
13986
  }
13976
13987
  },
@@ -13981,20 +13992,18 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13981
13992
  Jh();
13982
13993
  } catch {}
13983
13994
  let r = /\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message || ""));
13984
- if (!n && !r && t.role === "user" && Ge.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = O_(), ye.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => xe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${ve.current.length} sections on this page`);
13995
+ if (!n && !r && t.role === "user" && We.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = O_(), ye.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => xe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${ve.current.length} sections on this page`);
13985
13996
  else if (!n && t.role === "user" && he.current) {
13986
- let e = String(t.message || "").trim(), n = Xe(e), r = (e) => !!e && (qe.test(e) || Ye.test(e));
13987
- Je.test(be.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), ye.current = null, ve.current = [], I(!1)) : !n || r(e) || r(n) ? ge.current && (ge.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => xe.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), ye.current = null, ve.current = [], I(!1));
13997
+ let e = String(t.message || "").trim(), n = Ye(e), r = (e) => !!e && (Ke.test(e) || Je.test(e));
13998
+ qe.test(be.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), ye.current = null, ve.current = [], I(!1)) : !n || r(e) || r(n) ? ge.current && (ge.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => xe.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), ye.current = null, ve.current = [], I(!1));
13988
13999
  }
13989
- if (t.role !== "user" && !n && (be.current = String(t.message || "")), t.role !== "user" && Ke.test(String(t.message || ""))) {
14000
+ if (t.role !== "user" && !n && (be.current = String(t.message || "")), t.role !== "user" && Ge.test(String(t.message || ""))) {
13990
14001
  let e = ve.current.length;
13991
14002
  !e || L.current >= e - 1 ? I(!1) : console.debug(`[FlowEngage] agent claimed completion at step ${L.current + 1}/${e} — ignoring, tour continues`);
13992
14003
  }
13993
14004
  let a = t.role === "user" ? "user" : "bot", o = t.message || t.text || t.content || "";
13994
14005
  if (o) {
13995
- if (a === "user" && (Ce.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null), He.current = !0, Ve.current &&= (clearTimeout(Ve.current), null), B.current && clearTimeout(B.current), B.current = setTimeout(() => {
13996
- B.current = null, !(Be.current === "speaking" || Be.current === "thinking") && (O("thinking"), Be.current = "thinking");
13997
- }, 1400), le && !oe && !se.current && !_e.current && (oe = !0, fe.current = o, pe.current = !0, R.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), R.current?.setMicMuted?.(!0), F.current || (F.current = !0, de.current = 0, ie(!0), Ze()))), l.current = [...l.current, {
14006
+ if (a === "user" && (Ce.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null), B.current = !0, Ve.current &&= (clearTimeout(Ve.current), null), Be.current !== "speaking" && (O("thinking"), Be.current = "thinking"), le && !oe && !se.current && !_e.current && (oe = !0, fe.current = o, pe.current = !0, R.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), R.current?.setMicMuted?.(!0), F.current || (F.current = !0, de.current = 0, ie(!0), Xe()))), l.current = [...l.current, {
13998
14007
  sender: a,
13999
14008
  message: o,
14000
14009
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -14010,7 +14019,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14010
14019
  if (Ae.current && a === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(o)) if (Re.current += 1, Re.current === 2) try {
14011
14020
  R.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
14012
14021
  } catch {}
14013
- else Re.current >= 5 && V("minimized");
14022
+ else Re.current >= 5 && Ue("minimized");
14014
14023
  }
14015
14024
  },
14016
14025
  onError: (t) => {
@@ -14023,7 +14032,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14023
14032
  try {
14024
14033
  R.current?.setMicMuted?.(!0);
14025
14034
  } catch {}
14026
- A(!0), O("error"), V("chat");
14035
+ A(!0), O("error"), Ue("chat");
14027
14036
  }
14028
14037
  },
14029
14038
  onDisconnect: (t) => {
@@ -14040,7 +14049,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14040
14049
  try {
14041
14050
  R.current?.setMicMuted?.(!0);
14042
14051
  } catch {}
14043
- A(!0), V("chat");
14052
+ A(!0), Ue("chat");
14044
14053
  }
14045
14054
  });
14046
14055
  if (e) {
@@ -14138,7 +14147,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14138
14147
  if (i) try {
14139
14148
  Le(i);
14140
14149
  } catch {}
14141
- typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pr(), Ve.current &&= (clearTimeout(Ve.current), null), Ue.current &&= (clearTimeout(Ue.current), null), ue.current &&= (clearTimeout(ue.current), null), He.current = !1, Be.current = "idle", c && typeof window < "u" && (window.history.pushState = c), p && typeof window < "u" && window.removeEventListener("popstate", p);
14150
+ typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pr(), Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), ue.current &&= (clearTimeout(ue.current), null), B.current = !1, Be.current = "idle", c && typeof window < "u" && (window.history.pushState = c), p && typeof window < "u" && window.removeEventListener("popstate", p);
14142
14151
  let t = o || R.current, n = Fe.current, d = Ie.current;
14143
14152
  if (t?.endSession?.().catch(() => {}), n && s && a) {
14144
14153
  let e = d ? Math.round((Date.now() - d) / 1e3) : 0, t = JSON.stringify({
@@ -14160,7 +14169,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14160
14169
  r,
14161
14170
  i,
14162
14171
  a,
14163
- V
14172
+ Ue
14164
14173
  ]), c(() => {
14165
14174
  if (!ee) return;
14166
14175
  let e = (e) => {
@@ -14169,7 +14178,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14169
14178
  };
14170
14179
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
14171
14180
  }, [ee]);
14172
- let U = async () => {
14181
+ let H = async () => {
14173
14182
  if (R.current) try {
14174
14183
  if (k) {
14175
14184
  Re.current = 0, await R.current.setMicMuted?.(!1), A(!1);
@@ -14183,14 +14192,14 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14183
14192
  } catch {}
14184
14193
  }
14185
14194
  } catch {}
14186
- }, Qe = o(async (e) => {
14195
+ }, U = o(async (e) => {
14187
14196
  e?.preventDefault?.();
14188
14197
  let t = ae.trim().toLowerCase();
14189
14198
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
14190
14199
  P("Please enter a valid email address.");
14191
14200
  return;
14192
14201
  }
14193
- P(""), se.current = !0, F.current = !1, We(), ie(!1), N(""), pe.current = !1;
14202
+ P(""), se.current = !0, F.current = !1, V(), ie(!1), N(""), pe.current = !1;
14194
14203
  try {
14195
14204
  typeof b == "function" && await b(t);
14196
14205
  } catch {}
@@ -14203,8 +14212,8 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14203
14212
  }, [
14204
14213
  ae,
14205
14214
  b,
14206
- We
14207
- ]), $e = Array.isArray(e) && e[0] || "#3B82F6";
14215
+ V
14216
+ ]), Qe = Array.isArray(e) && e[0] || "#3B82F6";
14208
14217
  return /* @__PURE__ */ _("div", {
14209
14218
  ref: z,
14210
14219
  style: {
@@ -14217,7 +14226,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14217
14226
  },
14218
14227
  children: [
14219
14228
  re && /* @__PURE__ */ _("form", {
14220
- onSubmit: Qe,
14229
+ onSubmit: U,
14221
14230
  style: {
14222
14231
  width: "270px",
14223
14232
  maxWidth: "calc(100vw - 40px)",
@@ -14280,7 +14289,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14280
14289
  padding: "10px 12px",
14281
14290
  borderRadius: "10px",
14282
14291
  border: "none",
14283
- background: ae.trim() ? $e : "#374151",
14292
+ background: ae.trim() ? Qe : "#374151",
14284
14293
  color: "white",
14285
14294
  fontSize: "14px",
14286
14295
  fontWeight: 600,
@@ -14349,7 +14358,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14349
14358
  alignItems: "center"
14350
14359
  },
14351
14360
  children: [/* @__PURE__ */ g("button", {
14352
- onClick: U,
14361
+ onClick: H,
14353
14362
  title: k ? "Unmute" : "Mute",
14354
14363
  style: {
14355
14364
  width: "24px",
@@ -14444,7 +14453,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14444
14453
  children: [
14445
14454
  /* @__PURE__ */ _("button", {
14446
14455
  onClick: () => {
14447
- te(!1), Ne.current = "chat", H(t);
14456
+ te(!1), Ne.current = "chat", Ze(t);
14448
14457
  },
14449
14458
  style: {
14450
14459
  display: "flex",
@@ -14548,7 +14557,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14548
14557
  }),
14549
14558
  /* @__PURE__ */ _("button", {
14550
14559
  onClick: () => {
14551
- te(!1), Ne.current = "minimized", H(n);
14560
+ te(!1), Ne.current = "minimized", Ze(n);
14552
14561
  },
14553
14562
  style: {
14554
14563
  display: "flex",
@@ -15595,7 +15604,7 @@ function K_() {
15595
15604
  ...I.pageVisibility || {}
15596
15605
  };
15597
15606
  return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
15598
- })(), Ge = We.length === 0 || We.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), Ke = xe.greetings?.[A] || I.greetings?.[A] || L.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", qe = {
15607
+ })(), Ge = We.length === 0 || We.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), Ke = xe.greetings?.[A] || I.greetings?.[A] || L.introGreeting || (t?.websiteName && String(t.websiteName).trim() ? `Hello, I'm here to help you know more about ${String(t.websiteName).trim()}.` : "Hello, I'm here to help — what would you like to know?"), qe = {
15599
15608
  entryPrompt: L.entryPrompt || "Do you want to explore in a new way?",
15600
15609
  yesLabel: L.yesLabel || "Yes",
15601
15610
  laterLabel: L.laterLabel || "Later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "8.0.127",
3
+ "version": "8.0.129",
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",