@flowengage/react-chatbot 7.0.11 → 7.0.12
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(
|
|
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({
|
|
2848
2848
|
notifyRouteChange: () => {},
|
|
2849
2849
|
cleanup: () => {}
|
|
2850
|
-
}),
|
|
2850
|
+
}), At = 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
|
-
}, []),
|
|
2853
|
+
}, []), jt = 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
|
-
|
|
2860
|
+
wt.current = E;
|
|
2861
2861
|
}, [E]), c(() => {
|
|
2862
|
-
|
|
2862
|
+
Dt.current = Fe;
|
|
2863
2863
|
}, [Fe]), c(() => {
|
|
2864
|
-
|
|
2864
|
+
Ot.current = i;
|
|
2865
2865
|
}, [i]);
|
|
2866
|
-
let
|
|
2866
|
+
let Mt = () => {
|
|
2867
2867
|
nt("");
|
|
2868
|
-
},
|
|
2869
|
-
|
|
2870
|
-
}, []),
|
|
2868
|
+
}, Nt = o(() => {
|
|
2869
|
+
j.current &&= (window.clearTimeout(j.current), null);
|
|
2870
|
+
}, []), Pt = (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
|
|
2879
|
-
let t =
|
|
2880
|
-
if (
|
|
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") {
|
|
2881
2881
|
r.onstop = () => {
|
|
2882
|
-
let e =
|
|
2883
|
-
if (
|
|
2882
|
+
let e = St.current;
|
|
2883
|
+
if (St.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,
|
|
2891
|
+
r.onstop = null, St.current = [];
|
|
2892
2892
|
}
|
|
2893
2893
|
} else if (r && r.state === "inactive") {
|
|
2894
|
-
let e =
|
|
2895
|
-
if (
|
|
2894
|
+
let e = St.current;
|
|
2895
|
+
if (St.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
|
|
2900
|
-
if (
|
|
2899
|
+
} else St.current = [];
|
|
2900
|
+
if (xt.current) {
|
|
2901
2901
|
try {
|
|
2902
|
-
|
|
2902
|
+
xt.current.close();
|
|
2903
2903
|
} catch {}
|
|
2904
|
-
|
|
2904
|
+
xt.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),
|
|
2907
|
-
},
|
|
2908
|
-
let t = at.current, n =
|
|
2909
|
-
if (!(!t?.connected || !n ||
|
|
2910
|
-
|
|
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", {
|
|
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 && !
|
|
2918
|
-
|
|
2917
|
+
if (e && t && !bt.current) {
|
|
2918
|
+
St.current = [];
|
|
2919
2919
|
let n = new (window.AudioContext || window.webkitAudioContext)();
|
|
2920
|
-
|
|
2920
|
+
xt.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 &&
|
|
2926
|
-
},
|
|
2925
|
+
e.data && e.data.size > 0 && St.current.push(e.data);
|
|
2926
|
+
}, bt.current = a, Ct.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
|
-
},
|
|
2954
|
+
}, Lt = (e = {}) => {
|
|
2955
2955
|
if (!e.callId) return;
|
|
2956
|
-
let t =
|
|
2956
|
+
let t = gt.current === e.callId, n = ht.current === e.callId, r = ct.current?.callId === e.callId;
|
|
2957
2957
|
if (!(!t && !n && !r)) {
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2958
|
+
if (Nt(), Ue(null), t || n) {
|
|
2959
|
+
ht.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
|
-
},
|
|
2964
|
+
}, Rt = (e = {}) => {
|
|
2965
2965
|
if (!e.callId) return;
|
|
2966
|
-
let t =
|
|
2966
|
+
let t = gt.current === e.callId, n = ht.current === e.callId, r = ct.current?.callId === e.callId;
|
|
2967
2967
|
if (!(!t && !n && !r)) {
|
|
2968
|
-
if (
|
|
2969
|
-
|
|
2968
|
+
if (Nt(), n) {
|
|
2969
|
+
Ft();
|
|
2970
2970
|
return;
|
|
2971
2971
|
}
|
|
2972
|
-
|
|
2972
|
+
gt.current = null, ft.current = null, mt.current = [], Ue(null), Xe("idle");
|
|
2973
2973
|
}
|
|
2974
|
-
},
|
|
2974
|
+
}, zt = 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
|
-
})),
|
|
2989
|
+
})), mt.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:
|
|
2993
|
+
queuedCount: mt.current.length
|
|
2994
2994
|
});
|
|
2995
|
-
for (let e of
|
|
2996
|
-
|
|
2995
|
+
for (let e of mt.current) await t.addIceCandidate(new RTCIceCandidate(e));
|
|
2996
|
+
mt.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
|
-
|
|
3113
|
+
wt.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
|
-
|
|
3127
|
+
wt.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
|
-
|
|
3163
|
+
wt.current
|
|
3164
3164
|
], "Agent");
|
|
3165
|
-
|
|
3165
|
+
Mt(), Nt(), _t.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
|
|
3174
|
+
await zt(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:
|
|
3190
|
-
}),
|
|
3189
|
+
queueSize: mt.current.length + 1
|
|
3190
|
+
}), mt.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
|
-
|
|
3198
|
+
Mt(), Ft("socket:call_ended");
|
|
3199
3199
|
}), f.on("call:accepted", (e = {}) => {
|
|
3200
|
-
|
|
3200
|
+
Lt(e);
|
|
3201
3201
|
}), f.on("call:accepted_by_other", (e = {}) => {
|
|
3202
|
-
It(e);
|
|
3203
|
-
}), f.on("call:rejected", (e = {}) => {
|
|
3204
3202
|
Lt(e);
|
|
3203
|
+
}), f.on("call:rejected", (e = {}) => {
|
|
3204
|
+
Rt(e);
|
|
3205
3205
|
}), f.on("call:missed", (e = {}) => {
|
|
3206
|
-
|
|
3206
|
+
Rt(e);
|
|
3207
3207
|
}), f.on("call:failed", (e = {}) => {
|
|
3208
|
-
|
|
3208
|
+
Rt(e);
|
|
3209
3209
|
}), f.on("call:connected", (e = {}) => {
|
|
3210
3210
|
if (!e.callId) return;
|
|
3211
|
-
let t =
|
|
3211
|
+
let t = gt.current === e.callId, n = ht.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
|
-
|
|
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);
|
|
3217
3217
|
}), f.on("call:unavailable", (e = {}) => {
|
|
3218
|
-
|
|
3218
|
+
Ft("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
|
-
|
|
3220
|
+
Ft("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:
|
|
3225
|
+
}) && Or(e, { voiceActive: Dt.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
|
-
}),
|
|
3238
|
+
}), kt.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() &&
|
|
3246
|
+
if (g && String(g).trim() && Pt(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,
|
|
3255
|
+
e = !1, kt.current?.cleanup?.(), Ft(), at.current?.disconnect();
|
|
3256
3256
|
};
|
|
3257
3257
|
}, [
|
|
3258
3258
|
i,
|
|
3259
3259
|
r,
|
|
3260
3260
|
a
|
|
3261
3261
|
]), c(() => () => {
|
|
3262
|
-
if (Fe && !
|
|
3263
|
-
let e = A.current, t =
|
|
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(() => {}),
|
|
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);
|
|
3265
3265
|
}
|
|
3266
3266
|
}, [Fe, _]);
|
|
3267
|
-
let
|
|
3267
|
+
let Bt = p(null), Vt = p(!1);
|
|
3268
3268
|
c(() => {
|
|
3269
3269
|
let e = k.current;
|
|
3270
|
-
!e || !y ||
|
|
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);
|
|
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)),
|
|
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);
|
|
3283
3283
|
} catch {}
|
|
3284
3284
|
}, 1e4);
|
|
3285
3285
|
return () => window.clearInterval(e);
|
|
3286
3286
|
}, [
|
|
3287
3287
|
y,
|
|
3288
3288
|
l,
|
|
3289
|
-
|
|
3289
|
+
At
|
|
3290
3290
|
]);
|
|
3291
|
-
let
|
|
3291
|
+
let Ht = async () => {
|
|
3292
3292
|
if (!(!O?.callId || !k.current || !at.current || !y)) {
|
|
3293
|
-
|
|
3293
|
+
Mt(), gt.current = O.callId, Nt();
|
|
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),
|
|
3309
|
+
Xe("connected"), Qe((t) => t || e), It(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") &&
|
|
3316
|
+
(e === "failed" || e === "closed") && Ft(`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),
|
|
3321
|
+
Xe("connected"), Qe((t) => t || e), It(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") &&
|
|
3328
|
+
(e === "failed" || e === "closed") && Ft(`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 && (
|
|
3350
|
-
if (!
|
|
3349
|
+
let r = O?.callId, i = r && (gt.current === r || ht.current === r);
|
|
3350
|
+
if (!_t.current && i) {
|
|
3351
3351
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
3352
|
-
Xe("connected"), Qe((t) => t || e),
|
|
3352
|
+
Xe("connected"), Qe((t) => t || e), ht.current = r, Je(r), It(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
|
|
3362
|
+
}), await zt({
|
|
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
|
-
}),
|
|
3368
|
+
}), ht.current = O.callId, Je(O.callId), Xe((e) => e === "connected" || _t.current ? "connected" : "connecting"), Ue(null), w(!0);
|
|
3369
3369
|
} catch (e) {
|
|
3370
|
-
if (
|
|
3370
|
+
if (gt.current = null, Ft("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
|
-
},
|
|
3386
|
+
}, Ut = async () => {
|
|
3387
3387
|
if (!O?.callId || !k.current || !y) {
|
|
3388
|
-
|
|
3388
|
+
Ft("reject_call_without_server_context");
|
|
3389
3389
|
return;
|
|
3390
3390
|
}
|
|
3391
3391
|
let e = O.callId;
|
|
3392
|
-
|
|
3392
|
+
Nt(), Mt(), 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
|
-
|
|
3402
|
+
Ft("reject_call_finally");
|
|
3403
3403
|
}
|
|
3404
|
-
},
|
|
3405
|
-
|
|
3404
|
+
}, Wt = p(Ut);
|
|
3405
|
+
Wt.current = Ut, c(() => {
|
|
3406
3406
|
if (!O?.callId || qe) {
|
|
3407
|
-
|
|
3407
|
+
Nt();
|
|
3408
3408
|
return;
|
|
3409
3409
|
}
|
|
3410
3410
|
let e = O.callId;
|
|
3411
|
-
return
|
|
3412
|
-
ct.current?.callId === e &&
|
|
3411
|
+
return Nt(), j.current = window.setTimeout(() => {
|
|
3412
|
+
ct.current?.callId === e && gt.current !== e && ht.current !== e && Wt.current();
|
|
3413
3413
|
}, oe), () => {
|
|
3414
|
-
|
|
3414
|
+
j.current &&= (window.clearTimeout(j.current), null);
|
|
3415
3415
|
};
|
|
3416
3416
|
}, [
|
|
3417
3417
|
qe,
|
|
3418
|
-
|
|
3418
|
+
Nt,
|
|
3419
3419
|
O?.callId
|
|
3420
3420
|
]);
|
|
3421
|
-
let
|
|
3421
|
+
let Gt = async () => {
|
|
3422
3422
|
if (!qe || !k.current || !y) {
|
|
3423
|
-
|
|
3423
|
+
Ft("end_call_without_server_context");
|
|
3424
3424
|
return;
|
|
3425
3425
|
}
|
|
3426
|
-
|
|
3426
|
+
Mt();
|
|
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
|
-
|
|
3432
|
+
Ft("end_call_finally");
|
|
3433
3433
|
}
|
|
3434
|
-
},
|
|
3434
|
+
}, Kt = () => {
|
|
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
|
-
},
|
|
3441
|
+
}, qt = async (e = {}) => {
|
|
3442
3442
|
let t = e.notifyChatInitiated === !0;
|
|
3443
|
-
if (
|
|
3443
|
+
if (Vt.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
|
-
},
|
|
3455
|
-
let t =
|
|
3454
|
+
}, Jt = async (e) => {
|
|
3455
|
+
let t = Pt(e);
|
|
3456
3456
|
if (!t || !k.current || !A.current) return t;
|
|
3457
3457
|
try {
|
|
3458
3458
|
await k.current.trackVisitor({
|
|
@@ -3464,28 +3464,44 @@ 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
|
-
},
|
|
3468
|
-
!y || !at.current?.connected ||
|
|
3467
|
+
}, Yt = () => {
|
|
3468
|
+
!y || !at.current?.connected || vt.current || (vt.current = !0, at.current.emit("typing:start", {
|
|
3469
3469
|
chatId: y,
|
|
3470
3470
|
sender: "user"
|
|
3471
3471
|
}));
|
|
3472
|
-
},
|
|
3473
|
-
!y || !at.current?.connected || !
|
|
3472
|
+
}, Xt = () => {
|
|
3473
|
+
!y || !at.current?.connected || !vt.current || (vt.current = !1, at.current.emit("typing:stop", {
|
|
3474
3474
|
chatId: y,
|
|
3475
3475
|
sender: "user"
|
|
3476
3476
|
}));
|
|
3477
|
-
},
|
|
3477
|
+
}, Zt = (e = "") => {
|
|
3478
3478
|
let t = typeof e == "string" ? e : "";
|
|
3479
|
-
!y || !at.current?.connected || t !== "" &&
|
|
3479
|
+
!y || !at.current?.connected || t !== "" && yt.current === t || (yt.current = t, at.current.emit("typing:update", {
|
|
3480
3480
|
chatId: y,
|
|
3481
3481
|
sender: "user",
|
|
3482
3482
|
text: t
|
|
3483
3483
|
}));
|
|
3484
|
-
},
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
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)) {
|
|
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
|
+
});
|
|
3501
|
+
});
|
|
3502
|
+
} else s.test(o) || (pt.current = null);
|
|
3503
|
+
let c = `pending-user-${Date.now()}`, u = {
|
|
3504
|
+
id: c,
|
|
3489
3505
|
sender: "user",
|
|
3490
3506
|
message: e,
|
|
3491
3507
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3494,12 +3510,12 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3494
3510
|
metadata: a?.metadata || void 0,
|
|
3495
3511
|
...n || {}
|
|
3496
3512
|
};
|
|
3497
|
-
S((e) => [...e,
|
|
3498
|
-
let
|
|
3499
|
-
if (
|
|
3500
|
-
|
|
3513
|
+
S((e) => [...e, u]);
|
|
3514
|
+
let d = ne;
|
|
3515
|
+
if (d) try {
|
|
3516
|
+
d = At(await k.current.checkHumanHandled(y));
|
|
3501
3517
|
} catch {}
|
|
3502
|
-
if (
|
|
3518
|
+
if (d && at.current?.connected) {
|
|
3503
3519
|
at.current.emit("customer:message", {
|
|
3504
3520
|
chatId: y,
|
|
3505
3521
|
content: e,
|
|
@@ -3522,13 +3538,22 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3522
3538
|
currentPageTitle: typeof window < "u" ? document.title : void 0,
|
|
3523
3539
|
currentPagePath: typeof window < "u" ? window.location.pathname : void 0
|
|
3524
3540
|
}), s = o.chat_history || [];
|
|
3525
|
-
if (
|
|
3541
|
+
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) {
|
|
3526
3551
|
let { url: e, section: t } = o.navigate;
|
|
3527
3552
|
Sr(e, {
|
|
3528
3553
|
siteId: i?.siteId,
|
|
3529
3554
|
apiBaseUrl: i?.apiBaseUrl
|
|
3530
3555
|
}).then((n) => {
|
|
3531
|
-
n && Or(e, { voiceActive:
|
|
3556
|
+
n && Or(e, { voiceActive: Dt.current }).then((e) => {
|
|
3532
3557
|
t && setTimeout(() => {
|
|
3533
3558
|
let e = _r(null, t);
|
|
3534
3559
|
e && vr(e);
|
|
@@ -3543,7 +3568,7 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3543
3568
|
siteId: i?.siteId,
|
|
3544
3569
|
apiBaseUrl: i?.apiBaseUrl
|
|
3545
3570
|
}).then((e) => {
|
|
3546
|
-
e && Or(t.url, { voiceActive:
|
|
3571
|
+
e && Or(t.url, { voiceActive: Dt.current }).then((e) => {
|
|
3547
3572
|
t.section && setTimeout(() => {
|
|
3548
3573
|
let e = _r(null, t.section);
|
|
3549
3574
|
e && vr(e);
|
|
@@ -3554,24 +3579,24 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3554
3579
|
}
|
|
3555
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");
|
|
3556
3581
|
} catch (e) {
|
|
3557
|
-
S((e) => e.filter((e) => e.id !==
|
|
3582
|
+
S((e) => e.filter((e) => e.id !== c)), we(!1), ke(!1), e.status === 429 ? (je(!0), Ne(e.message), window.setTimeout(() => {
|
|
3558
3583
|
je(!1), Ne("");
|
|
3559
3584
|
}, ie)) : h(e);
|
|
3560
3585
|
}
|
|
3561
|
-
},
|
|
3586
|
+
}, $t = async (e) => {
|
|
3562
3587
|
if (!k.current || !e) throw Error("Upload is unavailable right now.");
|
|
3563
3588
|
return k.current.uploadChatFile(e);
|
|
3564
|
-
},
|
|
3589
|
+
}, en = async (e) => {
|
|
3565
3590
|
if (!(!k.current || !y)) {
|
|
3566
3591
|
try {
|
|
3567
3592
|
let t = e ? "voice" : "text";
|
|
3568
3593
|
await k.current.setChatMode(y, t);
|
|
3569
3594
|
} catch {}
|
|
3570
|
-
Ie(e), e && (
|
|
3595
|
+
Ie(e), e && (Et.current = !1);
|
|
3571
3596
|
}
|
|
3572
|
-
},
|
|
3573
|
-
if (
|
|
3574
|
-
if (
|
|
3597
|
+
}, tn = async (e) => {
|
|
3598
|
+
if (Et.current) return;
|
|
3599
|
+
if (Et.current = !0, !k.current || !y || !e?.length) {
|
|
3575
3600
|
Ie(!1);
|
|
3576
3601
|
return;
|
|
3577
3602
|
}
|
|
@@ -3598,9 +3623,9 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3598
3623
|
} finally {
|
|
3599
3624
|
Ie(!1);
|
|
3600
3625
|
}
|
|
3601
|
-
},
|
|
3626
|
+
}, nn = async () => {
|
|
3602
3627
|
if (!(!k.current || !y)) {
|
|
3603
|
-
Fe && !
|
|
3628
|
+
Fe && !Et.current && Tt.current.length > 0 && await tn(Tt.current);
|
|
3604
3629
|
try {
|
|
3605
3630
|
await k.current.endConversation(y);
|
|
3606
3631
|
} catch {
|
|
@@ -3618,9 +3643,9 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3618
3643
|
}
|
|
3619
3644
|
};
|
|
3620
3645
|
c(() => {
|
|
3621
|
-
if (Ye !== "connected" || !qe || !y || !Ze || !
|
|
3622
|
-
let e = new Date(Ze).getTime(), t = Number.isFinite(e) ? Date.now() - e : 0, n = Math.max(0,
|
|
3623
|
-
nt("The call ended because it reached the time limit."),
|
|
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();
|
|
3624
3649
|
}, n);
|
|
3625
3650
|
return () => window.clearTimeout(r);
|
|
3626
3651
|
}, [
|
|
@@ -3628,29 +3653,29 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3628
3653
|
Ze,
|
|
3629
3654
|
Ye,
|
|
3630
3655
|
y,
|
|
3631
|
-
|
|
3632
|
-
|
|
3656
|
+
Gt,
|
|
3657
|
+
jt
|
|
3633
3658
|
]), c(() => {
|
|
3634
3659
|
let e = () => {
|
|
3635
3660
|
let e = A.current, t = k.current;
|
|
3636
3661
|
if (!t || !e) return;
|
|
3637
|
-
if (
|
|
3638
|
-
t.beaconEndWebRTCCall(
|
|
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);
|
|
3639
3664
|
return;
|
|
3640
3665
|
}
|
|
3641
|
-
let n =
|
|
3666
|
+
let n = gt.current || ct.current?.callId;
|
|
3642
3667
|
n && t.beaconCustomerUnavailable(n, e);
|
|
3643
3668
|
};
|
|
3644
3669
|
return window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), () => {
|
|
3645
3670
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
3646
3671
|
};
|
|
3647
3672
|
}, []);
|
|
3648
|
-
let
|
|
3673
|
+
let rn = o(() => {
|
|
3649
3674
|
let e = i?.siteId;
|
|
3650
3675
|
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);
|
|
3651
|
-
}, [i?.siteId]),
|
|
3676
|
+
}, [i?.siteId]), an = o((e) => {
|
|
3652
3677
|
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);
|
|
3653
|
-
}, [i?.siteId]),
|
|
3678
|
+
}, [i?.siteId]), on = f(() => ({
|
|
3654
3679
|
status: l,
|
|
3655
3680
|
error: d,
|
|
3656
3681
|
runtimeConfig: _,
|
|
@@ -3681,36 +3706,36 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3681
3706
|
isCallMuted: $e,
|
|
3682
3707
|
webRTCError: tt,
|
|
3683
3708
|
language: r,
|
|
3684
|
-
historyRef:
|
|
3685
|
-
hasSyncedRef:
|
|
3686
|
-
dismissCallError:
|
|
3687
|
-
captureVisitorEmail:
|
|
3688
|
-
startTyping:
|
|
3689
|
-
stopTyping:
|
|
3690
|
-
updateTypingDraft:
|
|
3691
|
-
notifyRouteChange: () =>
|
|
3692
|
-
openWidget:
|
|
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,
|
|
3693
3718
|
closeWidget: () => w(!1),
|
|
3694
3719
|
toggleWidget: () => {
|
|
3695
3720
|
if (C) {
|
|
3696
3721
|
w(!1);
|
|
3697
3722
|
return;
|
|
3698
3723
|
}
|
|
3699
|
-
|
|
3724
|
+
qt({ notifyChatInitiated: !0 });
|
|
3700
3725
|
},
|
|
3701
|
-
sendMessage:
|
|
3702
|
-
uploadChatFile:
|
|
3703
|
-
setVoiceMode:
|
|
3704
|
-
onMessageSync:
|
|
3705
|
-
endConversation:
|
|
3706
|
-
startNewChat:
|
|
3707
|
-
resumeChat:
|
|
3726
|
+
sendMessage: Qt,
|
|
3727
|
+
uploadChatFile: $t,
|
|
3728
|
+
setVoiceMode: en,
|
|
3729
|
+
onMessageSync: tn,
|
|
3730
|
+
endConversation: nn,
|
|
3731
|
+
startNewChat: rn,
|
|
3732
|
+
resumeChat: an,
|
|
3708
3733
|
getVisitorChatHistory: () => k.current?.getVisitorChatHistory?.(),
|
|
3709
3734
|
getVisitorChatThread: (e) => k.current?.getVisitorChatThread?.(e),
|
|
3710
|
-
acceptCall:
|
|
3711
|
-
rejectCall:
|
|
3712
|
-
endWebRTCCall:
|
|
3713
|
-
toggleCallMute:
|
|
3735
|
+
acceptCall: Ht,
|
|
3736
|
+
rejectCall: Ut,
|
|
3737
|
+
endWebRTCCall: Gt,
|
|
3738
|
+
toggleCallMute: Kt
|
|
3714
3739
|
}), [
|
|
3715
3740
|
l,
|
|
3716
3741
|
d,
|
|
@@ -3742,25 +3767,25 @@ function Br({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3742
3767
|
$e,
|
|
3743
3768
|
tt,
|
|
3744
3769
|
r,
|
|
3745
|
-
qt,
|
|
3746
3770
|
Jt,
|
|
3747
3771
|
Yt,
|
|
3748
3772
|
Xt,
|
|
3749
|
-
|
|
3773
|
+
Zt,
|
|
3750
3774
|
Ht,
|
|
3751
|
-
|
|
3775
|
+
Ut,
|
|
3752
3776
|
Gt,
|
|
3753
3777
|
Kt,
|
|
3754
|
-
|
|
3778
|
+
qt,
|
|
3755
3779
|
Qt,
|
|
3756
3780
|
$t,
|
|
3757
3781
|
en,
|
|
3758
3782
|
tn,
|
|
3759
3783
|
nn,
|
|
3760
|
-
|
|
3784
|
+
rn,
|
|
3785
|
+
Mt
|
|
3761
3786
|
]);
|
|
3762
3787
|
return /* @__PURE__ */ g(In.Provider, {
|
|
3763
|
-
value:
|
|
3788
|
+
value: on,
|
|
3764
3789
|
children: n
|
|
3765
3790
|
});
|
|
3766
3791
|
}
|