@flowengage/react-chatbot 7.0.14 → 7.0.16

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.
@@ -2844,30 +2844,30 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
2844
2844
  let i = f(() => e ? {
2845
2845
  ...t || {},
2846
2846
  siteId: e
2847
- } : t || null, [e, t]), [a, s] = m(0), [l, u] = m("booting"), [d, h] = m(null), [_, v] = m(null), [y, b] = m(""), [x, S] = m([]), [C, w] = m(ve().isOpen), [T, te] = m(ve().activeScreen), [ne, re] = m(ve().isHumanHandled), [E, D] = m(ve().agentName), [se, de] = m(ve().agentHeadshot), [fe, pe] = m(() => be(i?.siteId)), [me, Se] = m(!1), [Ce, we] = m(!1), [Ee, De] = m("idle"), [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, Ne] = m(""), [Fe, Ie] = m(!1), [Le, Re] = m(0), [ze, Be] = m(0), [Ve, He] = m(!1), [O, Ue] = m(null), [qe, Je] = m(null), [Ye, Xe] = m("idle"), [Ze, Qe] = m(null), [$e, et] = m(!1), [tt, nt] = m(""), [rt, it] = m(!1), at = p(null), k = p(null), A = p(""), ot = p(!1), st = p(null), ct = p(null), lt = p(null), ut = p(null), dt = p(null), ft = p(null), pt = p(null), mt = p([]), ht = p(null), gt = p(null), j = p(null), _t = p(!1), vt = p(!1), yt = p(""), bt = p(null), xt = p(null), St = p([]), Ct = p(0), wt = p(E), Tt = p([]), Et = p(!1), Dt = p(!1), Ot = p(i), kt = p({
2847
+ } : t || null, [e, t]), [a, s] = m(0), [l, u] = m("booting"), [d, h] = m(null), [_, v] = m(null), [y, b] = m(""), [x, S] = m([]), [C, w] = m(ve().isOpen), [T, te] = m(ve().activeScreen), [ne, re] = m(ve().isHumanHandled), [E, D] = m(ve().agentName), [se, de] = m(ve().agentHeadshot), [fe, pe] = m(() => be(i?.siteId)), [me, Se] = m(!1), [Ce, we] = m(!1), [Ee, De] = m("idle"), [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, Ne] = m(""), [Fe, Ie] = m(!1), [Le, Re] = m(0), [ze, Be] = m(0), [Ve, He] = m(!1), [O, Ue] = m(null), [qe, Je] = m(null), [Ye, Xe] = m("idle"), [Ze, Qe] = m(null), [$e, et] = m(!1), [tt, nt] = m(""), [rt, it] = m(!1), at = p(null), k = p(null), A = p(""), ot = p(!1), st = p(null), ct = p(null), lt = p(null), ut = p(null), dt = p(null), ft = p(null), pt = p(null), mt = p(!1), ht = p([]), gt = p(null), j = p(null), _t = p(null), vt = p(!1), yt = p(!1), bt = p(""), xt = p(null), St = p(null), Ct = p([]), wt = p(0), Tt = p(E), Et = p([]), Dt = p(!1), Ot = p(!1), kt = p(i), At = p({
2848
2848
  notifyRouteChange: () => {},
2849
2849
  cleanup: () => {}
2850
- }), At = o((e = {}) => {
2850
+ }), jt = o((e = {}) => {
2851
2851
  let t = !!e.is_human_handled;
2852
2852
  return re(t), t ? (te("agent"), e.agent_info?.name && D(e.agent_info.name), e.agent_info?.headshot && de(e.agent_info.headshot), t) : (te("ai"), t);
2853
- }, []), jt = f(() => {
2853
+ }, []), Mt = f(() => {
2854
2854
  let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
2855
2855
  return Number.isFinite(t) && t > 0 ? t : ae;
2856
2856
  }, [i, _]);
2857
2857
  c(() => {
2858
2858
  ct.current = O;
2859
2859
  }, [O]), c(() => {
2860
- wt.current = E;
2860
+ Tt.current = E;
2861
2861
  }, [E]), c(() => {
2862
- Dt.current = Fe;
2862
+ Ot.current = Fe;
2863
2863
  }, [Fe]), c(() => {
2864
- Ot.current = i;
2864
+ kt.current = i;
2865
2865
  }, [i]);
2866
- let Mt = () => {
2866
+ let Nt = () => {
2867
2867
  nt("");
2868
- }, Nt = o(() => {
2869
- j.current &&= (window.clearTimeout(j.current), null);
2870
- }, []), Pt = (e) => {
2868
+ }, Pt = o(() => {
2869
+ _t.current &&= (window.clearTimeout(_t.current), null);
2870
+ }, []), Ft = (e) => {
2871
2871
  let t = typeof e == "string" ? e.trim().toLowerCase() : "";
2872
2872
  return pe(t), xe(t, i?.siteId), t;
2873
2873
  };
@@ -2875,12 +2875,12 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
2875
2875
  let e = i?.siteId;
2876
2876
  e && pe(be(e));
2877
2877
  }, [i?.siteId]);
