@flowengage/react-chatbot 6.0.33 → 6.0.34
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.
|
@@ -506,43 +506,43 @@ var k = (e) => {
|
|
|
506
506
|
let l = new ArrayBuffer(t), u = new Uint8Array(l);
|
|
507
507
|
for (r = 0; r < n; r += 4) a = at[e.charCodeAt(r)], o = at[e.charCodeAt(r + 1)], s = at[e.charCodeAt(r + 2)], c = at[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
|
|
508
508
|
return l;
|
|
509
|
-
},
|
|
509
|
+
}, ot = typeof ArrayBuffer == "function", st = (e, t) => {
|
|
510
510
|
if (typeof e != "string") return {
|
|
511
511
|
type: "message",
|
|
512
|
-
data:
|
|
512
|
+
data: lt(e, t)
|
|
513
513
|
};
|
|
514
514
|
let n = e.charAt(0);
|
|
515
515
|
return n === "b" ? {
|
|
516
516
|
type: "message",
|
|
517
|
-
data:
|
|
517
|
+
data: ct(e.substring(1), t)
|
|
518
518
|
} : Je[n] ? e.length > 1 ? {
|
|
519
519
|
type: Je[n],
|
|
520
520
|
data: e.substring(1)
|
|
521
521
|
} : { type: Je[n] } : Ye;
|
|
522
|
-
},
|
|
522
|
+
}, ct = (e, t) => ot ? lt(k(e), t) : {
|
|
523
523
|
base64: !0,
|
|
524
524
|
data: e
|
|
525
|
-
},
|
|
525
|
+
}, lt = (e, t) => {
|
|
526
526
|
switch (t) {
|
|
527
527
|
case "blob": return e instanceof Blob ? e : new Blob([e]);
|
|
528
528
|
default: return e instanceof ArrayBuffer ? e : e.buffer;
|
|
529
529
|
}
|
|
530
|
-
},
|
|
530
|
+
}, ut = "", dt = (e, t) => {
|
|
531
531
|
let n = e.length, r = Array(n), i = 0;
|
|
532
532
|
e.forEach((e, a) => {
|
|
533
533
|
$e(e, !1, (e) => {
|
|
534
|
-
r[a] = e, ++i === n && t(r.join(
|
|
534
|
+
r[a] = e, ++i === n && t(r.join(ut));
|
|
535
535
|
});
|
|
536
536
|
});
|
|
537
|
-
},
|
|
538
|
-
let n = e.split(
|
|
537
|
+
}, ft = (e, t) => {
|
|
538
|
+
let n = e.split(ut), r = [];
|
|
539
539
|
for (let e = 0; e < n.length; e++) {
|
|
540
|
-
let i =
|
|
540
|
+
let i = st(n[e], t);
|
|
541
541
|
if (r.push(i), i.type === "error") break;
|
|
542
542
|
}
|
|
543
543
|
return r;
|
|
544
544
|
};
|
|
545
|
-
function
|
|
545
|
+
function pt() {
|
|
546
546
|
return new TransformStream({ transform(e, t) {
|
|
547
547
|
rt(e, (n) => {
|
|
548
548
|
let r = n.length, i;
|
|
@@ -560,41 +560,41 @@ function ft() {
|
|
|
560
560
|
});
|
|
561
561
|
} });
|
|
562
562
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
563
|
+
var mt;
|
|
564
|
+
function ht(e) {
|
|
565
565
|
return e.reduce((e, t) => e + t.length, 0);
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function gt(e, t) {
|
|
568
568
|
if (e[0].length === t) return e.shift();
|
|
569
569
|
let n = new Uint8Array(t), r = 0;
|
|
570
570
|
for (let i = 0; i < t; i++) n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
|
|
571
571
|
return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
|
|
573
|
+
function _t(e, t) {
|
|
574
|
+
mt ||= new TextDecoder();
|
|
575
575
|
let n = [], r = 0, i = -1, a = !1;
|
|
576
576
|
return new TransformStream({ transform(o, s) {
|
|
577
577
|
for (n.push(o);;) {
|
|
578
578
|
if (r === 0) {
|
|
579
|
-
if (
|
|
580
|
-
let e =
|
|
579
|
+
if (ht(n) < 1) break;
|
|
580
|
+
let e = gt(n, 1);
|
|
581
581
|
a = (e[0] & 128) == 128, i = e[0] & 127, r = i < 126 ? 3 : i === 126 ? 1 : 2;
|
|
582
582
|
} else if (r === 1) {
|
|
583
|
-
if (
|
|
584
|
-
let e =
|
|
583
|
+
if (ht(n) < 2) break;
|
|
584
|
+
let e = gt(n, 2);
|
|
585
585
|
i = new DataView(e.buffer, e.byteOffset, e.length).getUint16(0), r = 3;
|
|
586
586
|
} else if (r === 2) {
|
|
587
|
-
if (
|
|
588
|
-
let e =
|
|
587
|
+
if (ht(n) < 8) break;
|
|
588
|
+
let e = gt(n, 8), t = new DataView(e.buffer, e.byteOffset, e.length), a = t.getUint32(0);
|
|
589
589
|
if (a > 2 ** 21 - 1) {
|
|
590
590
|
s.enqueue(Ye);
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
593
593
|
i = a * 2 ** 32 + t.getUint32(4), r = 3;
|
|
594
594
|
} else {
|
|
595
|
-
if (
|
|
596
|
-
let e =
|
|
597
|
-
s.enqueue(
|
|
595
|
+
if (ht(n) < i) break;
|
|
596
|
+
let e = gt(n, i);
|
|
597
|
+
s.enqueue(st(a ? e : mt.decode(e), t)), r = 0;
|
|
598
598
|
}
|
|
599
599
|
if (i === 0 || i > e) {
|
|
600
600
|
s.enqueue(Ye);
|
|
@@ -605,21 +605,21 @@ function gt(e, t) {
|
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
607
607
|
//#region node_modules/@socket.io/component-emitter/lib/esm/index.js
|
|
608
|
-
function
|
|
609
|
-
if (e) return
|
|
608
|
+
function A(e) {
|
|
609
|
+
if (e) return vt(e);
|
|
610
610
|
}
|
|
611
|
-
function
|
|
612
|
-
for (var t in
|
|
611
|
+
function vt(e) {
|
|
612
|
+
for (var t in A.prototype) e[t] = A.prototype[t];
|
|
613
613
|
return e;
|
|
614
614
|
}
|
|
615
|
-
|
|
615
|
+
A.prototype.on = A.prototype.addEventListener = function(e, t) {
|
|
616
616
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t), this;
|
|
617
|
-
},
|
|
617
|
+
}, A.prototype.once = function(e, t) {
|
|
618
618
|
function n() {
|
|
619
619
|
this.off(e, n), t.apply(this, arguments);
|
|
620
620
|
}
|
|
621
621
|
return n.fn = t, this.on(e, n), this;
|
|
622
|
-
},
|
|
622
|
+
}, A.prototype.off = A.prototype.removeListener = A.prototype.removeAllListeners = A.prototype.removeEventListener = function(e, t) {
|
|
623
623
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0) return this._callbacks = {}, this;
|
|
624
624
|
var n = this._callbacks["$" + e];
|
|
625
625
|
if (!n) return this;
|
|
@@ -629,7 +629,7 @@ j.prototype.on = j.prototype.addEventListener = function(e, t) {
|
|
|
629
629
|
break;
|
|
630
630
|
}
|
|
631
631
|
return n.length === 0 && delete this._callbacks["$" + e], this;
|
|
632
|
-
},
|
|
632
|
+
}, A.prototype.emit = function(e) {
|
|
633
633
|
this._callbacks = this._callbacks || {};
|
|
634
634
|
for (var t = Array(arguments.length - 1), n = this._callbacks["$" + e], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
|
|
635
635
|
if (n) {
|
|
@@ -637,22 +637,22 @@ j.prototype.on = j.prototype.addEventListener = function(e, t) {
|
|
|
637
637
|
for (var r = 0, i = n.length; r < i; ++r) n[r].apply(this, t);
|
|
638
638
|
}
|
|
639
639
|
return this;
|
|
640
|
-
},
|
|
640
|
+
}, A.prototype.emitReserved = A.prototype.emit, A.prototype.listeners = function(e) {
|
|
641
641
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + e] || [];
|
|
642
|
-
},
|
|
642
|
+
}, A.prototype.hasListeners = function(e) {
|
|
643
643
|
return !!this.listeners(e).length;
|
|
644
644
|
};
|
|
645
645
|
//#endregion
|
|
646
646
|
//#region node_modules/engine.io-client/build/esm/globals.js
|
|
647
|
-
var
|
|
647
|
+
var yt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), j = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), bt = "arraybuffer";
|
|
648
648
|
//#endregion
|
|
649
649
|
//#region node_modules/engine.io-client/build/esm/util.js
|
|
650
650
|
function xt(e, ...t) {
|
|
651
651
|
return t.reduce((t, n) => (e.hasOwnProperty(n) && (t[n] = e[n]), t), {});
|
|
652
652
|
}
|
|
653
|
-
var St =
|
|
653
|
+
var St = j.setTimeout, Ct = j.clearTimeout;
|
|
654
654
|
function wt(e, t) {
|
|
655
|
-
t.useNativeTimers ? (e.setTimeoutFn = St.bind(
|
|
655
|
+
t.useNativeTimers ? (e.setTimeoutFn = St.bind(j), e.clearTimeoutFn = Ct.bind(j)) : (e.setTimeoutFn = j.setTimeout.bind(j), e.clearTimeoutFn = j.clearTimeout.bind(j));
|
|
656
656
|
}
|
|
657
657
|
var Tt = 1.33;
|
|
658
658
|
function Et(e) {
|
|
@@ -687,7 +687,7 @@ var jt = class extends Error {
|
|
|
687
687
|
constructor(e, t, n) {
|
|
688
688
|
super(e), this.description = t, this.context = n, this.type = "TransportError";
|
|
689
689
|
}
|
|
690
|
-
}, Mt = class extends
|
|
690
|
+
}, Mt = class extends A {
|
|
691
691
|
constructor(e) {
|
|
692
692
|
super(), this.writable = !1, wt(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
693
693
|
}
|
|
@@ -707,7 +707,7 @@ var jt = class extends Error {
|
|
|
707
707
|
this.readyState = "open", this.writable = !0, super.emitReserved("open");
|
|
708
708
|
}
|
|
709
709
|
onData(e) {
|
|
710
|
-
let t =
|
|
710
|
+
let t = st(e, this.socket.binaryType);
|
|
711
711
|
this.onPacket(t);
|
|
712
712
|
}
|
|
713
713
|
onPacket(e) {
|
|
@@ -759,7 +759,7 @@ var jt = class extends Error {
|
|
|
759
759
|
this._polling = !0, this.doPoll(), this.emitReserved("poll");
|
|
760
760
|
}
|
|
761
761
|
onData(e) {
|
|
762
|
-
|
|
762
|
+
ft(e, this.socket.binaryType).forEach((e) => {
|
|
763
763
|
if (this.readyState === "opening" && e.type === "open" && this.onOpen(), e.type === "close") return this.onClose({ description: "transport closed by the server" }), !1;
|
|
764
764
|
this.onPacket(e);
|
|
765
765
|
}), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
@@ -771,7 +771,7 @@ var jt = class extends Error {
|
|
|
771
771
|
this.readyState === "open" ? e() : this.once("open", e);
|
|
772
772
|
}
|
|
773
773
|
write(e) {
|
|
774
|
-
this.writable = !1,
|
|
774
|
+
this.writable = !1, dt(e, (e) => {
|
|
775
775
|
this.doWrite(e, () => {
|
|
776
776
|
this.writable = !0, this.emitReserved("drain");
|
|
777
777
|
});
|
|
@@ -811,7 +811,7 @@ var Lt = class extends Nt {
|
|
|
811
811
|
this.onError("xhr poll error", e, t);
|
|
812
812
|
}), this.pollXhr = e;
|
|
813
813
|
}
|
|
814
|
-
}, Rt = class e extends
|
|
814
|
+
}, Rt = class e extends A {
|
|
815
815
|
constructor(e, t, n) {
|
|
816
816
|
super(), this.createRequest = e, wt(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data === void 0 ? null : n.data, this._create();
|
|
817
817
|
}
|
|
@@ -870,7 +870,7 @@ var Lt = class extends Nt {
|
|
|
870
870
|
if (Rt.requestsCount = 0, Rt.requests = {}, typeof document < "u") {
|
|
871
871
|
if (typeof attachEvent == "function") attachEvent("onunload", zt);
|
|
872
872
|
else if (typeof addEventListener == "function") {
|
|
873
|
-
let e = "onpagehide" in
|
|
873
|
+
let e = "onpagehide" in j ? "pagehide" : "unload";
|
|
874
874
|
addEventListener(e, zt, !1);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
@@ -896,7 +896,7 @@ function Ht(e) {
|
|
|
896
896
|
if (typeof XMLHttpRequest < "u" && (!t || Ft)) return new XMLHttpRequest();
|
|
897
897
|
} catch {}
|
|
898
898
|
if (!t) try {
|
|
899
|
-
return new
|
|
899
|
+
return new j[["Active", "Object"].join("X")]("Microsoft.XMLHTTP");
|
|
900
900
|
} catch {}
|
|
901
901
|
}
|
|
902
902
|
//#endregion
|
|
@@ -931,7 +931,7 @@ var Ut = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
931
931
|
try {
|
|
932
932
|
this.doWrite(n, e);
|
|
933
933
|
} catch {}
|
|
934
|
-
r &&
|
|
934
|
+
r && yt(() => {
|
|
935
935
|
this.writable = !0, this.emitReserved("drain");
|
|
936
936
|
}, this.setTimeoutFn);
|
|
937
937
|
});
|
|
@@ -944,7 +944,7 @@ var Ut = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
944
944
|
let e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
945
945
|
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ot()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
946
946
|
}
|
|
947
|
-
}, Gt =
|
|
947
|
+
}, Gt = j.WebSocket || j.MozWebSocket, Kt = {
|
|
948
948
|
websocket: class extends Wt {
|
|
949
949
|
createSocket(e, t, n) {
|
|
950
950
|
return Ut ? new Gt(e, t, n) : t ? new Gt(e, t) : new Gt(e);
|
|
@@ -969,7 +969,7 @@ var Ut = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
969
969
|
this.onError("webtransport error", e);
|
|
970
970
|
}), this._transport.ready.then(() => {
|
|
971
971
|
this._transport.createBidirectionalStream().then((e) => {
|
|
972
|
-
let t =
|
|
972
|
+
let t = _t(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = pt();
|
|
973
973
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
974
974
|
let i = () => {
|
|
975
975
|
n.read().then(({ done: e, value: t }) => {
|
|
@@ -987,7 +987,7 @@ var Ut = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
987
987
|
for (let t = 0; t < e.length; t++) {
|
|
988
988
|
let n = e[t], r = t === e.length - 1;
|
|
989
989
|
this._writer.write(n).then(() => {
|
|
990
|
-
r &&
|
|
990
|
+
r && yt(() => {
|
|
991
991
|
this.writable = !0, this.emitReserved("drain");
|
|
992
992
|
}, this.setTimeoutFn);
|
|
993
993
|
});
|
|
@@ -1039,7 +1039,7 @@ var Qt = typeof addEventListener == "function" && typeof removeEventListener ==
|
|
|
1039
1039
|
Qt && addEventListener("offline", () => {
|
|
1040
1040
|
$t.forEach((e) => e());
|
|
1041
1041
|
}, !1);
|
|
1042
|
-
var en = class e extends
|
|
1042
|
+
var en = class e extends A {
|
|
1043
1043
|
constructor(e, t) {
|
|
1044
1044
|
if (super(), this.binaryType = bt, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, e && typeof e == "object" && (t = e, e = null), e) {
|
|
1045
1045
|
let n = Yt(e);
|
|
@@ -1145,7 +1145,7 @@ var en = class e extends j {
|
|
|
1145
1145
|
_hasPingExpired() {
|
|
1146
1146
|
if (!this._pingTimeoutTime) return !0;
|
|
1147
1147
|
let e = Date.now() > this._pingTimeoutTime;
|
|
1148
|
-
return e && (this._pingTimeoutTime = 0,
|
|
1148
|
+
return e && (this._pingTimeoutTime = 0, yt(() => {
|
|
1149
1149
|
this._onClose("ping timeout");
|
|
1150
1150
|
}, this.setTimeoutFn)), e;
|
|
1151
1151
|
}
|
|
@@ -1364,7 +1364,7 @@ var vn = class {
|
|
|
1364
1364
|
let t = fn(e), n = this.encodeAsString(t.packet), r = t.buffers;
|
|
1365
1365
|
return r.unshift(n), r;
|
|
1366
1366
|
}
|
|
1367
|
-
}, yn = class e extends
|
|
1367
|
+
}, yn = class e extends A {
|
|
1368
1368
|
constructor(e) {
|
|
1369
1369
|
super(), this.opts = Object.assign({
|
|
1370
1370
|
reviver: void 0,
|
|
@@ -1497,7 +1497,7 @@ var On = Object.freeze({
|
|
|
1497
1497
|
disconnecting: 1,
|
|
1498
1498
|
newListener: 1,
|
|
1499
1499
|
removeListener: 1
|
|
1500
|
-
}), kn = class extends
|
|
1500
|
+
}), kn = class extends A {
|
|
1501
1501
|
constructor(e, t, n) {
|
|
1502
1502
|
super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = e, this.nsp = t, n && n.auth && (this.auth = n.auth), this._opts = Object.assign({}, n), this.io._autoConnect && this.open();
|
|
1503
1503
|
}
|
|
@@ -1750,7 +1750,7 @@ An.prototype.duration = function() {
|
|
|
1750
1750
|
};
|
|
1751
1751
|
//#endregion
|
|
1752
1752
|
//#region node_modules/socket.io-client/build/esm/manager.js
|
|
1753
|
-
var jn = class extends
|
|
1753
|
+
var jn = class extends A {
|
|
1754
1754
|
constructor(e, t) {
|
|
1755
1755
|
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t ||= {}, t.path = t.path || "/socket.io", this.opts = t, wt(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || Infinity), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor(t.randomizationFactor ?? .5), this.backoff = new An({
|
|
1756
1756
|
min: this.reconnectionDelay(),
|
|
@@ -1823,7 +1823,7 @@ var jn = class extends j {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
1825
|
ondecoded(e) {
|
|
1826
|
-
|
|
1826
|
+
yt(() => {
|
|
1827
1827
|
this.emitReserved("packet", e);
|
|
1828
1828
|
}, this.setTimeoutFn);
|
|
1829
1829
|
}
|
|
@@ -2836,7 +2836,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2836
2836
|
let i = f(() => e ? {
|
|
2837
2837
|
...t || {},
|
|
2838
2838
|
siteId: e
|
|
2839
|
-
} : 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),
|
|
2839
|
+
} : 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), ot = p(""), st = p(!1), 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), _t = p(null), A = p(!1), vt = p(!1), yt = p(""), j = p(null), bt = p(null), xt = p([]), St = p(0), Ct = p(E), wt = p([]), Tt = p(!1), Et = p(!1), Dt = p(i), Ot = p({
|
|
2840
2840
|
notifyRouteChange: () => {},
|
|
2841
2841
|
cleanup: () => {}
|
|
2842
2842
|
}), kt = o((e = {}) => {
|
|
@@ -2847,7 +2847,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2847
2847
|
return Number.isFinite(t) && t > 0 ? t : ae;
|
|
2848
2848
|
}, [i, _]);
|
|
2849
2849
|
c(() => {
|
|
2850
|
-
|
|
2850
|
+
lt.current = O;
|
|
2851
2851
|
}, [O]), c(() => {
|
|
2852
2852
|
Ct.current = E;
|
|
2853
2853
|
}, [E]), c(() => {
|
|
@@ -2858,7 +2858,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2858
2858
|
let jt = () => {
|
|
2859
2859
|
nt("");
|
|
2860
2860
|
}, Mt = o(() => {
|
|
2861
|
-
|
|
2861
|
+
_t.current &&= (window.clearTimeout(_t.current), null);
|
|
2862
2862
|
}, []), Nt = (e) => {
|
|
2863
2863
|
let t = typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
2864
2864
|
return pe(t), xe(t, i?.siteId), t;
|
|
@@ -2868,8 +2868,8 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2868
2868
|
e && pe(be(e));
|
|
2869
2869
|
}, [i?.siteId]);
|
|
2870
2870
|
let Pt = (e = "unspecified") => {
|
|
2871
|
-
let t =
|
|
2872
|
-
if (
|
|
2871
|
+
let t = ht.current || pt.current?.callId, n = St.current, r = j.current;
|
|
2872
|
+
if (j.current = null, St.current = 0, r && r.state !== "inactive") {
|
|
2873
2873
|
r.onstop = () => {
|
|
2874
2874
|
let e = xt.current;
|
|
2875
2875
|
if (xt.current = [], e.length > 0 && t && k.current) {
|
|
@@ -2895,18 +2895,18 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2895
2895
|
} catch {}
|
|
2896
2896
|
bt.current = null;
|
|
2897
2897
|
}
|
|
2898
|
-
|
|
2898
|
+
ut.current &&= (ut.current.close(), null), dt.current &&= (dt.current.getTracks().forEach((e) => e.stop()), null), ft.current &&= (ft.current.srcObject = null, ft.current.remove(), null), Mt(), pt.current = null, mt.current = [], ht.current = null, gt.current = null, A.current = !1, et(!1), Ue(null), Je(null), Xe("idle"), Qe(null);
|
|
2899
2899
|
}, Ft = (e = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
2900
|
-
let t = at.current, n =
|
|
2901
|
-
if (!(!t?.connected || !n ||
|
|
2902
|
-
|
|
2900
|
+
let t = at.current, n = ht.current || pt.current?.callId;
|
|
2901
|
+
if (!(!t?.connected || !n || A.current)) {
|
|
2902
|
+
A.current = !0, t.emit("call:connected", {
|
|
2903
2903
|
callId: n,
|
|
2904
|
-
chatId:
|
|
2904
|
+
chatId: ot.current,
|
|
2905
2905
|
connectedAt: e
|
|
2906
2906
|
});
|
|
2907
2907
|
try {
|
|
2908
|
-
let e =
|
|
2909
|
-
if (e && t && !
|
|
2908
|
+
let e = dt.current, t = ft.current?.srcObject;
|
|
2909
|
+
if (e && t && !j.current) {
|
|
2910
2910
|
xt.current = [];
|
|
2911
2911
|
let n = new (window.AudioContext || window.webkitAudioContext)();
|
|
2912
2912
|
bt.current = n;
|
|
@@ -2915,7 +2915,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2915
2915
|
let i = window.MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : "audio/mp4", a = new window.MediaRecorder(r.stream, { mimeType: i });
|
|
2916
2916
|
a.ondataavailable = (e) => {
|
|
2917
2917
|
e.data && e.data.size > 0 && xt.current.push(e.data);
|
|
2918
|
-
},
|
|
2918
|
+
}, j.current = a, St.current = Date.now(), a.start(1e3), setTimeout(() => {
|
|
2919
2919
|
try {
|
|
2920
2920
|
if (!window.speechSynthesis) return;
|
|
2921
2921
|
let e = new SpeechSynthesisUtterance("This call is being recorded for quality and training purposes.");
|
|
@@ -2945,53 +2945,53 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2945
2945
|
}
|
|
2946
2946
|
}, It = (e = {}) => {
|
|
2947
2947
|
if (!e.callId) return;
|
|
2948
|
-
let t =
|
|
2948
|
+
let t = gt.current === e.callId, n = ht.current === e.callId, r = lt.current?.callId === e.callId;
|
|
2949
2949
|
if (!(!t && !n && !r)) {
|
|
2950
2950
|
if (Mt(), Ue(null), t || n) {
|
|
2951
|
-
|
|
2951
|
+
ht.current = e.callId, Je(e.callId), Xe((e) => e === "connected" ? e : "connecting"), w(!0);
|
|
2952
2952
|
return;
|
|
2953
2953
|
}
|
|
2954
2954
|
Xe("idle");
|
|
2955
2955
|
}
|
|
2956
2956
|
}, Lt = (e = {}) => {
|
|
2957
2957
|
if (!e.callId) return;
|
|
2958
|
-
let t =
|
|
2958
|
+
let t = gt.current === e.callId, n = ht.current === e.callId, r = lt.current?.callId === e.callId;
|
|
2959
2959
|
if (!(!t && !n && !r)) {
|
|
2960
2960
|
if (Mt(), n) {
|
|
2961
2961
|
Pt();
|
|
2962
2962
|
return;
|
|
2963
2963
|
}
|
|
2964
|
-
|
|
2964
|
+
gt.current = null, pt.current = null, mt.current = [], Ue(null), Xe("idle");
|
|
2965
2965
|
}
|
|
2966
2966
|
}, Rt = async (e = {}) => {
|
|
2967
|
-
let t =
|
|
2967
|
+
let t = ut.current, n = at.current, r = e.sdpOffer || e.offer?.sdp;
|
|
2968
2968
|
if (!t || !n?.connected || !r || !e.callId) {
|
|
2969
2969
|
console.log("[FlowEngageProvider] deferring remote offer until peer/socket ready", {
|
|
2970
2970
|
callId: e.callId,
|
|
2971
|
-
chatId:
|
|
2971
|
+
chatId: ot.current,
|
|
2972
2972
|
hasPeerConnection: !!t,
|
|
2973
2973
|
socketConnected: !!n?.connected,
|
|
2974
2974
|
hasOffer: !!r
|
|
2975
|
-
}),
|
|
2975
|
+
}), pt.current = e;
|
|
2976
2976
|
return;
|
|
2977
2977
|
}
|
|
2978
2978
|
if (await t.setRemoteDescription(new RTCSessionDescription({
|
|
2979
2979
|
type: "offer",
|
|
2980
2980
|
sdp: r
|
|
2981
|
-
})),
|
|
2981
|
+
})), mt.current.length > 0) {
|
|
2982
2982
|
console.log("[FlowEngageProvider] flushing queued agent ICE candidates after remote offer", {
|
|
2983
2983
|
callId: e.callId,
|
|
2984
|
-
chatId:
|
|
2985
|
-
queuedCount:
|
|
2984
|
+
chatId: ot.current,
|
|
2985
|
+
queuedCount: mt.current.length
|
|
2986
2986
|
});
|
|
2987
|
-
for (let e of
|
|
2988
|
-
|
|
2987
|
+
for (let e of mt.current) await t.addIceCandidate(new RTCIceCandidate(e));
|
|
2988
|
+
mt.current = [];
|
|
2989
2989
|
}
|
|
2990
2990
|
let i = await t.createAnswer();
|
|
2991
2991
|
await t.setLocalDescription(i), n.emit("call:answer", {
|
|
2992
2992
|
callId: e.callId,
|
|
2993
2993
|
sdpAnswer: i.sdp,
|
|
2994
|
-
chatId:
|
|
2994
|
+
chatId: ot.current
|
|
2995
2995
|
});
|
|
2996
2996
|
};
|
|
2997
2997
|
c(() => {
|
|
@@ -3017,8 +3017,8 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3017
3017
|
if (!e) return;
|
|
3018
3018
|
let a = t.siteId, o = he(a), s = Te(a), c = "";
|
|
3019
3019
|
try {
|
|
3020
|
-
let e =
|
|
3021
|
-
if (
|
|
3020
|
+
let e = st.current, r = ct.current;
|
|
3021
|
+
if (st.current = !1, ct.current = null, c = (await We({
|
|
3022
3022
|
apiBaseUrl: t.apiBaseUrl,
|
|
3023
3023
|
userId: n.userId,
|
|
3024
3024
|
siteId: a,
|
|
@@ -3031,7 +3031,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3031
3031
|
} catch (e) {
|
|
3032
3032
|
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ue(), _e(a, c);
|
|
3033
3033
|
}
|
|
3034
|
-
|
|
3034
|
+
ot.current = c;
|
|
3035
3035
|
let l = Ke({
|
|
3036
3036
|
apiBaseUrl: t.apiBaseUrl,
|
|
3037
3037
|
userId: n.userId,
|
|
@@ -3154,14 +3154,14 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3154
3154
|
e.agent?.name,
|
|
3155
3155
|
Ct.current
|
|
3156
3156
|
], "Agent");
|
|
3157
|
-
jt(), Mt(),
|
|
3157
|
+
jt(), Mt(), A.current = !1, Ue({
|
|
3158
3158
|
callId: e.callId,
|
|
3159
3159
|
from: e.from || "owner",
|
|
3160
3160
|
agentId: e.agentId || null,
|
|
3161
3161
|
agentName: t
|
|
3162
3162
|
}), D((e) => Ir([t, e], "Agent")), Xe("incoming"), Qe(null), w(!0);
|
|
3163
3163
|
}), f.on("call:offer", async (e = {}) => {
|
|
3164
|
-
|
|
3164
|
+
pt.current = e;
|
|
3165
3165
|
try {
|
|
3166
3166
|
await Rt(e);
|
|
3167
3167
|
} catch (e) {
|
|
@@ -3174,15 +3174,15 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3174
3174
|
console.warn("[FlowEngageProvider] ignoring invalid ICE candidate payload", e);
|
|
3175
3175
|
return;
|
|
3176
3176
|
}
|
|
3177
|
-
if (!
|
|
3177
|
+
if (!ut.current || !ut.current.remoteDescription) {
|
|
3178
3178
|
console.log("[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready", {
|
|
3179
3179
|
callId: e.callId,
|
|
3180
|
-
chatId: e.chatId ||
|
|
3181
|
-
queueSize:
|
|
3182
|
-
}),
|
|
3180
|
+
chatId: e.chatId || ot.current,
|
|
3181
|
+
queueSize: mt.current.length + 1
|
|
3182
|
+
}), mt.current.push(t);
|
|
3183
3183
|
return;
|
|
3184
3184
|
}
|
|
3185
|
-
await
|
|
3185
|
+
await ut.current.addIceCandidate(new RTCIceCandidate(t));
|
|
3186
3186
|
} catch (e) {
|
|
3187
3187
|
console.error("[FlowEngageProvider] failed to add ICE candidate", e);
|
|
3188
3188
|
}
|
|
@@ -3200,12 +3200,12 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3200
3200
|
Lt(e);
|
|
3201
3201
|
}), f.on("call:connected", (e = {}) => {
|
|
3202
3202
|
if (!e.callId) return;
|
|
3203
|
-
let t =
|
|
3203
|
+
let t = gt.current === e.callId, n = ht.current === e.callId, r = pt.current?.callId === e.callId, i = lt.current?.callId === e.callId;
|
|
3204
3204
|
if (!t && !n && !r) {
|
|
3205
3205
|
i && (Ue(null), Xe("idle"));
|
|
3206
3206
|
return;
|
|
3207
3207
|
}
|
|
3208
|
-
|
|
3208
|
+
A.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);
|
|
3209
3209
|
}), f.on("call:unavailable", (e = {}) => {
|
|
3210
3210
|
Pt("socket:call_unavailable"), nt(Pr(e, "This visitor is not available for a call right now.")), w(!0);
|
|
3211
3211
|
}), f.on("call:error", (e = {}) => {
|
|
@@ -3252,7 +3252,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3252
3252
|
a
|
|
3253
3253
|
]), c(() => () => {
|
|
3254
3254
|
if (Fe && !Tt.current && wt.current.length > 0) {
|
|
3255
|
-
let e =
|
|
3255
|
+
let e = ot.current, t = wt.current, n = k.current;
|
|
3256
3256
|
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), Tt.current = !0);
|
|
3257
3257
|
}
|
|
3258
3258
|
}, [Fe, _]);
|
|
@@ -3262,7 +3262,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3262
3262
|
!e || !y || zt.current !== C && (C && zt.current !== null ? (e.updateChatStatus(y, "open").catch(() => {}), Bt.current = !0) : zt.current === !0 && e.updateChatStatus(y, "widget_closed").catch(() => {}), zt.current = C);
|
|
3263
3263
|
}, [C, y]), c(() => {
|
|
3264
3264
|
let e = () => {
|
|
3265
|
-
let e =
|
|
3265
|
+
let e = ot.current, t = k.current;
|
|
3266
3266
|
!e || !t || typeof navigator > "u" || t.beaconWidgetClosed?.(e) || t.updateChatStatus(e, "widget_closed").catch(() => {});
|
|
3267
3267
|
};
|
|
3268
3268
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
@@ -3282,10 +3282,10 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3282
3282
|
]);
|
|
3283
3283
|
let Vt = async () => {
|
|
3284
3284
|
if (!(!O?.callId || !k.current || !at.current || !y)) {
|
|
3285
|
-
jt(),
|
|
3285
|
+
jt(), gt.current = O.callId, Mt();
|
|
3286
3286
|
try {
|
|
3287
3287
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
3288
|
-
|
|
3288
|
+
dt.current = e;
|
|
3289
3289
|
let t = [{ urls: "stun:stun.l.google.com:19302" }];
|
|
3290
3290
|
try {
|
|
3291
3291
|
let e = await k.current.getIceServersConfig();
|
|
@@ -3294,7 +3294,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3294
3294
|
console.warn("[FlowEngageProvider] ice-config fetch failed, using STUN default", e);
|
|
3295
3295
|
}
|
|
3296
3296
|
let n = new RTCPeerConnection({ iceServers: t });
|
|
3297
|
-
|
|
3297
|
+
ut.current = n, n.onconnectionstatechange = () => {
|
|
3298
3298
|
let e = n.connectionState;
|
|
3299
3299
|
if (e === "connected") {
|
|
3300
3300
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -3333,21 +3333,21 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3333
3333
|
});
|
|
3334
3334
|
}, n.ontrack = (e) => {
|
|
3335
3335
|
let [t] = e.streams || [], [n] = t?.getAudioTracks?.() || [];
|
|
3336
|
-
if (!
|
|
3336
|
+
if (!ft.current) {
|
|
3337
3337
|
let e = document.createElement("audio");
|
|
3338
|
-
e.id = "flowengage-remote-audio", e.autoplay = !0, e.playsInline = !0, e.onplay = () => {}, e.onpause = () => {}, e.onended = () => {}, e.onerror = (e) => {},
|
|
3338
|
+
e.id = "flowengage-remote-audio", e.autoplay = !0, e.playsInline = !0, e.onplay = () => {}, e.onpause = () => {}, e.onended = () => {}, e.onerror = (e) => {}, ft.current = e, document.body.appendChild(e);
|
|
3339
3339
|
}
|
|
3340
|
-
|
|
3341
|
-
let r = O?.callId, i = r && (
|
|
3342
|
-
if (!
|
|
3340
|
+
ft.current.srcObject = e.streams[0];
|
|
3341
|
+
let r = O?.callId, i = r && (gt.current === r || ht.current === r);
|
|
3342
|
+
if (!A.current && i) {
|
|
3343
3343
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
3344
|
-
Xe("connected"), Qe((t) => t || e),
|
|
3344
|
+
Xe("connected"), Qe((t) => t || e), ht.current = r, Je(r), Ft(e);
|
|
3345
3345
|
}
|
|
3346
|
-
|
|
3347
|
-
let a =
|
|
3346
|
+
ft.current.srcObject = t || null;
|
|
3347
|
+
let a = ft.current.play?.();
|
|
3348
3348
|
a?.catch && a.catch((e) => {});
|
|
3349
3349
|
};
|
|
3350
|
-
let r =
|
|
3350
|
+
let r = pt.current;
|
|
3351
3351
|
r && (console.log("[FlowEngageProvider] found pending remote offer during accept", {
|
|
3352
3352
|
callId: r.callId || O.callId,
|
|
3353
3353
|
chatId: y
|
|
@@ -3357,9 +3357,9 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3357
3357
|
})), await k.current.acceptCall(O.callId, y), at.current?.emit("call:accepted", {
|
|
3358
3358
|
callId: O.callId,
|
|
3359
3359
|
chatId: y
|
|
3360
|
-
}),
|
|
3360
|
+
}), ht.current = O.callId, Je(O.callId), Xe((e) => e === "connected" || A.current ? "connected" : "connecting"), Ue(null), w(!0);
|
|
3361
3361
|
} catch (e) {
|
|
3362
|
-
if (
|
|
3362
|
+
if (gt.current = null, Pt("accept_call_failed"), e?.status === 404 || e?.status === 409 || e?.status === 422) {
|
|
3363
3363
|
nt(Pr(e, "This visitor call is no longer available."));
|
|
3364
3364
|
return;
|
|
3365
3365
|
}
|
|
@@ -3400,10 +3400,10 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3400
3400
|
return;
|
|
3401
3401
|
}
|
|
3402
3402
|
let e = O.callId;
|
|
3403
|
-
return Mt(),
|
|
3404
|
-
|
|
3403
|
+
return Mt(), _t.current = window.setTimeout(() => {
|
|
3404
|
+
lt.current?.callId === e && gt.current !== e && ht.current !== e && Ut.current();
|
|
3405
3405
|
}, oe), () => {
|
|
3406
|
-
|
|
3406
|
+
_t.current &&= (window.clearTimeout(_t.current), null);
|
|
3407
3407
|
};
|
|
3408
3408
|
}, [
|
|
3409
3409
|
qe,
|
|
@@ -3424,7 +3424,7 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3424
3424
|
Pt("end_call_finally");
|
|
3425
3425
|
}
|
|
3426
3426
|
}, Gt = () => {
|
|
3427
|
-
let e =
|
|
3427
|
+
let e = dt.current?.getAudioTracks?.() || [], t = ut.current?.getSenders?.().map((e) => e.track).filter((e) => e?.kind === "audio") || [], n = [...e, ...t].filter(Boolean);
|
|
3428
3428
|
if (n.length === 0) return;
|
|
3429
3429
|
let r = !$e;
|
|
3430
3430
|
n.forEach((e) => {
|
|
@@ -3445,10 +3445,10 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3445
3445
|
}
|
|
3446
3446
|
}, qt = async (e) => {
|
|
3447
3447
|
let t = Nt(e);
|
|
3448
|
-
if (!t || !k.current || !
|
|
3448
|
+
if (!t || !k.current || !ot.current) return t;
|
|
3449
3449
|
try {
|
|
3450
3450
|
await k.current.trackVisitor({
|
|
3451
|
-
chatId:
|
|
3451
|
+
chatId: ot.current,
|
|
3452
3452
|
currentPagePath: typeof window < "u" && window.location.pathname || "/",
|
|
3453
3453
|
email: t
|
|
3454
3454
|
});
|
|
@@ -3457,18 +3457,18 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3457
3457
|
}
|
|
3458
3458
|
return t;
|
|
3459
3459
|
}, Jt = () => {
|
|
3460
|
-
!y || !at.current?.connected ||
|
|
3460
|
+
!y || !at.current?.connected || vt.current || (vt.current = !0, at.current.emit("typing:start", {
|
|
3461
3461
|
chatId: y,
|
|
3462
3462
|
sender: "user"
|
|
3463
3463
|
}));
|
|
3464
3464
|
}, Yt = () => {
|
|
3465
|
-
!y || !at.current?.connected || !
|
|
3465
|
+
!y || !at.current?.connected || !vt.current || (vt.current = !1, at.current.emit("typing:stop", {
|
|
3466
3466
|
chatId: y,
|
|
3467
3467
|
sender: "user"
|
|
3468
3468
|
}));
|
|
3469
3469
|
}, Xt = (e = "") => {
|
|
3470
3470
|
let t = typeof e == "string" ? e : "";
|
|
3471
|
-
!y || !at.current?.connected || t !== "" &&
|
|
3471
|
+
!y || !at.current?.connected || t !== "" && yt.current === t || (yt.current = t, at.current.emit("typing:update", {
|
|
3472
3472
|
chatId: y,
|
|
3473
3473
|
sender: "user",
|
|
3474
3474
|
text: t
|
|
@@ -3608,13 +3608,13 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3608
3608
|
At
|
|
3609
3609
|
]), c(() => {
|
|
3610
3610
|
let e = () => {
|
|
3611
|
-
let e =
|
|
3611
|
+
let e = ot.current, t = k.current;
|
|
3612
3612
|
if (!t || !e) return;
|
|
3613
|
-
if (Et.current && wt.current.length > 0 && Pe(), !Tt.current && wt.current.length > 0 && (t.beaconSyncVoice(e, wt.current) || t.syncVoice(e, wt.current).catch(() => {}), Tt.current = !0),
|
|
3614
|
-
t.beaconEndWebRTCCall(
|
|
3613
|
+
if (Et.current && wt.current.length > 0 && Pe(), !Tt.current && wt.current.length > 0 && (t.beaconSyncVoice(e, wt.current) || t.syncVoice(e, wt.current).catch(() => {}), Tt.current = !0), ht.current) {
|
|
3614
|
+
t.beaconEndWebRTCCall(ht.current, e);
|
|
3615
3615
|
return;
|
|
3616
3616
|
}
|
|
3617
|
-
let n =
|
|
3617
|
+
let n = gt.current || lt.current?.callId;
|
|
3618
3618
|
n && t.beaconCustomerUnavailable(n, e);
|
|
3619
3619
|
};
|
|
3620
3620
|
return window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), () => {
|
|
@@ -3623,9 +3623,9 @@ function Rr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3623
3623
|
}, []);
|
|
3624
3624
|
let nn = o(() => {
|
|
3625
3625
|
let e = i?.siteId;
|
|
3626
|
-
ge(e),
|
|
3626
|
+
ge(e), st.current = !0, ct.current = null, at.current?.disconnect(), S([]), b(""), ot.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3627
3627
|
}, [i?.siteId]), rn = o((e) => {
|
|
3628
|
-
i?.siteId,
|
|
3628
|
+
i?.siteId, st.current = !1, ct.current = e, at.current?.disconnect(), S([]), b(""), ot.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3629
3629
|
}, [i?.siteId]), an = f(() => ({
|
|
3630
3630
|
status: l,
|
|
3631
3631
|
error: d,
|
|
@@ -29401,7 +29401,7 @@ function Sk(e) {
|
|
|
29401
29401
|
for (; Date.now() < c && (await new Promise((e) => setTimeout(e, 250)), s = xk(), !(s.length >= 1)););
|
|
29402
29402
|
bk(), $("flowengage_navigate → page headings collected:", s);
|
|
29403
29403
|
let l = s.length ? s.join(" | ") : "none", u = s.length ? "Use ONLY these exact heading strings for flowengage_highlight." : "No headings were collected from the live DOM — use your knowledge base heading strings for this page to call flowengage_highlight. Follow RULE 1: call each highlight BEFORE describing its section (transition → highlight → content).";
|
|
29404
|
-
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u}
|
|
29404
|
+
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u} Speak 2-3 sentences about this page from your knowledge, then IMMEDIATELY ask: "Is there a specific section or topic you'd like to know more about?" Do NOT highlight or walkthrough unless the visitor explicitly requests it. Do NOT say "I have navigated you" or "I've taken you to".`) : (wr(), `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}") | Section headings: ${l}. ${u} Speak 2-3 sentences about this page from your knowledge, then IMMEDIATELY ask: "Is there a specific section or topic you'd like to know more about?" Describe THIS page only — do not mention the page you tried to navigate to.`);
|
|
29405
29405
|
} catch {}
|
|
29406
29406
|
return "OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, immediately introduce the new page and continue guiding the visitor — do not wait for the user to speak first.";
|
|
29407
29407
|
} catch (e) {
|
|
@@ -29499,7 +29499,7 @@ function Sk(e) {
|
|
|
29499
29499
|
url: e,
|
|
29500
29500
|
path: t,
|
|
29501
29501
|
title: n
|
|
29502
|
-
}), $("flowengage_get_current_page → page headings collected:", r), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n} | Section headings: ${i}. Use ONLY these exact heading strings for flowengage_highlight — never invent or abbreviate section names.`;
|
|
29502
|
+
}), $("flowengage_get_current_page → page headings collected:", r), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n} | Section headings: ${i}. Give 1-2 sentences about this page, then ask: "Is there a specific section or topic you'd like to know more about?" Use ONLY these exact heading strings for flowengage_highlight — never invent or abbreviate section names.`;
|
|
29503
29503
|
},
|
|
29504
29504
|
flowengage_list_forms: async () => {
|
|
29505
29505
|
let e = XO(), t = ZO();
|
|
@@ -30164,7 +30164,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30164
30164
|
e && Ae(i, e);
|
|
30165
30165
|
} catch {}
|
|
30166
30166
|
if (Ak(n, r)) {
|
|
30167
|
-
|
|
30167
|
+
D.current = !0;
|
|
30168
30168
|
return;
|
|
30169
30169
|
}
|
|
30170
30170
|
if (ee.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (oe.current += 1, oe.current === 2) try {
|
|
@@ -31400,7 +31400,7 @@ function Rk() {
|
|
|
31400
31400
|
pr();
|
|
31401
31401
|
} catch {}
|
|
31402
31402
|
}, []), c(() => {
|
|
31403
|
-
Ee && k !== "voice_mode" && k !== "text_chat" && k !== "call_screen" && (ue?.(!1),
|
|
31403
|
+
Ee && k !== "voice_mode" && k !== "text_chat" && k !== "call_screen" && (ue?.(!1), ot("text_chat"));
|
|
31404
31404
|
}, [Ee]);
|
|
31405
31405
|
let Oe = t?.widgetSettings || {}, ke = n?.widgetSettings || {}, Ae = {
|
|
31406
31406
|
...Oe.branding || {},
|
|
@@ -31438,35 +31438,30 @@ function Rk() {
|
|
|
31438
31438
|
]), nt = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, rt = r.some((e) => e.sender === "user"), it = f(() => {
|
|
31439
31439
|
let e = r.findIndex((e) => e.sender === "user");
|
|
31440
31440
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
31441
|
-
}, [r]), at = !!(ke._dashboardLivePreview || Oe._dashboardLivePreview), [k,
|
|
31441
|
+
}, [r]), at = !!(ke._dashboardLivePreview || Oe._dashboardLivePreview), [k, ot] = m(() => at ? "text_chat" : "entry_prompt"), [st, ct] = m(""), [lt, ut] = m(null), [dt, ft] = m(h || ""), [pt, mt] = m(""), [ht, gt] = m(!1), [_t, A] = m(0), [vt, yt] = m(null), [j, bt] = m(null), [xt, St] = m(""), [Ct, wt] = m(!1), [Tt, Et] = m(!1), [Dt, Ot] = m(!1), kt = p(null), At = p(!1), jt = !h && rt && it && k !== "voice_mode";
|
|
31442
31442
|
d(() => {
|
|
31443
31443
|
if (e !== "ready" || At.current) return;
|
|
31444
31444
|
if (At.current = !0, !Pe) {
|
|
31445
|
-
|
|
31445
|
+
ot("minimized_orb");
|
|
31446
31446
|
return;
|
|
31447
31447
|
}
|
|
31448
31448
|
let t = !1;
|
|
31449
31449
|
try {
|
|
31450
31450
|
t = Tr().shouldResumeVoice;
|
|
31451
31451
|
} catch {}
|
|
31452
|
-
|
|
31453
|
-
|
|
31454
|
-
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), A("voice_mode");
|
|
31452
|
+
if (Fe(), t) {
|
|
31453
|
+
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31455
31454
|
return;
|
|
31456
31455
|
}
|
|
31457
31456
|
if (Re()) {
|
|
31458
|
-
ce?.({ notifyChatInitiated: !1 }),
|
|
31459
|
-
return;
|
|
31460
|
-
}
|
|
31461
|
-
if (n) {
|
|
31462
|
-
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), A("voice_mode");
|
|
31457
|
+
ce?.({ notifyChatInitiated: !1 }), ot("text_chat");
|
|
31463
31458
|
return;
|
|
31464
31459
|
}
|
|
31465
31460
|
if ($e) try {
|
|
31466
31461
|
Me($e);
|
|
31467
31462
|
} catch {}
|
|
31468
31463
|
if (fe($e)) {
|
|
31469
|
-
|
|
31464
|
+
ot("minimized_orb");
|
|
31470
31465
|
return;
|
|
31471
31466
|
}
|
|
31472
31467
|
}, [e, r]);
|
|
@@ -31475,7 +31470,7 @@ function Rk() {
|
|
|
31475
31470
|
let e = window.matchMedia("(max-width: 640px)"), t = (e) => Nt(e.matches);
|
|
31476
31471
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
31477
31472
|
}, []), c(() => {
|
|
31478
|
-
|
|
31473
|
+
ft(h || ""), h && mt("");
|
|
31479
31474
|
}, [h]);
|
|
31480
31475
|
let Pt = o(() => {
|
|
31481
31476
|
bt(null), St("");
|
|
@@ -31489,21 +31484,21 @@ function Rk() {
|
|
|
31489
31484
|
}, []);
|
|
31490
31485
|
c(() => {
|
|
31491
31486
|
if (!te || ee !== "connected") {
|
|
31492
|
-
|
|
31487
|
+
A(0);
|
|
31493
31488
|
return;
|
|
31494
31489
|
}
|
|
31495
31490
|
let e = () => {
|
|
31496
31491
|
let e = new Date(te).getTime();
|
|
31497
|
-
isNaN(e) ||
|
|
31492
|
+
isNaN(e) || A(Math.max(0, Math.floor((Date.now() - e) / 1e3)));
|
|
31498
31493
|
};
|
|
31499
31494
|
e();
|
|
31500
31495
|
let t = window.setInterval(e, 1e3);
|
|
31501
31496
|
return () => window.clearInterval(t);
|
|
31502
31497
|
}, [te, ee]);
|
|
31503
31498
|
let It = o(() => {
|
|
31504
|
-
|
|
31499
|
+
ot("call_screen"), Et(!1);
|
|
31505
31500
|
}, []), Lt = o(() => {
|
|
31506
|
-
|
|
31501
|
+
ot("text_chat"), Et(!0);
|
|
31507
31502
|
}, []);
|
|
31508
31503
|
c(() => {
|
|
31509
31504
|
let e = w?.callId || T || null;
|
|
@@ -31535,7 +31530,7 @@ function Rk() {
|
|
|
31535
31530
|
ue,
|
|
31536
31531
|
k
|
|
31537
31532
|
]), c(() => {
|
|
31538
|
-
!w && !T && k === "call_screen" &&
|
|
31533
|
+
!w && !T && k === "call_screen" && ot("text_chat");
|
|
31539
31534
|
}, [
|
|
31540
31535
|
w,
|
|
31541
31536
|
T,
|
|
@@ -31547,19 +31542,19 @@ function Rk() {
|
|
|
31547
31542
|
Se?.(""), xe?.();
|
|
31548
31543
|
return;
|
|
31549
31544
|
}
|
|
31550
|
-
if (!
|
|
31545
|
+
if (!st.trim() || j) {
|
|
31551
31546
|
Se?.("");
|
|
31552
31547
|
let e = window.setTimeout(() => xe?.(), 100);
|
|
31553
31548
|
return () => window.clearTimeout(e);
|
|
31554
31549
|
}
|
|
31555
31550
|
be?.();
|
|
31556
|
-
let e = window.setTimeout(() => Se?.(
|
|
31551
|
+
let e = window.setTimeout(() => Se?.(st), 120), t = window.setTimeout(() => xe?.(), 1200);
|
|
31557
31552
|
return () => {
|
|
31558
31553
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
31559
31554
|
};
|
|
31560
31555
|
}, [
|
|
31561
|
-
|
|
31562
|
-
|
|
31556
|
+
st,
|
|
31557
|
+
j,
|
|
31563
31558
|
s,
|
|
31564
31559
|
C,
|
|
31565
31560
|
be,
|
|
@@ -31573,27 +31568,27 @@ function Rk() {
|
|
|
31573
31568
|
} : null, zt = async (e) => {
|
|
31574
31569
|
if (e.preventDefault(), C) return;
|
|
31575
31570
|
if (jt) {
|
|
31576
|
-
let e =
|
|
31571
|
+
let e = dt.trim().toLowerCase();
|
|
31577
31572
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
31578
|
-
|
|
31573
|
+
mt("Please enter a valid email so we can continue helping you.");
|
|
31579
31574
|
return;
|
|
31580
31575
|
}
|
|
31581
|
-
await le(e),
|
|
31576
|
+
await le(e), mt(""), gt(!0), setTimeout(() => gt(!1), 3e3);
|
|
31582
31577
|
return;
|
|
31583
31578
|
}
|
|
31584
|
-
let t = Rt(
|
|
31585
|
-
if (!
|
|
31586
|
-
if (
|
|
31579
|
+
let t = Rt(lt);
|
|
31580
|
+
if (!st.trim() && !j) return;
|
|
31581
|
+
if (j) {
|
|
31587
31582
|
try {
|
|
31588
31583
|
wt(!0), St("");
|
|
31589
|
-
let e = await se(
|
|
31590
|
-
|
|
31584
|
+
let e = await se(j), n = e?.data || e, r = st.trim() || `Shared file: ${YD(j)}`;
|
|
31585
|
+
ct(""), ut(null), Pt(), await D(r, "", t, {
|
|
31591
31586
|
type: "file",
|
|
31592
31587
|
metadata: {
|
|
31593
31588
|
fileUrl: n?.fileUrl,
|
|
31594
|
-
fileName: n?.fileName ||
|
|
31595
|
-
fileType: n?.fileType ||
|
|
31596
|
-
fileSize: n?.fileSize ||
|
|
31589
|
+
fileName: n?.fileName || j.name,
|
|
31590
|
+
fileType: n?.fileType || j.type,
|
|
31591
|
+
fileSize: n?.fileSize || j.size
|
|
31597
31592
|
}
|
|
31598
31593
|
});
|
|
31599
31594
|
} catch (e) {
|
|
@@ -31603,8 +31598,8 @@ function Rk() {
|
|
|
31603
31598
|
}
|
|
31604
31599
|
return;
|
|
31605
31600
|
}
|
|
31606
|
-
let n =
|
|
31607
|
-
|
|
31601
|
+
let n = st.trim();
|
|
31602
|
+
ct(""), ut(null), await D(n, "", t);
|
|
31608
31603
|
}, Bt = o(() => {
|
|
31609
31604
|
r.length !== 0 && me?.();
|
|
31610
31605
|
}, [r.length, me]), Vt = (e) => {
|
|
@@ -31653,9 +31648,9 @@ function Rk() {
|
|
|
31653
31648
|
bottom: "1.5rem"
|
|
31654
31649
|
}, Wt = o(() => {
|
|
31655
31650
|
k !== "minimized_orb" && (Ot(!0), setTimeout(() => {
|
|
31656
|
-
|
|
31651
|
+
ot("minimized_orb"), Ot(!1), T && Et(!0);
|
|
31657
31652
|
}, 280));
|
|
31658
|
-
}, [T, k]), Gt = () =>
|
|
31653
|
+
}, [T, k]), Gt = () => ot("connection_modal"), Kt = () => {
|
|
31659
31654
|
try {
|
|
31660
31655
|
let e = window.AudioContext || window.webkitAudioContext;
|
|
31661
31656
|
if (e) {
|
|
@@ -31663,9 +31658,9 @@ function Rk() {
|
|
|
31663
31658
|
t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
|
|
31664
31659
|
}
|
|
31665
31660
|
} catch {}
|
|
31666
|
-
ce({ notifyChatInitiated: !0 }), ue?.(!0),
|
|
31661
|
+
ce({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31667
31662
|
}, qt = () => {
|
|
31668
|
-
ce({ notifyChatInitiated: !0 }), ue?.(!1),
|
|
31663
|
+
ce({ notifyChatInitiated: !0 }), ue?.(!1), ot("text_chat");
|
|
31669
31664
|
}, Jt = () => {
|
|
31670
31665
|
ue?.(!1), Wt();
|
|
31671
31666
|
};
|
|
@@ -31759,7 +31754,7 @@ function Rk() {
|
|
|
31759
31754
|
marginTop: "2px",
|
|
31760
31755
|
whiteSpace: "nowrap"
|
|
31761
31756
|
},
|
|
31762
|
-
children: ee === "connected" ? `${Vt(
|
|
31757
|
+
children: ee === "connected" ? `${Vt(_t)} with ${tt}` : `Tap to return to ${tt}`
|
|
31763
31758
|
})]
|
|
31764
31759
|
})]
|
|
31765
31760
|
}), /* @__PURE__ */ g(jk, {
|
|
@@ -31794,7 +31789,7 @@ function Rk() {
|
|
|
31794
31789
|
incomingCall: w,
|
|
31795
31790
|
activeCallId: T,
|
|
31796
31791
|
callConnectionState: ee,
|
|
31797
|
-
callDurationSeconds:
|
|
31792
|
+
callDurationSeconds: _t,
|
|
31798
31793
|
isCallMuted: ne,
|
|
31799
31794
|
agentName: tt,
|
|
31800
31795
|
agentHeadshot: nt,
|
|
@@ -31826,35 +31821,35 @@ function Rk() {
|
|
|
31826
31821
|
agentName: tt,
|
|
31827
31822
|
agentHeadshot: nt,
|
|
31828
31823
|
fallbackAgentName: He,
|
|
31829
|
-
input:
|
|
31830
|
-
setInput:
|
|
31824
|
+
input: st,
|
|
31825
|
+
setInput: ct,
|
|
31831
31826
|
onSubmit: zt,
|
|
31832
31827
|
isConversationEnded: C,
|
|
31833
31828
|
isLoading: b,
|
|
31834
31829
|
isRateLimited: x,
|
|
31835
31830
|
rateLimitMessage: S,
|
|
31836
|
-
selectedFile:
|
|
31831
|
+
selectedFile: j,
|
|
31837
31832
|
onFileSelect: Ft,
|
|
31838
31833
|
onRemoveSelectedFile: Pt,
|
|
31839
31834
|
attachmentError: xt,
|
|
31840
31835
|
isUploadingAttachment: Ct,
|
|
31841
31836
|
requiresEmail: jt,
|
|
31842
|
-
emailInput:
|
|
31843
|
-
setEmailInput:
|
|
31844
|
-
emailError:
|
|
31845
|
-
emailCaptureSuccess:
|
|
31846
|
-
replyContext:
|
|
31847
|
-
setReplyContext:
|
|
31837
|
+
emailInput: dt,
|
|
31838
|
+
setEmailInput: ft,
|
|
31839
|
+
emailError: pt,
|
|
31840
|
+
emailCaptureSuccess: ht,
|
|
31841
|
+
replyContext: lt,
|
|
31842
|
+
setReplyContext: ut,
|
|
31848
31843
|
webRTCError: re,
|
|
31849
|
-
micError:
|
|
31850
|
-
setMicError:
|
|
31844
|
+
micError: vt,
|
|
31845
|
+
setMicError: yt,
|
|
31851
31846
|
dismissCallError: ye,
|
|
31852
31847
|
activeCallId: T,
|
|
31853
31848
|
isCallMuted: ne,
|
|
31854
31849
|
toggleCallMute: ve,
|
|
31855
31850
|
endWebRTCCall: _e,
|
|
31856
31851
|
formatCallDuration: Vt,
|
|
31857
|
-
callDurationSeconds:
|
|
31852
|
+
callDurationSeconds: _t,
|
|
31858
31853
|
onCollapse: Wt,
|
|
31859
31854
|
onStartVoice: Kt,
|
|
31860
31855
|
onNewChat: Bt,
|