@flowengage/react-chatbot 1.5.3 → 1.5.5

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.
@@ -1862,13 +1862,17 @@ var un = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => ln(e, {
1862
1862
  chatId: t,
1863
1863
  timestamp: Date.now()
1864
1864
  });
1865
+ }, v = () => {
1866
+ _();
1867
+ }, y = (e) => {
1868
+ e.persisted || _();
1865
1869
  };
1866
- return window.addEventListener("popstate", m), window.addEventListener("hashchange", m), window.addEventListener("beforeunload", _), window.addEventListener("visibilitychange", p), o(), document.hidden ? a = window.setTimeout(() => {
1870
+ return window.addEventListener("popstate", m), window.addEventListener("hashchange", m), window.addEventListener("beforeunload", v), window.addEventListener("pagehide", y), window.addEventListener("visibilitychange", p), o(), document.hidden ? a = window.setTimeout(() => {
1867
1871
  a = null, d(), f("hidden");
1868
1872
  }, re) : (l(), u()), {
1869
1873
  notifyRouteChange: m,
1870
1874
  cleanup: () => {
1871
- a &&= (window.clearTimeout(a), null), d(), window.history.pushState = h, window.history.replaceState = g, window.removeEventListener("popstate", m), window.removeEventListener("hashchange", m), window.removeEventListener("beforeunload", _), window.removeEventListener("visibilitychange", p);
1875
+ a &&= (window.clearTimeout(a), null), d(), window.history.pushState = h, window.history.replaceState = g, window.removeEventListener("popstate", m), window.removeEventListener("hashchange", m), window.removeEventListener("beforeunload", v), window.removeEventListener("pagehide", y), window.removeEventListener("visibilitychange", p);
1872
1876
  }
1873
1877
  };
1874
1878
  }, fn = r(null), pn = () => {
@@ -2619,7 +2623,10 @@ function In({ siteId: e, config: t, children: n, language: r = "en" }) {
2619
2623
  chatId: c
2620
2624
  }), console.log("[FlowEngageProvider] tracking started", { chatId: c });
2621
2625
  let m = await l.loadHistory(c, r);
2622
- if (console.log("[FlowEngageProvider] history loaded", m), !e || (b(An(m.chat_history || [])), te(!!m.is_human_handled), w(m.is_human_handled ? "agent" : C), await new Promise((e) => setTimeout(e, 500)), !e)) return;
2626
+ if (console.log("[FlowEngageProvider] history loaded", m), !e) return;
2627
+ b(An(m.chat_history || [])), te(!!m.is_human_handled), w(m.is_human_handled ? "agent" : C);
2628
+ let g = m?.visitor_email || m?.visitorEmail;
2629
+ if (g && String(g).trim() && pt(String(g).trim()), await new Promise((e) => setTimeout(e, 500)), !e) return;
2623
2630
  s("ready"), console.log("[FlowEngageProvider] status ready");
2624
2631
  } catch (t) {
2625
2632
  if (!e) return;
@@ -28811,7 +28818,8 @@ function wO({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
28811
28818
  ]), c(() => {
28812
28819
  if (!y) return;
28813
28820
  let e = (e) => {
28814
- re.current && !re.current.contains(e.target) && b(!1);
28821
+ let t = e.composedPath?.()?.[0] || e.target;
28822
+ re.current && !re.current.contains(t) && b(!1);
28815
28823
  };
28816
28824
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
28817
28825
  }, [y]), /* @__PURE__ */ g(h, { children: /* @__PURE__ */ _("div", {
@@ -29133,7 +29141,8 @@ function DO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
29133
29141
  return c(() => {
29134
29142
  if (!je) return;
29135
29143
  let e = (e) => {
29136
- Ne.current && !Ne.current.contains(e.target) && Me(!1);
29144
+ let t = e.composedPath?.()?.[0] || e.target;
29145
+ Ne.current && !Ne.current.contains(t) && Me(!1);
29137
29146
  };
29138
29147
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
29139
29148
  }, [je]), /* @__PURE__ */ _("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
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",