2878
- let Ft = (e = "unspecified") => {
2879
- let t = ht.current || ft.current?.callId, n = Ct.current, r = bt.current;
2880
- if (bt.current = null, Ct.current = 0, r && r.state !== "inactive") {
2878
+ let It = (e = "unspecified") => {
2879
+ let t = gt.current || ft.current?.callId, n = wt.current, r = xt.current;
2880
+ if (xt.current = null, wt.current = 0, r && r.state !== "inactive") {
2881
2881
  r.onstop = () => {
2882
- let e = St.current;
2883
- if (St.current = [], e.length > 0 && t && k.current) {
2882
+ let e = Ct.current;
2883
+ if (Ct.current = [], e.length > 0 && t && k.current) {
2884
2884
  let r = new Blob(e, { type: e[0].type }), i = n > 0 ? Math.round((Date.now() - n) / 1e3) : 0;
2885
2885
  k.current.uploadRecording(t, r, i).then((e) => console.log("[FlowEngageCall] recording upload success", e)).catch((e) => console.warn("[FlowEngageCall] recording upload failed", e));
2886
2886
  }
@@ -2888,42 +2888,42 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
2888
2888
  try {
2889
2889
  r.stop();
2890
2890
  } catch {
2891
- r.onstop = null, St.current = [];
2891
+ r.onstop = null, Ct.current = [];
2892
2892
  }
2893
2893
  } else if (r && r.state === "inactive") {
2894
- let e = St.current;
2895
- if (St.current = [], e.length > 0 && t && k.current) {
2894
+ let e = Ct.current;
2895
+ if (Ct.current = [], e.length > 0 && t && k.current) {
2896
2896
  let r = new Blob(e, { type: e[0].type }), i = n > 0 ? Math.round((Date.now() - n) / 1e3) : 0;
2897
2897
  k.current.uploadRecording(t, r, i).then((e) => console.log("[FlowEngageCall] recording upload success", e)).catch((e) => console.warn("[FlowEngageCall] recording upload failed", e));
2898
2898
  }
2899
- } else St.current = [];
2900
- if (xt.current) {
2899
+ } else Ct.current = [];
2900
+ if (St.current) {
2901
2901
  try {
2902
- xt.current.close();
2902
+ St.current.close();
2903
2903
  } catch {}
2904
- xt.current = null;
2904
+ St.current = null;
2905
2905
  }
2906
- lt.current &&= (lt.current.close(), null), ut.current &&= (ut.current.getTracks().forEach((e) => e.stop()), null), dt.current &&= (dt.current.srcObject = null, dt.current.remove(), null), Nt(), ft.current = null, mt.current = [], ht.current = null, gt.current = null, _t.current = !1, et(!1), Ue(null), Je(null), Xe("idle"), Qe(null);
2907
- }, It = (e = (/* @__PURE__ */ new Date()).toISOString()) => {
2908
- let t = at.current, n = ht.current || ft.current?.callId;
2909
- if (!(!t?.connected || !n || _t.current)) {
2910
- _t.current = !0, t.emit("call:connected", {
2906
+ lt.current &&= (lt.current.close(), null), ut.current &&= (ut.current.getTracks().forEach((e) => e.stop()), null), dt.current &&= (dt.current.srcObject = null, dt.current.remove(), null), Pt(), ft.current = null, ht.current = [], gt.current = null, j.current = null, vt.current = !1, et(!1), Ue(null), Je(null), Xe("idle"), Qe(null);
2907
+ }, Lt = (e = (/* @__PURE__ */ new Date()).toISOString()) => {
2908
+ let t = at.current, n = gt.current || ft.current?.callId;
2909
+ if (!(!t?.connected || !n || vt.current)) {
2910
+ vt.current = !0, t.emit("call:connected", {
2911
2911
  callId: n,
2912
2912
  chatId: A.current,
2913
2913
  connectedAt: e
2914
2914
  });
2915
2915
  try {
2916
2916
  let e = ut.current, t = dt.current?.srcObject;
2917
- if (e && t && !bt.current) {
2918
- St.current = [];
2917
+ if (e && t && !xt.current) {
2918
+ Ct.current = [];
2919
2919
  let n = new (window.AudioContext || window.webkitAudioContext)();
2920
- xt.current = n;
2920
+ St.current = n;
2921
2921
  let r = n.createMediaStreamDestination();
2922
2922
  n.createMediaStreamSource(e).connect(r), n.createMediaStreamSource(t).connect(r);
2923
2923
  let i = window.MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : "audio/mp4", a = new window.MediaRecorder(r.stream, { mimeType: i });
2924
2924
  a.ondataavailable = (e) => {
2925
- e.data && e.data.size > 0 && St.current.push(e.data);
2926
- }, bt.current = a, Ct.current = Date.now(), a.start(1e3), setTimeout(() => {
2925
+ e.data && e.data.size > 0 && Ct.current.push(e.data);
2926
+ }, xt.current = a, wt.current = Date.now(), a.start(1e3), setTimeout(() => {
2927
2927
  try {
2928
2928
  if (!window.speechSynthesis) return;
2929
2929
  let e = new SpeechSynthesisUtterance("This call is being recorded for quality and training purposes.");
@@ -2951,27 +2951,27 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
2951
2951
  }
2952
2952
  } catch {}
2953
2953
  }
2954
- }, Lt = (e = {}) => {
2954
+ }, Rt = (e = {}) => {
2955
2955
  if (!e.callId) return;
2956
- let t = gt.current === e.callId, n = ht.current === e.callId, r = ct.current?.callId === e.callId;
2956
+ let t = j.current === e.callId, n = gt.current === e.callId, r = ct.current?.callId === e.callId;
2957
2957
  if (!(!t && !n && !r)) {
2958
- if (Nt(), Ue(null), t || n) {
2959
- ht.current = e.callId, Je(e.callId), Xe((e) => e === "connected" ? e : "connecting"), w(!0);
2958
+ if (Pt(), Ue(null), t || n) {
2959
+ gt.current = e.callId, Je(e.callId), Xe((e) => e === "connected" ? e : "connecting"), w(!0);
2960
2960
  return;
2961
2961
  }
2962
2962
  Xe("idle");
2963
2963
  }
2964
- }, Rt = (e = {}) => {
2964
+ }, zt = (e = {}) => {
2965
2965
  if (!e.callId) return;
2966
- let t = gt.current === e.callId, n = ht.current === e.callId, r = ct.current?.callId === e.callId;
2966
+ let t = j.current === e.callId, n = gt.current === e.callId, r = ct.current?.callId === e.callId;
2967
2967
  if (!(!t && !n && !r)) {
2968
- if (Nt(), n) {
2969
- Ft();
2968
+ if (Pt(), n) {
2969
+ It();
2970
2970
  return;
2971
2971
  }
2972
- gt.current = null, ft.current = null, mt.current = [], Ue(null), Xe("idle");
2972
+ j.current = null, ft.current = null, ht.current = [], Ue(null), Xe("idle");
2973
2973
  }
2974
- }, zt = async (e = {}) => {
2974
+ }, Bt = async (e = {}) => {
2975
2975
  let t = lt.current, n = at.current, r = e.sdpOffer || e.offer?.sdp;
2976
2976
  if (!t || !n?.connected || !r || !e.callId) {
2977
2977
  console.log("[FlowEngageProvider] deferring remote offer until peer/socket ready", {
@@ -2986,14 +2986,14 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
2986
2986
  if (await t.setRemoteDescription(new RTCSessionDescription({
2987
2987
  type: "offer",
2988
2988
  sdp: r
2989
- })), mt.current.length > 0) {
2989
+ })), ht.current.length > 0) {
2990
2990
  console.log("[FlowEngageProvider] flushing queued agent ICE candidates after remote offer", {
2991
2991
  callId: e.callId,
2992
2992
  chatId: A.current,
2993
- queuedCount: mt.current.length
2993
+ queuedCount: ht.current.length
2994
2994
  });
2995
- for (let e of mt.current) await t.addIceCandidate(new RTCIceCandidate(e));
2996
- mt.current = [];
2995
+ for (let e of ht.current) await t.addIceCandidate(new RTCIceCandidate(e));
2996
+ ht.current = [];
2997
2997
  }
2998
2998
  let i = await t.createAnswer();
2999
2999
  await t.setLocalDescription(i), n.emit("call:answer", {
@@ -3110,7 +3110,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3110
3110
  e.agent?.name,
3111
3111
  e.agentName,
3112
3112
  e.agent_name,
3113
- wt.current
3113
+ Tt.current
3114
3114
  ], d);
3115
3115
  re(!0), te("agent"), D(t), de(e.agent?.headshot || null), w(!0), Re((e) => e + 1), S((e) => zr(e, {
3116
3116
  id: `agent-joined-${Date.now()}`,
@@ -3124,7 +3124,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3124
3124
  e.agent?.name,
3125
3125
  e.agentName,
3126
3126
  e.agent_name,
3127
- wt.current
3127
+ Tt.current
3128
3128
  ], d);
3129
3129
  re(!1), te("ai"), S((e) => zr(e, {
3130
3130
  id: `agent-left-${Date.now()}`,
@@ -3160,9 +3160,9 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3160
3160
  e.agentName,
3161
3161
  e.ownerName,
3162
3162
  e.agent?.name,
3163
- wt.current
3163
+ Tt.current
3164
3164
  ], "Agent");
3165
- Mt(), Nt(), _t.current = !1, Ue({
3165
+ Nt(), Pt(), vt.current = !1, Ue({
3166
3166
  callId: e.callId,
3167
3167
  from: e.from || "owner",
3168
3168
  agentId: e.agentId || null,
@@ -3171,7 +3171,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3171
3171
  }), f.on("call:offer", async (e = {}) => {
3172
3172
  ft.current = e;
3173
3173
  try {
3174
- await zt(e);
3174
+ await Bt(e);
3175
3175
  } catch (e) {
3176
3176
  console.error("[FlowEngageProvider] failed to apply remote offer", e);
3177
3177
  }
@@ -3186,8 +3186,8 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3186
3186
  console.log("[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready", {
3187
3187
  callId: e.callId,
3188
3188
  chatId: e.chatId || A.current,
3189
- queueSize: mt.current.length + 1
3190
- }), mt.current.push(t);
3189
+ queueSize: ht.current.length + 1
3190
+ }), ht.current.push(t);
3191
3191
  return;
3192
3192
  }
3193
3193
  await lt.current.addIceCandidate(new RTCIceCandidate(t));
@@ -3195,34 +3195,34 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3195
3195
  console.error("[FlowEngageProvider] failed to add ICE candidate", e);
3196
3196
  }
3197
3197
  }), f.on("call:ended", () => {
3198
- Mt(), Ft("socket:call_ended");
3198
+ Nt(), It("socket:call_ended");
3199
3199
  }), f.on("call:accepted", (e = {}) => {
3200
- Lt(e);
3200
+ Rt(e);
3201
3201
  }), f.on("call:accepted_by_other", (e = {}) => {
3202
- Lt(e);
3203
- }), f.on("call:rejected", (e = {}) => {
3204
3202
  Rt(e);
3203
+ }), f.on("call:rejected", (e = {}) => {
3204
+ zt(e);
3205
3205
  }), f.on("call:missed", (e = {}) => {
3206
- Rt(e);
3206
+ zt(e);
3207
3207
  }), f.on("call:failed", (e = {}) => {
3208
- Rt(e);
3208
+ zt(e);
3209
3209
  }), f.on("call:connected", (e = {}) => {
3210
3210
  if (!e.callId) return;
3211
- let t = gt.current === e.callId, n = ht.current === e.callId, r = ft.current?.callId === e.callId, i = ct.current?.callId === e.callId;
3211
+ let t = j.current === e.callId, n = gt.current === e.callId, r = ft.current?.callId === e.callId, i = ct.current?.callId === e.callId;
3212
3212
  if (!t && !n && !r) {
3213
3213
  i && (Ue(null), Xe("idle"));
3214
3214
  return;
3215
3215
  }
3216
- _t.current = !0, gt.current = null, ht.current = e.callId, Je(e.callId), Ue(null), Xe("connected"), Qe(e.connectedAt || (/* @__PURE__ */ new Date()).toISOString()), w(!0);
3216
+ vt.current = !0, j.current = null, gt.current = e.callId, Je(e.callId), Ue(null), Xe("connected"), Qe(e.connectedAt || (/* @__PURE__ */ new Date()).toISOString()), w(!0);
3217
3217
  }), f.on("call:unavailable", (e = {}) => {
3218
- Ft("socket:call_unavailable"), nt(Ir(e, "This visitor is not available for a call right now.")), w(!0);
3218
+ It("socket:call_unavailable"), nt(Ir(e, "This visitor is not available for a call right now.")), w(!0);
3219
3219
  }), f.on("call:error", (e = {}) => {
3220
- Ft("socket:call_error"), nt(Ir(e, "We couldn't connect the call right now.")), w(!0);
3220
+ It("socket:call_error"), nt(Ir(e, "We couldn't connect the call right now.")), w(!0);
3221
3221
  }), f.on("visitor:navigate", async ({ url: e, section: n, highlight: r } = {}) => {
3222
3222
  e && await Sr(e, {
3223
3223
  siteId: t.siteId,
3224
3224
  apiBaseUrl: t.apiBaseUrl
3225
- }) && Or(e, { voiceActive: Dt.current }).then((e) => {
3225
+ }) && Or(e, { voiceActive: Ot.current }).then((e) => {
3226
3226
  let t = n || r;
3227
3227
  t && setTimeout(() => {
3228
3228
  let e = _r(null, t);
@@ -3235,7 +3235,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3235
3235
  n && vr(n);
3236
3236
  }), f.on("visitor:clear_highlight", () => {
3237
3237
  yr();
3238
- }), kt.current = Fn({
3238
+ }), At.current = Fn({
3239
3239
  socket: f,
3240
3240
  chatId: c
3241
3241
  });
@@ -3243,7 +3243,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3243
3243
  if (!e) return;
3244
3244
  S(Pr(h.chat_history || [])), re(!!h.is_human_handled), te(h.is_human_handled ? "agent" : T);
3245
3245
  let g = h?.visitor_email || h?.visitorEmail;
3246
- if (g && String(g).trim() && Pt(String(g).trim()), await new Promise((e) => setTimeout(e, 500)), !e) return;
3246
+ if (g && String(g).trim() && Ft(String(g).trim()), await new Promise((e) => setTimeout(e, 500)), !e) return;
3247
3247
  u("ready");
3248
3248
  } catch (t) {
3249
3249
  if (!e) return;
@@ -3252,22 +3252,22 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3252
3252
  e && it(!1);
3253
3253
  }
3254
3254
  })(), () => {
3255
- e = !1, kt.current?.cleanup?.(), Ft(), at.current?.disconnect();
3255
+ e = !1, At.current?.cleanup?.(), It(), at.current?.disconnect();
3256
3256
  };
3257
3257
  }, [
3258
3258
  i,
3259
3259
  r,
3260
3260
  a
3261
3261
  ]), c(() => () => {
3262
- if (Fe && !Et.current && Tt.current.length > 0) {
3263
- let e = A.current, t = Tt.current, n = k.current;
3264
- n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), Et.current = !0);
3262
+ if (Fe && !Dt.current && Et.current.length > 0) {
3263
+ let e = A.current, t = Et.current, n = k.current;
3264
+ n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), Dt.current = !0);
3265
3265
  }
3266
3266
  }, [Fe, _]);
3267
- let Bt = p(null), Vt = p(!1);
3267
+ let Vt = p(null), Ht = p(!1);
3268
3268
  c(() => {
3269
3269
  let e = k.current;
3270
- !e || !y || Bt.current !== C && (C && Bt.current !== null ? (e.updateChatStatus(y, "open").catch(() => {}), Vt.current = !0) : Bt.current === !0 && e.updateChatStatus(y, "widget_closed").catch(() => {}), Bt.current = C);
3270
+ !e || !y || Vt.current !== C && (C && Vt.current !== null ? (e.updateChatStatus(y, "open").catch(() => {}), Ht.current = !0) : Vt.current === !0 && e.updateChatStatus(y, "widget_closed").catch(() => {}), Vt.current = C);
3271
3271
  }, [C, y]), c(() => {
3272
3272
  let e = () => {
3273
3273
  let e = A.current, t = k.current;
@@ -3279,18 +3279,18 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3279
3279
  let e = window.setInterval(async () => {
3280
3280
  try {
3281
3281
  let e = await k.current.checkHumanHandled(y);
3282
- re(!!e.is_human_handled), e.is_human_handled && (te("agent"), e.agent_info?.name && D(Rr([e.agent_info.name], "Agent")), e.agent_info?.headshot && de(e.agent_info.headshot)), At(e);
3282
+ re(!!e.is_human_handled), e.is_human_handled && (te("agent"), e.agent_info?.name && D(Rr([e.agent_info.name], "Agent")), e.agent_info?.headshot && de(e.agent_info.headshot)), jt(e);
3283
3283
  } catch {}
3284
3284
  }, 1e4);
3285
3285
  return () => window.clearInterval(e);
3286
3286
  }, [
3287
3287
  y,
3288
3288
  l,
3289
- At
3289
+ jt
3290
3290
  ]);
3291
- let Ht = async () => {
3291
+ let Ut = async () => {
3292
3292
  if (!(!O?.callId || !k.current || !at.current || !y)) {
3293
- Mt(), gt.current = O.callId, Nt();
3293
+ Nt(), j.current = O.callId, Pt();
3294
3294
  try {
3295
3295
  let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
3296
3296
  ut.current = e;
@@ -3306,26 +3306,26 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3306
3306
  let e = n.connectionState;
3307
3307
  if (e === "connected") {
3308
3308
  let e = (/* @__PURE__ */ new Date()).toISOString();
3309
- Xe("connected"), Qe((t) => t || e), It(e);
3309
+ Xe("connected"), Qe((t) => t || e), Lt(e);
3310
3310
  return;
3311
3311
  }
3312
3312
  if (e === "connecting") {
3313
3313
  Xe((e) => e === "connected" ? e : "connecting");
3314
3314
  return;
3315
3315
  }
3316
- (e === "failed" || e === "closed") && Ft(`peer:connection_${e}`);
3316
+ (e === "failed" || e === "closed") && It(`peer:connection_${e}`);
3317
3317
  }, n.oniceconnectionstatechange = () => {
3318
3318
  let e = n.iceConnectionState;
3319
3319
  if (e === "connected" || e === "completed") {
3320
3320
  let e = (/* @__PURE__ */ new Date()).toISOString();
3321
- Xe("connected"), Qe((t) => t || e), It(e);
3321
+ Xe("connected"), Qe((t) => t || e), Lt(e);
3322
3322
  return;
3323
3323
  }
3324
3324
  if (e === "checking" || e === "new") {
3325
3325
  Xe((e) => e === "connected" ? e : "connecting");
3326
3326
  return;
3327
3327
  }
3328
- (e === "failed" || e === "closed") && Ft(`peer:ice_${e}`);
3328
+ (e === "failed" || e === "closed") && It(`peer:ice_${e}`);
3329
3329
  }, n.onsignalingstatechange = () => {}, n.onicegatheringstatechange = () => {}, e.getTracks().forEach((t) => {
3330
3330
  n.addTrack(t, e);
3331
3331
  }), n.onicecandidate = (e) => {
@@ -3346,10 +3346,10 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3346
3346
  e.id = "flowengage-remote-audio", e.autoplay = !0, e.playsInline = !0, e.onplay = () => {}, e.onpause = () => {}, e.onended = () => {}, e.onerror = (e) => {}, dt.current = e, document.body.appendChild(e);
3347
3347
  }
3348
3348
  dt.current.srcObject = e.streams[0];
3349
- let r = O?.callId, i = r && (gt.current === r || ht.current === r);
3350
- if (!_t.current && i) {
3349
+ let r = O?.callId, i = r && (j.current === r || gt.current === r);
3350
+ if (!vt.current && i) {
3351
3351
  let e = (/* @__PURE__ */ new Date()).toISOString();
3352
- Xe("connected"), Qe((t) => t || e), ht.current = r, Je(r), It(e);
3352
+ Xe("connected"), Qe((t) => t || e), gt.current = r, Je(r), Lt(e);
3353
3353
  }
3354
3354
  dt.current.srcObject = t || null;
3355
3355
  let a = dt.current.play?.();
@@ -3359,15 +3359,15 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3359
3359
  r && (console.log("[FlowEngageProvider] found pending remote offer during accept", {
3360
3360
  callId: r.callId || O.callId,
3361
3361
  chatId: y
3362
- }), await zt({
3362
+ }), await Bt({
3363
3363
  ...r,
3364
3364
  callId: r.callId || O.callId
3365
3365
  })), await k.current.acceptCall(O.callId, y), at.current?.emit("call:accepted", {
3366
3366
  callId: O.callId,
3367
3367
  chatId: y
3368
- }), ht.current = O.callId, Je(O.callId), Xe((e) => e === "connected" || _t.current ? "connected" : "connecting"), Ue(null), w(!0);
3368
+ }), gt.current = O.callId, Je(O.callId), Xe((e) => e === "connected" || vt.current ? "connected" : "connecting"), Ue(null), w(!0);
3369
3369
  } catch (e) {
3370
- if (gt.current = null, Ft("accept_call_failed"), e?.status === 404 || e?.status === 409 || e?.status === 422) {
3370
+ if (j.current = null, It("accept_call_failed"), e?.status === 404 || e?.status === 409 || e?.status === 422) {
3371
3371
  nt(Ir(e, "This visitor call is no longer available."));
3372
3372
  return;
3373
3373
  }
@@ -3383,13 +3383,13 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3383
3383
  nt("We couldn't connect the call right now. Please try again.");
3384
3384
  }
3385
3385
  }
3386
- }, Ut = async () => {
3386
+ }, Wt = async () => {
3387
3387
  if (!O?.callId || !k.current || !y) {
3388
- Ft("reject_call_without_server_context");
3388
+ It("reject_call_without_server_context");
3389
3389
  return;
3390
3390
  }
3391
3391
  let e = O.callId;
3392
- Nt(), Mt(), at.current?.emit("call:rejected", {
3392
+ Pt(), Nt(), at.current?.emit("call:rejected", {
3393
3393
  callId: e,
3394
3394
  chatId: y,
3395
3395
  reason: "visitor_declined"
@@ -3399,48 +3399,48 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3399
3399
  } catch (e) {
3400
3400
  nt(Ir(e, "We couldn't decline the call cleanly."));
3401
3401
  } finally {
3402
- Ft("reject_call_finally");
3402
+ It("reject_call_finally");
3403
3403
  }
3404
- }, Wt = p(Ut);
3405
- Wt.current = Ut, c(() => {
3404
+ }, Gt = p(Wt);
3405
+ Gt.current = Wt, c(() => {
3406
3406
  if (!O?.callId || qe) {
3407
- Nt();
3407
+ Pt();
3408
3408
  return;
3409
3409
  }
3410
3410
  let e = O.callId;
3411
- return Nt(), j.current = window.setTimeout(() => {
3412
- ct.current?.callId === e && gt.current !== e && ht.current !== e && Wt.current();
3411
+ return Pt(), _t.current = window.setTimeout(() => {
3412
+ ct.current?.callId === e && j.current !== e && gt.current !== e && Gt.current();
3413
3413
  }, oe), () => {
3414
- j.current &&= (window.clearTimeout(j.current), null);
3414
+ _t.current &&= (window.clearTimeout(_t.current), null);
3415
3415
  };
3416
3416
  }, [
3417
3417
  qe,
3418
- Nt,
3418
+ Pt,
3419
3419
  O?.callId
3420
3420
  ]);
3421
- let Gt = async () => {
3421
+ let Kt = async () => {
3422
3422
  if (!qe || !k.current || !y) {
3423
- Ft("end_call_without_server_context");
3423
+ It("end_call_without_server_context");
3424
3424
  return;
3425
3425
  }
3426
- Mt();
3426
+ Nt();
3427
3427
  try {
3428
3428
  await k.current.endWebRTCCall(qe, y);
3429
3429
  } catch (e) {
3430
3430
  nt(Ir(e, "The call ended locally, but the server could not be updated."));
3431
3431
  } finally {
3432
- Ft("end_call_finally");
3432
+ It("end_call_finally");
3433
3433
  }
3434
- }, Kt = () => {
3434
+ }, qt = () => {
3435
3435
  let e = ut.current?.getAudioTracks?.() || [], t = lt.current?.getSenders?.().map((e) => e.track).filter((e) => e?.kind === "audio") || [], n = [...e, ...t].filter(Boolean);
3436
3436
  if (n.length === 0) return;
3437
3437
  let r = !$e;
3438
3438
  n.forEach((e) => {
3439
3439
  e.enabled = !r;
3440
3440
  }), et(r);
3441
- }, qt = async (e = {}) => {
3441
+ }, Jt = async (e = {}) => {
3442
3442
  let t = e.notifyChatInitiated === !0;
3443
- if (Vt.current = !0, w(!0), !(!t || !k.current || !y || typeof window > "u")) {
3443
+ if (Ht.current = !0, w(!0), !(!t || !k.current || !y || typeof window > "u")) {
3444
3444
  try {
3445
3445
  await k.current.trackVisitor({
3446
3446
  chatId: y,
@@ -3451,8 +3451,8 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3451
3451
  await k.current.updateChatStatus(y, "open");
3452
3452
  } catch {}
3453
3453
  }
3454
- }, Jt = async (e) => {
3455
- let t = Pt(e);
3454
+ }, Yt = async (e) => {
3455
+ let t = Ft(e);
3456
3456
  if (!t || !k.current || !A.current) return t;
3457
3457
  try {
3458
3458
  await k.current.trackVisitor({
@@ -3464,112 +3464,104 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3464
3464
  console.error("[FlowEngageProvider] failed to persist visitor email", e);
3465
3465
  }
3466
3466
  return t;
3467
- }, Yt = () => {
3468
- !y || !at.current?.connected || vt.current || (vt.current = !0, at.current.emit("typing:start", {
3467
+ }, Xt = () => {
3468
+ !y || !at.current?.connected || yt.current || (yt.current = !0, at.current.emit("typing:start", {
3469
3469
  chatId: y,
3470
3470
  sender: "user"
3471
3471
  }));
3472
- }, Xt = () => {
3473
- !y || !at.current?.connected || !vt.current || (vt.current = !1, at.current.emit("typing:stop", {
3472
+ }, Zt = () => {
3473
+ !y || !at.current?.connected || !yt.current || (yt.current = !1, at.current.emit("typing:stop", {
3474
3474
  chatId: y,
3475
3475
  sender: "user"
3476
3476
  }));
3477
- }, Zt = (e = "") => {
3477
+ }, Qt = (e = "") => {
3478
3478
  let t = typeof e == "string" ? e : "";
3479
- !y || !at.current?.connected || t !== "" && yt.current === t || (yt.current = t, at.current.emit("typing:update", {
3479
+ !y || !at.current?.connected || t !== "" && bt.current === t || (bt.current = t, at.current.emit("typing:update", {
3480
3480
  chatId: y,
3481
3481
  sender: "user",
3482
3482
  text: t
3483
3483
  }));
3484
- }, Qt = async (e, t = "", n = null, a = {}) => {
3485
- let o = typeof e == "string" ? e.trim() : "";
3486
- if (!o || !k.current || !y || l !== "ready" || Ve) return;
3487
- Xt();
3488
- let s = /^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?|navigate(?: me)?|yep|absolutely|please do|do it|let'?s go|go there|show me|go to it|bring me there|navigate me there)\b/i;
3489
- if (pt.current && s.test(o)) {
3484
+ }, $t = async (e, t = "", n = null, i = {}) => {
3485
+ let a = typeof e == "string" ? e.trim() : "";
3486
+ if (!a || !k.current || !y || l !== "ready" || Ve) return;
3487
+ Zt();
3488
+ let o = /^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i;
3489
+ if (pt.current && o.test(a)) {
3490
3490
  let { url: e, section: t } = pt.current;
3491
- pt.current = null, console.log("[FWH Nav] Client-side nav firing →", e), Sr(e, {
3492
- siteId: i?.siteId,
3493
- apiBaseUrl: i?.apiBaseUrl
3494
- }).then((n) => {
3495
- n && Or(e, { voiceActive: Dt.current }).then((e) => {
3496
- t && setTimeout(() => {
3497
- let e = _r(null, t);
3498
- e && vr(e);
3499
- }, e ? 300 : 150);
3500
- });
3491
+ pt.current = null, mt.current = !0, console.log("[FWH Nav] Client-side nav firing →", e), Or(e, { voiceActive: Ot.current }).then((e) => {
3492
+ !t || !Ot.current || setTimeout(() => {
3493
+ let e = _r(null, t);
3494
+ e && vr(e);
3495
+ }, e ? 300 : 150);
3501
3496
  });
3502
- } else s.test(o) || (pt.current = null);
3503
- let c = `pending-user-${Date.now()}`, u = {
3504
- id: c,
3497
+ } else o.test(a) || (pt.current = null);
3498
+ let s = `pending-user-${Date.now()}`, c = {
3499
+ id: s,
3505
3500
  sender: "user",
3506
3501
  message: e,
3507
3502
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3508
3503
  isPending: !0,
3509
- type: a?.type || "text",
3510
- metadata: a?.metadata || void 0,
3504
+ type: i?.type || "text",
3505
+ metadata: i?.metadata || void 0,
3511
3506
  ...n || {}
3512
3507
  };
3513
- S((e) => [...e, u]);
3514
- let d = ne;
3515
- if (d) try {
3516
- d = At(await k.current.checkHumanHandled(y));
3508
+ S((e) => [...e, c]);
3509
+ let u = ne;
3510
+ if (u) try {
3511
+ u = jt(await k.current.checkHumanHandled(y));
3517
3512
  } catch {}
3518
- if (d && at.current?.connected) {
3513
+ if (u && at.current?.connected) {
3519
3514
  at.current.emit("customer:message", {
3520
3515
  chatId: y,
3521
3516
  content: e,
3522
3517
  sender: "user",
3523
3518
  email: fe || void 0,
3524
- type: a?.type || "text",
3525
- metadata: a?.metadata || {},
3519
+ type: i?.type || "text",
3520
+ metadata: i?.metadata || {},
3526
3521
  ...n || {}
3527
3522
  });
3528
3523
  return;
3529
3524
  }
3530
3525
  ke(!0);
3531
3526
  try {
3532
- let o = await k.current.sendAiMessage(y, e, r, t, {
3527
+ let a = await k.current.sendAiMessage(y, e, r, t, {
3533
3528
  ...n || {},
3534
3529
  ...fe ? { email: fe } : {}
3535
3530
  }, {
3536
- ...a,
3531
+ ...i,
3537
3532
  currentPageUrl: typeof window < "u" ? window.location.href : void 0,
3538
3533
  currentPageTitle: typeof window < "u" ? document.title : void 0,
3539
3534
  currentPagePath: typeof window < "u" ? window.location.pathname : void 0
3540
- }), s = o.chat_history || [];
3535
+ }), o = a.chat_history || [];
3541
3536
  if (console.log("[FWH Nav Debug] API response fields:", {
3542
- has_navigate: !!o.navigate,
3543
- navigate: o.navigate,
3544
- has_pending_navigate: !!o.pending_navigate,
3545
- pending_navigate: o.pending_navigate,
3546
- last_bot_msg: [...s].reverse().find((e) => e.sender === "bot")?.message?.substring(0, 80)
3547
- }), o.pending_navigate?.url && (pt.current = {
3548
- url: o.pending_navigate.url,
3549
- section: o.pending_navigate.section || null
3550
- }, console.log("[FWH Nav] Stored pending nav →", pt.current)), o.navigate?.url) {
3551
- let { url: e, section: t } = o.navigate;
3552
- Sr(e, {
3553
- siteId: i?.siteId,
3554
- apiBaseUrl: i?.apiBaseUrl
3555
- }).then((n) => {
3556
- n && Or(e, { voiceActive: Dt.current }).then((e) => {
3557
- t && setTimeout(() => {
3558
- let e = _r(null, t);
3559
- e && vr(e);
3560
- }, e ? 300 : 150);
3561
- });
3537
+ has_navigate: !!a.navigate,
3538
+ navigate: a.navigate,
3539
+ has_pending_navigate: !!a.pending_navigate,
3540
+ pending_navigate: a.pending_navigate,
3541
+ last_bot_msg: [...o].reverse().find((e) => e.sender === "bot")?.message?.substring(0, 80)
3542
+ }), a.pending_navigate?.url && (pt.current = {
3543
+ url: a.pending_navigate.url,
3544
+ section: a.pending_navigate.section || null
3545
+ }, console.log("[FWH Nav] Stored pending nav →", pt.current)), a.navigate?.url) if (mt.current) mt.current = !1;
3546
+ else {
3547
+ let { url: e, section: t } = a.navigate;
3548
+ Or(e, { voiceActive: Ot.current }).then((e) => {
3549
+ !t || !Ot.current || setTimeout(() => {
3550
+ let e = _r(null, t);
3551
+ e && vr(e);
3552
+ }, e ? 300 : 150);
3562
3553
  });
3563
- } else {
3564
- let e = [...s].reverse().find((e) => e.sender === "bot" || e.sender === "assistant");
3554
+ }
3555
+ else {
3556
+ let e = [...o].reverse().find((e) => e.sender === "bot" || e.sender === "assistant");
3565
3557
  if (e?.message) {
3566
3558
  let t = Fr(e.message);
3567
3559
  t && Sr(t.url, {
3568
- siteId: i?.siteId,
3569
- apiBaseUrl: i?.apiBaseUrl
3560
+ siteId: kt.current?.siteId,
3561
+ apiBaseUrl: kt.current?.apiBaseUrl
3570
3562
  }).then((e) => {
3571
- e && Or(t.url, { voiceActive: Dt.current }).then((e) => {
3572
- t.section && setTimeout(() => {
3563
+ e && Or(t.url, { voiceActive: Ot.current }).then((e) => {
3564
+ !t.section || !Ot.current || setTimeout(() => {
3573
3565
  let e = _r(null, t.section);
3574
3566
  e && vr(e);
3575
3567
  }, e ? 300 : 150);
@@ -3577,26 +3569,26 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3577
3569
  });
3578
3570
  }
3579
3571
  }
3580
- S(Pr(s)), re(!!o.is_human_handled), te(o.is_human_handled ? "agent" : "ai"), we(!1), ke(!1), await k.current.updateChatStatus(y, "messageSent");
3572
+ S(Pr(o)), re(!!a.is_human_handled), te(a.is_human_handled ? "agent" : "ai"), we(!1), ke(!1), await k.current.updateChatStatus(y, "messageSent");
3581
3573
  } catch (e) {
3582
- S((e) => e.filter((e) => e.id !== c)), we(!1), ke(!1), e.status === 429 ? (je(!0), Ne(e.message), window.setTimeout(() => {
3574
+ S((e) => e.filter((e) => e.id !== s)), we(!1), ke(!1), e.status === 429 ? (je(!0), Ne(e.message), window.setTimeout(() => {
3583
3575
  je(!1), Ne("");
3584
3576
  }, ie)) : h(e);
3585
3577
  }
3586
- }, $t = async (e) => {
3578
+ }, en = async (e) => {
3587
3579
  if (!k.current || !e) throw Error("Upload is unavailable right now.");
3588
3580
  return k.current.uploadChatFile(e);
3589
- }, en = async (e) => {
3581
+ }, tn = async (e) => {
3590
3582
  if (!(!k.current || !y)) {
3591
3583
  try {
3592
3584
  let t = e ? "voice" : "text";
3593
3585
  await k.current.setChatMode(y, t);
3594
3586
  } catch {}
3595
- Ie(e), e && (Et.current = !1);
3587
+ Ie(e), e && (Dt.current = !1);
3596
3588
  }
3597
- }, tn = async (e) => {
3598
- if (Et.current) return;
3599
- if (Et.current = !0, !k.current || !y || !e?.length) {
3589
+ }, nn = async (e) => {
3590
+ if (Dt.current) return;
3591
+ if (Dt.current = !0, !k.current || !y || !e?.length) {
3600
3592
  Ie(!1);
3601
3593
  return;
3602
3594
  }
@@ -3623,9 +3615,9 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3623
3615
  } finally {
3624
3616
  Ie(!1);
3625
3617
  }
3626
- }, nn = async () => {
3618
+ }, rn = async () => {
3627
3619
  if (!(!k.current || !y)) {
3628
- Fe && !Et.current && Tt.current.length > 0 && await tn(Tt.current);
3620
+ Fe && !Dt.current && Et.current.length > 0 && await nn(Et.current);
3629
3621
  try {
3630
3622
  await k.current.endConversation(y);
3631
3623
  } catch {
@@ -3643,9 +3635,9 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3643
3635
  }
3644
3636
  };
3645
3637
  c(() => {
3646
- if (Ye !== "connected" || !qe || !y || !Ze || !jt) return;
3647
- let e = new Date(Ze).getTime(), t = Number.isFinite(e) ? Date.now() - e : 0, n = Math.max(0, jt * 1e3 - t), r = window.setTimeout(() => {
3648
- nt("The call ended because it reached the time limit."), Gt();
3638
+ if (Ye !== "connected" || !qe || !y || !Ze || !Mt) return;
3639
+ let e = new Date(Ze).getTime(), t = Number.isFinite(e) ? Date.now() - e : 0, n = Math.max(0, Mt * 1e3 - t), r = window.setTimeout(() => {
3640
+ nt("The call ended because it reached the time limit."), Kt();
3649
3641
  }, n);
3650
3642
  return () => window.clearTimeout(r);
3651
3643
  }, [
@@ -3653,29 +3645,29 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3653
3645
  Ze,
3654
3646
  Ye,
3655
3647
  y,
3656
- Gt,
3657
- jt
3648
+ Kt,
3649
+ Mt
3658
3650
  ]), c(() => {
3659
3651
  let e = () => {
3660
3652
  let e = A.current, t = k.current;
3661
3653
  if (!t || !e) return;
3662
- if (Dt.current && Tt.current.length > 0 && Pe(), !Et.current && Tt.current.length > 0 && (t.beaconSyncVoice(e, Tt.current) || t.syncVoice(e, Tt.current).catch(() => {}), Et.current = !0), ht.current) {
3663
- t.beaconEndWebRTCCall(ht.current, e);
3654
+ if (Ot.current && Et.current.length > 0 && Pe(), !Dt.current && Et.current.length > 0 && (t.beaconSyncVoice(e, Et.current) || t.syncVoice(e, Et.current).catch(() => {}), Dt.current = !0), gt.current) {
3655
+ t.beaconEndWebRTCCall(gt.current, e);
3664
3656
  return;
3665
3657
  }
3666
- let n = gt.current || ct.current?.callId;
3658
+ let n = j.current || ct.current?.callId;
3667
3659
  n && t.beaconCustomerUnavailable(n, e);
3668
3660
  };
3669
3661
  return window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), () => {
3670
3662
  window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
3671
3663
  };
3672
3664
  }, []);
3673
- let rn = o(() => {
3665
+ let an = o(() => {
3674
3666
  let e = i?.siteId;
3675
3667
  ge(e), ot.current = !0, st.current = null, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
3676
- }, [i?.siteId]), an = o((e) => {
3668
+ }, [i?.siteId]), on = o((e) => {
3677
3669
  i?.siteId, ot.current = !1, st.current = e, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
3678
- }, [i?.siteId]), on = f(() => ({
3670
+ }, [i?.siteId]), sn = f(() => ({
3679
3671
  status: l,
3680
3672
  error: d,
3681
3673
  runtimeConfig: _,
@@ -3706,36 +3698,36 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3706
3698
  isCallMuted: $e,
3707
3699
  webRTCError: tt,
3708
3700
  language: r,
3709
- historyRef: Tt,
3710
- hasSyncedRef: Et,
3711
- dismissCallError: Mt,
3712
- captureVisitorEmail: Jt,
3713
- startTyping: Yt,
3714
- stopTyping: Xt,
3715
- updateTypingDraft: Zt,
3716
- notifyRouteChange: () => kt.current?.notifyRouteChange?.(),
3717
- openWidget: qt,
3701
+ historyRef: Et,
3702
+ hasSyncedRef: Dt,
3703
+ dismissCallError: Nt,
3704
+ captureVisitorEmail: Yt,
3705
+ startTyping: Xt,
3706
+ stopTyping: Zt,
3707
+ updateTypingDraft: Qt,
3708
+ notifyRouteChange: () => At.current?.notifyRouteChange?.(),
3709
+ openWidget: Jt,
3718
3710
  closeWidget: () => w(!1),
3719
3711
  toggleWidget: () => {
3720
3712
  if (C) {
3721
3713
  w(!1);
3722
3714
  return;
3723
3715
  }
3724
- qt({ notifyChatInitiated: !0 });
3716
+ Jt({ notifyChatInitiated: !0 });
3725
3717
  },
3726
- sendMessage: Qt,
3727
- uploadChatFile: $t,
3728
- setVoiceMode: en,
3729
- onMessageSync: tn,
3730
- endConversation: nn,
3731
- startNewChat: rn,
3732
- resumeChat: an,
3718
+ sendMessage: $t,
3719
+ uploadChatFile: en,
3720
+ setVoiceMode: tn,
3721
+ onMessageSync: nn,
3722
+ endConversation: rn,
3723
+ startNewChat: an,
3724
+ resumeChat: on,
3733
3725
  getVisitorChatHistory: () => k.current?.getVisitorChatHistory?.(),
3734
3726
  getVisitorChatThread: (e) => k.current?.getVisitorChatThread?.(e),
3735
- acceptCall: Ht,
3736
- rejectCall: Ut,
3737
- endWebRTCCall: Gt,
3738
- toggleCallMute: Kt
3727
+ acceptCall: Ut,
3728
+ rejectCall: Wt,
3729
+ endWebRTCCall: Kt,
3730
+ toggleCallMute: qt
3739
3731
  }), [
3740
3732
  l,
3741
3733
  d,
@@ -3767,25 +3759,25 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
3767
3759
  $e,
3768
3760
  tt,
3769
3761
  r,
3770
- Jt,
3771
3762
  Yt,
3772
3763
  Xt,
3773
3764
  Zt,
3774
- Ht,
3765
+ Qt,
3775
3766
  Ut,
3776
- Gt,
3767
+ Wt,
3777
3768
  Kt,
3778
3769
  qt,
3779
- Qt,
3770
+ Jt,
3780
3771
  $t,
3781
3772
  en,
3782
3773
  tn,
3783
3774
  nn,
3784
3775
  rn,
3785
- Mt
3776
+ an,
3777
+ Nt
3786
3778
  ]);
3787
3779
  return /* @__PURE__ */ g(In.Provider, {
3788
- value: on,
3780
+ value: sn,
3789
3781
  children: n
3790
3782
  });
3791
3783
  }