@flowengage/react-chatbot 5.0.30 → 5.0.32

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.
@@ -26596,8 +26596,25 @@ function HD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26596
26596
  }
26597
26597
  //#endregion
26598
26598
  //#region src/components/MessageList.jsx
26599
- function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26600
- let u = p(null), [d, f] = m(null), [v, y] = m(null), b = p(e.length), x = p(!0), S = p(null), C = (e) => {
26599
+ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
26600
+ let { resolvedConfig: d } = Ln(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
26601
+ let t = e.target.closest("a[href]");
26602
+ if (!t) return;
26603
+ let n = t.getAttribute("href") || "";
26604
+ if (!(!n || n.startsWith("mailto:") || n.startsWith("tel:") || n.startsWith("javascript:"))) try {
26605
+ let t = new URL(n, window.location.href);
26606
+ if (t.origin !== window.location.origin) {
26607
+ e.preventDefault(), window.open(t.href, "_blank", "noopener,noreferrer");
26608
+ return;
26609
+ }
26610
+ e.preventDefault(), gr(t.href, {
26611
+ siteId: d?.siteId,
26612
+ apiBaseUrl: d?.apiBaseUrl
26613
+ }).then((e) => {
26614
+ e && xr(t.href);
26615
+ });
26616
+ } catch {}
26617
+ }, [d]), ee = (e) => {
26601
26618
  if (!e) return "just now";
26602
26619
  let t = /* @__PURE__ */ new Date(), n = new Date(e), r = Math.max(0, Math.floor((t - n) / 1e3));
26603
26620
  if (r < 60) return "just now";
@@ -26609,19 +26626,19 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26609
26626
  return `${o} day${o > 1 ? "s" : ""} ago`;
26610
26627
  };
