@flowengage/react-chatbot 2.0.8 → 2.0.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.
@@ -29371,12 +29371,12 @@ function BO({ orbColors: e, ...t }) {
29371
29371
  ...t
29372
29372
  });
29373
29373
  }
29374
- function VO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a }) {
29375
- let o = n || PO.green, s = IO(o), c = a ? 72 : 94, l = /* @__PURE__ */ _("div", {
29374
+ function VO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29375
+ let s = n || PO.green, c = IO(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29376
29376
  style: {
29377
29377
  display: "flex",
29378
- alignItems: "center",
29379
- gap: a ? "14px" : "18px"
29378
+ alignItems: a ? "flex-end" : "center",
29379
+ gap: a ? "7px" : "9px"
29380
29380
  },
29381
29381
  children: [/* @__PURE__ */ _("div", {
29382
29382
  style: {
@@ -29435,14 +29435,14 @@ function VO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29435
29435
  boxSizing: "border-box",
29436
29436
  padding: "0 16px",
29437
29437
  borderRadius: "999px",
29438
- background: o,
29439
- color: s,
29438
+ background: s,
29439
+ color: c,
29440
29440
  fontWeight: 400,
29441
29441
  fontSize: "14px",
29442
29442
  border: "none",
29443
29443
  cursor: "pointer",
29444
29444
  whiteSpace: "nowrap",
29445
- boxShadow: `0 4px 16px ${o}66`,
29445
+ boxShadow: `0 4px 16px ${s}66`,
29446
29446
  transition: "transform 0.15s ease"
29447
29447
  },
29448
29448
  onMouseEnter: (e) => {
@@ -29494,15 +29494,15 @@ function VO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29494
29494
  },
29495
29495
  style: { flexShrink: 0 },
29496
29496
  children: /* @__PURE__ */ g(BO, {
29497
- size: c,
29497
+ size: l,
29498
29498
  orbColors: t
29499
29499
  })
29500
29500
  })]
29501
29501
  });
29502
29502
  return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Yp.div, {
29503
29503
  initial: { opacity: 0 },
29504
- animate: { opacity: 1 },
29505
- transition: { duration: .4 },
29504
+ animate: { opacity: o ? 0 : 1 },
29505
+ transition: { duration: .28 },
29506
29506
  style: {
29507
29507
  position: "fixed",
29508
29508
  inset: 0,
@@ -29516,21 +29516,30 @@ function VO({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29516
29516
  left: 0,
29517
29517
  right: 0,
29518
29518
  padding: "24px 20px 40px",
29519
- overflow: "hidden"
29519
+ overflow: "hidden",
29520
+ animation: o ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : ""
29520
29521
  },
29521
- children: l
29522
- }) : l] });
29522
+ children: u
29523
+ }) : /* @__PURE__ */ g("div", {
29524
+ style: { animation: o ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "" },
29525
+ children: u
29526
+ })] });
29523
29527
  }
