@flowengage/react-chatbot 1.1.7 → 1.1.9

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.
@@ -23020,7 +23020,7 @@ async function f_(e, t, n) {
23020
23020
  return _g(e), !0;
23021
23021
  }
23022
23022
  function p_(e) {
23023
- let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = null, o = {
23023
+ let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = !!e.preferLiveSpeechHighlight, i = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, a = [], o = null, s = {
23024
23024
  navigate_to_page: async (n) => {
23025
23025
  $("navigate_to_page ▶ raw parameters:", n);
23026
23026
  let r = r_(n), i = l_(r), a = r.section_text ?? r.sectionText ?? r.section;
@@ -23065,9 +23065,9 @@ function p_(e) {
23065
23065
  }
23066
23066
  },
23067
23067
  highlight_on_page: async (e) => {
23068
- $("highlight_on_page ▶", e);
23069
- let t = r_(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = an(n || null, r || null);
23070
- return i ? (mn(i, { speaking: !0 }), $("highlight_on_page ✓ (speaking)"), "OK_HIGHLIGHT section is now highlighted and scrolled into view.") : ($("highlight_on_page ✖ no element"), "Could not find that section on the page.");
23068
+ if ($("highlight_on_page ▶", e), r) return $("highlight_on_page · skipped (live speech highlight owns the page)"), "OK_HIGHLIGHT The page already follows your speech automatically; do not call highlight_on_page again for this turn.";
23069
+ let t = r_(e), n = t?.section_id || t?.sectionId, i = t?.section_text || t?.sectionText, a = an(n || null, i || null);
23070
+ return a ? (mn(a, { speaking: !0 }), $("highlight_on_page ✓ (speaking)"), "OK_HIGHLIGHT section is now highlighted and scrolled into view.") : ($("highlight_on_page ✖ no element"), "Could not find that section on the page.");
23071
23071
  },
23072
23072
  search_site_content: async (e) => {
23073
23073
  $("search_site_content ▶", e);
@@ -23129,7 +23129,7 @@ function p_(e) {
23129
23129
  }), bg(!0), vg(), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
23130
23130
  list_page_forms: async () => {
23131
23131
  let e = Rg(), t = Bg();
23132
- return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), a = Lg(), $("list_page_forms · activeFormAncestor", a ? "contact-preferring" : "none"), JSON.stringify({
23132
+ return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), o = Lg(), $("list_page_forms · activeFormAncestor", o ? "contact-preferring" : "none"), JSON.stringify({
23133
23133
  fields: e,
23134
23134
  buttons: t,
23135
23135
  hint: "Fields are grouped by formIndex/formName. Work with ONE form at a time — only fill fields from the same formIndex. Do not jump to fields in a different form. On pages with a contact form AND a footer or secondary website-URL field: only use the contact form unless the visitor explicitly asks to use the URL or promo flow. Contact forms: fill in order Full Name → Email Address → Message. Message must be a short note the visitor wants to send (one or two sentences), never a recap of the whole chat or assistant replies. field_key: use placeholder, label, name, or id from this list. click_page_button picks the button nearest the filled fields (e.g. Send Message on the same form)."
@@ -23139,8 +23139,8 @@ function p_(e) {
23139
23139
  try {
23140
23140
  $("fill_form_fields ▶ raw:", e);
23141
23141
  let t = i_(e);
23142
- if (!t.length && r) {
23143
- let e = r(), n = s_(e);
23142
+ if (!t.length && i) {
23143
+ let e = i(), n = s_(e);
23144
23144
  n.length ? $("fill_form_fields · inferred URL from last user utterance (model omitted usable fields):", n) : (n = c_(e), n.length && $("fill_form_fields · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
23145
23145
  }
23146
23146
  if ($("fill_form_fields · normalized fields:", t), !t.length) return "No fields provided. Call list_page_forms for field_key strings, then fill_form_fields with { \"fields\": [ { \"field_key\": \"<label or placeholder from list>\", \"value\": \"<user value>\" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.";
@@ -23149,34 +23149,34 @@ function p_(e) {
23149
23149
  for (let e of t) {
23150
23150
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
23151
23151
  if (t == null || r == null) continue;
23152
- let o = String(t).toLowerCase();
23153
- if (/email|e-mail|mail/.test(o)) r = a_(r);
23154
- else if (/phone|mobile|tel|cell/.test(o)) r = o_(r);
23155
- else if (Jg(t) || o === "url") {
23152
+ let i = String(t).toLowerCase();
23153
+ if (/email|e-mail|mail/.test(i)) r = a_(r);
23154
+ else if (/phone|mobile|tel|cell/.test(i)) r = o_(r);
23155
+ else if (Jg(t) || i === "url") {
23156
23156
  let e = String(r ?? "").trim();
23157
23157
  if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) || /\bat\b/i.test(e) && /\bdot\b/i.test(e)) {
23158
23158
  let n = a_(e);
23159
- /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.trim()) && ($("fill_form_fields · remapping url/website intent to Email Address (value is an email)"), t = "Email Address", o = "email address", r = n.trim());
23159
+ /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.trim()) && ($("fill_form_fields · remapping url/website intent to Email Address (value is an email)"), t = "Email Address", i = "email address", r = n.trim());
23160
23160
  }
23161
23161
  }
23162
23162
  fg(`Filling ${t}…`), $("fill_form_fields · processing field:", t, "=", r);
23163
23163
  let s = Fg(), c = s;
23164
- if (a) {
23165
- let e = s.filter((e) => kg(e) === a);
23164
+ if (o) {
23165
+ let e = s.filter((e) => kg(e) === o);
23166
23166
  e.length > 0 && (c = e, $("fill_form_fields · scoped to active form, inputs:", e.length));
23167
23167
  }
23168
23168
  $("fill_form_fields · visible inputs count:", s.length, "scoped:", c.length);
23169
23169
  let l = !1;
23170
23170
  for (let e of [c, ...c === s ? [] : [s]]) {
23171
- let o = Zg(e, String(t), r);
23172
- if (o.length) {
23173
- for (let e = 0; e < o.length; e++) await f_(o[e], r, { skipScroll: e > 0 }), await new Promise((e) => setTimeout(e, 80));
23174
- i = o, a = kg(o[0]) || a, n.push(String(t)), l = !0;
23171
+ let i = Zg(e, String(t), r);
23172
+ if (i.length) {
23173
+ for (let e = 0; e < i.length; e++) await f_(i[e], r, { skipScroll: e > 0 }), await new Promise((e) => setTimeout(e, 80));
23174
+ a = i, o = kg(i[0]) || o, n.push(String(t)), l = !0;
23175
23175
  break;
23176
23176
  }
23177
23177
  let s = e_(e, String(t));
23178
23178
  if (s ||= Gg(e, String(t)), s ||= Kg(e, String(t), r), s) {
23179
- await f_(s, r), i = [s], a = kg(s) || a, n.push(String(t)), l = !0;
23179
+ await f_(s, r), a = [s], o = kg(s) || o, n.push(String(t)), l = !0;
23180
23180
  break;
23181
23181
  }
23182
23182
  }
@@ -23187,8 +23187,8 @@ function p_(e) {
23187
23187
  bg();
23188
23188
  } catch {}
23189
23189
  if (!n.length) return $("fill_form_fields ✖ no matches"), "Could not match any fields. Call list_page_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.";
23190
- let o = `OK_FILLED: ${n.join(", ")}`;
23191
- return $("fill_form_fields ✓", o), o;
23190
+ let r = `OK_FILLED: ${n.join(", ")}`;
23191
+ return $("fill_form_fields ✓", r), r;
23192
23192
  } catch (e) {
23193
23193
  pg(), vg(), bg(!0);
23194
23194
  let t = `fill_form_fields error: ${e?.message || String(e)}`;
@@ -23199,7 +23199,7 @@ function p_(e) {
23199
23199
  let t = r_(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
23200
23200
  if ($("click_page_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Submit or Read more.";
23201
23201
  fg(`Clicking "${n}"…`);
23202
- let r = n_(n, i);
23202
+ let r = n_(n, a);
23203
23203
  if (!r) return pg(200), $("click_page_button ✖ no match"), `Could not find a button matching "${n}". Call list_page_forms to see button texts.`;
23204
23204
  try {
23205
23205
  try {
@@ -23220,7 +23220,7 @@ function p_(e) {
23220
23220
  try {
23221
23221
  await xg(r);
23222
23222
  } catch {}
23223
- let e = kg(r) || a, t = [];
23223
+ let e = kg(r) || o, t = [];
23224
23224
  if (e) {
23225
23225
  let n = Array.from(e.querySelectorAll("input[required], textarea[required], select[required]")).filter((e) => !wg(e));
23226
23226
  for (let e of n) if (!(e.value || "").trim()) {
@@ -23242,9 +23242,9 @@ function p_(e) {
23242
23242
  try {
23243
23243
  bg();
23244
23244
  } catch {}
23245
- vg(), a = null, i = [];
23246
- let o = `OK_CLICK ${n}`;
23247
- return $("click_page_button ✓", o), o;
23245
+ vg(), o = null, a = [];
23246
+ let i = `OK_CLICK ${n}`;
23247
+ return $("click_page_button ✓", i), i;
23248
23248
  } catch (e) {
23249
23249
  pg(200), bg(!0);
23250
23250
  let t = `Click failed: ${e?.message || String(e)}`;
@@ -23253,14 +23253,14 @@ function p_(e) {
23253
23253
  }
23254
23254
  };
23255
23255
  return {
23256
- ...o,
23257
- navigateToPage: o.navigate_to_page,
23258
- highlightOnPage: o.highlight_on_page,
23259
- searchSiteContent: o.search_site_content,
23260
- endVoiceSession: o.end_voice_session,
23261
- listPageForms: o.list_page_forms,
23262
- fillFormFields: o.fill_form_fields,
23263
- clickPageButton: o.click_page_button
23256
+ ...s,
23257
+ navigateToPage: s.navigate_to_page,
23258
+ highlightOnPage: s.highlight_on_page,
23259
+ searchSiteContent: s.search_site_content,
23260
+ endVoiceSession: s.end_voice_session,
23261
+ listPageForms: s.list_page_forms,
23262
+ fillFormFields: s.fill_form_fields,
23263
+ clickPageButton: s.click_page_button
23264
23264
  };
23265
23265
  }
23266
23266
  //#endregion
@@ -23292,30 +23292,30 @@ var h_ = {
23292
23292
  listening: "#10b981",
23293
23293
  speaking: "#f59e0b",
23294
23294
  error: "#ef4444"
23295
- }, __ = 13;
23296
- function v_(e, t) {
23295
+ }, __ = 17, v_ = 6;
23296
+ function y_(e, t) {
23297
23297
  let n = (t || "").trim();
23298
23298
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
23299
23299
  }
23300
- function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
23301
- let [h, g] = s("idle"), [ee, te] = s(null), [_, ne] = s(!1), re = o(null), ie = o(null), ae = o(""), oe = o(async () => {}), se = o(!1), v = o(""), ce = o(null), le = o(null), ue = o(null), y = n(() => {
23302
- le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearInterval(ue.current), null), v.current = "", ce.current = null;
23300
+ function b_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
23301
+ let [h, g] = s("idle"), [ee, te] = s(null), [_, ne] = s(!1), re = o(null), ie = o(null), ae = o(""), oe = o(async () => {}), se = o(!1), v = o(""), ce = o(null), le = o(null), ue = o(null), y = o(null), b = o(null), de = n(() => {
23302
+ ue.current &&= (clearTimeout(ue.current), null), y.current &&= (clearInterval(y.current), null), v.current = "", ce.current = null, le.current = null, b.current != null && (cancelAnimationFrame(b.current), b.current = null);
23303
23303
  try {
23304
23304
  hn();
23305
23305
  } catch {}
23306
- }, []), b = n(async () => {
23307
- y();
23306
+ }, []), fe = n(async () => {
23307
+ de();
23308
23308
  try {
23309
23309
  await re.current?.endSession?.();
23310
23310
  } catch {}
23311
23311
  re.current = null, ne(!1), g("idle"), se.current = !1, typeof p == "function" && await p(d.current), typeof c == "function" && c();
23312
23312
  }, [
23313
- y,
23313
+ de,
23314
23314
  d,
23315
23315
  p,
23316
23316
  c
23317
23317
  ]);
23318
- oe.current = b, i(() => {
23318
+ oe.current = fe, i(() => {
23319
23319
  let t = !1, n = null;
23320
23320
  return (async () => {
23321
23321
  try {
@@ -23325,6 +23325,7 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23325
23325
  siteId: r || null,
23326
23326
  apiBaseUrl: a || null,
23327
23327
  getLastUserVoiceText: () => ae.current,
23328
+ preferLiveSpeechHighlight: !0,
23328
23329
  requestEndSession: () => {
23329
23330
  queueMicrotask(() => {
23330
23331
  se.current || (se.current = !0, oe.current?.());
@@ -23334,38 +23335,57 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23334
23335
  try {
23335
23336
  let e = v.current, t = ce.current;
23336
23337
  if (!e?.trim() || t == null) return;
23337
- let n = Math.max(0, (Date.now() - t) / 1e3), r = Math.min(e.length, Math.floor(n * __)), i = e.slice(0, r);
23338
- if (i.trim().length < 12) return;
23338
+ let n = le.current, r = Date.now(), i;
23339
+ if (n != null) {
23340
+ let t = Math.max(0, (r - n) / 1e3);
23341
+ i = Math.min(e.length, Math.floor(t * __));
23342
+ } else {
23343
+ let n = Math.max(0, (r - t) / 1e3);
23344
+ if (n > 2.1 && e.length > 36) i = Math.min(e.length, Math.floor(Math.max(0, n - .4) * __));
23345
+ else {
23346
+ let t = Math.min(96, Math.floor(n * v_));
23347
+ i = Math.min(e.length, t);
23348
+ }
23349
+ }
23350
+ let a = e.slice(0, i);
23351
+ if (a.trim().length < 8) return;
23339
23352
  rn();
23340
- let a = pn(i);
23341
- a && mn(a, { speaking: !0 });
23353
+ let o = pn(a);
23354
+ o && mn(o, { speaking: !0 });
23342
23355
  } catch (e) {
23343
23356
  console.warn("[VoiceInterface] speech highlight failed", e?.message);
23344
23357
  }
23345
23358
  }, s = () => {
23346
- le.current && clearTimeout(le.current), le.current = setTimeout(() => {
23347
- le.current = null, o();
23348
- }, 200);
23359
+ b.current ??= requestAnimationFrame(() => {
23360
+ b.current = null, o();
23361
+ });
23349
23362
  }, c = () => {
23350
- ue.current ||= setInterval(() => {
23363
+ ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
23364
+ ue.current = null, o();
23365
+ }, 120);
23366
+ }, l = () => {
23367
+ y.current ||= setInterval(() => {
23351
23368
  o();
23352
- }, 400);
23353
- }, l = await Bh.startSession({
23369
+ }, 160);
23370
+ }, u = await Bh.startSession({
23354
23371
  agentId: e,
23355
23372
  clientTools: i,
23356
23373
  onUnhandledClientToolCall: (e) => {
23357
23374
  console.error("[VoiceInterface] ElevenLabs requested a client tool that is not registered in the widget:", e?.tool_name, e?.parameters, "Add a matching handler in voiceClientTools (snake_case and camelCase are both supported).");
23358
23375
  },
23359
23376
  onModeChange: ({ mode: e }) => {
23360
- t || (g(e === "speaking" ? "speaking" : "listening"), e === "listening" && (le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearInterval(ue.current), null)));
23377
+ t || g(e === "speaking" ? "speaking" : "listening");
23378
+ },
23379
+ onAudio: () => {
23380
+ t || (le.current ??= Date.now(), l(), s());
23361
23381
  },
23362
23382
  onAgentChatResponsePart: (e) => {
23363
23383
  if (t) return;
23364
23384
  let n = e?.text_response_part ?? e, r = n?.type, i = n?.text ?? "";
23365
- r === "start" ? (le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearInterval(ue.current), null), v.current = i, ce.current = Date.now(), c()) : r === "delta" ? (v.current += i, ce.current ??= Date.now(), c()) : r === "stop" ? (v.current += i, c()) : (v.current += i, ce.current == null && i && (ce.current = Date.now()), c()), v.current.trim().length >= 18 && s();
23385
+ r === "start" ? (ue.current &&= (clearTimeout(ue.current), null), y.current &&= (clearInterval(y.current), null), b.current != null && (cancelAnimationFrame(b.current), b.current = null), le.current = null, v.current = i, ce.current = Date.now(), l()) : r === "delta" ? (v.current += i, ce.current ??= Date.now(), l()) : r === "stop" ? (v.current += i, l()) : (v.current += i, ce.current == null && i && (ce.current = Date.now()), l()), v.current.trim().length >= 10 && (c(), s());
23366
23386
  },
23367
23387
  onInterruption: () => {
23368
- y();
23388
+ de();
23369
23389
  },
23370
23390
  onMessage: (e) => {
23371
23391
  if (t) return;
@@ -23376,22 +23396,22 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23376
23396
  message: r,
23377
23397
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
23378
23398
  };
23379
- n === "user" && (ae.current = r), d.current = [...d.current, i], v_(n, r) && queueMicrotask(() => {
23399
+ n === "user" && (ae.current = r, de()), d.current = [...d.current, i], y_(n, r) && queueMicrotask(() => {
23380
23400
  se.current || (se.current = !0, oe.current?.());
23381
23401
  });
23382
23402
  },
23383
23403
  onError: (e) => {
23384
- t || (console.error("[VoiceInterface] ElevenLabs error", e), y(), g("error"), te("Voice session encountered an error."));
23404
+ t || (console.error("[VoiceInterface] ElevenLabs error", e), de(), g("error"), te("Voice session encountered an error."));
23385
23405
  },
23386
23406
  onDisconnect: () => {
23387
- t || (console.log("[VoiceInterface] session disconnected"), y(), ne(!1), g("idle"));
23407
+ t || (console.log("[VoiceInterface] session disconnected"), de(), ne(!1), g("idle"));
23388
23408
  }
23389
23409
  });
23390
23410
  if (t) {
23391
- l.endSession().catch(() => {});
23411
+ u.endSession().catch(() => {});
23392
23412
  return;
23393
23413
  }
23394
- n = l, re.current = l, ne(!0), g("listening");
23414
+ n = u, re.current = u, ne(!0), g("listening");
23395
23415
  try {
23396
23416
  let e = typeof window < "u" ? window.location.href : "", t = "";
23397
23417
  try {
@@ -23399,14 +23419,14 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23399
23419
  } catch {
23400
23420
  t = "[]";
23401
23421
  }
23402
- l.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${r || "unknown"}. Page fields/buttons JSON: ${t}. Navigation: when the user wants to go to any page (contact, pricing, about, services, etc.), call search_site_content then navigate_to_page immediately — never ask permission. After navigating to a page with a form, call list_page_forms and proactively start helping the user fill it. Contact / lead forms: use only the main contact form (Full Name, Email, Message). Ignore footer or secondary marketing URL fields unless the user explicitly asks to use them. Fill in order: name → email → message. Message must be a short visitor note (what they want from the team), not a transcript of the conversation. Forms: use fill_form_fields then click_page_button (e.g. Send Message) when appropriate. Fill each field right after the user gives that value — do not click submit until required fields are filled. Voice: if the user wants to end the voice session, call end_voice_session or confirm and end.`);
23422
+ u.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${r || "unknown"}. Page fields/buttons JSON: ${t}. Navigation: when the user wants to go to any page (contact, pricing, about, services, etc.), call search_site_content then navigate_to_page immediately — never ask permission. After navigating to a page with a form, call list_page_forms and proactively start helping the user fill it. Contact / lead forms: use only the main contact form (Full Name, Email, Message). Ignore footer or secondary marketing URL fields unless the user explicitly asks to use them. Fill in order: name → email → message. Message must be a short visitor note (what they want from the team), not a transcript of the conversation. Forms: use fill_form_fields then click_page_button (e.g. Send Message) when appropriate. Fill each field right after the user gives that value — do not click submit until required fields are filled. Voice: if the user wants to end the voice session, call end_voice_session or confirm and end.`);
23403
23423
  } catch {}
23404
23424
  typeof m == "function" && m();
23405
23425
  } catch (e) {
23406
23426
  t || (console.error("[VoiceInterface] startSession failed", e), g("error"), te("Could not start voice session. Please try again."));
23407
23427
  }
23408
23428
  })(), () => {
23409
- t = !0, y(), n ? n.endSession().catch(() => {}) : re.current && re.current.endSession().catch(() => {});
23429
+ t = !0, de(), n ? n.endSession().catch(() => {}) : re.current && re.current.endSession().catch(() => {});
23410
23430
  };
23411
23431
  }, [
23412
23432
  e,
@@ -23414,9 +23434,9 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23414
23434
  a,
23415
23435
  d,
23416
23436
  m,
23417
- y
23437
+ de
23418
23438
  ]);
23419
- let de = h === "listening" || h === "speaking", fe = g_[h] || g_.idle, pe = h_[h] || h_.idle;
23439
+ let pe = h === "listening" || h === "speaking", me = g_[h] || g_.idle, he = h_[h] || h_.idle;
23420
23440
  return /* @__PURE__ */ u("div", {
23421
23441
  ref: ie,
23422
23442
  style: {
@@ -23440,19 +23460,19 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23440
23460
  justifyContent: "center"
23441
23461
  },
23442
23462
  children: [
23443
- de && /* @__PURE__ */ l("div", { style: {
23463
+ pe && /* @__PURE__ */ l("div", { style: {
23444
23464
  position: "absolute",
23445
23465
  inset: "-16px",
23446
23466
  borderRadius: "50%",
23447
- border: `2px solid ${fe}`,
23467
+ border: `2px solid ${me}`,
23448
23468
  animation: "fe-orb-pulse 1.4s ease-in-out infinite",
23449
23469
  opacity: .6
23450
23470
  } }),
23451
- de && /* @__PURE__ */ l("div", { style: {
23471
+ pe && /* @__PURE__ */ l("div", { style: {
23452
23472
  position: "absolute",
23453
23473
  inset: "-8px",
23454
23474
  borderRadius: "50%",
23455
- border: `2px solid ${fe}`,
23475
+ border: `2px solid ${me}`,
23456
23476
  animation: "fe-orb-pulse 1.4s ease-in-out 0.35s infinite",
23457
23477
  opacity: .4
23458
23478
  } }),
@@ -23461,18 +23481,18 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23461
23481
  width: "140px",
23462
23482
  height: "140px",
23463
23483
  borderRadius: "50%",
23464
- background: pe,
23465
- border: `3px solid ${fe}`,
23484
+ background: he,
23485
+ border: `3px solid ${me}`,
23466
23486
  display: "flex",
23467
23487
  alignItems: "center",
23468
23488
  justifyContent: "center",
23469
23489
  transition: "all 0.35s ease",
23470
23490
  transform: h === "speaking" ? "scale(1.08)" : "scale(1)",
23471
- boxShadow: `0 0 40px ${pe}, 0 8px 32px rgba(0,0,0,0.08)`
23491
+ boxShadow: `0 0 40px ${he}, 0 8px 32px rgba(0,0,0,0.08)`
23472
23492
  },
23473
23493
  children: /* @__PURE__ */ l(An, {
23474
23494
  size: 44,
23475
- color: fe
23495
+ color: me
23476
23496
  })
23477
23497
  })
23478
23498
  ]
@@ -23493,7 +23513,7 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23493
23513
  ]
23494
23514
  }),
23495
23515
  /* @__PURE__ */ u("button", {
23496
- onClick: b,
23516
+ onClick: fe,
23497
23517
  style: {
23498
23518
  display: "flex",
23499
23519
  alignItems: "center",
@@ -23522,7 +23542,7 @@ function y_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
23522
23542
  }
23523
23543
  //#endregion
23524
23544
  //#region src/components/FlowEngageWidget.jsx
23525
- var b_ = [
23545
+ var x_ = [
23526
23546
  {
23527
23547
  key: "become_client",
23528
23548
  label: "Become a Client"
@@ -23543,7 +23563,7 @@ var b_ = [
23543
23563
  key: "looking_for_job",
23544
23564
  label: "Looking for a Job"
23545
23565
  }
23546
- ], x_ = () => /* @__PURE__ */ l("div", {
23566
+ ], S_ = () => /* @__PURE__ */ l("div", {
23547
23567
  style: {
23548
23568
  display: "flex",
23549
23569
  marginBottom: "12px",
@@ -23574,7 +23594,7 @@ var b_ = [
23574
23594
  } }, e)), /* @__PURE__ */ l("style", { children: "\n @keyframes fe-dot-bounce {\n 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }\n 40% { transform: translateY(-5px); opacity: 1; }\n }\n " })]
23575
23595
  })
23576
23596
  });
23577
- function S_() {
23597
+ function C_() {
23578
23598
  let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: o, isOpen: c, activeScreen: d, isHumanHandled: f, agentName: p, agentHeadshot: m, visitorEmail: h, isAgentTyping: g, isAiTyping: ee, isLoading: te, isVoiceMode: _, isRateLimited: ne, rateLimitMessage: re, isConversationEnded: ie, incomingCall: ae, activeCallId: oe, callConnectionState: se, callConnectedAt: v, isCallMuted: ce, webRTCError: le, language: ue, historyRef: y, onMessageSync: b, endConversation: de, acceptCall: fe, rejectCall: pe, endWebRTCCall: me, toggleCallMute: he, dismissCallError: ge, captureVisitorEmail: _e, openWidget: ve, closeWidget: ye, sendMessage: be, setVoiceMode: xe, startTyping: Se, stopTyping: Ce, updateTypingDraft: we } = Xt(), [Te, Ee] = s(""), [De, Oe] = s(null), [ke, Ae] = s(null), [je, Me] = s(null), [Ne, Pe] = s(0), [x, Fe] = s(h || ""), [Ie, Le] = s("");
23579
23599
  i(() => {
23580
23600
  try {
@@ -23602,7 +23622,7 @@ function S_() {
23602
23622
  outline: "none",
23603
23623
  fontFamily: "ui-sans-serif, system-ui, sans-serif",
23604
23624
  ...c ? {} : Ue
23605
- }, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] || b_, Ke = S.greetings?.[ue] || Re.greetings?.[ue], qe = ze.chatButtonText || "Chat with us", Je = ze.headerName || t?.websiteName || "OpenSense Labs", C = ze.logoUrl || null, w = ze.hideWatermark || !1, T = Re.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "", Ze = ze.fallbackAgentName || "Agent", Qe = ze.botLabel || "AI", $e = m && String(m).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, et = ae?.agentName || p || Ze, tt = o.some((e) => e.sender === "user"), nt = a(() => {
23625
+ }, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] || x_, Ke = S.greetings?.[ue] || Re.greetings?.[ue], qe = ze.chatButtonText || "Chat with us", Je = ze.headerName || t?.websiteName || "OpenSense Labs", C = ze.logoUrl || null, w = ze.hideWatermark || !1, T = Re.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "", Ze = ze.fallbackAgentName || "Agent", Qe = ze.botLabel || "AI", $e = m && String(m).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, et = ae?.agentName || p || Ze, tt = o.some((e) => e.sender === "user"), nt = a(() => {
23606
23626
  let e = o.findIndex((e) => e.sender === "user");
23607
23627
  return e === -1 ? !1 : o.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
23608
23628
  }, [o]), rt = !h && tt && nt;
@@ -23730,7 +23750,7 @@ function S_() {
23730
23750
  flexDirection: "column"
23731
23751
  },
23732
23752
  className: "fe-screen-fade-in",
23733
- children: /* @__PURE__ */ l(y_, {
23753
+ children: /* @__PURE__ */ l(b_, {
23734
23754
  agentId: T,
23735
23755
  chatId: r,
23736
23756
  siteId: Ye,
@@ -23763,7 +23783,7 @@ function S_() {
23763
23783
  isAiTyping: ee,
23764
23784
  isAgentTyping: g,
23765
23785
  setReplyContext: Me,
23766
- TypingDots: x_,
23786
+ TypingDots: S_,
23767
23787
  primaryColor: Ve,
23768
23788
  agentHeadshot: $e,
23769
23789
  agentDisplayName: p || Ze
@@ -23842,4 +23862,4 @@ function S_() {
23842
23862
  }) : null;
23843
23863
  }
23844
23864
  //#endregion
23845
- export { Dn as FlowEngageProvider, S_ as FlowEngageWidget, Xt as useFlowEngage };
23865
+ export { Dn as FlowEngageProvider, C_ as FlowEngageWidget, Xt as useFlowEngage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
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",