@flowengage/react-chatbot 6.0.34 → 6.0.35
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
|
+
}, A = typeof ArrayBuffer == "function", ot = (e, t) => {
|
|
510
510
|
if (typeof e != "string") return {
|
|
511
511
|
type: "message",
|
|
512
|
-
data:
|
|
512
|
+
data: ct(e, t)
|
|
513
513
|
};
|
|
514
514
|
let n = e.charAt(0);
|
|
515
515
|
return n === "b" ? {
|
|
516
516
|
type: "message",
|
|
517
|
-
data:
|
|
517
|
+
data: st(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
|
+
}, st = (e, t) => A ? ct(k(e), t) : {
|
|
523
523
|
base64: !0,
|
|
524
524
|
data: e
|
|
525
|
-
},
|
|
525
|
+
}, ct = (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
|
+
}, lt = "", ut = (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(lt));
|
|
535
535
|
});
|
|
536
536
|
});
|
|
537
|
-
},
|
|
538
|
-
let n = e.split(
|
|
537
|
+
}, dt = (e, t) => {
|
|
538
|
+
let n = e.split(lt), r = [];
|
|
539
539
|
for (let e = 0; e < n.length; e++) {
|
|
540
|
-
let i =
|
|
540
|
+
let i = ot(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 ft() {
|
|
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 pt() {
|
|
|
560
560
|
});
|
|
561
561
|
} });
|
|
562
562
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
563
|
+
var pt;
|
|
564
|
+
function mt(e) {
|
|
565
565
|
return e.reduce((e, t) => e + t.length, 0);
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function ht(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 gt(e, t) {
|
|
574
|
+
pt ||= 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 (mt(n) < 1) break;
|
|
580
|
+
let e = ht(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 (mt(n) < 2) break;
|
|
584
|
+
let e = ht(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 (mt(n) < 8) break;
|
|
588
|
+
let e = ht(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 (mt(n) < i) break;
|
|
596
|
+
let e = ht(n, i);
|
|
597
|
+
s.enqueue(ot(a ? e : pt.decode(e), t)), r = 0;
|
|
598
598
|
}
|
|
599
599
|
if (i === 0 || i > e) {
|
|
600
600
|
s.enqueue(Ye);
|
|
@@ -605,21 +605,21 @@ function _t(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 j(e) {
|
|
609
|
+
if (e) return _t(e);
|
|
610
610
|
}
|
|
611
|
-
function
|
|
612
|
-
for (var t in
|
|
611
|
+
function _t(e) {
|
|
612
|
+
for (var t in j.prototype) e[t] = j.prototype[t];
|
|
613
613
|
return e;
|
|
614
614
|
}
|
|
615
|
-
|
|
615
|
+
j.prototype.on = j.prototype.addEventListener = function(e, t) {
|
|
616
616
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t), this;
|
|
617
|
-
},
|
|
617
|
+
}, j.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
|
+
}, j.prototype.off = j.prototype.removeListener = j.prototype.removeAllListeners = j.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 @@ A.prototype.on = A.prototype.addEventListener = function(e, t) {
|
|
|
629
629
|
break;
|
|
630
630
|
}
|
|
631
631
|
return n.length === 0 && delete this._callbacks["$" + e], this;
|
|
632
|
-
},
|
|
632
|
+
}, j.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 @@ A.prototype.on = A.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
|
+
}, j.prototype.emitReserved = j.prototype.emit, j.prototype.listeners = function(e) {
|
|
641
641
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + e] || [];
|
|
642
|
-
},
|
|
642
|
+
}, j.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 vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), yt = 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 = yt.setTimeout, Ct = yt.clearTimeout;
|
|
654
654
|
function wt(e, t) {
|
|
655
|
-
t.useNativeTimers ? (e.setTimeoutFn = St.bind(
|
|
655
|
+
t.useNativeTimers ? (e.setTimeoutFn = St.bind(yt), e.clearTimeoutFn = Ct.bind(yt)) : (e.setTimeoutFn = yt.setTimeout.bind(yt), e.clearTimeoutFn = yt.clearTimeout.bind(yt));
|
|
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 j {
|
|
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 = ot(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
|
+
dt(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, ut(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 j {
|
|
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 yt ? "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 yt[["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 && vt(() => {
|
|
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 = yt.WebSocket || yt.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 = gt(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = ft();
|
|
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 && vt(() => {
|
|
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 j {
|
|
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 A {
|
|
|
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, vt(() => {
|
|
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 j {
|
|
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 j {
|
|
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 j {
|
|
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 A {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
1825
|
ondecoded(e) {
|
|
1826
|
-
|
|
1826
|
+
vt(() => {
|
|
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), A = p(""), ot = p(!1), st = p(null), ct = p(null), lt = p(null), ut = p(null), dt = p(null), ft = p(null), pt = p([]), mt = p(null), ht = p(null), gt = p(null), j = p(!1), _t = p(!1), vt = p(""), yt = 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
|
+
ct.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
|
+
gt.current &&= (window.clearTimeout(gt.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 = mt.current || ft.current?.callId, n = St.current, r = yt.current;
|
|
2872
|
+
if (yt.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
|
+
lt.current &&= (lt.current.close(), null), ut.current &&= (ut.current.getTracks().forEach((e) => e.stop()), null), dt.current &&= (dt.current.srcObject = null, dt.current.remove(), null), Mt(), ft.current = null, pt.current = [], mt.current = null, ht.current = null, j.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 = mt.current || ft.current?.callId;
|
|
2901
|
+
if (!(!t?.connected || !n || j.current)) {
|
|
2902
|
+
j.current = !0, t.emit("call:connected", {
|
|
2903
2903
|
callId: n,
|
|
2904
|
-
chatId:
|
|
2904
|
+
chatId: A.current,
|
|
2905
2905
|
connectedAt: e
|
|
2906
2906
|
});
|
|
2907
2907
|
try {
|
|
2908
|
-
let e =
|
|
2909
|
-
if (e && t && !
|
|
2908
|
+
let e = ut.current, t = dt.current?.srcObject;
|
|
2909
|
+
if (e && t && !yt.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
|
+
}, yt.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 = ht.current === e.callId, n = mt.current === e.callId, r = ct.current?.callId === e.callId;
|
|
2949
2949
|
if (!(!t && !n && !r)) {
|
|
2950
2950
|
if (Mt(), Ue(null), t || n) {
|
|
2951
|
-
|
|
2951
|
+
mt.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 = ht.current === e.callId, n = mt.current === e.callId, r = ct.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
|
+
ht.current = null, ft.current = null, pt.current = [], Ue(null), Xe("idle");
|
|
2965
2965
|
}
|
|
2966
2966
|
}, Rt = async (e = {}) => {
|
|
2967
|
-
let t =
|
|
2967
|
+
let t = lt.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: A.current,
|
|
2972
2972
|
hasPeerConnection: !!t,
|
|
2973
2973
|
socketConnected: !!n?.connected,
|
|
2974
2974
|
hasOffer: !!r
|
|
2975
|
-
}),
|
|
2975
|
+
}), ft.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
|
+
})), pt.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: A.current,
|
|
2985
|
+
queuedCount: pt.current.length
|
|
2986
2986
|
});
|
|
2987
|
-
for (let e of
|
|
2988
|
-
|
|
2987
|
+
for (let e of pt.current) await t.addIceCandidate(new RTCIceCandidate(e));
|
|
2988
|
+
pt.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: A.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 = ot.current, r = st.current;
|
|
3021
|
+
if (ot.current = !1, st.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
|
+
A.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(), j.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
|
+
ft.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 (!lt.current || !lt.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 || A.current,
|
|
3181
|
+
queueSize: pt.current.length + 1
|
|
3182
|
+
}), pt.current.push(t);
|
|
3183
3183
|
return;
|
|
3184
3184
|
}
|
|
3185
|
-
await
|
|
3185
|
+
await lt.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 = ht.current === e.callId, n = mt.current === e.callId, r = ft.current?.callId === e.callId, i = ct.current?.callId === e.callId;
|
|
3204
3204
|
if (!t && !n && !r) {
|
|
3205
3205
|
i && (Ue(null), Xe("idle"));
|
|
3206
3206
|
return;
|
|
3207
3207
|
}
|
|
3208
|
-
|
|
3208
|
+
j.current = !0, ht.current = null, mt.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 = A.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 = A.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(), ht.current = O.callId, Mt();
|
|
3286
3286
|
try {
|
|
3287
3287
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
3288
|
-
|
|
3288
|
+
ut.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
|
+
lt.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 (!dt.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) => {}, dt.current = e, document.body.appendChild(e);
|
|
3339
3339
|
}
|
|
3340
|
-
|
|
3341
|
-
let r = O?.callId, i = r && (
|
|
3342
|
-
if (!
|
|
3340
|
+
dt.current.srcObject = e.streams[0];
|
|
3341
|
+
let r = O?.callId, i = r && (ht.current === r || mt.current === r);
|
|
3342
|
+
if (!j.current && i) {
|
|
3343
3343
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
3344
|
-
Xe("connected"), Qe((t) => t || e),
|
|
3344
|
+
Xe("connected"), Qe((t) => t || e), mt.current = r, Je(r), Ft(e);
|
|
3345
3345
|
}
|
|
3346
|
-
|
|
3347
|
-
let a =
|
|
3346
|
+
dt.current.srcObject = t || null;
|
|
3347
|
+
let a = dt.current.play?.();
|
|
3348
3348
|
a?.catch && a.catch((e) => {});
|
|
3349
3349
|
};
|
|
3350
|
-
let r =
|
|
3350
|
+
let r = ft.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
|
+
}), mt.current = O.callId, Je(O.callId), Xe((e) => e === "connected" || j.current ? "connected" : "connecting"), Ue(null), w(!0);
|
|
3361
3361
|
} catch (e) {
|
|
3362
|
-
if (
|
|
3362
|
+
if (ht.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(), gt.current = window.setTimeout(() => {
|
|
3404
|
+
ct.current?.callId === e && ht.current !== e && mt.current !== e && Ut.current();
|
|
3405
3405
|
}, oe), () => {
|
|
3406
|
-
|
|
3406
|
+
gt.current &&= (window.clearTimeout(gt.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 = ut.current?.getAudioTracks?.() || [], t = lt.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 || !A.current) return t;
|
|
3449
3449
|
try {
|
|
3450
3450
|
await k.current.trackVisitor({
|
|
3451
|
-
chatId:
|
|
3451
|
+
chatId: A.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 || _t.current || (_t.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 || !_t.current || (_t.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 !== "" && vt.current === t || (vt.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 = A.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), mt.current) {
|
|
3614
|
+
t.beaconEndWebRTCCall(mt.current, e);
|
|
3615
3615
|
return;
|
|
3616
3616
|
}
|
|
3617
|
-
let n =
|
|
3617
|
+
let n = ht.current || ct.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), ot.current = !0, st.current = null, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3627
3627
|
}, [i?.siteId]), rn = o((e) => {
|
|
3628
|
-
i?.siteId,
|
|
3628
|
+
i?.siteId, ot.current = !1, st.current = e, at.current?.disconnect(), S([]), b(""), A.current = "", He(!1), re(!1), D(null), de(null), it(!0), s((e) => e + 1);
|
|
3629
3629
|
}, [i?.siteId]), an = f(() => ({
|
|
3630
3630
|
status: l,
|
|
3631
3631
|
error: d,
|
|
@@ -29400,8 +29400,8 @@ function Sk(e) {
|
|
|
29400
29400
|
let s = [], c = Date.now() + 8e3;
|
|
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
|
-
let l = s.length ? s.join(" | ") : "none", u = s.length ? "
|
|
29404
|
-
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u} Speak 2-3 sentences
|
|
29403
|
+
let l = s.length ? s.join(" | ") : "none", u = s.length ? "These exact heading strings are available for flowengage_highlight once the visitor approves a walkthrough." : "No DOM headings collected — if the visitor approves a walkthrough, call flowengage_get_current_page first to get fresh headings.";
|
|
29404
|
+
return i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}") | Section headings: ${l}. ${u} REQUIRED: (1) Speak 2-3 natural sentences introducing the ${o} page — what it is and what the visitor will find here. (2) Ask: "Would you like me to walk you through this page in detail?" (3) Wait for their answer. ONLY call flowengage_highlight if they say yes. DO NOT highlight sections before the visitor approves.`) : (wr(), `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}") | Section headings: ${l}. ${u} REQUIRED: (1) Speak 2-3 natural sentences introducing the ${o} page. (2) Ask: "Would you like me to walk you through this page?" (3) Wait for the visitor's answer before calling flowengage_highlight.`);
|
|
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}.
|
|
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.`;
|
|
29503
29503
|
},
|
|
29504
29504
|
flowengage_list_forms: async () => {
|
|
29505
29505
|
let e = XO(), t = ZO();
|
|
@@ -29596,19 +29596,21 @@ function Sk(e) {
|
|
|
29596
29596
|
}
|
|
29597
29597
|
//#endregion
|
|
29598
29598
|
//#region src/utils/wrapVoiceToolsForLogging.js
|
|
29599
|
-
function Ck(e) {
|
|
29600
|
-
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e,
|
|
29601
|
-
let
|
|
29602
|
-
|
|
29603
|
-
let
|
|
29599
|
+
function Ck(e, { onToolStart: t, onToolEnd: n } = {}) {
|
|
29600
|
+
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, r]) => [e, async (i) => {
|
|
29601
|
+
let a = Rn();
|
|
29602
|
+
a ? console.log("[FlowEngage:voice-tool] ▶", e, i) : console.info(`[FlowEngage] voice tool » ${e}`), t?.();
|
|
29603
|
+
let o;
|
|
29604
29604
|
try {
|
|
29605
|
-
|
|
29605
|
+
o = await r(i);
|
|
29606
29606
|
} catch (t) {
|
|
29607
29607
|
let n = `Tool error: ${t?.message || String(t)}`;
|
|
29608
29608
|
return console.error(`[FlowEngage] voice tool ${e} threw:`, t), n;
|
|
29609
|
+
} finally {
|
|
29610
|
+
n?.();
|
|
29609
29611
|
}
|
|
29610
|
-
let
|
|
29611
|
-
return
|
|
29612
|
+
let s = typeof o == "string" ? o.length > 220 ? `${o.slice(0, 220)}…` : o : String(o);
|
|
29613
|
+
return a ? console.log("[FlowEngage:voice-tool] ◀", e, s) : console.info(`[FlowEngage] voice tool « ${e}:`, s), o;
|
|
29612
29614
|
}]));
|
|
29613
29615
|
}
|
|
29614
29616
|
//#endregion
|
|
@@ -30009,14 +30011,14 @@ function Nk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
30009
30011
|
}
|
|
30010
30012
|
function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d }) {
|
|
30011
30013
|
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
30012
|
-
let [f, h] = m("idle"), [v, y] = m(!1), [b, x] = m(!1), S = p(null), C = p(""), w = p(async () => {}), T = p(!1), ee = p(!1), te = p(!1), ne = p(!1), re = p("minimized"), E = p(null), ie = p(null), ae = p(null), oe = p(0), D = p(!1), se = p("idle"), ce = p(!1), le = p(null), ue = p(null), de = p(!1), fe = o((e = "minimized") => {
|
|
30014
|
+
let [f, h] = m("idle"), [v, y] = m(!1), [b, x] = m(!1), S = p(null), C = p(""), w = p(async () => {}), T = p(!1), ee = p(!1), te = p(!1), ne = p(!1), re = p("minimized"), E = p(null), ie = p(null), ae = p(null), oe = p(0), D = p(!1), se = p("idle"), ce = p(!1), le = p(null), ue = p(null), de = p(!1), fe = p(!1), pe = o((e = "minimized") => {
|
|
30013
30015
|
console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
|
|
30014
30016
|
destination: e,
|
|
30015
30017
|
stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
|
|
30016
30018
|
}), re.current = e, ne.current = !0, queueMicrotask(() => {
|
|
30017
30019
|
T.current || (T.current = !0, w.current?.());
|
|
30018
30020
|
});
|
|
30019
|
-
}, [l]),
|
|
30021
|
+
}, [l]), me = o(async (e) => {
|
|
30020
30022
|
ne.current = !0;
|
|
30021
30023
|
try {
|
|
30022
30024
|
SD();
|
|
@@ -30052,10 +30054,10 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30052
30054
|
s,
|
|
30053
30055
|
a
|
|
30054
30056
|
]);
|
|
30055
|
-
return w.current = () =>
|
|
30057
|
+
return w.current = () => me(re.current === "chat" ? t : n), c(() => {
|
|
30056
30058
|
ee.current = v;
|
|
30057
30059
|
}, [v]), c(() => {
|
|
30058
|
-
d &&
|
|
30060
|
+
d && pe("chat");
|
|
30059
30061
|
}, [d]), c(() => {
|
|
30060
30062
|
let e = !1, o = null, c = null, d = null;
|
|
30061
30063
|
return (async () => {
|
|
@@ -30096,7 +30098,14 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30096
30098
|
requestEndSession: () => {
|
|
30097
30099
|
D.current = !0;
|
|
30098
30100
|
}
|
|
30099
|
-
})
|
|
30101
|
+
}), {
|
|
30102
|
+
onToolStart: () => {
|
|
30103
|
+
e || (de.current = !0, ue.current &&= (clearTimeout(ue.current), null), se.current = "thinking", h("thinking"));
|
|
30104
|
+
},
|
|
30105
|
+
onToolEnd: () => {
|
|
30106
|
+
e || (de.current = !1, se.current = "listening", h("listening"));
|
|
30107
|
+
}
|
|
30108
|
+
}), n = i ? je(i) : null, u = !!n?.transcript, f = !!(i && He(i)), p = typeof window < "u" ? window.location.pathname : "/", m = typeof document < "u" ? document.title : "", g = p === "/" || p === "", _ = null;
|
|
30100
30109
|
try {
|
|
30101
30110
|
let e = await fetch(`${a}/api/voice/signed-url?siteId=${encodeURIComponent(i || "")}`, {
|
|
30102
30111
|
method: "GET",
|
|
@@ -30119,8 +30128,8 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30119
30128
|
}, b = (p.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()), x = "";
|
|
30120
30129
|
m && m.includes("|") && (x = m.split("|").map((e) => e.trim()).filter(Boolean).reduce((e, t) => e.length <= t.length ? e : t));
|
|
30121
30130
|
let w = x || b || "this page";
|
|
30122
|
-
_ ? f ? (v.overrides = { agent: { firstMessage: `I've navigated you to the ${w} page
|
|
30123
|
-
let ae = !1,
|
|
30131
|
+
_ ? f ? (v.overrides = { agent: { firstMessage: `I've navigated you to the ${w} page.` } }, console.log(`[FlowEngage] 🔄 Agent-nav resume: firstMessage set for "${w}" (${p})`)) : u ? v.overrides = { agent: { firstMessage: "I'm still here. Go ahead!" } } : g ? v.overrides = { agent: { firstMessage: "Hi there! Let me give you a quick tour of what's available here." } } : (v.overrides = { agent: { firstMessage: `Welcome! You're on the ${w} page — let me walk you through the highlights.` } }, console.log(`[FlowEngage] 🏠 Page-context override: "${w}" for ${p}`)) : u && (v.overrides = { agent: { firstMessage: "" } });
|
|
30132
|
+
let ae = !1, me = f ? `NAVIGATION RESUME: You are on the "${w}" page. Speak 2-3 natural sentences introducing this page — what it is and what the visitor will find here. Then ask exactly: "Would you like me to walk you through this page in detail?" Wait for the visitor's response. ONLY if they say yes/sure/go ahead → call flowengage_highlight section by section. If they decline → respond helpfully and let them explore. DO NOT call flowengage_highlight before the visitor explicitly approves. Prior conversation context:\n${n?.transcript || ""}\n\n` : null, he = !1, ge = !f && !u ? "AUTO-START — Your greeting has been spoken. NOW — without waiting for the visitor to say anything — call flowengage_get_current_page, then immediately highlight the top 3 sections and give a one-sentence summary for each. Keep it brisk — no filler, no questions until the walkthrough is done." : null, _e = await vD.startSession({
|
|
30124
30133
|
...v,
|
|
30125
30134
|
onConnect: ({ conversationId: e }) => {
|
|
30126
30135
|
E.current = e, ie.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
@@ -30129,21 +30138,27 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30129
30138
|
onModeChange: ({ mode: t }) => {
|
|
30130
30139
|
if (!e) {
|
|
30131
30140
|
if (t === "speaking") {
|
|
30132
|
-
ue.current &&= (clearTimeout(ue.current), null), h("speaking"), se.current = "speaking", ce.current = !0,
|
|
30141
|
+
ue.current &&= (clearTimeout(ue.current), null), h("speaking"), se.current = "speaking", ce.current = !0, fe.current = !1, le.current &&= (clearTimeout(le.current), null);
|
|
30133
30142
|
return;
|
|
30134
30143
|
}
|
|
30135
|
-
if (se.current = "listening", D.current) {
|
|
30136
|
-
D.current = !1,
|
|
30144
|
+
if (de.current || (se.current = "listening", h("listening")), D.current) {
|
|
30145
|
+
D.current = !1, pe();
|
|
30137
30146
|
return;
|
|
30138
30147
|
}
|
|
30139
|
-
if (
|
|
30148
|
+
if (me && !ae) {
|
|
30140
30149
|
ae = !0;
|
|
30141
30150
|
try {
|
|
30142
|
-
S.current?.sendUserMessage?.(
|
|
30151
|
+
S.current?.sendUserMessage?.(me);
|
|
30152
|
+
} catch {}
|
|
30153
|
+
}
|
|
30154
|
+
if (ge && !he) {
|
|
30155
|
+
he = !0;
|
|
30156
|
+
try {
|
|
30157
|
+
S.current?.sendContextualUpdate?.(ge);
|
|
30143
30158
|
} catch {}
|
|
30144
30159
|
}
|
|
30145
30160
|
ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
|
|
30146
|
-
e || se.current !== "speaking" && (de.current || (ue.current = null, se.current = "listening", h("listening"), ce.current && !ee.current && (le.current && clearTimeout(le.current), le.current = setTimeout(() => {
|
|
30161
|
+
e || se.current !== "speaking" && se.current !== "thinking" && (de.current || fe.current || (ue.current = null, se.current = "listening", h("listening"), ce.current && !ee.current && (le.current && clearTimeout(le.current), le.current = setTimeout(() => {
|
|
30147
30162
|
if (!e && se.current === "listening" && !ee.current) try {
|
|
30148
30163
|
S.current?.sendContextualUpdate?.("The visitor has been silent for a while. Ask one short, natural question to re-engage — for example: 'Is there anything specific you'd like to know more about?' or 'What else can I help you with today?' Keep it to one sentence.");
|
|
30149
30164
|
} catch {}
|
|
@@ -30155,7 +30170,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30155
30170
|
if (e) return;
|
|
30156
30171
|
let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
|
|
30157
30172
|
if (r) {
|
|
30158
|
-
if (n === "user" && (C.current = r,
|
|
30173
|
+
if (n === "user" && (C.current = r, fe.current = !0, ue.current &&= (clearTimeout(ue.current), null), le.current &&= (clearTimeout(le.current), null)), l.current = [...l.current, {
|
|
30159
30174
|
sender: n,
|
|
30160
30175
|
message: r,
|
|
30161
30176
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -30164,13 +30179,13 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30164
30179
|
e && Ae(i, e);
|
|
30165
30180
|
} catch {}
|
|
30166
30181
|
if (Ak(n, r)) {
|
|
30167
|
-
|
|
30182
|
+
pe("minimized");
|
|
30168
30183
|
return;
|
|
30169
30184
|
}
|
|
30170
30185
|
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 {
|
|
30171
30186
|
S.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the flowengage_end_session tool to end the voice session. Do NOT ask again after that.");
|
|
30172
30187
|
} catch {}
|
|
30173
|
-
else oe.current >= 5 &&
|
|
30188
|
+
else oe.current >= 5 && pe("minimized");
|
|
30174
30189
|
}
|
|
30175
30190
|
},
|
|
30176
30191
|
onError: (t) => {
|
|
@@ -30183,7 +30198,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30183
30198
|
try {
|
|
30184
30199
|
S.current?.setMicMuted?.(!0);
|
|
30185
30200
|
} catch {}
|
|
30186
|
-
y(!0), h("error"),
|
|
30201
|
+
y(!0), h("error"), pe("chat");
|
|
30187
30202
|
}
|
|
30188
30203
|
},
|
|
30189
30204
|
onDisconnect: (t) => {
|
|
@@ -30200,21 +30215,21 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30200
30215
|
try {
|
|
30201
30216
|
S.current?.setMicMuted?.(!0);
|
|
30202
30217
|
} catch {}
|
|
30203
|
-
y(!0),
|
|
30218
|
+
y(!0), pe("chat");
|
|
30204
30219
|
}
|
|
30205
30220
|
});
|
|
30206
30221
|
if (e) {
|
|
30207
|
-
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"),
|
|
30222
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), _e.endSession().catch(() => {});
|
|
30208
30223
|
return;
|
|
30209
30224
|
}
|
|
30210
|
-
o =
|
|
30225
|
+
o = _e, S.current = _e, h("listening");
|
|
30211
30226
|
try {
|
|
30212
30227
|
let e = typeof window < "u" ? window.location.href : "", r = "[]";
|
|
30213
30228
|
try {
|
|
30214
30229
|
r = await t.flowengage_list_forms();
|
|
30215
30230
|
} catch {}
|
|
30216
30231
|
let a = u && !f ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript || ""}\n\n` : "";
|
|
30217
|
-
|
|
30232
|
+
_e.sendContextualUpdate(`${a}Page: ${e}. SiteId: ${i || "unknown"}. Forms: ${r}. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
30218
30233
|
} catch {}
|
|
30219
30234
|
if (typeof window < "u") {
|
|
30220
30235
|
let t = window.location.pathname, n = () => {
|
|
@@ -30267,7 +30282,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30267
30282
|
if (i) try {
|
|
30268
30283
|
He(i);
|
|
30269
30284
|
} catch {}
|
|
30270
|
-
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ar(), le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearTimeout(ue.current), null), ce.current = !1, de.current = !1, se.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
|
|
30285
|
+
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ar(), le.current &&= (clearTimeout(le.current), null), ue.current &&= (clearTimeout(ue.current), null), ce.current = !1, fe.current = !1, de.current = !1, se.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
|
|
30271
30286
|
let t = o || S.current, n = E.current, f = ie.current;
|
|
30272
30287
|
if (t?.endSession?.().catch(() => {}), n && s && a) {
|
|
30273
30288
|
let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
|
|
@@ -30289,7 +30304,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30289
30304
|
r,
|
|
30290
30305
|
i,
|
|
30291
30306
|
a,
|
|
30292
|
-
|
|
30307
|
+
pe
|
|
30293
30308
|
]), c(() => {
|
|
30294
30309
|
if (!b) return;
|
|
30295
30310
|
let e = (e) => {
|
|
@@ -30311,6 +30326,22 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30311
30326
|
/* @__PURE__ */ _("div", {
|
|
30312
30327
|
style: { position: "relative" },
|
|
30313
30328
|
children: [
|
|
30329
|
+
f === "thinking" && !v && /* @__PURE__ */ g("span", {
|
|
30330
|
+
style: {
|
|
30331
|
+
position: "absolute",
|
|
30332
|
+
right: "100%",
|
|
30333
|
+
marginRight: "18px",
|
|
30334
|
+
top: "50%",
|
|
30335
|
+
transform: "translateY(-50%)",
|
|
30336
|
+
color: "#a78bfa",
|
|
30337
|
+
fontSize: "18px",
|
|
30338
|
+
fontWeight: 600,
|
|
30339
|
+
letterSpacing: "0.01em",
|
|
30340
|
+
textShadow: "0 2px 4px rgba(0,0,0,0.4)",
|
|
30341
|
+
whiteSpace: "nowrap"
|
|
30342
|
+
},
|
|
30343
|
+
children: "Processing..."
|
|
30344
|
+
}),
|
|
30314
30345
|
f === "listening" && !v && /* @__PURE__ */ g("span", {
|
|
30315
30346
|
style: {
|
|
30316
30347
|
position: "absolute",
|
|
@@ -30475,7 +30506,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30475
30506
|
children: [
|
|
30476
30507
|
/* @__PURE__ */ _("button", {
|
|
30477
30508
|
onClick: () => {
|
|
30478
|
-
x(!1), re.current = "chat",
|
|
30509
|
+
x(!1), re.current = "chat", me(t);
|
|
30479
30510
|
},
|
|
30480
30511
|
style: {
|
|
30481
30512
|
display: "flex",
|
|
@@ -30504,7 +30535,7 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30504
30535
|
}),
|
|
30505
30536
|
/* @__PURE__ */ _("button", {
|
|
30506
30537
|
onClick: () => {
|
|
30507
|
-
x(!1), re.current = "minimized",
|
|
30538
|
+
x(!1), re.current = "minimized", me(n);
|
|
30508
30539
|
},
|
|
30509
30540
|
style: {
|
|
30510
30541
|
display: "flex",
|
|
@@ -31400,27 +31431,27 @@ function Rk() {
|
|
|
31400
31431
|
pr();
|
|
31401
31432
|
} catch {}
|
|
31402
31433
|
}, []), c(() => {
|
|
31403
|
-
Ee &&
|
|
31434
|
+
Ee && A !== "voice_mode" && A !== "text_chat" && A !== "call_screen" && (ue?.(!1), ot("text_chat"));
|
|
31404
31435
|
}, [Ee]);
|
|
31405
31436
|
let Oe = t?.widgetSettings || {}, ke = n?.widgetSettings || {}, Ae = {
|
|
31406
31437
|
...Oe.branding || {},
|
|
31407
31438
|
...ke.branding || {}
|
|
31408
|
-
},
|
|
31439
|
+
}, Ne = {
|
|
31409
31440
|
...Oe.theme || {},
|
|
31410
31441
|
...ke.theme || {}
|
|
31411
|
-
},
|
|
31442
|
+
}, Pe = {
|
|
31412
31443
|
...Oe.features || {},
|
|
31413
31444
|
...ke.features || {}
|
|
31414
|
-
},
|
|
31445
|
+
}, Ie = Pe.voice !== !1, Le = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Le?.[0] || "#3B82F6", Be = {
|
|
31415
31446
|
small: 50,
|
|
31416
31447
|
medium: 64,
|
|
31417
31448
|
large: 80
|
|
31418
|
-
},
|
|
31449
|
+
}, Ve = Be[Ne.orbSize] || Be.small, He = Ne.position || "bottom-right", O = Ae.fallbackAgentName || "Agent", Ue = Tk(Le ?? Ne.chatBgColors), We = Ae.logo || Ae.logoUrl || null, Ge = E || "en", Ke = Oe.recommendations?.[Ge] || [], qe = (ke.recommendations?.[Ge] ?? Ke).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
31419
31450
|
id: e.key || `qr-${t}`,
|
|
31420
31451
|
label: e.label,
|
|
31421
31452
|
message: e.label,
|
|
31422
31453
|
text: e.label
|
|
31423
|
-
})),
|
|
31454
|
+
})), Je = Array.isArray(Ae.quickChatOptions) && Ae.quickChatOptions.length > 0 ? Ae.quickChatOptions : qe, Ye = Ae.hideWatermark === !0 ? !1 : Ae.showPoweredBy !== !1, Xe = Ae.chatbotEnabled !== !1 && Ne.chatbotEnabled !== !1, Ze = Oe.greetings?.[E] || ke.greetings?.[E] || Ae.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Qe = {
|
|
31424
31455
|
entryPrompt: Ae.entryPrompt || "Do you want to explore in a new way?",
|
|
31425
31456
|
yesLabel: Ae.yesLabel || "Yes",
|
|
31426
31457
|
laterLabel: Ae.laterLabel || "Later",
|
|
@@ -31428,20 +31459,20 @@ function Rk() {
|
|
|
31428
31459
|
voiceLabel: Ae.voiceLabel || "Voice",
|
|
31429
31460
|
textLabel: Ae.textLabel || "Text",
|
|
31430
31461
|
chatTitle: Ae.headerName || "Chat with FlowEngage",
|
|
31431
|
-
introGreeting:
|
|
31462
|
+
introGreeting: Ze,
|
|
31432
31463
|
inputPlaceholder: Ae.inputPlaceholder || "Type your message",
|
|
31433
31464
|
analysingLabel: Ae.analysingLabel || "analysing..."
|
|
31434
|
-
},
|
|
31465
|
+
}, $e = ke.elevenLabsAgentId || t?.elevenLabsAgentId || null, et = t?.siteId || n?.siteId || null, tt = t?.apiBaseUrl || "", nt = f(() => l && String(l).trim() || t?.ownerName && String(t.ownerName).trim() || t?.websiteName && String(t.websiteName).trim() || "Agent", [
|
|
31435
31466
|
l,
|
|
31436
31467
|
t?.ownerName,
|
|
31437
31468
|
t?.websiteName
|
|
31438
|
-
]),
|
|
31469
|
+
]), rt = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, it = r.some((e) => e.sender === "user"), at = f(() => {
|
|
31439
31470
|
let e = r.findIndex((e) => e.sender === "user");
|
|
31440
31471
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
31441
|
-
}, [r]),
|
|
31472
|
+
}, [r]), k = !!(ke._dashboardLivePreview || Oe._dashboardLivePreview), [A, ot] = m(() => k ? "text_chat" : "entry_prompt"), [st, ct] = m(""), [lt, ut] = m(null), [dt, ft] = m(h || ""), [pt, mt] = m(""), [ht, gt] = m(!1), [j, _t] = m(0), [vt, yt] = m(null), [bt, xt] = m(null), [St, Ct] = m(""), [wt, Tt] = m(!1), [Et, Dt] = m(!1), [Ot, kt] = m(!1), At = p(null), jt = p(!1), Mt = !h && it && at && A !== "voice_mode";
|
|
31442
31473
|
d(() => {
|
|
31443
|
-
if (e !== "ready" ||
|
|
31444
|
-
if (
|
|
31474
|
+
if (e !== "ready" || jt.current) return;
|
|
31475
|
+
if (jt.current = !0, !Ie) {
|
|
31445
31476
|
ot("minimized_orb");
|
|
31446
31477
|
return;
|
|
31447
31478
|
}
|
|
@@ -31449,7 +31480,8 @@ function Rk() {
|
|
|
31449
31480
|
try {
|
|
31450
31481
|
t = Tr().shouldResumeVoice;
|
|
31451
31482
|
} catch {}
|
|
31452
|
-
|
|
31483
|
+
let n = Fe(), r = et ? je(et) : null, i = n || !!r?.transcript;
|
|
31484
|
+
if (t) {
|
|
31453
31485
|
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31454
31486
|
return;
|
|
31455
31487
|
}
|
|
@@ -31457,92 +31489,96 @@ function Rk() {
|
|
|
31457
31489
|
ce?.({ notifyChatInitiated: !1 }), ot("text_chat");
|
|
31458
31490
|
return;
|
|
31459
31491
|
}
|
|
31460
|
-
if (
|
|
31461
|
-
|
|
31492
|
+
if (i) {
|
|
31493
|
+
ce?.({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31494
|
+
return;
|
|
31495
|
+
}
|
|
31496
|
+
if (et) try {
|
|
31497
|
+
Me(et);
|
|
31462
31498
|
} catch {}
|
|
31463
|
-
if (fe(
|
|
31499
|
+
if (fe(et)) {
|
|
31464
31500
|
ot("minimized_orb");
|
|
31465
31501
|
return;
|
|
31466
31502
|
}
|
|
31467
31503
|
}, [e, r]);
|
|
31468
|
-
let [
|
|
31504
|
+
let [Nt, Pt] = m(() => typeof window < "u" && window.matchMedia("(max-width: 640px)").matches);
|
|
31469
31505
|
c(() => {
|
|
31470
|
-
let e = window.matchMedia("(max-width: 640px)"), t = (e) =>
|
|
31506
|
+
let e = window.matchMedia("(max-width: 640px)"), t = (e) => Pt(e.matches);
|
|
31471
31507
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
31472
31508
|
}, []), c(() => {
|
|
31473
31509
|
ft(h || ""), h && mt("");
|
|
31474
31510
|
}, [h]);
|
|
31475
|
-
let
|
|
31476
|
-
|
|
31477
|
-
}, []),
|
|
31511
|
+
let Ft = o(() => {
|
|
31512
|
+
xt(null), Ct("");
|
|
31513
|
+
}, []), It = o((e) => {
|
|
31478
31514
|
let t = qD(e);
|
|
31479
31515
|
if (t) {
|
|
31480
|
-
|
|
31516
|
+
xt(null), Ct(t);
|
|
31481
31517
|
return;
|
|
31482
31518
|
}
|
|
31483
|
-
|
|
31519
|
+
xt(e), Ct("");
|
|
31484
31520
|
}, []);
|
|
31485
31521
|
c(() => {
|
|
31486
31522
|
if (!te || ee !== "connected") {
|
|
31487
|
-
|
|
31523
|
+
_t(0);
|
|
31488
31524
|
return;
|
|
31489
31525
|
}
|
|
31490
31526
|
let e = () => {
|
|
31491
31527
|
let e = new Date(te).getTime();
|
|
31492
|
-
isNaN(e) ||
|
|
31528
|
+
isNaN(e) || _t(Math.max(0, Math.floor((Date.now() - e) / 1e3)));
|
|
31493
31529
|
};
|
|
31494
31530
|
e();
|
|
31495
31531
|
let t = window.setInterval(e, 1e3);
|
|
31496
31532
|
return () => window.clearInterval(t);
|
|
31497
31533
|
}, [te, ee]);
|
|
31498
|
-
let
|
|
31499
|
-
ot("call_screen"),
|
|
31500
|
-
}, []),
|
|
31501
|
-
ot("text_chat"),
|
|
31534
|
+
let Lt = o(() => {
|
|
31535
|
+
ot("call_screen"), Dt(!1);
|
|
31536
|
+
}, []), Rt = o(() => {
|
|
31537
|
+
ot("text_chat"), Dt(!0);
|
|
31502
31538
|
}, []);
|
|
31503
31539
|
c(() => {
|
|
31504
31540
|
let e = w?.callId || T || null;
|
|
31505
31541
|
if (!e) {
|
|
31506
|
-
|
|
31542
|
+
At.current = null;
|
|
31507
31543
|
return;
|
|
31508
31544
|
}
|
|
31509
31545
|
if (w?.callId || ee === "connecting" || ee === "connected") {
|
|
31510
|
-
if (
|
|
31511
|
-
|
|
31546
|
+
if (A === "minimized_orb" && Et && T && !w?.callId) {
|
|
31547
|
+
At.current = e;
|
|
31512
31548
|
return;
|
|
31513
31549
|
}
|
|
31514
|
-
!(!i ||
|
|
31550
|
+
!(!i || A === "minimized_orb" || A === "voice_mode") && At.current === e || (console.log("[FlowEngageWidget] forcing call UI to front", {
|
|
31515
31551
|
forcedKey: e,
|
|
31516
31552
|
isOpen: i,
|
|
31517
|
-
surface:
|
|
31553
|
+
surface: A,
|
|
31518
31554
|
hasIncomingCall: !!w?.callId,
|
|
31519
31555
|
activeCallId: T,
|
|
31520
31556
|
callConnectionState: ee
|
|
31521
|
-
}),
|
|
31557
|
+
}), At.current = e, A === "voice_mode" && ue?.(!1), ce?.(), Lt());
|
|
31522
31558
|
}
|
|
31523
31559
|
}, [
|
|
31524
31560
|
T,
|
|
31525
31561
|
ee,
|
|
31526
|
-
|
|
31562
|
+
Lt,
|
|
31527
31563
|
w?.callId,
|
|
31528
31564
|
i,
|
|
31529
31565
|
ce,
|
|
31530
31566
|
ue,
|
|
31531
|
-
|
|
31567
|
+
A
|
|
31532
31568
|
]), c(() => {
|
|
31533
|
-
!w && !T &&
|
|
31569
|
+
!w && !T && A === "call_screen" && ot("text_chat");
|
|
31534
31570
|
}, [
|
|
31535
31571
|
w,
|
|
31536
31572
|
T,
|
|
31537
|
-
|
|
31573
|
+
A
|
|
31538
31574
|
]), c(() => {
|
|
31539
|
-
!T &&
|
|
31540
|
-
}, [T,
|
|
31575
|
+
!T && Et && Dt(!1);
|
|
31576
|
+
}, [T, Et]), c(() => {
|
|
31541
31577
|
if (!s || C) {
|
|
31542
31578
|
Se?.(""), xe?.();
|
|
31543
31579
|
return;
|
|
31544
31580
|
}
|
|
31545
|
-
if (!st.trim() ||
|
|
31581
|
+
if (!st.trim() || bt) {
|
|
31546
31582
|
Se?.("");
|
|
31547
31583
|
let e = window.setTimeout(() => xe?.(), 100);
|
|
31548
31584
|
return () => window.clearTimeout(e);
|
|
@@ -31554,20 +31590,20 @@ function Rk() {
|
|
|
31554
31590
|
};
|
|
31555
31591
|
}, [
|
|
31556
31592
|
st,
|
|
31557
|
-
|
|
31593
|
+
bt,
|
|
31558
31594
|
s,
|
|
31559
31595
|
C,
|
|
31560
31596
|
be,
|
|
31561
31597
|
xe,
|
|
31562
31598
|
Se
|
|
31563
31599
|
]);
|
|
31564
|
-
let
|
|
31600
|
+
let zt = (e) => e ? {
|
|
31565
31601
|
replyTo: e.messageId || e.id || null,
|
|
31566
31602
|
replyToContent: (e.replyToContent || e.message || "").replace(/<[^>]+>/g, "").trim().slice(0, 200),
|
|
31567
31603
|
replyToSender: e.sender || null
|
|
31568
|
-
} : null,
|
|
31604
|
+
} : null, Bt = async (e) => {
|
|
31569
31605
|
if (e.preventDefault(), C) return;
|
|
31570
|
-
if (
|
|
31606
|
+
if (Mt) {
|
|
31571
31607
|
let e = dt.trim().toLowerCase();
|
|
31572
31608
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
31573
31609
|
mt("Please enter a valid email so we can continue helping you.");
|
|
@@ -31576,36 +31612,36 @@ function Rk() {
|
|
|
31576
31612
|
await le(e), mt(""), gt(!0), setTimeout(() => gt(!1), 3e3);
|
|
31577
31613
|
return;
|
|
31578
31614
|
}
|
|
31579
|
-
let t =
|
|
31580
|
-
if (!st.trim() && !
|
|
31581
|
-
if (
|
|
31615
|
+
let t = zt(lt);
|
|
31616
|
+
if (!st.trim() && !bt) return;
|
|
31617
|
+
if (bt) {
|
|
31582
31618
|
try {
|
|
31583
|
-
|
|
31584
|
-
let e = await se(
|
|
31585
|
-
ct(""), ut(null),
|
|
31619
|
+
Tt(!0), Ct("");
|
|
31620
|
+
let e = await se(bt), n = e?.data || e, r = st.trim() || `Shared file: ${YD(bt)}`;
|
|
31621
|
+
ct(""), ut(null), Ft(), await D(r, "", t, {
|
|
31586
31622
|
type: "file",
|
|
31587
31623
|
metadata: {
|
|
31588
31624
|
fileUrl: n?.fileUrl,
|
|
31589
|
-
fileName: n?.fileName ||
|
|
31590
|
-
fileType: n?.fileType ||
|
|
31591
|
-
fileSize: n?.fileSize ||
|
|
31625
|
+
fileName: n?.fileName || bt.name,
|
|
31626
|
+
fileType: n?.fileType || bt.type,
|
|
31627
|
+
fileSize: n?.fileSize || bt.size
|
|
31592
31628
|
}
|
|
31593
31629
|
});
|
|
31594
31630
|
} catch (e) {
|
|
31595
|
-
|
|
31631
|
+
Ct(e?.message || "Failed to upload the selected file.");
|
|
31596
31632
|
} finally {
|
|
31597
|
-
|
|
31633
|
+
Tt(!1);
|
|
31598
31634
|
}
|
|
31599
31635
|
return;
|
|
31600
31636
|
}
|
|
31601
31637
|
let n = st.trim();
|
|
31602
31638
|
ct(""), ut(null), await D(n, "", t);
|
|
31603
|
-
},
|
|
31639
|
+
}, Vt = o(() => {
|
|
31604
31640
|
r.length !== 0 && me?.();
|
|
31605
|
-
}, [r.length, me]),
|
|
31641
|
+
}, [r.length, me]), Ht = (e) => {
|
|
31606
31642
|
let t = Math.floor(e / 60);
|
|
31607
31643
|
return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
|
|
31608
|
-
},
|
|
31644
|
+
}, Ut = o(async (e) => {
|
|
31609
31645
|
if (C || b) return;
|
|
31610
31646
|
let t = e.message || e.label || e.text || "";
|
|
31611
31647
|
t.trim() && await D(t.trim(), "");
|
|
@@ -31613,44 +31649,44 @@ function Rk() {
|
|
|
31613
31649
|
C,
|
|
31614
31650
|
b,
|
|
31615
31651
|
D
|
|
31616
|
-
]),
|
|
31652
|
+
]), Wt = Nt && A === "entry_prompt" ? { inset: 0 } : Nt && A === "text_chat" ? {
|
|
31617
31653
|
left: 0,
|
|
31618
31654
|
right: 0,
|
|
31619
31655
|
bottom: 0
|
|
31620
|
-
} :
|
|
31656
|
+
} : Nt && A === "call_screen" ? {
|
|
31621
31657
|
left: 0,
|
|
31622
31658
|
right: 0,
|
|
31623
31659
|
bottom: 0,
|
|
31624
31660
|
height: "90dvh",
|
|
31625
31661
|
overflow: "hidden",
|
|
31626
31662
|
borderRadius: "16px 16px 0 0"
|
|
31627
|
-
} :
|
|
31663
|
+
} : Nt && A === "connection_modal" ? {
|
|
31628
31664
|
left: "12px",
|
|
31629
31665
|
right: "12px",
|
|
31630
31666
|
bottom: "12px"
|
|
31631
|
-
} :
|
|
31667
|
+
} : A === "call_screen" ? {
|
|
31632
31668
|
width: "min(350px, calc(100vw - 40px))",
|
|
31633
31669
|
height: "min(640px, calc(100vh - 120px))",
|
|
31634
31670
|
borderRadius: "22px",
|
|
31635
31671
|
overflow: "hidden",
|
|
31636
|
-
...
|
|
31672
|
+
...He === "bottom-left" ? {
|
|
31637
31673
|
left: "1.5rem",
|
|
31638
31674
|
bottom: "1.5rem"
|
|
31639
31675
|
} : {
|
|
31640
31676
|
right: "1.5rem",
|
|
31641
31677
|
bottom: "1.5rem"
|
|
31642
31678
|
}
|
|
31643
|
-
} :
|
|
31679
|
+
} : He === "bottom-left" ? {
|
|
31644
31680
|
left: "1.5rem",
|
|
31645
31681
|
bottom: "1.5rem"
|
|
31646
31682
|
} : {
|
|
31647
31683
|
right: "1.5rem",
|
|
31648
31684
|
bottom: "1.5rem"
|
|
31649
|
-
},
|
|
31650
|
-
|
|
31651
|
-
ot("minimized_orb"),
|
|
31685
|
+
}, Gt = o(() => {
|
|
31686
|
+
A !== "minimized_orb" && (kt(!0), setTimeout(() => {
|
|
31687
|
+
ot("minimized_orb"), kt(!1), T && Dt(!0);
|
|
31652
31688
|
}, 280));
|
|
31653
|
-
}, [T,
|
|
31689
|
+
}, [T, A]), Kt = () => ot("connection_modal"), qt = () => {
|
|
31654
31690
|
try {
|
|
31655
31691
|
let e = window.AudioContext || window.webkitAudioContext;
|
|
31656
31692
|
if (e) {
|
|
@@ -31659,35 +31695,35 @@ function Rk() {
|
|
|
31659
31695
|
}
|
|
31660
31696
|
} catch {}
|
|
31661
31697
|
ce({ notifyChatInitiated: !0 }), ue?.(!0), ot("voice_mode");
|
|
31662
|
-
}, qt = () => {
|
|
31663
|
-
ce({ notifyChatInitiated: !0 }), ue?.(!1), ot("text_chat");
|
|
31664
31698
|
}, Jt = () => {
|
|
31665
|
-
ue?.(!1),
|
|
31699
|
+
ce({ notifyChatInitiated: !0 }), ue?.(!1), ot("text_chat");
|
|
31700
|
+
}, Yt = () => {
|
|
31701
|
+
ue?.(!1), Gt();
|
|
31666
31702
|
};
|
|
31667
|
-
return e !== "ready" || !
|
|
31703
|
+
return e !== "ready" || !Xe || Pe.chat === !1 ? null : /* @__PURE__ */ _("div", {
|
|
31668
31704
|
className: "flowengage-widget-root",
|
|
31669
31705
|
style: {
|
|
31670
31706
|
position: "fixed",
|
|
31671
31707
|
zIndex: 999999,
|
|
31672
|
-
...
|
|
31708
|
+
...Wt
|
|
31673
31709
|
},
|
|
31674
31710
|
onWheel: (e) => e.stopPropagation(),
|
|
31675
31711
|
onTouchMove: (e) => e.stopPropagation(),
|
|
31676
31712
|
children: [
|
|
31677
|
-
|
|
31678
|
-
copy:
|
|
31679
|
-
orbColors:
|
|
31680
|
-
primaryColor:
|
|
31713
|
+
A === "entry_prompt" && /* @__PURE__ */ g(Mk, {
|
|
31714
|
+
copy: Qe,
|
|
31715
|
+
orbColors: Le,
|
|
31716
|
+
primaryColor: ze,
|
|
31681
31717
|
onYes: () => {
|
|
31682
|
-
pe(
|
|
31718
|
+
pe(et), qt();
|
|
31683
31719
|
},
|
|
31684
31720
|
onLater: () => {
|
|
31685
|
-
pe(
|
|
31721
|
+
pe(et), Gt();
|
|
31686
31722
|
},
|
|
31687
|
-
isMobile:
|
|
31688
|
-
isClosing:
|
|
31723
|
+
isMobile: Nt,
|
|
31724
|
+
isClosing: Ot
|
|
31689
31725
|
}),
|
|
31690
|
-
|
|
31726
|
+
A === "minimized_orb" && /* @__PURE__ */ _(Dm.div, {
|
|
31691
31727
|
layoutId: "fe-main-orb",
|
|
31692
31728
|
initial: {
|
|
31693
31729
|
scale: .4,
|
|
@@ -31706,14 +31742,14 @@ function Rk() {
|
|
|
31706
31742
|
transformOrigin: "bottom right",
|
|
31707
31743
|
display: "inline-flex",
|
|
31708
31744
|
flexDirection: "column",
|
|
31709
|
-
alignItems:
|
|
31745
|
+
alignItems: He === "bottom-left" ? "flex-start" : "flex-end",
|
|
31710
31746
|
gap: "10px"
|
|
31711
31747
|
},
|
|
31712
31748
|
children: [T && /* @__PURE__ */ _("button", {
|
|
31713
31749
|
type: "button",
|
|
31714
|
-
onClick:
|
|
31750
|
+
onClick: Lt,
|
|
31715
31751
|
style: {
|
|
31716
|
-
maxWidth:
|
|
31752
|
+
maxWidth: Nt ? "220px" : "240px",
|
|
31717
31753
|
padding: "10px 14px",
|
|
31718
31754
|
borderRadius: "18px",
|
|
31719
31755
|
border: "1px solid rgba(255,255,255,0.7)",
|
|
@@ -31754,86 +31790,86 @@ function Rk() {
|
|
|
31754
31790
|
marginTop: "2px",
|
|
31755
31791
|
whiteSpace: "nowrap"
|
|
31756
31792
|
},
|
|
31757
|
-
children: ee === "connected" ? `${
|
|
31793
|
+
children: ee === "connected" ? `${Ht(j)} with ${nt}` : `Tap to return to ${nt}`
|
|
31758
31794
|
})]
|
|
31759
31795
|
})]
|
|
31760
31796
|
}), /* @__PURE__ */ g(jk, {
|
|
31761
|
-
size:
|
|
31762
|
-
orbColors:
|
|
31763
|
-
onClick: T ?
|
|
31797
|
+
size: Ve,
|
|
31798
|
+
orbColors: Le,
|
|
31799
|
+
onClick: T ? Lt : Ie ? Kt : Jt
|
|
31764
31800
|
})]
|
|
31765
31801
|
}),
|
|
31766
|
-
|
|
31767
|
-
copy:
|
|
31768
|
-
orbColors:
|
|
31769
|
-
primaryColor:
|
|
31770
|
-
onVoice:
|
|
31771
|
-
onText:
|
|
31772
|
-
onClose:
|
|
31773
|
-
isMobile:
|
|
31774
|
-
isClosing:
|
|
31802
|
+
A === "connection_modal" && /* @__PURE__ */ g(Nk, {
|
|
31803
|
+
copy: Qe,
|
|
31804
|
+
orbColors: Le,
|
|
31805
|
+
primaryColor: ze,
|
|
31806
|
+
onVoice: qt,
|
|
31807
|
+
onText: Jt,
|
|
31808
|
+
onClose: Gt,
|
|
31809
|
+
isMobile: Nt,
|
|
31810
|
+
isClosing: Ot
|
|
31775
31811
|
}),
|
|
31776
|
-
|
|
31777
|
-
orbColors:
|
|
31778
|
-
onEnterChat:
|
|
31779
|
-
onEndChat:
|
|
31780
|
-
agentId:
|
|
31781
|
-
siteId:
|
|
31782
|
-
apiBaseUrl:
|
|
31812
|
+
A === "voice_mode" && /* @__PURE__ */ g(Pk, {
|
|
31813
|
+
orbColors: Le,
|
|
31814
|
+
onEnterChat: Jt,
|
|
31815
|
+
onEndChat: Yt,
|
|
31816
|
+
agentId: $e,
|
|
31817
|
+
siteId: et,
|
|
31818
|
+
apiBaseUrl: tt,
|
|
31783
31819
|
chatId: ie,
|
|
31784
31820
|
historyRef: ae,
|
|
31785
31821
|
onMessageSync: oe,
|
|
31786
31822
|
voiceEndCounter: De
|
|
31787
31823
|
}, "voice"),
|
|
31788
|
-
|
|
31824
|
+
A === "call_screen" && /* @__PURE__ */ g(gO, {
|
|
31789
31825
|
incomingCall: w,
|
|
31790
31826
|
activeCallId: T,
|
|
31791
31827
|
callConnectionState: ee,
|
|
31792
|
-
callDurationSeconds:
|
|
31828
|
+
callDurationSeconds: j,
|
|
31793
31829
|
isCallMuted: ne,
|
|
31794
|
-
agentName:
|
|
31795
|
-
agentHeadshot:
|
|
31796
|
-
fallbackAgentName:
|
|
31830
|
+
agentName: nt,
|
|
31831
|
+
agentHeadshot: rt,
|
|
31832
|
+
fallbackAgentName: O,
|
|
31797
31833
|
acceptCall: he,
|
|
31798
31834
|
rejectCall: ge,
|
|
31799
31835
|
endWebRTCCall: _e,
|
|
31800
31836
|
toggleCallMute: ve,
|
|
31801
|
-
formatCallDuration:
|
|
31802
|
-
onMinimize:
|
|
31803
|
-
primaryColor:
|
|
31804
|
-
orbColors:
|
|
31837
|
+
formatCallDuration: Ht,
|
|
31838
|
+
onMinimize: Rt,
|
|
31839
|
+
primaryColor: ze,
|
|
31840
|
+
orbColors: Le,
|
|
31805
31841
|
chatHistory: r
|
|
31806
31842
|
}),
|
|
31807
|
-
|
|
31808
|
-
isClosing:
|
|
31809
|
-
copy:
|
|
31810
|
-
orbColors:
|
|
31811
|
-
primaryColor:
|
|
31812
|
-
chatBgGradient:
|
|
31813
|
-
logo:
|
|
31814
|
-
quickChatOptions:
|
|
31815
|
-
onQuickChatSelect:
|
|
31816
|
-
isMobile:
|
|
31843
|
+
A === "text_chat" && /* @__PURE__ */ g(Lk, {
|
|
31844
|
+
isClosing: Ot,
|
|
31845
|
+
copy: Qe,
|
|
31846
|
+
orbColors: Le,
|
|
31847
|
+
primaryColor: ze,
|
|
31848
|
+
chatBgGradient: Ue,
|
|
31849
|
+
logo: We,
|
|
31850
|
+
quickChatOptions: Je,
|
|
31851
|
+
onQuickChatSelect: Ut,
|
|
31852
|
+
isMobile: Nt,
|
|
31817
31853
|
chatHistory: r,
|
|
31818
31854
|
isAiTyping: y,
|
|
31819
31855
|
isAgentTyping: v,
|
|
31820
31856
|
activeScreen: a,
|
|
31821
|
-
agentName:
|
|
31822
|
-
agentHeadshot:
|
|
31823
|
-
fallbackAgentName:
|
|
31857
|
+
agentName: nt,
|
|
31858
|
+
agentHeadshot: rt,
|
|
31859
|
+
fallbackAgentName: O,
|
|
31824
31860
|
input: st,
|
|
31825
31861
|
setInput: ct,
|
|
31826
|
-
onSubmit:
|
|
31862
|
+
onSubmit: Bt,
|
|
31827
31863
|
isConversationEnded: C,
|
|
31828
31864
|
isLoading: b,
|
|
31829
31865
|
isRateLimited: x,
|
|
31830
31866
|
rateLimitMessage: S,
|
|
31831
|
-
selectedFile:
|
|
31832
|
-
onFileSelect:
|
|
31833
|
-
onRemoveSelectedFile:
|
|
31834
|
-
attachmentError:
|
|
31835
|
-
isUploadingAttachment:
|
|
31836
|
-
requiresEmail:
|
|
31867
|
+
selectedFile: bt,
|
|
31868
|
+
onFileSelect: It,
|
|
31869
|
+
onRemoveSelectedFile: Ft,
|
|
31870
|
+
attachmentError: St,
|
|
31871
|
+
isUploadingAttachment: wt,
|
|
31872
|
+
requiresEmail: Mt,
|
|
31837
31873
|
emailInput: dt,
|
|
31838
31874
|
setEmailInput: ft,
|
|
31839
31875
|
emailError: pt,
|
|
@@ -31848,15 +31884,15 @@ function Rk() {
|
|
|
31848
31884
|
isCallMuted: ne,
|
|
31849
31885
|
toggleCallMute: ve,
|
|
31850
31886
|
endWebRTCCall: _e,
|
|
31851
|
-
formatCallDuration:
|
|
31852
|
-
callDurationSeconds:
|
|
31853
|
-
onCollapse:
|
|
31854
|
-
onStartVoice:
|
|
31855
|
-
onNewChat:
|
|
31856
|
-
onMinimize:
|
|
31857
|
-
onExpand:
|
|
31887
|
+
formatCallDuration: Ht,
|
|
31888
|
+
callDurationSeconds: j,
|
|
31889
|
+
onCollapse: Gt,
|
|
31890
|
+
onStartVoice: qt,
|
|
31891
|
+
onNewChat: Vt,
|
|
31892
|
+
onMinimize: Rt,
|
|
31893
|
+
onExpand: Lt,
|
|
31858
31894
|
isCallMinimized: !!T,
|
|
31859
|
-
showPoweredBy:
|
|
31895
|
+
showPoweredBy: Ye,
|
|
31860
31896
|
getVisitorChatHistory: Ce,
|
|
31861
31897
|
resumeChat: we,
|
|
31862
31898
|
isSessionRestoring: Te
|