29524
- function HO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o }) {
29525
- let s = n || PO.green, c = IO(s);
29528
+ function HO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29529
+ let c = n || PO.green, l = IO(c);
29526
29530
  return /* @__PURE__ */ _(Yp.div, {
29527
29531
  initial: {
29528
29532
  scale: 50 / 350,
29529
29533
  borderRadius: "50%"
29530
29534
  },
29531
- animate: {
29535
+ animate: s ? {
29536
+ scale: 50 / 350,
29537
+ opacity: 0,
29538
+ borderRadius: "50%"
29539
+ } : {
29532
29540
  scale: 1,
29533
- borderRadius: "16px"
29541
+ borderRadius: "16px",
29542
+ opacity: 1
29534
29543
  },
29535
29544
  transition: {
29536
29545
  type: "spring",
@@ -29615,14 +29624,14 @@ function HO({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
29615
29624
  width: "127px",
29616
29625
  height: "43px",
29617
29626
  borderRadius: "999px",
29618
- background: s,
29619
- color: c,
29627
+ background: c,
29628
+ color: l,
29620
29629
  fontWeight: 400,
29621
29630
  fontSize: "16px",
29622
29631
  border: "none",
29623
29632
  cursor: "pointer",
29624
29633
  transition: "transform 0.15s ease",
29625
- boxShadow: `0 4px 12px ${s}55`
29634
+ boxShadow: `0 4px 12px ${c}55`
29626
29635
  },
29627
29636
  onMouseEnter: (e) => {
29628
29637
  e.currentTarget.style.transform = "scale(1.03)";
@@ -30064,28 +30073,28 @@ var GO = () => /* @__PURE__ */ g("div", {
30064
30073
  } }, e))
30065
30074
  })
30066
30075
  });
30067
- function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: se, setEmailInput: ce, emailError: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me }) {
30068
- let Ne = l.length > 0, Pe = T || ee || w, Fe = !!ge, [Ie, Le] = m(!1), [Re, ze] = m(!1), [Be, Ve] = m([]), [D, He] = m(!1), [Ue, We] = m(null), [Ge, Ke] = m([]), qe = p(null), Je = async () => {
30069
- Le(!1), ze(!0), He(!0), We(null);
30076
+ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: se, setEmailInput: ce, emailError: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: Ne }) {
30077
+ let Pe = l.length > 0, Fe = T || ee || w, Ie = !!ge, [Le, Re] = m(!1), [ze, Be] = m(!1), [Ve, D] = m([]), [He, Ue] = m(!1), [We, Ge] = m(null), [Ke, qe] = m([]), Je = p(null), Ye = async () => {
30078
+ Re(!1), Be(!0), Ue(!0), Ge(null);
30070
30079
  try {
30071
30080
  let e = await ke();
30072
- e?.data && Ve(e.data);
30081
+ e?.data && D(e.data);
30073
30082
  } catch (e) {
30074
30083
  console.error(e);
30075
30084
  } finally {
30076
- He(!1);
30085
+ Ue(!1);
30077
30086
  }
30078
- }, Ye = async (e) => {
30079
- ze(!1), je?.(e.chatId);
30087
+ }, Xe = async (e) => {
30088
+ Be(!1), je?.(e.chatId);
30080
30089
  };
30081
30090
  return c(() => {
30082
- if (!Ie) return;
30091
+ if (!Le) return;
30083
30092
  let e = (e) => {
30084
30093
  let t = e.composedPath?.()?.[0] || e.target;
30085
- qe.current && !qe.current.contains(t) && Le(!1);
30094
+ Je.current && !Je.current.contains(t) && Re(!1);
30086
30095
  };
30087
30096
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
30088
- }, [Ie]), /* @__PURE__ */ _("div", {
30097
+ }, [Le]), /* @__PURE__ */ _("div", {
30089
30098
  style: s ? {
30090
30099
  "--flowengage-primary": n,
30091
30100
  "--flowengage-accent": n,
@@ -30100,7 +30109,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30100
30109
  display: "flex",
30101
30110
  flexDirection: "column",
30102
30111
  overflow: "hidden",
30103
- animation: "fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)"
30112
+ animation: Ne ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)"
30104
30113
  } : {
30105
30114
  "--flowengage-primary": n,
30106
30115
  "--flowengage-accent": n,
@@ -30113,7 +30122,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30113
30122
  flexDirection: "column",
30114
30123
  overflow: "hidden",
30115
30124
  position: "relative",
30116
- animation: "fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)"
30125
+ animation: Ne ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)"
30117
30126
  },
30118
30127
  children: [
30119
30128
  /* @__PURE__ */ _("div", {
@@ -30230,10 +30239,10 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30230
30239
  isolation: "isolate",
30231
30240
  zIndex: 10
30232
30241
  },
30233
- ref: qe,
30242
+ ref: Je,
30234
30243
  children: [/* @__PURE__ */ g("button", {
30235
30244
  type: "button",
30236
- onClick: () => Le((e) => !e),
30245
+ onClick: () => Re((e) => !e),
30237
30246
  style: {
30238
30247
  width: "40px",
30239
30248
  height: "40px",
@@ -30279,7 +30288,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30279
30288
  })
30280
30289
  ]
30281
30290
  })
30282
- }), Ie && /* @__PURE__ */ _("div", {
30291
+ }), Le && /* @__PURE__ */ _("div", {
30283
30292
  style: {
30284
30293
  position: "absolute",
30285
30294
  top: "34px",
@@ -30298,7 +30307,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30298
30307
  /* @__PURE__ */ _("button", {
30299
30308
  type: "button",
30300
30309
  onClick: () => {
30301
- Le(!1), Te?.();
30310
+ Re(!1), Te?.();
30302
30311
  },
30303
30312
  style: {
30304
30313
  display: "flex",
@@ -30341,7 +30350,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30341
30350
  /* @__PURE__ */ _("button", {
30342
30351
  type: "button",
30343
30352
  onClick: () => {
30344
- Le(!1), Ee?.();
30353
+ Re(!1), Ee?.();
30345
30354
  },
30346
30355
  style: {
30347
30356
  display: "flex",
@@ -30382,7 +30391,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30382
30391
  margin: "0 14px"
30383
30392
  } }), /* @__PURE__ */ _("button", {
30384
30393
  type: "button",
30385
- onClick: Je,
30394
+ onClick: Ye,
30386
30395
  style: {
30387
30396
  display: "flex",
30388
30397
  alignItems: "center",
@@ -30424,7 +30433,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30424
30433
  /* @__PURE__ */ _("button", {
30425
30434
  type: "button",
30426
30435
  onClick: () => {
30427
- Le(!1), we?.();
30436
+ Re(!1), we?.();
30428
30437
  },
30429
30438
  style: {
30430
30439
  display: "flex",
@@ -30511,7 +30520,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30511
30520
  background: "transparent",
30512
30521
  position: "relative"
30513
30522
  },
30514
- children: [Re ? /* @__PURE__ */ _("div", {
30523
+ children: [ze ? /* @__PURE__ */ _("div", {
30515
30524
  style: {
30516
30525
  position: "absolute",
30517
30526
  inset: 0,
@@ -30529,8 +30538,8 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30529
30538
  borderBottom: "1px solid #f3f4f6",
30530
30539
  flexShrink: 0
30531
30540
  },
30532
- children: Ue ? /* @__PURE__ */ _("button", {
30533
- onClick: () => We(null),
30541
+ children: We ? /* @__PURE__ */ _("button", {
30542
+ onClick: () => Ge(null),
30534
30543
  style: {
30535
30544
  background: "none",
30536
30545
  border: "none",
@@ -30558,7 +30567,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30558
30567
  children: "Back to List"
30559
30568
  })]
30560
30569
  }) : /* @__PURE__ */ _("button", {
30561
- onClick: () => ze(!1),
30570
+ onClick: () => Be(!1),
30562
30571
  style: {
30563
30572
  background: "none",
30564
30573
  border: "none",
@@ -30592,7 +30601,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30592
30601
  overflowY: "auto",
30593
30602
  position: "relative"
30594
30603
  },
30595
- children: D && !Ue ? /* @__PURE__ */ g("div", {
30604
+ children: He && !We ? /* @__PURE__ */ g("div", {
30596
30605
  style: {
30597
30606
  padding: "40px 20px",
30598
30607
  textAlign: "center",
@@ -30600,9 +30609,9 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30600
30609
  fontSize: "14px"
30601
30610
  },
30602
30611
  children: "Loading past conversations..."
30603
- }) : Ue ? /* @__PURE__ */ _("div", {
30612
+ }) : We ? /* @__PURE__ */ _("div", {
30604
30613
  style: { padding: "20px 16px" },
30605
- children: [Ge.length === 0 ? /* @__PURE__ */ g("div", {
30614
+ children: [Ke.length === 0 ? /* @__PURE__ */ g("div", {
30606
30615
  style: {
30607
30616
  color: "#9ca3af",
30608
30617
  textAlign: "center",
@@ -30610,7 +30619,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30610
30619
  fontSize: "14px"
30611
30620
  },
30612
30621
  children: "No messages"
30613
- }) : null, Ge.map((e, t) => /* @__PURE__ */ g("div", {
30622
+ }) : null, Ke.map((e, t) => /* @__PURE__ */ g("div", {
30614
30623
  style: {
30615
30624
  marginBottom: "16px",
30616
30625
  display: "flex",
@@ -30630,8 +30639,8 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30630
30639
  children: e.content
30631
30640
  })
30632
30641
  }, e._id || t))]
30633
- }) : Be.length > 0 ? /* @__PURE__ */ g("div", { children: Be.map((e) => /* @__PURE__ */ _("div", {
30634
- onClick: () => Ye(e),
30642
+ }) : Ve.length > 0 ? /* @__PURE__ */ g("div", { children: Ve.map((e) => /* @__PURE__ */ _("div", {
30643
+ onClick: () => Xe(e),
30635
30644
  style: {
30636
30645
  padding: "16px 20px",
30637
30646
  borderBottom: "1px solid #f3f4f6",
@@ -30682,7 +30691,7 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30682
30691
  children: "No previous chats found."
30683
30692
  })
30684
30693
  })]
30685
- }) : null, Ne ? /* @__PURE__ */ g(dD, {
30694
+ }) : null, Pe ? /* @__PURE__ */ g(dD, {
30686
30695
  chatHistory: l,
30687
30696
  isAiTyping: u,
30688
30697
  isLoading: T,
@@ -30796,11 +30805,11 @@ function KO({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30796
30805
  setInput: S,
30797
30806
  onSubmit: C,
30798
30807
  isConversationEnded: w,
30799
- callUiActive: Fe,
30808
+ callUiActive: Ie,
30800
30809
  handleToggleVoice: Te,
30801
30810
  showVoiceToggle: f === "agent",
30802
30811
  activeScreen: f,
30803
- inputDisabled: Pe,
30812
+ inputDisabled: Fe,
30804
30813
  replyContext: ue,
30805
30814
  clearReplyContext: () => de(null),
30806
30815
  onFileSelect: re,
@@ -30857,7 +30866,7 @@ function qO() {
30857
30866
  }, je = {
30858
30867
  ...De.features || {},
30859
30868
  ...Oe.features || {}
30860
- }, Me = je.voice !== !1, Ne = Array.isArray(Ae.orbColors) && Ae.orbColors.length > 0 ? Ae.orbColors : null, Pe = Ne?.[0] || Ae.primaryColor || "#3B82F6", Fe = Ae.position || "bottom-right", Ie = ke.fallbackAgentName || "Agent", Le = FO(Ne ?? Ae.chatBgColors), Re = ke.logo || ke.logoUrl || null, ze = E || "en", Be = De.recommendations?.[ze] || [], Ve = (Oe.recommendations?.[ze] ?? Be).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
30869
+ }, Me = je.voice !== !1, Ne = Array.isArray(Ae.orbColors) && Ae.orbColors.length > 0 ? Ae.orbColors : null, Pe = Ae.buttonColor || Ae.primaryColor || Ne?.[0] || "#3B82F6", Fe = Ae.position || "bottom-right", Ie = ke.fallbackAgentName || "Agent", Le = FO(Ne ?? Ae.chatBgColors), Re = ke.logo || ke.logoUrl || null, ze = E || "en", Be = De.recommendations?.[ze] || [], Ve = (Oe.recommendations?.[ze] ?? Be).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
30861
30870
  id: e.key || `qr-${t}`,
30862
30871
  label: e.label,
30863
30872
  message: e.label,
@@ -30880,10 +30889,10 @@ function qO() {
30880
30889
  ]), Xe = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, Ze = r.some((e) => e.sender === "user"), Qe = f(() => {
30881
30890
  let e = r.findIndex((e) => e.sender === "user");
30882
30891
  return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
30883
- }, [r]), $e = !h && Ze && Qe, et = !!(Oe._dashboardLivePreview || De._dashboardLivePreview), [O, k] = m(() => et ? "text_chat" : "entry_prompt"), [A, tt] = m(""), [nt, rt] = m(null), [it, at] = m(h || ""), [ot, st] = m(""), [ct, lt] = m(0), [ut, dt] = m(null), [ft, pt] = m(null), [mt, ht] = m(""), [gt, _t] = m(!1), [vt, yt] = m(!1), bt = p(null), xt = p(!1);
30892
+ }, [r]), $e = !h && Ze && Qe, et = !!(Oe._dashboardLivePreview || De._dashboardLivePreview), [O, k] = m(() => et ? "text_chat" : "entry_prompt"), [A, tt] = m(""), [nt, rt] = m(null), [it, at] = m(h || ""), [ot, st] = m(""), [ct, lt] = m(0), [ut, dt] = m(null), [ft, pt] = m(null), [mt, ht] = m(""), [gt, _t] = m(!1), [vt, yt] = m(!1), [bt, xt] = m(!1), St = p(null), Ct = p(!1);
30884
30893
  d(() => {
30885
- if (!(e !== "ready" || xt.current)) {
30886
- if (xt.current = !0, pe(qe) || !Me) {
30894
+ if (!(e !== "ready" || Ct.current)) {
30895
+ if (Ct.current = !0, pe(qe) || !Me) {
30887
30896
  k("minimized_orb");
30888
30897
  return;
30889
30898
  }
@@ -30893,16 +30902,16 @@ function qO() {
30893
30902
  } catch {}
30894
30903
  }
30895
30904
  }, [e, r]);
30896
- let [St, Ct] = m(() => typeof window < "u" && window.matchMedia("(max-width: 640px)").matches);
30905
+ let [wt, Tt] = m(() => typeof window < "u" && window.matchMedia("(max-width: 640px)").matches);
30897
30906
  c(() => {
30898
- let e = window.matchMedia("(max-width: 640px)"), t = (e) => Ct(e.matches);
30907
+ let e = window.matchMedia("(max-width: 640px)"), t = (e) => Tt(e.matches);
30899
30908
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
30900
30909
  }, []), c(() => {
30901
30910
  at(h || ""), h && st("");
30902
30911
  }, [h]);
30903
- let wt = o(() => {
30912
+ let Et = o(() => {
30904
30913
  pt(null), ht("");
30905
- }, []), Tt = o((e) => {
30914
+ }, []), Dt = o((e) => {
30906
30915
  let t = oD(e);
30907
30916
  if (t) {
30908
30917
  pt(null), ht(t);
@@ -30923,35 +30932,35 @@ function qO() {
30923
30932
  let t = window.setInterval(e, 1e3);
30924
30933
  return () => window.clearInterval(t);
30925
30934
  }, [te, ee]);
30926
- let Et = o(() => {
30935
+ let Ot = o(() => {
30927
30936
  k("call_screen"), yt(!1);
30928
- }, []), Dt = o(() => {
30937
+ }, []), kt = o(() => {
30929
30938
  k("text_chat"), yt(!0);
30930
30939
  }, []);
30931
30940
  c(() => {
30932
30941
  let e = w?.callId || T || null;
30933
30942
  if (!e) {
30934
- bt.current = null;
30943
+ St.current = null;
30935
30944
  return;
30936
30945
  }
30937
30946
  if (w?.callId || ee === "connecting" || ee === "connected") {
30938
30947
  if (O === "minimized_orb" && vt && T && !w?.callId) {
30939
- bt.current = e;
30948
+ St.current = e;
30940
30949
  return;
30941
30950
  }
30942
- !(!i || O === "minimized_orb" || O === "voice_mode") && bt.current === e || (console.log("[FlowEngageWidget] forcing call UI to front", {
30951
+ !(!i || O === "minimized_orb" || O === "voice_mode") && St.current === e || (console.log("[FlowEngageWidget] forcing call UI to front", {
30943
30952
  forcedKey: e,
30944
30953
  isOpen: i,
30945
30954
  surface: O,
30946
30955
  hasIncomingCall: !!w?.callId,
30947
30956
  activeCallId: T,
30948
30957
  callConnectionState: ee
30949
- }), bt.current = e, O === "voice_mode" && ue?.(!1), ce?.(), Et());
30958
+ }), St.current = e, O === "voice_mode" && ue?.(!1), ce?.(), Ot());
30950
30959
  }
30951
30960
  }, [
30952
30961
  T,
30953
30962
  ee,
30954
- Et,
30963
+ Ot,
30955
30964
  w?.callId,
30956
30965
  i,
30957
30966
  ce,
@@ -30989,11 +30998,11 @@ function qO() {
30989
30998
  xe,
30990
30999
  Se
30991
31000
  ]);
30992
- let Ot = (e) => e ? {
31001
+ let At = (e) => e ? {
30993
31002
  replyTo: e.messageId || e.id || null,
30994
31003
  replyToContent: (e.replyToContent || e.message || "").replace(/<[^>]+>/g, "").trim().slice(0, 200),
30995
31004
  replyToSender: e.sender || null
30996
- } : null, kt = async (e) => {
31005
+ } : null, jt = async (e) => {
30997
31006
  if (e.preventDefault(), C) return;
30998
31007
  if ($e) {
30999
31008
  let e = it.trim().toLowerCase();
@@ -31004,13 +31013,13 @@ function qO() {
31004
31013
  await le(e), st("");
31005
31014
  return;
31006
31015
  }
31007
- let t = Ot(nt);
31016
+ let t = At(nt);
31008
31017
  if (!A.trim() && !ft) return;
31009
31018
  if (ft) {
31010
31019
  try {
31011
31020
  _t(!0), ht("");
31012
31021
  let e = await se(ft), n = e?.data || e, r = A.trim() || `Shared file: ${cD(ft)}`;
31013
- tt(""), rt(null), wt(), await oe(r, "", t, {
31022
+ tt(""), rt(null), Et(), await oe(r, "", t, {
31014
31023
  type: "file",
31015
31024
  metadata: {
31016
31025
  fileUrl: n?.fileUrl,
@@ -31028,10 +31037,10 @@ function qO() {
31028
31037
  }
31029
31038
  let n = A.trim();
31030
31039
  tt(""), rt(null), await oe(n, "", t);
31031
- }, At = (e) => {
31040
+ }, Mt = (e) => {
31032
31041
  let t = Math.floor(e / 60);
31033
31042
  return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
31034
- }, jt = o(async (e) => {
31043
+ }, Nt = o(async (e) => {
31035
31044
  if (C || b) return;
31036
31045
  let t = e.message || e.label || e.text || "";
31037
31046
  t.trim() && await oe(t.trim(), "");
@@ -31039,18 +31048,18 @@ function qO() {
31039
31048
  C,
31040
31049
  b,
31041
31050
  oe
31042
- ]), Mt = St && O === "entry_prompt" ? { inset: 0 } : St && O === "text_chat" ? {
31051
+ ]), Pt = wt && O === "entry_prompt" ? { inset: 0 } : wt && O === "text_chat" ? {
31043
31052
  left: 0,
31044
31053
  right: 0,
31045
31054
  bottom: 0
31046
- } : St && O === "call_screen" ? {
31055
+ } : wt && O === "call_screen" ? {
31047
31056
  left: 0,
31048
31057
  right: 0,
31049
31058
  bottom: 0,
31050
31059
  height: "90dvh",
31051
31060
  overflow: "hidden",
31052
31061
  borderRadius: "16px 16px 0 0"
31053
- } : St && O === "connection_modal" ? {
31062
+ } : wt && O === "connection_modal" ? {
31054
31063
  left: "28px",
31055
31064
  right: "12px",
31056
31065
  bottom: "12px"
@@ -31072,19 +31081,23 @@ function qO() {
31072
31081
  } : {
31073
31082
  right: "1.5rem",
31074
31083
  bottom: "1.5rem"
31075
- }, Nt = () => k("minimized_orb"), Pt = () => k("connection_modal"), Ft = () => {
31084
+ }, Ft = o(() => {
31085
+ O !== "minimized_orb" && (xt(!0), setTimeout(() => {
31086
+ k("minimized_orb"), xt(!1);
31087
+ }, 280));
31088
+ }, [O]), It = () => k("connection_modal"), Lt = () => {
31076
31089
  ce({ notifyChatInitiated: !0 }), ue?.(!0), k("voice_mode");
31077
- }, It = () => {
31090
+ }, Rt = () => {
31078
31091
  ce({ notifyChatInitiated: !0 }), ue?.(!1), k("text_chat");
31079
- }, Lt = () => {
31080
- ue?.(!1), Nt();
31092
+ }, zt = () => {
31093
+ ue?.(!1), Ft();
31081
31094
  };
31082
31095
  return e !== "ready" || !Ue || je.chat === !1 ? null : /* @__PURE__ */ _("div", {
31083
31096
  className: "flowengage-widget-root",
31084
31097
  style: {
31085
31098
  position: "fixed",
31086
31099
  zIndex: 999999,
31087
- ...Mt
31100
+ ...Pt
31088
31101
  },
31089
31102
  children: [
31090
31103
  O === "entry_prompt" && /* @__PURE__ */ g(VO, {
@@ -31092,21 +31105,28 @@ function qO() {
31092
31105
  orbColors: Ne,
31093
31106
  primaryColor: Pe,
31094
31107
  onYes: () => {
31095
- me(qe), Ft();
31108
+ me(qe), Lt();
31096
31109
  },
31097
31110
  onLater: () => {
31098
- me(qe), Nt();
31111
+ me(qe), Ft();
31099
31112
  },
31100
- isMobile: St
31113
+ isMobile: wt,
31114
+ isClosing: bt
31101
31115
  }),
31102
31116
  O === "minimized_orb" && /* @__PURE__ */ _(Yp.div, {
31103
31117
  layoutId: "fe-main-orb",
31104
- initial: { scale: 94 / 50 },
31105
- animate: { scale: 1 },
31118
+ initial: {
31119
+ scale: .4,
31120
+ opacity: 0
31121
+ },
31122
+ animate: {
31123
+ scale: 1,
31124
+ opacity: 1
31125
+ },
31106
31126
  transition: {
31107
31127
  type: "spring",
31108
- stiffness: 220,
31109
- damping: 26
31128
+ stiffness: 280,
31129
+ damping: 18
31110
31130
  },
31111
31131
  style: {
31112
31132
  transformOrigin: "bottom right",
@@ -31117,9 +31137,9 @@ function qO() {
31117
31137
  },
31118
31138
  children: [T && vt && /* @__PURE__ */ _("button", {
31119
31139
  type: "button",
31120
- onClick: Et,
31140
+ onClick: Ot,
31121
31141
  style: {
31122
- maxWidth: St ? "220px" : "240px",
31142
+ maxWidth: wt ? "220px" : "240px",
31123
31143
  padding: "10px 14px",
31124
31144
  borderRadius: "18px",
31125
31145
  border: "1px solid rgba(255,255,255,0.7)",
@@ -31160,28 +31180,29 @@ function qO() {
31160
31180
  marginTop: "2px",
31161
31181
  whiteSpace: "nowrap"
31162
31182
  },
31163
- children: ee === "connected" ? `${At(ct)} with ${Ye}` : `Tap to return to ${Ye}`
31183
+ children: ee === "connected" ? `${Mt(ct)} with ${Ye}` : `Tap to return to ${Ye}`
31164
31184
  })]
31165
31185
  })]
31166
31186
  }), /* @__PURE__ */ g(BO, {
31167
31187
  size: 50,
31168
31188
  orbColors: Ne,
31169
- onClick: T && vt ? Et : Me ? Pt : It
31189
+ onClick: T && vt ? Ot : Me ? It : Rt
31170
31190
  })]
31171
31191
  }),
31172
31192
  O === "connection_modal" && /* @__PURE__ */ g(HO, {
31173
31193
  copy: Ge,
31174
31194
  orbColors: Ne,
31175
31195
  primaryColor: Pe,
31176
- onVoice: Ft,
31177
- onText: It,
31178
- onClose: Nt,
31179
- isMobile: St
31196
+ onVoice: Lt,
31197
+ onText: Rt,
31198
+ onClose: Ft,
31199
+ isMobile: wt,
31200
+ isClosing: bt
31180
31201
  }),
31181
31202
  O === "voice_mode" && /* @__PURE__ */ g(UO, {
31182
31203
  orbColors: Ne,
31183
- onEnterChat: It,
31184
- onEndChat: Lt,
31204
+ onEnterChat: Rt,
31205
+ onEndChat: zt,
31185
31206
  agentId: Ke,
31186
31207
  siteId: qe,
31187
31208
  apiBaseUrl: Je,
@@ -31201,21 +31222,22 @@ function qO() {
31201
31222
  rejectCall: ge,
31202
31223
  endWebRTCCall: _e,
31203
31224
  toggleCallMute: ve,
31204
- formatCallDuration: At,
31205
- onMinimize: Dt,
31225
+ formatCallDuration: Mt,
31226
+ onMinimize: kt,
31206
31227
  primaryColor: Pe,
31207
31228
  orbColors: Ne,
31208
31229
  chatHistory: r
31209
31230
  }),
31210
31231
  O === "text_chat" && /* @__PURE__ */ g(KO, {
31232
+ isClosing: bt,
31211
31233
  copy: Ge,
31212
31234
  orbColors: Ne,
31213
31235
  primaryColor: Pe,
31214
31236
  chatBgGradient: Le,
31215
31237
  logo: Re,
31216
31238
  quickChatOptions: D,
31217
- onQuickChatSelect: jt,
31218
- isMobile: St,
31239
+ onQuickChatSelect: Nt,
31240
+ isMobile: wt,
31219
31241
  chatHistory: r,
31220
31242
  isAiTyping: y,
31221
31243
  isAgentTyping: v,
@@ -31225,14 +31247,14 @@ function qO() {
31225
31247
  fallbackAgentName: Ie,
31226
31248
  input: A,
31227
31249
  setInput: tt,
31228
- onSubmit: kt,
31250
+ onSubmit: jt,
31229
31251
  isConversationEnded: C,
31230
31252
  isLoading: b,
31231
31253
  isRateLimited: x,
31232
31254
  rateLimitMessage: S,
31233
31255
  selectedFile: ft,
31234
- onFileSelect: Tt,
31235
- onRemoveSelectedFile: wt,
31256
+ onFileSelect: Dt,
31257
+ onRemoveSelectedFile: Et,
31236
31258
  attachmentError: mt,
31237
31259
  isUploadingAttachment: gt,
31238
31260
  requiresEmail: $e,
@@ -31249,14 +31271,14 @@ function qO() {
31249
31271
  isCallMuted: ne,
31250
31272
  toggleCallMute: ve,
31251
31273
  endWebRTCCall: _e,
31252
- formatCallDuration: At,
31274
+ formatCallDuration: Mt,
31253
31275
  callDurationSeconds: ct,
31254
- onCollapse: Nt,
31255
- onStartVoice: Ft,
31276
+ onCollapse: Ft,
31277
+ onStartVoice: Lt,
31256
31278
  onNewChat: fe,
31257
31279
  onEndConversation: de,
31258
- onMinimize: Dt,
31259
- onExpand: Et,
31280
+ onMinimize: kt,
31281
+ onExpand: Ot,
31260
31282
  isCallMinimized: vt && !!T,
31261
31283
  showPoweredBy: He,
31262
31284
  getVisitorChatHistory: Ce,
@@ -31264,7 +31286,7 @@ function qO() {
31264
31286
  resumeChat: Te,
31265
31287
  isSessionRestoring: Ee
31266
31288
  }),
31267
- /* @__PURE__ */ g("style", { children: "\n /* Force any SVG (or img) inside LogoSlot to fill the container height\n regardless of whether the component forwards its style prop. */\n .fe-logo-slot svg,\n .fe-logo-slot img { height: 100%; width: auto; display: block; }\n\n @keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }\n @keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }\n @keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }\n @keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }\n @keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }\n @keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }\n @keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }\n @keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }\n @keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }\n @keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }\n @keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }\n @keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }\n " })
31289
+ /* @__PURE__ */ g("style", { children: "\n /* Force any SVG (or img) inside LogoSlot to fill the container height\n regardless of whether the component forwards its style prop. */\n .fe-logo-slot svg,\n .fe-logo-slot img { height: 100%; width: auto; display: block; }\n\n @keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }\n @keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }\n @keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }\n @keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }\n @keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }\n @keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }\n @keyframes fe-orb-slide-down { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(24px)} }\n @keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }\n @keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }\n @keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }\n @keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }\n @keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }\n @keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }\n " })
31268
31290
  ]
31269
31291
  });
31270
31292
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "2.0.8",
3
+ "version": "2.0.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",