@flowengage/react-chatbot 6.0.32 → 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,27 +31400,27 @@ function Rk() {
|
|
|
31400
31400
|
pr();
|
|
31401
31401
|
} catch {}
|
|
31402
31402
|
}, []), c(() => {
|
|
31403
|
-
Ee &&
|
|
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 || {},
|
|
31407
31407
|
...ke.branding || {}
|
|
31408
|
-
},
|
|
31408
|
+
}, je = {
|
|
31409
31409
|
...Oe.theme || {},
|
|
31410
31410
|
...ke.theme || {}
|
|
31411
|
-
},
|
|
31411
|
+
}, Ne = {
|
|
31412
31412
|
...Oe.features || {},
|
|
31413
31413
|
...ke.features || {}
|
|
31414
|
-
},
|
|
31414
|
+
}, Pe = Ne.voice !== !1, Ie = Array.isArray(je.orbColors) && je.orbColors.length > 0 ? je.orbColors : null, Le = je.buttonColor || je.primaryColor || Ie?.[0] || "#3B82F6", ze = {
|
|
31415
31415
|
small: 50,
|
|
31416
31416
|
medium: 64,
|
|
31417
31417
|
large: 80
|
|
31418
|
-
},
|
|
31418
|
+
}, Be = ze[je.orbSize] || ze.small, Ve = je.position || "bottom-right", He = Ae.fallbackAgentName || "Agent", O = Tk(Ie ?? je.chatBgColors), Ue = Ae.logo || Ae.logoUrl || null, We = E || "en", Ge = Oe.recommendations?.[We] || [], Ke = (ke.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
31419
31419
|
id: e.key || `qr-${t}`,
|
|
31420
31420
|
label: e.label,
|
|
31421
31421
|
message: e.label,
|
|
31422
31422
|
text: e.label
|
|
31423
|
-
})),
|
|
31423
|
+
})), qe = Array.isArray(Ae.quickChatOptions) && Ae.quickChatOptions.length > 0 ? Ae.quickChatOptions : Ke, Je = Ae.hideWatermark === !0 ? !1 : Ae.showPoweredBy !== !1, Ye = Ae.chatbotEnabled !== !1 && je.chatbotEnabled !== !1, Xe = Oe.greetings?.[E] || ke.greetings?.[E] || Ae.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ze = {
|
|
31424
31424
|
entryPrompt: Ae.entryPrompt || "Do you want to explore in a new way?",
|
|
31425
31425
|
yesLabel: Ae.yesLabel || "Yes",
|
|
31426
31426
|
laterLabel: Ae.laterLabel || "Later",
|
|
@@ -31428,20 +31428,20 @@ function Rk() {
|
|
|
31428
31428
|
voiceLabel: Ae.voiceLabel || "Voice",
|
|
31429
31429
|
textLabel: Ae.textLabel || "Text",
|
|
31430
31430
|
chatTitle: Ae.headerName || "Chat with FlowEngage",
|
|
31431
|
-
introGreeting:
|
|
31431
|
+
introGreeting: Xe,
|
|
31432
31432
|
inputPlaceholder: Ae.inputPlaceholder || "Type your message",
|
|
31433
31433
|
analysingLabel: Ae.analysingLabel || "analysing..."
|
|
31434
|
-
},
|
|
31434
|
+
}, Qe = ke.elevenLabsAgentId || t?.elevenLabsAgentId || null, $e = t?.siteId || n?.siteId || null, et = t?.apiBaseUrl || "", tt = f(() => l && String(l).trim() || t?.ownerName && String(t.ownerName).trim() || t?.websiteName && String(t.websiteName).trim() || "Agent", [
|
|
31435
31435
|
l,
|
|
31436
31436
|
t?.ownerName,
|
|
31437
31437
|
t?.websiteName
|
|
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]),
|
|
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
|
-
if (e !== "ready" ||
|
|
31444
|
-
if (
|
|
31443
|
+
if (e !== "ready" || At.current) return;
|
|
31444
|
+
if (At.current = !0, !Pe) {
|
|
31445
31445
|
ot("minimized_orb");
|
|
31446
31446
|
return;
|
|
31447
31447
|
}
|
|
@@ -31449,8 +31449,7 @@ function Rk() {
|
|
|
31449
31449
|
try {
|
|
31450
31450
|
t = Tr().shouldResumeVoice;
|
|
31451
31451
|
} catch {}
|
|
31452
|
-
|
|
31453
|
-
if (t) {
|
|
31452
|
+
if (Fe(), t) {
|
|
31454
31453
|
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31455
31454
|
return;
|
|
31456
31455
|
}
|
|
@@ -31458,96 +31457,92 @@ function Rk() {
|
|
|
31458
31457
|
ce?.({ notifyChatInitiated: !1 }), ot("text_chat");
|
|
31459
31458
|
return;
|
|
31460
31459
|
}
|
|
31461
|
-
if (
|
|
31462
|
-
|
|
31463
|
-
return;
|
|
31464
|
-
}
|
|
31465
|
-
if (et) try {
|
|
31466
|
-
Me(et);
|
|
31460
|
+
if ($e) try {
|
|
31461
|
+
Me($e);
|
|
31467
31462
|
} catch {}
|
|
31468
|
-
if (fe(
|
|
31463
|
+
if (fe($e)) {
|
|
31469
31464
|
ot("minimized_orb");
|
|
31470
31465
|
return;
|
|
31471
31466
|
}
|
|
31472
31467
|
}, [e, r]);
|
|
31473
|
-
let [
|
|
31468
|
+
let [Mt, Nt] = m(() => typeof window < "u" && window.matchMedia("(max-width: 640px)").matches);
|
|
31474
31469
|
c(() => {
|
|
31475
|
-
let e = window.matchMedia("(max-width: 640px)"), t = (e) =>
|
|
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
|
-
let
|
|
31481
|
-
|
|
31482
|
-
}, []),
|
|
31475
|
+
let Pt = o(() => {
|
|
31476
|
+
bt(null), St("");
|
|
31477
|
+
}, []), Ft = o((e) => {
|
|
31483
31478
|
let t = qD(e);
|
|
31484
31479
|
if (t) {
|
|
31485
|
-
|
|
31480
|
+
bt(null), St(t);
|
|
31486
31481
|
return;
|
|
31487
31482
|
}
|
|
31488
|
-
|
|
31483
|
+
bt(e), St("");
|
|
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
|
-
let
|
|
31504
|
-
ot("call_screen"),
|
|
31505
|
-
}, []),
|
|
31506
|
-
ot("text_chat"),
|
|
31498
|
+
let It = o(() => {
|
|
31499
|
+
ot("call_screen"), Et(!1);
|
|
31500
|
+
}, []), Lt = o(() => {
|
|
31501
|
+
ot("text_chat"), Et(!0);
|
|
31507
31502
|
}, []);
|
|
31508
31503
|
c(() => {
|
|
31509
31504
|
let e = w?.callId || T || null;
|
|
31510
31505
|
if (!e) {
|
|
31511
|
-
|
|
31506
|
+
kt.current = null;
|
|
31512
31507
|
return;
|
|
31513
31508
|
}
|
|
31514
31509
|
if (w?.callId || ee === "connecting" || ee === "connected") {
|
|
31515
|
-
if (
|
|
31516
|
-
|
|
31510
|
+
if (k === "minimized_orb" && Tt && T && !w?.callId) {
|
|
31511
|
+
kt.current = e;
|
|
31517
31512
|
return;
|
|
31518
31513
|
}
|
|
31519
|
-
!(!i ||
|
|
31514
|
+
!(!i || k === "minimized_orb" || k === "voice_mode") && kt.current === e || (console.log("[FlowEngageWidget] forcing call UI to front", {
|
|
31520
31515
|
forcedKey: e,
|
|
31521
31516
|
isOpen: i,
|
|
31522
|
-
surface:
|
|
31517
|
+
surface: k,
|
|
31523
31518
|
hasIncomingCall: !!w?.callId,
|
|
31524
31519
|
activeCallId: T,
|
|
31525
31520
|
callConnectionState: ee
|
|
31526
|
-
}),
|
|
31521
|
+
}), kt.current = e, k === "voice_mode" && ue?.(!1), ce?.(), It());
|
|
31527
31522
|
}
|
|
31528
31523
|
}, [
|
|
31529
31524
|
T,
|
|
31530
31525
|
ee,
|
|
31531
|
-
|
|
31526
|
+
It,
|
|
31532
31527
|
w?.callId,
|
|
31533
31528
|
i,
|
|
31534
31529
|
ce,
|
|
31535
31530
|
ue,
|
|
31536
|
-
|
|
31531
|
+
k
|
|
31537
31532
|
]), c(() => {
|
|
31538
|
-
!w && !T &&
|
|
31533
|
+
!w && !T && k === "call_screen" && ot("text_chat");
|
|
31539
31534
|
}, [
|
|
31540
31535
|
w,
|
|
31541
31536
|
T,
|
|
31542
|
-
|
|
31537
|
+
k
|
|
31543
31538
|
]), c(() => {
|
|
31544
|
-
!T &&
|
|
31545
|
-
}, [T,
|
|
31539
|
+
!T && Tt && Et(!1);
|
|
31540
|
+
}, [T, Tt]), c(() => {
|
|
31546
31541
|
if (!s || C) {
|
|
31547
31542
|
Se?.(""), xe?.();
|
|
31548
31543
|
return;
|
|
31549
31544
|
}
|
|
31550
|
-
if (!st.trim() ||
|
|
31545
|
+
if (!st.trim() || j) {
|
|
31551
31546
|
Se?.("");
|
|
31552
31547
|
let e = window.setTimeout(() => xe?.(), 100);
|
|
31553
31548
|
return () => window.clearTimeout(e);
|
|
@@ -31559,20 +31554,20 @@ function Rk() {
|
|
|
31559
31554
|
};
|
|
31560
31555
|
}, [
|
|
31561
31556
|
st,
|
|
31562
|
-
|
|
31557
|
+
j,
|
|
31563
31558
|
s,
|
|
31564
31559
|
C,
|
|
31565
31560
|
be,
|
|
31566
31561
|
xe,
|
|
31567
31562
|
Se
|
|
31568
31563
|
]);
|
|
31569
|
-
let
|
|
31564
|
+
let Rt = (e) => e ? {
|
|
31570
31565
|
replyTo: e.messageId || e.id || null,
|
|
31571
31566
|
replyToContent: (e.replyToContent || e.message || "").replace(/<[^>]+>/g, "").trim().slice(0, 200),
|
|
31572
31567
|
replyToSender: e.sender || null
|
|
31573
|
-
} : null,
|
|
31568
|
+
} : null, zt = async (e) => {
|
|
31574
31569
|
if (e.preventDefault(), C) return;
|
|
31575
|
-
if (
|
|
31570
|
+
if (jt) {
|
|
31576
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.");
|
|
@@ -31581,36 +31576,36 @@ function Rk() {
|
|
|
31581
31576
|
await le(e), mt(""), gt(!0), setTimeout(() => gt(!1), 3e3);
|
|
31582
31577
|
return;
|
|
31583
31578
|
}
|
|
31584
|
-
let t =
|
|
31585
|
-
if (!st.trim() && !
|
|
31586
|
-
if (
|
|
31579
|
+
let t = Rt(lt);
|
|
31580
|
+
if (!st.trim() && !j) return;
|
|
31581
|
+
if (j) {
|
|
31587
31582
|
try {
|
|
31588
|
-
|
|
31589
|
-
let e = await se(
|
|
31590
|
-
ct(""), ut(null),
|
|
31583
|
+
wt(!0), St("");
|
|
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) {
|
|
31600
|
-
|
|
31595
|
+
St(e?.message || "Failed to upload the selected file.");
|
|
31601
31596
|
} finally {
|
|
31602
|
-
|
|
31597
|
+
wt(!1);
|
|
31603
31598
|
}
|
|
31604
31599
|
return;
|
|
31605
31600
|
}
|
|
31606
31601
|
let n = st.trim();
|
|
31607
31602
|
ct(""), ut(null), await D(n, "", t);
|
|
31608
|
-
},
|
|
31603
|
+
}, Bt = o(() => {
|
|
31609
31604
|
r.length !== 0 && me?.();
|
|
31610
|
-
}, [r.length, me]),
|
|
31605
|
+
}, [r.length, me]), Vt = (e) => {
|
|
31611
31606
|
let t = Math.floor(e / 60);
|
|
31612
31607
|
return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
|
|
31613
|
-
},
|
|
31608
|
+
}, Ht = o(async (e) => {
|
|
31614
31609
|
if (C || b) return;
|
|
31615
31610
|
let t = e.message || e.label || e.text || "";
|
|
31616
31611
|
t.trim() && await D(t.trim(), "");
|
|
@@ -31618,44 +31613,44 @@ function Rk() {
|
|
|
31618
31613
|
C,
|
|
31619
31614
|
b,
|
|
31620
31615
|
D
|
|
31621
|
-
]),
|
|
31616
|
+
]), Ut = Mt && k === "entry_prompt" ? { inset: 0 } : Mt && k === "text_chat" ? {
|
|
31622
31617
|
left: 0,
|
|
31623
31618
|
right: 0,
|
|
31624
31619
|
bottom: 0
|
|
31625
|
-
} :
|
|
31620
|
+
} : Mt && k === "call_screen" ? {
|
|
31626
31621
|
left: 0,
|
|
31627
31622
|
right: 0,
|
|
31628
31623
|
bottom: 0,
|
|
31629
31624
|
height: "90dvh",
|
|
31630
31625
|
overflow: "hidden",
|
|
31631
31626
|
borderRadius: "16px 16px 0 0"
|
|
31632
|
-
} :
|
|
31627
|
+
} : Mt && k === "connection_modal" ? {
|
|
31633
31628
|
left: "12px",
|
|
31634
31629
|
right: "12px",
|
|
31635
31630
|
bottom: "12px"
|
|
31636
|
-
} :
|
|
31631
|
+
} : k === "call_screen" ? {
|
|
31637
31632
|
width: "min(350px, calc(100vw - 40px))",
|
|
31638
31633
|
height: "min(640px, calc(100vh - 120px))",
|
|
31639
31634
|
borderRadius: "22px",
|
|
31640
31635
|
overflow: "hidden",
|
|
31641
|
-
...
|
|
31636
|
+
...Ve === "bottom-left" ? {
|
|
31642
31637
|
left: "1.5rem",
|
|
31643
31638
|
bottom: "1.5rem"
|
|
31644
31639
|
} : {
|
|
31645
31640
|
right: "1.5rem",
|
|
31646
31641
|
bottom: "1.5rem"
|
|
31647
31642
|
}
|
|
31648
|
-
} :
|
|
31643
|
+
} : Ve === "bottom-left" ? {
|
|
31649
31644
|
left: "1.5rem",
|
|
31650
31645
|
bottom: "1.5rem"
|
|
31651
31646
|
} : {
|
|
31652
31647
|
right: "1.5rem",
|
|
31653
31648
|
bottom: "1.5rem"
|
|
31654
|
-
},
|
|
31655
|
-
|
|
31656
|
-
ot("minimized_orb"),
|
|
31649
|
+
}, Wt = o(() => {
|
|
31650
|
+
k !== "minimized_orb" && (Ot(!0), setTimeout(() => {
|
|
31651
|
+
ot("minimized_orb"), Ot(!1), T && Et(!0);
|
|
31657
31652
|
}, 280));
|
|
31658
|
-
}, [T,
|
|
31653
|
+
}, [T, k]), Gt = () => ot("connection_modal"), Kt = () => {
|
|
31659
31654
|
try {
|
|
31660
31655
|
let e = window.AudioContext || window.webkitAudioContext;
|
|
31661
31656
|
if (e) {
|
|
@@ -31664,35 +31659,35 @@ function Rk() {
|
|
|
31664
31659
|
}
|
|
31665
31660
|
} catch {}
|
|
31666
31661
|
ce({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31667
|
-
},
|
|
31662
|
+
}, qt = () => {
|
|
31668
31663
|
ce({ notifyChatInitiated: !0 }), ue?.(!1), ot("text_chat");
|
|
31669
|
-
},
|
|
31670
|
-
ue?.(!1),
|
|
31664
|
+
}, Jt = () => {
|
|
31665
|
+
ue?.(!1), Wt();
|
|
31671
31666
|
};
|
|
31672
|
-
return e !== "ready" || !
|
|
31667
|
+
return e !== "ready" || !Ye || Ne.chat === !1 ? null : /* @__PURE__ */ _("div", {
|
|
31673
31668
|
className: "flowengage-widget-root",
|
|
31674
31669
|
style: {
|
|
31675
31670
|
position: "fixed",
|
|
31676
31671
|
zIndex: 999999,
|
|
31677
|
-
...
|
|
31672
|
+
...Ut
|
|
31678
31673
|
},
|
|
31679
31674
|
onWheel: (e) => e.stopPropagation(),
|
|
31680
31675
|
onTouchMove: (e) => e.stopPropagation(),
|
|
31681
31676
|
children: [
|
|
31682
|
-
|
|
31683
|
-
copy:
|
|
31684
|
-
orbColors:
|
|
31685
|
-
primaryColor:
|
|
31677
|
+
k === "entry_prompt" && /* @__PURE__ */ g(Mk, {
|
|
31678
|
+
copy: Ze,
|
|
31679
|
+
orbColors: Ie,
|
|
31680
|
+
primaryColor: Le,
|
|
31686
31681
|
onYes: () => {
|
|
31687
|
-
pe(
|
|
31682
|
+
pe($e), Kt();
|
|
31688
31683
|
},
|
|
31689
31684
|
onLater: () => {
|
|
31690
|
-
pe(
|
|
31685
|
+
pe($e), Wt();
|
|
31691
31686
|
},
|
|
31692
|
-
isMobile:
|
|
31693
|
-
isClosing:
|
|
31687
|
+
isMobile: Mt,
|
|
31688
|
+
isClosing: Dt
|
|
31694
31689
|
}),
|
|
31695
|
-
|
|
31690
|
+
k === "minimized_orb" && /* @__PURE__ */ _(Dm.div, {
|
|
31696
31691
|
layoutId: "fe-main-orb",
|
|
31697
31692
|
initial: {
|
|
31698
31693
|
scale: .4,
|
|
@@ -31711,14 +31706,14 @@ function Rk() {
|
|
|
31711
31706
|
transformOrigin: "bottom right",
|
|
31712
31707
|
display: "inline-flex",
|
|
31713
31708
|
flexDirection: "column",
|
|
31714
|
-
alignItems:
|
|
31709
|
+
alignItems: Ve === "bottom-left" ? "flex-start" : "flex-end",
|
|
31715
31710
|
gap: "10px"
|
|
31716
31711
|
},
|
|
31717
31712
|
children: [T && /* @__PURE__ */ _("button", {
|
|
31718
31713
|
type: "button",
|
|
31719
|
-
onClick:
|
|
31714
|
+
onClick: It,
|
|
31720
31715
|
style: {
|
|
31721
|
-
maxWidth:
|
|
31716
|
+
maxWidth: Mt ? "220px" : "240px",
|
|
31722
31717
|
padding: "10px 14px",
|
|
31723
31718
|
borderRadius: "18px",
|
|
31724
31719
|
border: "1px solid rgba(255,255,255,0.7)",
|
|
@@ -31759,86 +31754,86 @@ function Rk() {
|
|
|
31759
31754
|
marginTop: "2px",
|
|
31760
31755
|
whiteSpace: "nowrap"
|
|
31761
31756
|
},
|
|
31762
|
-
children: ee === "connected" ? `${
|
|
31757
|
+
children: ee === "connected" ? `${Vt(_t)} with ${tt}` : `Tap to return to ${tt}`
|
|
31763
31758
|
})]
|
|
31764
31759
|
})]
|
|
31765
31760
|
}), /* @__PURE__ */ g(jk, {
|
|
31766
|
-
size:
|
|
31767
|
-
orbColors:
|
|
31768
|
-
onClick: T ?
|
|
31761
|
+
size: Be,
|
|
31762
|
+
orbColors: Ie,
|
|
31763
|
+
onClick: T ? It : Pe ? Gt : qt
|
|
31769
31764
|
})]
|
|
31770
31765
|
}),
|
|
31771
|
-
|
|
31772
|
-
copy:
|
|
31773
|
-
orbColors:
|
|
31774
|
-
primaryColor:
|
|
31775
|
-
onVoice:
|
|
31776
|
-
onText:
|
|
31777
|
-
onClose:
|
|
31778
|
-
isMobile:
|
|
31779
|
-
isClosing:
|
|
31766
|
+
k === "connection_modal" && /* @__PURE__ */ g(Nk, {
|
|
31767
|
+
copy: Ze,
|
|
31768
|
+
orbColors: Ie,
|
|
31769
|
+
primaryColor: Le,
|
|
31770
|
+
onVoice: Kt,
|
|
31771
|
+
onText: qt,
|
|
31772
|
+
onClose: Wt,
|
|
31773
|
+
isMobile: Mt,
|
|
31774
|
+
isClosing: Dt
|
|
31780
31775
|
}),
|
|
31781
|
-
|
|
31782
|
-
orbColors:
|
|
31783
|
-
onEnterChat:
|
|
31784
|
-
onEndChat:
|
|
31785
|
-
agentId:
|
|
31786
|
-
siteId:
|
|
31787
|
-
apiBaseUrl:
|
|
31776
|
+
k === "voice_mode" && /* @__PURE__ */ g(Pk, {
|
|
31777
|
+
orbColors: Ie,
|
|
31778
|
+
onEnterChat: qt,
|
|
31779
|
+
onEndChat: Jt,
|
|
31780
|
+
agentId: Qe,
|
|
31781
|
+
siteId: $e,
|
|
31782
|
+
apiBaseUrl: et,
|
|
31788
31783
|
chatId: ie,
|
|
31789
31784
|
historyRef: ae,
|
|
31790
31785
|
onMessageSync: oe,
|
|
31791
31786
|
voiceEndCounter: De
|
|
31792
31787
|
}, "voice"),
|
|
31793
|
-
|
|
31788
|
+
k === "call_screen" && /* @__PURE__ */ g(gO, {
|
|
31794
31789
|
incomingCall: w,
|
|
31795
31790
|
activeCallId: T,
|
|
31796
31791
|
callConnectionState: ee,
|
|
31797
|
-
callDurationSeconds:
|
|
31792
|
+
callDurationSeconds: _t,
|
|
31798
31793
|
isCallMuted: ne,
|
|
31799
|
-
agentName:
|
|
31800
|
-
agentHeadshot:
|
|
31801
|
-
fallbackAgentName:
|
|
31794
|
+
agentName: tt,
|
|
31795
|
+
agentHeadshot: nt,
|
|
31796
|
+
fallbackAgentName: He,
|
|
31802
31797
|
acceptCall: he,
|
|
31803
31798
|
rejectCall: ge,
|
|
31804
31799
|
endWebRTCCall: _e,
|
|
31805
31800
|
toggleCallMute: ve,
|
|
31806
|
-
formatCallDuration:
|
|
31807
|
-
onMinimize:
|
|
31808
|
-
primaryColor:
|
|
31809
|
-
orbColors:
|
|
31801
|
+
formatCallDuration: Vt,
|
|
31802
|
+
onMinimize: Lt,
|
|
31803
|
+
primaryColor: Le,
|
|
31804
|
+
orbColors: Ie,
|
|
31810
31805
|
chatHistory: r
|
|
31811
31806
|
}),
|
|
31812
|
-
|
|
31813
|
-
isClosing:
|
|
31814
|
-
copy:
|
|
31815
|
-
orbColors:
|
|
31816
|
-
primaryColor:
|
|
31817
|
-
chatBgGradient:
|
|
31818
|
-
logo:
|
|
31819
|
-
quickChatOptions:
|
|
31820
|
-
onQuickChatSelect:
|
|
31821
|
-
isMobile:
|
|
31807
|
+
k === "text_chat" && /* @__PURE__ */ g(Lk, {
|
|
31808
|
+
isClosing: Dt,
|
|
31809
|
+
copy: Ze,
|
|
31810
|
+
orbColors: Ie,
|
|
31811
|
+
primaryColor: Le,
|
|
31812
|
+
chatBgGradient: O,
|
|
31813
|
+
logo: Ue,
|
|
31814
|
+
quickChatOptions: qe,
|
|
31815
|
+
onQuickChatSelect: Ht,
|
|
31816
|
+
isMobile: Mt,
|
|
31822
31817
|
chatHistory: r,
|
|
31823
31818
|
isAiTyping: y,
|
|
31824
31819
|
isAgentTyping: v,
|
|
31825
31820
|
activeScreen: a,
|
|
31826
|
-
agentName:
|
|
31827
|
-
agentHeadshot:
|
|
31828
|
-
fallbackAgentName:
|
|
31821
|
+
agentName: tt,
|
|
31822
|
+
agentHeadshot: nt,
|
|
31823
|
+
fallbackAgentName: He,
|
|
31829
31824
|
input: st,
|
|
31830
31825
|
setInput: ct,
|
|
31831
|
-
onSubmit:
|
|
31826
|
+
onSubmit: zt,
|
|
31832
31827
|
isConversationEnded: C,
|
|
31833
31828
|
isLoading: b,
|
|
31834
31829
|
isRateLimited: x,
|
|
31835
31830
|
rateLimitMessage: S,
|
|
31836
|
-
selectedFile:
|
|
31837
|
-
onFileSelect:
|
|
31838
|
-
onRemoveSelectedFile:
|
|
31839
|
-
attachmentError:
|
|
31840
|
-
isUploadingAttachment:
|
|
31841
|
-
requiresEmail:
|
|
31831
|
+
selectedFile: j,
|
|
31832
|
+
onFileSelect: Ft,
|
|
31833
|
+
onRemoveSelectedFile: Pt,
|
|
31834
|
+
attachmentError: xt,
|
|
31835
|
+
isUploadingAttachment: Ct,
|
|
31836
|
+
requiresEmail: jt,
|
|
31842
31837
|
emailInput: dt,
|
|
31843
31838
|
setEmailInput: ft,
|
|
31844
31839
|
emailError: pt,
|
|
@@ -31853,15 +31848,15 @@ function Rk() {
|
|
|
31853
31848
|
isCallMuted: ne,
|
|
31854
31849
|
toggleCallMute: ve,
|
|
31855
31850
|
endWebRTCCall: _e,
|
|
31856
|
-
formatCallDuration:
|
|
31857
|
-
callDurationSeconds:
|
|
31858
|
-
onCollapse:
|
|
31859
|
-
onStartVoice:
|
|
31860
|
-
onNewChat:
|
|
31861
|
-
onMinimize:
|
|
31862
|
-
onExpand:
|
|
31851
|
+
formatCallDuration: Vt,
|
|
31852
|
+
callDurationSeconds: _t,
|
|
31853
|
+
onCollapse: Wt,
|
|
31854
|
+
onStartVoice: Kt,
|
|
31855
|
+
onNewChat: Bt,
|
|
31856
|
+
onMinimize: Lt,
|
|
31857
|
+
onExpand: It,
|
|
31863
31858
|
isCallMinimized: !!T,
|
|
31864
|
-
showPoweredBy:
|
|
31859
|
+
showPoweredBy: Je,
|
|
31865
31860
|
getVisitorChatHistory: Ce,
|
|
31866
31861
|
resumeChat: we,
|
|
31867
31862
|
isSessionRestoring: Te
|