@flowengage/react-chatbot 1.3.1 → 1.3.3

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.
@@ -1714,7 +1714,7 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
1714
1714
  }
1715
1715
  }), qt = ({ socket: e, chatId: t }) => {
1716
1716
  if (!e || !t || typeof window > "u") return () => {};
1717
- let n = window.location.pathname + window.location.search, r = Date.now(), i = () => {
1717
+ let n = window.location.pathname + window.location.search, r = Date.now(), i = null, a = () => {
1718
1718
  console.log("[FlowEngageTracking] visitor:session_start", {
1719
1719
  chatId: t,
1720
1720
  path: n
@@ -1726,7 +1726,7 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
1726
1726
  userAgent: navigator.userAgent,
1727
1727
  timestamp: Date.now()
1728
1728
  });
1729
- }, a = () => {
1729
+ }, o = () => {
1730
1730
  console.log("[FlowEngageTracking] visitor:page_enter", {
1731
1731
  chatId: t,
1732
1732
  path: n
@@ -1736,7 +1736,7 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
1736
1736
  title: document.title,
1737
1737
  timestamp: Date.now()
1738
1738
  });
1739
- }, o = (n, r) => {
1739
+ }, s = (n, r) => {
1740
1740
  console.log("[FlowEngageTracking] visitor:page_leave", {
1741
1741
  chatId: t,
1742
1742
  path: n,
@@ -1747,15 +1747,38 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
1747
1747
  duration: Math.max(0, Math.floor((Date.now() - r) / 1e3)),
1748
1748
  timestamp: Date.now()
1749
1749
  });
1750
- }, s = () => {
1750
+ }, c = () => {
1751
1751
  console.log("[FlowEngageTracking] visitor:heartbeat", {
1752
1752
  chatId: t,
1753
1753
  path: n
1754
1754
  }), e.emit("visitor:heartbeat", {
1755
1755
  chatId: t,
1756
+ path: n,
1757
+ title: document.title,
1756
1758
  timestamp: Date.now()
1757
1759
  });
1758
- }, c = () => {
1760
+ }, l = () => {
1761
+ i && window.clearInterval(i), i = window.setInterval(c, h);
1762
+ }, u = () => {
1763
+ i &&= (window.clearInterval(i), null);
1764
+ }, d = (r) => {
1765
+ console.log("[FlowEngageTracking] visitor:visibility", {
1766
+ chatId: t,
1767
+ state: r
1768
+ }), e.emit("visitor:visibility", {
1769
+ chatId: t,
1770
+ state: r,
1771
+ path: n,
1772
+ title: document.title,
1773
+ timestamp: Date.now()
1774
+ });
1775
+ }, f = () => {
1776
+ if (document.hidden) {
1777
+ u(), d("hidden");
1778
+ return;
1779
+ }
1780
+ d("visible"), c(), l();
1781
+ }, p = () => {
1759
1782
  let e = window.location.pathname + window.location.search;
1760
1783
  if (e === n) {
1761
1784
  console.log("[FlowEngageTracking] route unchanged", { currentPath: n });
@@ -1764,23 +1787,23 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
1764
1787
  console.log("[FlowEngageTracking] route changed", {
1765
1788
  from: n,
1766
1789
  to: e
1767
- }), o(n, r), n = e, r = Date.now(), a();
1768
- }, l = window.history.pushState.bind(window.history), u = window.history.replaceState.bind(window.history);
1790
+ }), s(n, r), n = e, r = Date.now(), o();
1791
+ }, m = window.history.pushState.bind(window.history), g = window.history.replaceState.bind(window.history);
1769
1792
  window.history.pushState = (...e) => {
1770
- l(...e), c();
1793
+ m(...e), p();
1771
1794
  }, window.history.replaceState = (...e) => {
1772
- u(...e), c();
1795
+ g(...e), p();
1773
1796
  };
1774
- let d = window.setInterval(s, h), f = () => {
1775
- o(n, r), e.emit("visitor:session_end", {
1797
+ let ee = () => {
1798
+ s(n, r), e.emit("visitor:session_end", {
1776
1799
  chatId: t,
1777
1800
  timestamp: Date.now()
1778
1801
  });
1779
1802
  };
1780
- return window.addEventListener("popstate", c), window.addEventListener("hashchange", c), window.addEventListener("beforeunload", f), i(), s(), {
1781
- notifyRouteChange: c,
1803
+ return window.addEventListener("popstate", p), window.addEventListener("hashchange", p), window.addEventListener("beforeunload", ee), window.addEventListener("visibilitychange", f), a(), document.hidden ? d("hidden") : (c(), l()), {
1804
+ notifyRouteChange: p,
1782
1805
  cleanup: () => {
1783
- window.clearInterval(d), window.history.pushState = l, window.history.replaceState = u, window.removeEventListener("popstate", c), window.removeEventListener("hashchange", c), window.removeEventListener("beforeunload", f);
1806
+ u(), window.history.pushState = m, window.history.replaceState = g, window.removeEventListener("popstate", p), window.removeEventListener("hashchange", p), window.removeEventListener("beforeunload", ee), window.removeEventListener("visibilitychange", f);
1784
1807
  }
1785
1808
  };
1786
1809
  }, Jt = t(null), Yt = () => {
@@ -4223,7 +4246,8 @@ function tr({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
4223
4246
  outline: "none",
4224
4247
  padding: "6px 0",
4225
4248
  color: "#111827",
4226
- background: "transparent"
4249
+ background: "transparent",
4250
+ margin: "0 !important"
4227
4251
  },
4228
4252
  value: f ? p : e,
4229
4253
  onChange: (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
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",