@flowengage/react-chatbot 3.0.0 → 3.0.2
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.
|
@@ -2790,7 +2790,7 @@ function Sr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2790
2790
|
e && pe(be(e));
|
|
2791
2791
|
}, [i?.siteId]);
|
|
2792
2792
|
let Dt = (e = "unspecified") => {
|
|
2793
|
-
|
|
2793
|
+
console.log("[FlowEngageCall] cleanup:start", {
|
|
2794
2794
|
reason: e,
|
|
2795
2795
|
chatId: A.current,
|
|
2796
2796
|
activeCallId: ct.current,
|
|
@@ -2799,21 +2799,37 @@ function Sr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2799
2799
|
hasLocalStream: !!at.current,
|
|
2800
2800
|
hasRemoteAudio: !!ot.current,
|
|
2801
2801
|
queuedIceCount: j.current.length
|
|
2802
|
-
})
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2802
|
+
});
|
|
2803
|
+
let t = ct.current || st.current?.callId, n = _t.current, r = mt.current;
|
|
2804
|
+
if (mt.current = null, _t.current = 0, r && r.state !== "inactive") {
|
|
2805
|
+
r.onstop = () => {
|
|
2806
|
+
let e = gt.current;
|
|
2807
|
+
if (gt.current = [], e.length > 0 && t && k.current) {
|
|
2808
|
+
console.log("[FlowEngageCall] preparing to upload recording blob", {
|
|
2809
|
+
chunks: e.length,
|
|
2810
|
+
callId: t
|
|
2811
|
+
});
|
|
2812
|
+
let r = new Blob(e, { type: e[0].type }), i = n > 0 ? Math.round((Date.now() - n) / 1e3) : 0;
|
|
2813
|
+
k.current.uploadRecording(t, r, i).then((e) => console.log("[FlowEngageCall] recording upload success", e)).catch((e) => console.warn("[FlowEngageCall] recording upload failed", e));
|
|
2814
|
+
}
|
|
2815
|
+
};
|
|
2816
|
+
try {
|
|
2817
|
+
r.stop();
|
|
2818
|
+
} catch (e) {
|
|
2819
|
+
console.warn("[FlowEngageCall] error stopping media recorder", e), r.onstop = null, gt.current = [];
|
|
2820
|
+
}
|
|
2821
|
+
} else if (r && r.state === "inactive") {
|
|
2822
|
+
let e = gt.current;
|
|
2823
|
+
if (gt.current = [], e.length > 0 && t && k.current) {
|
|
2824
|
+
console.log("[FlowEngageCall] preparing to upload recording blob (pre-stopped)", {
|
|
2825
|
+
chunks: e.length,
|
|
2826
|
+
callId: t
|
|
2827
|
+
});
|
|
2828
|
+
let r = new Blob(e, { type: e[0].type }), i = n > 0 ? Math.round((Date.now() - n) / 1e3) : 0;
|
|
2829
|
+
k.current.uploadRecording(t, r, i).then((e) => console.log("[FlowEngageCall] recording upload success", e)).catch((e) => console.warn("[FlowEngageCall] recording upload failed", e));
|
|
2830
|
+
}
|
|
2831
|
+
} else gt.current = [];
|
|
2832
|
+
if (ht.current) {
|
|
2817
2833
|
try {
|
|
2818
2834
|
ht.current.close();
|
|
2819
2835
|
} catch {}
|
|
@@ -2846,6 +2862,7 @@ function Sr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2846
2862
|
try {
|
|
2847
2863
|
let e = at.current, t = ot.current?.srcObject;
|
|
2848
2864
|
if (e && t && !mt.current) {
|
|
2865
|
+
gt.current = [];
|
|
2849
2866
|
let n = new (window.AudioContext || window.webkitAudioContext)();
|
|
2850
2867
|
ht.current = n;
|
|
2851
2868
|
let r = n.createMediaStreamDestination();
|