26611
26628
  return c(() => {
26612
- if (x.current) {
26613
- x.current = !1, b.current = e.length, S.current && (S.current.scrollTop = S.current.scrollHeight);
26629
+ if (C.current) {
26630
+ C.current = !1, S.current = e.length, w.current && (w.current.scrollTop = w.current.scrollHeight);
26614
26631
  return;
26615
26632
  }
26616
- let n = e.length > b.current;
26617
- b.current = e.length, (n || t || r) && u.current?.scrollIntoView({ behavior: "smooth" });
26633
+ let n = e.length > S.current;
26634
+ S.current = e.length, (n || t || r) && f.current?.scrollIntoView({ behavior: "smooth" });
26618
26635
  }, [
26619
26636
  e.length,
26620
26637
  t,
26621
26638
  n,
26622
26639
  r
26623
26640
  ]), /* @__PURE__ */ _("div", {
26624
- ref: S,
26641
+ ref: w,
26625
26642
  style: {
26626
26643
  flex: 1,
26627
26644
  overflowY: "auto",
@@ -26634,7 +26651,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26634
26651
  children: [
26635
26652
  e.map((e) => {
26636
26653
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
26637
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", c = e.sender === "agent", u = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || s, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof o == "string" && o.trim() || null, b = ED(e.replyToContent || e.replyContext?.message || ""), x = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26654
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = ED(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
26638
26655
  return t ? /* @__PURE__ */ g("div", {
26639
26656
  style: {
26640
26657
  display: "flex",
@@ -26661,7 +26678,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26661
26678
  gap: "8px",
26662
26679
  flexDirection: "row"
26663
26680
  },
26664
- children: [!n && (r || c) && /* @__PURE__ */ g("div", {
26681
+ children: [!n && (r || o) && /* @__PURE__ */ g("div", {
26665
26682
  style: {
26666
26683
  width: "32px",
26667
26684
  height: "32px",
@@ -26670,18 +26687,18 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26670
26687
  alignItems: "center",
26671
26688
  justifyContent: "center",
26672
26689
  borderRadius: "50%",
26673
- background: c ? "#f3f4f6" : l && r ? "transparent" : "var(--flowengage-primary)",
26674
- color: c ? a : "#fff",
26675
- boxShadow: c ? "0 2px 8px rgba(0,0,0,0.06)" : l && r ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
26690
+ background: o ? "#f3f4f6" : u && r ? "transparent" : "var(--flowengage-primary)",
26691
+ color: o ? a : "#fff",
26692
+ boxShadow: o ? "0 2px 8px rgba(0,0,0,0.06)" : u && r ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
26676
26693
  overflow: "hidden",
26677
- border: c ? `1px solid ${a}22` : "none",
26694
+ border: o ? `1px solid ${a}22` : "none",
26678
26695
  fontSize: "12px",
26679
26696
  fontWeight: 800,
26680
- marginTop: !u && (r || c) ? "22px" : "0px"
26697
+ marginTop: !c && (r || o) ? "22px" : "0px"
26681
26698
  },
26682
- children: r ? l || /* @__PURE__ */ g(bD, { size: 16 }) : /* @__PURE__ */ g(HD, {
26683
- src: m || "",
26684
- name: p,
26699
+ children: r ? u || /* @__PURE__ */ g(bD, { size: 16 }) : /* @__PURE__ */ g(HD, {
26700
+ src: p || "",
26701
+ name: f,
26685
26702
  imgStyle: {
26686
26703
  width: "100%",
26687
26704
  height: "100%",
@@ -26698,7 +26715,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26698
26715
  minWidth: 0
26699
26716
  },
26700
26717
  children: [
26701
- !u && c && /* @__PURE__ */ _("button", {
26718
+ !c && o && /* @__PURE__ */ _("button", {
26702
26719
  type: "button",
26703
26720
  onClick: () => i(e),
26704
26721
  style: {
@@ -26734,12 +26751,12 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26734
26751
  color: n ? "#fff" : "#111827",
26735
26752
  fontSize: "14px",
26736
26753
  fontWeight: 400,
26737
- opacity: u ? .55 : 1,
26754
+ opacity: c ? .55 : 1,
26738
26755
  transition: "opacity 0.3s ease",
26739
26756
  wordBreak: "break-word",
26740
26757
  width: "fit-content"
26741
26758
  },
26742
- children: [b && /* @__PURE__ */ _("div", {
26759
+ children: [m && /* @__PURE__ */ _("div", {
26743
26760
  style: {
26744
26761
  marginBottom: "8px",
26745
26762
  borderRadius: "14px",
@@ -26754,7 +26771,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26754
26771
  marginBottom: "2px",
26755
26772
  fontWeight: 600
26756
26773
  },
26757
- children: x
26774
+ children: v
26758
26775
  }), /* @__PURE__ */ g("div", {
26759
26776
  style: {
26760
26777
  display: "-webkit-box",
@@ -26762,7 +26779,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26762
26779
  WebkitBoxOrient: "vertical",
26763
26780
  overflow: "hidden"
26764
26781
  },
26765
- children: b
26782
+ children: m
26766
26783
  })]
26767
26784
  }), d ? (() => {
26768
26785
  let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = zD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
@@ -26785,12 +26802,12 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26785
26802
  },
26786
26803
  children: a ? /* @__PURE__ */ g("button", {
26787
26804
  type: "button",
26788
- onClick: () => f({
26805
+ onClick: () => y({
26789
26806
  url: e.metadata.fileUrl,
26790
26807
  name: r
26791
26808
  }),
26792
- onMouseEnter: () => y(e.id),
26793
- onMouseLeave: () => y(null),
26809
+ onMouseEnter: () => x(e.id),
26810
+ onMouseLeave: () => x(null),
26794
26811
  style: {
26795
26812
  display: "block",
26796
26813
  width: "100%",
@@ -26818,7 +26835,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26818
26835
  position: "absolute",
26819
26836
  inset: 0,
26820
26837
  borderRadius: "10px",
26821
- background: v === e.id ? "rgba(17,24,39,0.32)" : "rgba(17,24,39,0)",
26838
+ background: b === e.id ? "rgba(17,24,39,0.32)" : "rgba(17,24,39,0)",
26822
26839
  display: "flex",
26823
26840
  alignItems: "center",
26824
26841
  justifyContent: "center",
@@ -26826,7 +26843,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26826
26843
  fontSize: "13px",
26827
26844
  fontWeight: 700,
26828
26845
  letterSpacing: "0.02em",
26829
- opacity: v === e.id ? 1 : 0,
26846
+ opacity: b === e.id ? 1 : 0,
26830
26847
  transition: "background 0.18s ease, opacity 0.18s ease",
26831
26848
  pointerEvents: "none"
26832
26849
  },
@@ -26937,9 +26954,10 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26937
26954
  });
26938
26955
  })() : r ? /* @__PURE__ */ g("div", {
26939
26956
  className: "flowengage-message-content fe-bot-message",
26940
- dangerouslySetInnerHTML: { __html: ND(e.message) }
26957
+ dangerouslySetInnerHTML: { __html: ND(e.message) },
26958
+ onClick: T
26941
26959
  }) : /* @__PURE__ */ g("div", {
26942
- style: { whiteSpace: n || c ? "normal" : "pre-wrap" },
26960
+ style: { whiteSpace: n || o ? "normal" : "pre-wrap" },
26943
26961
  children: e.message
26944
26962
  })]
26945
26963
  }),
@@ -26952,7 +26970,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26952
26970
  padding: "0 4px",
26953
26971
  alignSelf: n ? "flex-end" : "flex-start"
26954
26972
  },
26955
- children: u ? /* @__PURE__ */ g("span", {
26973
+ children: c ? /* @__PURE__ */ g("span", {
26956
26974
  style: {
26957
26975
  fontSize: "10px",
26958
26976
  color: "#9ca3af",
@@ -26966,7 +26984,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26966
26984
  color: "#9ca3af",
26967
26985
  fontWeight: 500
26968
26986
  },
26969
- children: C(e.timestamp || e.createdAt)
26987
+ children: ee(e.timestamp || e.createdAt)
26970
26988
  }), /* @__PURE__ */ g("span", {
26971
26989
  style: {
26972
26990
  fontSize: "10px",
@@ -26996,12 +27014,12 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26996
27014
  alignItems: "center",
26997
27015
  justifyContent: "center",
26998
27016
  borderRadius: "50%",
26999
- background: l ? "transparent" : "var(--flowengage-primary)",
27017
+ background: u ? "transparent" : "var(--flowengage-primary)",
27000
27018
  color: "#fff",
27001
- boxShadow: l ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
27019
+ boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
27002
27020
  overflow: "hidden"
27003
27021
  },
27004
- children: l || /* @__PURE__ */ g(bD, { size: 16 })
27022
+ children: u || /* @__PURE__ */ g(bD, { size: 16 })
27005
27023
  }), /* @__PURE__ */ _("div", {
27006
27024
  style: {
27007
27025
  display: "flex",
@@ -27044,8 +27062,8 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27044
27062
  overflow: "hidden"
27045
27063
  },
27046
27064
  children: /* @__PURE__ */ g(HD, {
27047
- src: o || "",
27048
- name: s,
27065
+ src: s || "",
27066
+ name: l,
27049
27067
  imgStyle: {
27050
27068
  width: "100%",
27051
27069
  height: "100%",
@@ -27077,10 +27095,10 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27077
27095
  } }, e))
27078
27096
  })]
27079
27097
  }),
27080
- /* @__PURE__ */ g("div", { ref: u }),
27081
- d && /* @__PURE__ */ g("button", {
27098
+ /* @__PURE__ */ g("div", { ref: f }),
27099
+ v && /* @__PURE__ */ g("button", {
27082
27100
  type: "button",
27083
- onClick: () => f(null),
27101
+ onClick: () => y(null),
27084
27102
  style: {
27085
27103
  position: "fixed",
27086
27104
  inset: 0,
@@ -27106,8 +27124,8 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27106
27124
  alignItems: "center"
27107
27125
  },
27108
27126
  children: [/* @__PURE__ */ g("img", {
27109
- src: d.url,
27110
- alt: d.name,
27127
+ src: v.url,
27128
+ alt: v.name,
27111
27129
  style: {
27112
27130
  width: "100%",
27113
27131
  maxHeight: "calc(96vh - 72px)",
@@ -27128,7 +27146,7 @@ function UD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27128
27146
  textOverflow: "ellipsis",
27129
27147
  whiteSpace: "nowrap"
27130
27148
  },
27131
- children: d.name
27149
+ children: v.name
27132
27150
  })]
27133
27151
  })
27134
27152
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "5.0.30",
3
+ "version": "5.0.32",
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",