@voicenter-team/events-sdk 0.0.105 → 0.0.106
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.
- package/dist/voicenter-events-sdk.cjs.js +11 -11
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.es.js +260 -125
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +4 -4
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +4 -4
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var X = (a, t, e) => (
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var xe = (a, t, e) => t in a ? Re(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var X = (a, t, e) => (xe(a, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
import Ie from "ws";
|
|
5
|
-
import
|
|
6
|
-
function
|
|
5
|
+
import Ue, { LevelEnum as z, ActionNameEnum as Y, LogTypeEnum as Q } from "@voicenter-team/socketio-storage-logger";
|
|
6
|
+
function Be(a) {
|
|
7
7
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
8
8
|
}
|
|
9
9
|
var Te = { exports: {} }, be = { exports: {} };
|
|
@@ -72,7 +72,7 @@ var Te = { exports: {} }, be = { exports: {} };
|
|
|
72
72
|
};
|
|
73
73
|
be.exports = t;
|
|
74
74
|
})();
|
|
75
|
-
var
|
|
75
|
+
var De = be.exports, me = {
|
|
76
76
|
// UTF-8 encoding
|
|
77
77
|
utf8: {
|
|
78
78
|
// Convert a string to a byte array
|
|
@@ -106,17 +106,17 @@ var Be = be.exports, me = {
|
|
|
106
106
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
107
107
|
* @license MIT
|
|
108
108
|
*/
|
|
109
|
-
var
|
|
110
|
-
return a != null && (Ae(a) ||
|
|
109
|
+
var je = function(a) {
|
|
110
|
+
return a != null && (Ae(a) || Pe(a) || !!a._isBuffer);
|
|
111
111
|
};
|
|
112
112
|
function Ae(a) {
|
|
113
113
|
return !!a.constructor && typeof a.constructor.isBuffer == "function" && a.constructor.isBuffer(a);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Pe(a) {
|
|
116
116
|
return typeof a.readFloatLE == "function" && typeof a.slice == "function" && Ae(a.slice(0, 0));
|
|
117
117
|
}
|
|
118
118
|
(function() {
|
|
119
|
-
var a =
|
|
119
|
+
var a = De, t = we.utf8, e = je, s = we.bin, o = function(h, f) {
|
|
120
120
|
h.constructor == String ? f && f.encoding === "binary" ? h = s.stringToBytes(h) : h = t.stringToBytes(h) : e(h) ? h = Array.prototype.slice.call(h, 0) : !Array.isArray(h) && h.constructor !== Uint8Array && (h = h.toString());
|
|
121
121
|
for (var l = a.bytesToWords(h), d = h.length * 8, i = 1732584193, p = -271733879, c = -1732584194, r = 271733878, n = 0; n < l.length; n++)
|
|
122
122
|
l[n] = (l[n] << 8 | l[n] >>> 24) & 16711935 | (l[n] << 24 | l[n] >>> 8) & 4278255360;
|
|
@@ -146,8 +146,8 @@ function je(a) {
|
|
|
146
146
|
return f && f.asBytes ? l : f && f.asString ? s.bytesToString(l) : a.bytesToHex(l);
|
|
147
147
|
};
|
|
148
148
|
})();
|
|
149
|
-
var
|
|
150
|
-
const
|
|
149
|
+
var Fe = Te.exports;
|
|
150
|
+
const Me = /* @__PURE__ */ Be(Fe);
|
|
151
151
|
var ne = /* @__PURE__ */ ((a) => (a.BOOTSTRAP = "bootstrap", a.DEBUG_EXTENSIONS = "debugExtensions", a.DEBUG_QUEUE = "debugQueue", a.DEBUG_DIALER = "debugDialer", a.FULL = "full", a))(ne || {}), te = /* @__PURE__ */ ((a) => (a.MAIN = "main", a.NEXT = "next", a))(te || {}), Z = /* @__PURE__ */ ((a) => (a.USER = "User", a.TOKEN = "Token", a))(Z || {});
|
|
152
152
|
class ae {
|
|
153
153
|
static async getSessionStorageDataByKey(t, e = !0) {
|
|
@@ -171,7 +171,7 @@ class ae {
|
|
|
171
171
|
typeof chrome < "u" && typeof chrome.storage < "u" && chrome.storage.session.clear(), typeof window < "u" && typeof window.sessionStorage < "u" && typeof window.sessionStorage.clear == "function" && window.sessionStorage.clear();
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
class
|
|
174
|
+
class qe {
|
|
175
175
|
constructor(t) {
|
|
176
176
|
X(this, "delay", 1e3);
|
|
177
177
|
X(this, "lastLoginTimestamp");
|
|
@@ -187,7 +187,7 @@ class Me {
|
|
|
187
187
|
email: this.eventsSdkClass.options.email && this.eventsSdkClass.options.email,
|
|
188
188
|
password: this.eventsSdkClass.options.password && this.eventsSdkClass.options.password
|
|
189
189
|
};
|
|
190
|
-
if (this.storageKey =
|
|
190
|
+
if (this.storageKey = Me(JSON.stringify({
|
|
191
191
|
...this.eventsSdkClass.options,
|
|
192
192
|
loggerSocketConnection: null
|
|
193
193
|
}, this.eventsSdkClass.getCircularReplacer())), this.lastLoginTimestamp && this.lastLoginTimestamp + this.delay > (/* @__PURE__ */ new Date()).getTime())
|
|
@@ -341,12 +341,13 @@ class Me {
|
|
|
341
341
|
return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const Ne = {
|
|
345
345
|
isNewStack: !1,
|
|
346
346
|
loginUrl: "https://loginapi.voicenter.co.il/monitorAPI/Login",
|
|
347
347
|
refreshTokenUrl: "https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",
|
|
348
348
|
forceNew: !0,
|
|
349
|
-
|
|
349
|
+
/** Initial reconnection delay in seconds will be used as a base, and on each unsuccessfully attempt delay is exponentially increased */
|
|
350
|
+
reconnectionDelay: 5,
|
|
350
351
|
timeout: 1e4,
|
|
351
352
|
keepAliveTimeout: 6e4,
|
|
352
353
|
protocol: "https",
|
|
@@ -1518,8 +1519,8 @@ function Xe() {
|
|
|
1518
1519
|
return e.encodeBase64Packet(C, A);
|
|
1519
1520
|
var v = C.data, m = new Uint8Array(v), L = new Uint8Array(1 + v.byteLength);
|
|
1520
1521
|
L[0] = P[C.type];
|
|
1521
|
-
for (var
|
|
1522
|
-
L[
|
|
1522
|
+
for (var x = 0; x < m.length; x++)
|
|
1523
|
+
L[x + 1] = m[x];
|
|
1523
1524
|
return A(L.buffer);
|
|
1524
1525
|
}
|
|
1525
1526
|
function f(C, b, A) {
|
|
@@ -1545,8 +1546,8 @@ function Xe() {
|
|
|
1545
1546
|
b(S, function(K, G) {
|
|
1546
1547
|
v[R] = G, V(K, v);
|
|
1547
1548
|
});
|
|
1548
|
-
},
|
|
1549
|
-
L(
|
|
1549
|
+
}, x = 0; x < C.length; x++)
|
|
1550
|
+
L(x, C[x], m);
|
|
1550
1551
|
}
|
|
1551
1552
|
var i = a("./keys"), p = a("has-binary"), c = a("arraybuffer.slice"), r = a("base64-arraybuffer"), n = a("after"), u = a("utf8"), g = navigator.userAgent.match(/Android/i), y = /PhantomJS/i.test(navigator.userAgent), T = g || y;
|
|
1552
1553
|
e.protocol = 3;
|
|
@@ -1575,9 +1576,9 @@ function Xe() {
|
|
|
1575
1576
|
try {
|
|
1576
1577
|
m = String.fromCharCode.apply(null, new Uint8Array(C.data));
|
|
1577
1578
|
} catch {
|
|
1578
|
-
for (var L = new Uint8Array(C.data),
|
|
1579
|
-
|
|
1580
|
-
m = String.fromCharCode.apply(null,
|
|
1579
|
+
for (var L = new Uint8Array(C.data), x = new Array(L.length), R = 0; R < L.length; R++)
|
|
1580
|
+
x[R] = L[R];
|
|
1581
|
+
m = String.fromCharCode.apply(null, x);
|
|
1581
1582
|
}
|
|
1582
1583
|
return A += s.btoa(m), b(A);
|
|
1583
1584
|
}, e.decodePacket = function(C, b, A) {
|
|
@@ -1605,17 +1606,17 @@ function Xe() {
|
|
|
1605
1606
|
var v = r.decode(C.substr(1));
|
|
1606
1607
|
return b === "blob" && _ && (v = new _([v])), { type: A, data: v };
|
|
1607
1608
|
}, e.encodePayload = function(C, b, A) {
|
|
1608
|
-
function v(
|
|
1609
|
-
return
|
|
1609
|
+
function v(x) {
|
|
1610
|
+
return x.length + ":" + x;
|
|
1610
1611
|
}
|
|
1611
|
-
function m(
|
|
1612
|
-
e.encodePacket(
|
|
1612
|
+
function m(x, R) {
|
|
1613
|
+
e.encodePacket(x, L ? b : !1, !0, function(S) {
|
|
1613
1614
|
R(null, v(S));
|
|
1614
1615
|
});
|
|
1615
1616
|
}
|
|
1616
1617
|
typeof b == "function" && (A = b, b = null);
|
|
1617
1618
|
var L = p(C);
|
|
1618
|
-
return b && L ? _ && !T ? e.encodePayloadAsBlob(C, A) : e.encodePayloadAsArrayBuffer(C, A) : C.length ? void d(C, m, function(
|
|
1619
|
+
return b && L ? _ && !T ? e.encodePayloadAsBlob(C, A) : e.encodePayloadAsArrayBuffer(C, A) : C.length ? void d(C, m, function(x, R) {
|
|
1619
1620
|
return A(R.join(""));
|
|
1620
1621
|
}) : A("0:");
|
|
1621
1622
|
}, e.decodePayload = function(C, b, A) {
|
|
@@ -1625,12 +1626,12 @@ function Xe() {
|
|
|
1625
1626
|
var v;
|
|
1626
1627
|
if (C == "")
|
|
1627
1628
|
return A(M, 0, 1);
|
|
1628
|
-
for (var m, L,
|
|
1629
|
+
for (var m, L, x = "", R = 0, S = C.length; S > R; R++) {
|
|
1629
1630
|
var V = C.charAt(R);
|
|
1630
1631
|
if (V != ":")
|
|
1631
|
-
|
|
1632
|
+
x += V;
|
|
1632
1633
|
else {
|
|
1633
|
-
if (
|
|
1634
|
+
if (x == "" || x != (m = Number(x)) || (L = C.substr(R + 1, m), x != L.length))
|
|
1634
1635
|
return A(M, 0, 1);
|
|
1635
1636
|
if (L.length) {
|
|
1636
1637
|
if (v = e.decodePacket(L, b, !0), M.type == v.type && M.data == v.data)
|
|
@@ -1639,10 +1640,10 @@ function Xe() {
|
|
|
1639
1640
|
if (K === !1)
|
|
1640
1641
|
return;
|
|
1641
1642
|
}
|
|
1642
|
-
R += m,
|
|
1643
|
+
R += m, x = "";
|
|
1643
1644
|
}
|
|
1644
1645
|
}
|
|
1645
|
-
return
|
|
1646
|
+
return x != "" ? A(M, 0, 1) : void 0;
|
|
1646
1647
|
}, e.encodePayloadAsArrayBuffer = function(C, b) {
|
|
1647
1648
|
function A(v, m) {
|
|
1648
1649
|
e.encodePacket(v, !0, !0, function(L) {
|
|
@@ -1653,7 +1654,7 @@ function Xe() {
|
|
|
1653
1654
|
var L = m.reduce(function(S, V) {
|
|
1654
1655
|
var K;
|
|
1655
1656
|
return K = typeof V == "string" ? V.length : V.byteLength, S + K.toString().length + K + 2;
|
|
1656
|
-
}, 0),
|
|
1657
|
+
}, 0), x = new Uint8Array(L), R = 0;
|
|
1657
1658
|
return m.forEach(function(S) {
|
|
1658
1659
|
var V = typeof S == "string", K = S;
|
|
1659
1660
|
if (V) {
|
|
@@ -1661,27 +1662,27 @@ function Xe() {
|
|
|
1661
1662
|
G[q] = S.charCodeAt(q);
|
|
1662
1663
|
K = G.buffer;
|
|
1663
1664
|
}
|
|
1664
|
-
|
|
1665
|
+
x[R++] = V ? 0 : 1;
|
|
1665
1666
|
for (var J = K.byteLength.toString(), q = 0; q < J.length; q++)
|
|
1666
|
-
|
|
1667
|
-
|
|
1667
|
+
x[R++] = parseInt(J[q]);
|
|
1668
|
+
x[R++] = 255;
|
|
1668
1669
|
for (var G = new Uint8Array(K), q = 0; q < G.length; q++)
|
|
1669
|
-
|
|
1670
|
-
}), b(
|
|
1670
|
+
x[R++] = G[q];
|
|
1671
|
+
}), b(x.buffer);
|
|
1671
1672
|
}) : b(new ArrayBuffer(0));
|
|
1672
1673
|
}, e.encodePayloadAsBlob = function(C, b) {
|
|
1673
1674
|
function A(v, m) {
|
|
1674
1675
|
e.encodePacket(v, !0, !0, function(L) {
|
|
1675
|
-
var
|
|
1676
|
-
if (
|
|
1676
|
+
var x = new Uint8Array(1);
|
|
1677
|
+
if (x[0] = 1, typeof L == "string") {
|
|
1677
1678
|
for (var R = new Uint8Array(L.length), S = 0; S < L.length; S++)
|
|
1678
1679
|
R[S] = L.charCodeAt(S);
|
|
1679
|
-
L = R.buffer,
|
|
1680
|
+
L = R.buffer, x[0] = 0;
|
|
1680
1681
|
}
|
|
1681
1682
|
for (var V = L instanceof ArrayBuffer ? L.byteLength : L.size, K = V.toString(), G = new Uint8Array(K.length + 1), S = 0; S < K.length; S++)
|
|
1682
1683
|
G[S] = parseInt(K[S]);
|
|
1683
1684
|
if (G[K.length] = 255, _) {
|
|
1684
|
-
var q = new _([
|
|
1685
|
+
var q = new _([x.buffer, G.buffer, L]);
|
|
1685
1686
|
m(null, q);
|
|
1686
1687
|
}
|
|
1687
1688
|
});
|
|
@@ -1692,12 +1693,12 @@ function Xe() {
|
|
|
1692
1693
|
}, e.decodePayloadAsBinary = function(C, b, A) {
|
|
1693
1694
|
typeof b == "function" && (A = b, b = null);
|
|
1694
1695
|
for (var v = C, m = [], L = !1; v.byteLength > 0; ) {
|
|
1695
|
-
for (var
|
|
1696
|
+
for (var x = new Uint8Array(v), R = x[0] === 0, S = "", V = 1; x[V] != 255; V++) {
|
|
1696
1697
|
if (S.length > 310) {
|
|
1697
1698
|
L = !0;
|
|
1698
1699
|
break;
|
|
1699
1700
|
}
|
|
1700
|
-
S +=
|
|
1701
|
+
S += x[V];
|
|
1701
1702
|
}
|
|
1702
1703
|
if (L)
|
|
1703
1704
|
return A(M, 0, 1);
|
|
@@ -1830,13 +1831,13 @@ function Xe() {
|
|
|
1830
1831
|
(function(s) {
|
|
1831
1832
|
(function(o) {
|
|
1832
1833
|
function h(v) {
|
|
1833
|
-
for (var m, L,
|
|
1834
|
-
m = v.charCodeAt(R++), m >= 55296 && 56319 >= m && S > R ? (L = v.charCodeAt(R++), (64512 & L) == 56320 ?
|
|
1835
|
-
return
|
|
1834
|
+
for (var m, L, x = [], R = 0, S = v.length; S > R; )
|
|
1835
|
+
m = v.charCodeAt(R++), m >= 55296 && 56319 >= m && S > R ? (L = v.charCodeAt(R++), (64512 & L) == 56320 ? x.push(((1023 & m) << 10) + (1023 & L) + 65536) : (x.push(m), R--)) : x.push(m);
|
|
1836
|
+
return x;
|
|
1836
1837
|
}
|
|
1837
1838
|
function f(v) {
|
|
1838
|
-
for (var m, L = v.length,
|
|
1839
|
-
m = v[
|
|
1839
|
+
for (var m, L = v.length, x = -1, R = ""; ++x < L; )
|
|
1840
|
+
m = v[x], m > 65535 && (m -= 65536, R += M(m >>> 10 & 1023 | 55296), m = 56320 | 1023 & m), R += M(m);
|
|
1840
1841
|
return R;
|
|
1841
1842
|
}
|
|
1842
1843
|
function l(v) {
|
|
@@ -1853,7 +1854,7 @@ function Xe() {
|
|
|
1853
1854
|
return 4294965248 & v ? 4294901760 & v ? !(4292870144 & v) && (m = M(v >> 18 & 7 | 240), m += d(v, 12), m += d(v, 6)) : (l(v), m = M(v >> 12 & 15 | 224), m += d(v, 6)) : m = M(v >> 6 & 31 | 192), m += M(63 & v | 128);
|
|
1854
1855
|
}
|
|
1855
1856
|
function p(v) {
|
|
1856
|
-
for (var m, L = h(v),
|
|
1857
|
+
for (var m, L = h(v), x = L.length, R = -1, S = ""; ++R < x; )
|
|
1857
1858
|
m = L[R], S += i(m);
|
|
1858
1859
|
return S;
|
|
1859
1860
|
}
|
|
@@ -1866,7 +1867,7 @@ function Xe() {
|
|
|
1866
1867
|
throw Error("Invalid continuation byte");
|
|
1867
1868
|
}
|
|
1868
1869
|
function r() {
|
|
1869
|
-
var v, m, L,
|
|
1870
|
+
var v, m, L, x, R;
|
|
1870
1871
|
if (U > P)
|
|
1871
1872
|
throw Error("Invalid byte index");
|
|
1872
1873
|
if (U == P)
|
|
@@ -1884,7 +1885,7 @@ function Xe() {
|
|
|
1884
1885
|
return l(R), R;
|
|
1885
1886
|
throw Error("Invalid continuation byte");
|
|
1886
1887
|
}
|
|
1887
|
-
if ((248 & v) == 240 && (m = c(), L = c(),
|
|
1888
|
+
if ((248 & v) == 240 && (m = c(), L = c(), x = c(), R = (15 & v) << 18 | m << 12 | L << 6 | x, R >= 65536 && 1114111 >= R))
|
|
1888
1889
|
return R;
|
|
1889
1890
|
throw Error("Invalid UTF-8 detected");
|
|
1890
1891
|
}
|
|
@@ -2221,22 +2222,22 @@ function Xe() {
|
|
|
2221
2222
|
else {
|
|
2222
2223
|
var w, D = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
|
|
2223
2224
|
if (E == "json-stringify") {
|
|
2224
|
-
var k = p.stringify,
|
|
2225
|
-
if (
|
|
2225
|
+
var k = p.stringify, I = typeof k == "function" && c;
|
|
2226
|
+
if (I) {
|
|
2226
2227
|
(w = function() {
|
|
2227
2228
|
return 1;
|
|
2228
2229
|
}).toJSON = w;
|
|
2229
2230
|
try {
|
|
2230
|
-
|
|
2231
|
+
I = k(0) === "0" && k(new Number()) === "0" && k(new String()) == '""' && k(d) === l && k(l) === l && k() === l && k(w) === "1" && k([w]) == "[1]" && k([l]) == "[null]" && k(null) == "null" && k([l, d, null]) == "[null,null,null]" && k({ a: [w, !0, !1, null, `\0\b
|
|
2231
2232
|
\f\r `] }) == D && k(null, w) === "1" && k([1, 2], null, 1) == `[
|
|
2232
2233
|
1,
|
|
2233
2234
|
2
|
|
2234
2235
|
]` && k(/* @__PURE__ */ new Date(-864e13)) == '"-271821-04-20T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(864e13)) == '"+275760-09-13T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
|
2235
2236
|
} catch {
|
|
2236
|
-
|
|
2237
|
+
I = !1;
|
|
2237
2238
|
}
|
|
2238
2239
|
}
|
|
2239
|
-
O =
|
|
2240
|
+
O = I;
|
|
2240
2241
|
}
|
|
2241
2242
|
if (E == "json-parse") {
|
|
2242
2243
|
var B = p.parse;
|
|
@@ -2286,8 +2287,8 @@ function Xe() {
|
|
|
2286
2287
|
(h = {}.hasOwnProperty) || (h = function(E) {
|
|
2287
2288
|
var O, w = {};
|
|
2288
2289
|
return (w.__proto__ = null, w.__proto__ = { toString: 1 }, w).toString != d ? h = function(D) {
|
|
2289
|
-
var k = this.__proto__,
|
|
2290
|
-
return this.__proto__ = k,
|
|
2290
|
+
var k = this.__proto__, I = D in (this.__proto__ = null, this);
|
|
2291
|
+
return this.__proto__ = k, I;
|
|
2291
2292
|
} : (O = w.constructor, h = function(D) {
|
|
2292
2293
|
var k = (this.constructor || O).prototype;
|
|
2293
2294
|
return D in this && !(D in k && this[D] === k[D]);
|
|
@@ -2298,13 +2299,13 @@ function Xe() {
|
|
|
2298
2299
|
return w == "object" ? !!E[O] : !C[w];
|
|
2299
2300
|
};
|
|
2300
2301
|
if (f = function(E, O) {
|
|
2301
|
-
var w, D, k,
|
|
2302
|
+
var w, D, k, I = 0;
|
|
2302
2303
|
(w = function() {
|
|
2303
2304
|
this.valueOf = 0;
|
|
2304
2305
|
}).prototype.valueOf = 0, D = new w();
|
|
2305
2306
|
for (k in D)
|
|
2306
|
-
h.call(D, k) &&
|
|
2307
|
-
return w = D = null,
|
|
2307
|
+
h.call(D, k) && I++;
|
|
2308
|
+
return w = D = null, I ? f = I == 2 ? function(B, N) {
|
|
2308
2309
|
var F, $ = {}, W = d.call(B) == r;
|
|
2309
2310
|
for (F in B)
|
|
2310
2311
|
W && F == "prototype" || h.call($, F) || !($[F] = 1) || !h.call(B, F) || N(F);
|
|
@@ -2323,9 +2324,9 @@ function Xe() {
|
|
|
2323
2324
|
}, !o("json-stringify")) {
|
|
2324
2325
|
var A = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }, v = "000000", m = function(E, O) {
|
|
2325
2326
|
return (v + (O || 0)).slice(-E);
|
|
2326
|
-
}, L = "\\u00",
|
|
2327
|
-
var O, w = '"', D = 0, k = E.length,
|
|
2328
|
-
for (
|
|
2327
|
+
}, L = "\\u00", x = function(E) {
|
|
2328
|
+
var O, w = '"', D = 0, k = E.length, I = k > 10 && P;
|
|
2329
|
+
for (I && (O = E.split("")); k > D; D++) {
|
|
2329
2330
|
var B = E.charCodeAt(D);
|
|
2330
2331
|
switch (B) {
|
|
2331
2332
|
case 8:
|
|
@@ -2342,11 +2343,11 @@ function Xe() {
|
|
|
2342
2343
|
w += L + m(2, B.toString(16));
|
|
2343
2344
|
break;
|
|
2344
2345
|
}
|
|
2345
|
-
w +=
|
|
2346
|
+
w += I ? O[D] : P ? E.charAt(D) : E[D];
|
|
2346
2347
|
}
|
|
2347
2348
|
}
|
|
2348
2349
|
return w + '"';
|
|
2349
|
-
}, R = function(E, O, w, D, k,
|
|
2350
|
+
}, R = function(E, O, w, D, k, I, B) {
|
|
2350
2351
|
var N, F, $, W, H, oe, he, pe, ue, fe, ee, de, ce, ie, ge, ye;
|
|
2351
2352
|
try {
|
|
2352
2353
|
N = O[E];
|
|
@@ -2374,37 +2375,37 @@ function Xe() {
|
|
|
2374
2375
|
if (F == u)
|
|
2375
2376
|
return N > -1 / 0 && 1 / 0 > N ? "" + N : "null";
|
|
2376
2377
|
if (F == g)
|
|
2377
|
-
return
|
|
2378
|
+
return x("" + N);
|
|
2378
2379
|
if (typeof N == "object") {
|
|
2379
2380
|
for (ie = B.length; ie--; )
|
|
2380
2381
|
if (B[ie] === N)
|
|
2381
2382
|
throw TypeError();
|
|
2382
|
-
if (B.push(N), ee = [], ge =
|
|
2383
|
+
if (B.push(N), ee = [], ge = I, I += k, F == y) {
|
|
2383
2384
|
for (ce = 0, ie = N.length; ie > ce; ce++)
|
|
2384
|
-
de = R(ce, N, w, D, k,
|
|
2385
|
+
de = R(ce, N, w, D, k, I, B), ee.push(de === l ? "null" : de);
|
|
2385
2386
|
ye = ee.length ? k ? `[
|
|
2386
|
-
` +
|
|
2387
|
-
` +
|
|
2387
|
+
` + I + ee.join(`,
|
|
2388
|
+
` + I) + `
|
|
2388
2389
|
` + ge + "]" : "[" + ee.join(",") + "]" : "[]";
|
|
2389
2390
|
} else
|
|
2390
2391
|
f(D || N, function(ve) {
|
|
2391
|
-
var Ee = R(ve, N, w, D, k,
|
|
2392
|
-
Ee !== l && ee.push(
|
|
2392
|
+
var Ee = R(ve, N, w, D, k, I, B);
|
|
2393
|
+
Ee !== l && ee.push(x(ve) + ":" + (k ? " " : "") + Ee);
|
|
2393
2394
|
}), ye = ee.length ? k ? `{
|
|
2394
|
-
` +
|
|
2395
|
-
` +
|
|
2395
|
+
` + I + ee.join(`,
|
|
2396
|
+
` + I) + `
|
|
2396
2397
|
` + ge + "}" : "{" + ee.join(",") + "}" : "{}";
|
|
2397
2398
|
return B.pop(), ye;
|
|
2398
2399
|
}
|
|
2399
2400
|
};
|
|
2400
2401
|
p.stringify = function(E, O, w) {
|
|
2401
|
-
var D, k,
|
|
2402
|
+
var D, k, I, B;
|
|
2402
2403
|
if (typeof O == "function" || typeof O == "object" && O) {
|
|
2403
2404
|
if ((B = d.call(O)) == r)
|
|
2404
2405
|
k = O;
|
|
2405
2406
|
else if (B == y) {
|
|
2406
|
-
|
|
2407
|
-
for (var N, F = 0, $ = O.length; $ > F; N = O[F++], B = d.call(N), (B == g || B == u) && (
|
|
2407
|
+
I = {};
|
|
2408
|
+
for (var N, F = 0, $ = O.length; $ > F; N = O[F++], B = d.call(N), (B == g || B == u) && (I[N] = 1))
|
|
2408
2409
|
;
|
|
2409
2410
|
}
|
|
2410
2411
|
}
|
|
@@ -2415,7 +2416,7 @@ function Xe() {
|
|
|
2415
2416
|
;
|
|
2416
2417
|
} else
|
|
2417
2418
|
B == g && (D = w.length <= 10 ? w : w.slice(0, 10));
|
|
2418
|
-
return R("", (N = {}, N[""] = E, N), k,
|
|
2419
|
+
return R("", (N = {}, N[""] = E, N), k, I, D, "", []);
|
|
2419
2420
|
};
|
|
2420
2421
|
}
|
|
2421
2422
|
if (!o("json-parse")) {
|
|
@@ -2423,8 +2424,8 @@ function Xe() {
|
|
|
2423
2424
|
`, 102: "\f", 114: "\r" }, q = function() {
|
|
2424
2425
|
throw S = V = null, SyntaxError();
|
|
2425
2426
|
}, J = function() {
|
|
2426
|
-
for (var E, O, w, D, k,
|
|
2427
|
-
switch (k =
|
|
2427
|
+
for (var E, O, w, D, k, I = V, B = I.length; B > S; )
|
|
2428
|
+
switch (k = I.charCodeAt(S)) {
|
|
2428
2429
|
case 9:
|
|
2429
2430
|
case 10:
|
|
2430
2431
|
case 13:
|
|
@@ -2437,13 +2438,13 @@ function Xe() {
|
|
|
2437
2438
|
case 93:
|
|
2438
2439
|
case 58:
|
|
2439
2440
|
case 44:
|
|
2440
|
-
return E = P ?
|
|
2441
|
+
return E = P ? I.charAt(S) : I[S], S++, E;
|
|
2441
2442
|
case 34:
|
|
2442
2443
|
for (E = "@", S++; B > S; )
|
|
2443
|
-
if (k =
|
|
2444
|
+
if (k = I.charCodeAt(S), 32 > k)
|
|
2444
2445
|
q();
|
|
2445
2446
|
else if (k == 92)
|
|
2446
|
-
switch (k =
|
|
2447
|
+
switch (k = I.charCodeAt(++S)) {
|
|
2447
2448
|
case 92:
|
|
2448
2449
|
case 34:
|
|
2449
2450
|
case 47:
|
|
@@ -2456,8 +2457,8 @@ function Xe() {
|
|
|
2456
2457
|
break;
|
|
2457
2458
|
case 117:
|
|
2458
2459
|
for (O = ++S, w = S + 4; w > S; S++)
|
|
2459
|
-
k =
|
|
2460
|
-
E += K("0x" +
|
|
2460
|
+
k = I.charCodeAt(S), k >= 48 && 57 >= k || k >= 97 && 102 >= k || k >= 65 && 70 >= k || q();
|
|
2461
|
+
E += K("0x" + I.slice(O, S));
|
|
2461
2462
|
break;
|
|
2462
2463
|
default:
|
|
2463
2464
|
q();
|
|
@@ -2465,34 +2466,34 @@ function Xe() {
|
|
|
2465
2466
|
else {
|
|
2466
2467
|
if (k == 34)
|
|
2467
2468
|
break;
|
|
2468
|
-
for (k =
|
|
2469
|
-
k =
|
|
2470
|
-
E +=
|
|
2469
|
+
for (k = I.charCodeAt(S), O = S; k >= 32 && k != 92 && k != 34; )
|
|
2470
|
+
k = I.charCodeAt(++S);
|
|
2471
|
+
E += I.slice(O, S);
|
|
2471
2472
|
}
|
|
2472
|
-
if (
|
|
2473
|
+
if (I.charCodeAt(S) == 34)
|
|
2473
2474
|
return S++, E;
|
|
2474
2475
|
q();
|
|
2475
2476
|
default:
|
|
2476
|
-
if (O = S, k == 45 && (D = !0, k =
|
|
2477
|
-
for (k == 48 && (k =
|
|
2477
|
+
if (O = S, k == 45 && (D = !0, k = I.charCodeAt(++S)), k >= 48 && 57 >= k) {
|
|
2478
|
+
for (k == 48 && (k = I.charCodeAt(S + 1), k >= 48 && 57 >= k) && q(), D = !1; B > S && (k = I.charCodeAt(S), k >= 48 && 57 >= k); S++)
|
|
2478
2479
|
;
|
|
2479
|
-
if (
|
|
2480
|
-
for (w = ++S; B > w && (k =
|
|
2480
|
+
if (I.charCodeAt(S) == 46) {
|
|
2481
|
+
for (w = ++S; B > w && (k = I.charCodeAt(w), k >= 48 && 57 >= k); w++)
|
|
2481
2482
|
;
|
|
2482
2483
|
w == S && q(), S = w;
|
|
2483
2484
|
}
|
|
2484
|
-
if (k =
|
|
2485
|
-
for (k =
|
|
2485
|
+
if (k = I.charCodeAt(S), k == 101 || k == 69) {
|
|
2486
|
+
for (k = I.charCodeAt(++S), (k == 43 || k == 45) && S++, w = S; B > w && (k = I.charCodeAt(w), k >= 48 && 57 >= k); w++)
|
|
2486
2487
|
;
|
|
2487
2488
|
w == S && q(), S = w;
|
|
2488
2489
|
}
|
|
2489
|
-
return +
|
|
2490
|
+
return +I.slice(O, S);
|
|
2490
2491
|
}
|
|
2491
|
-
if (D && q(),
|
|
2492
|
+
if (D && q(), I.slice(S, S + 4) == "true")
|
|
2492
2493
|
return S += 4, !0;
|
|
2493
|
-
if (
|
|
2494
|
+
if (I.slice(S, S + 5) == "false")
|
|
2494
2495
|
return S += 5, !1;
|
|
2495
|
-
if (
|
|
2496
|
+
if (I.slice(S, S + 4) == "null")
|
|
2496
2497
|
return S += 4, null;
|
|
2497
2498
|
q();
|
|
2498
2499
|
}
|
|
@@ -2525,8 +2526,8 @@ function Xe() {
|
|
|
2525
2526
|
for (D = k.length; D--; )
|
|
2526
2527
|
ke(k, D, w);
|
|
2527
2528
|
else
|
|
2528
|
-
f(k, function(
|
|
2529
|
-
ke(k,
|
|
2529
|
+
f(k, function(I) {
|
|
2530
|
+
ke(k, I, w);
|
|
2530
2531
|
});
|
|
2531
2532
|
return w.call(E, O, k);
|
|
2532
2533
|
};
|
|
@@ -2566,16 +2567,16 @@ const Se = Object.entries(Ke).reduce(
|
|
|
2566
2567
|
return Ge(e) && s && (a[s] = e()), a;
|
|
2567
2568
|
},
|
|
2568
2569
|
{}
|
|
2569
|
-
),
|
|
2570
|
+
), Le = (a) => {
|
|
2570
2571
|
if (a in Se)
|
|
2571
2572
|
return Se[a];
|
|
2572
2573
|
throw new Error(`Socket version ${a} not found`);
|
|
2573
|
-
}, ze = (a, ...t) =>
|
|
2574
|
+
}, ze = (a, ...t) => Le(a)(...t), Je = {
|
|
2574
2575
|
...Se,
|
|
2575
|
-
getSocketVersion:
|
|
2576
|
+
getSocketVersion: Le,
|
|
2576
2577
|
makeSocketVersion: ze
|
|
2577
2578
|
};
|
|
2578
|
-
var We = /* @__PURE__ */ ((a) => (a.RINGING = "Ringing", a.TALKING = "Talking", a.DIALING = "Dialing", a.HOLD = "Hold", a))(We || {}), He = /* @__PURE__ */ ((a) => (a.INCOMING = "Incoming", a.OUTGOING = "Outgoing", a))(He || {}), re = /* @__PURE__ */ ((a) => (a.CONNECTED = "connected", a.DISCONNECTED = "disconnected", a.TRYING_TO_CONNECT = "tryingToConnect", a))(re || {}), Ye = /* @__PURE__ */ ((a) => (a.AUTOMATIC = "Automatic", a.IVR = "IVR", a))(Ye || {}), Qe = /* @__PURE__ */ ((a) => (a.INCOMINC = "Incoming", a.OUTGOING = "Outgoing", a.SPY = "Spy", a.CLICK2CALL = "Click2Call", a))(Qe || {}), Ze = /* @__PURE__ */ ((a) => (a.RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID", a.RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID", a))(Ze || {}), j = /* @__PURE__ */ ((a) => (a.ALL_DIALER_STATUS = "AllDialersStatus", a.ALL_EXTENSION_STATUS = "AllExtensionsStatus", a.ALL_USERS_STATUS = "AllUsersStatus", a.CONNECT = "connect", a.DISCONNECT = "disconnect", a.CONNECT_ERROR_EVENT = "connect_error", a.EXTENSION_EVENT = "ExtensionEvent", a.KEEP_ALIVE = "keepalive", a.KEEP_ALIVE_RESPONSE = "keepaliveResponse", a.LOGIN_STATUS = "loginStatus", a.LOGIN_SUCCESS = "loginSuccess", a.QUEUE_EVENT = "QueueEvent", a.ONLINE_STATUS_EVENT = "onlineStatusEvent", a.DIALER_EVENT = "DialerEvent", a.EXTENSIONS_UPDATED = "ExtensionsUpdated", a))(j || {}),
|
|
2579
|
+
var We = /* @__PURE__ */ ((a) => (a.RINGING = "Ringing", a.TALKING = "Talking", a.DIALING = "Dialing", a.HOLD = "Hold", a))(We || {}), He = /* @__PURE__ */ ((a) => (a.INCOMING = "Incoming", a.OUTGOING = "Outgoing", a))(He || {}), re = /* @__PURE__ */ ((a) => (a.CONNECTED = "connected", a.DISCONNECTED = "disconnected", a.TRYING_TO_CONNECT = "tryingToConnect", a))(re || {}), Ye = /* @__PURE__ */ ((a) => (a.AUTOMATIC = "Automatic", a.IVR = "IVR", a))(Ye || {}), Qe = /* @__PURE__ */ ((a) => (a.INCOMINC = "Incoming", a.OUTGOING = "Outgoing", a.SPY = "Spy", a.CLICK2CALL = "Click2Call", a))(Qe || {}), Ze = /* @__PURE__ */ ((a) => (a.RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID", a.RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID", a))(Ze || {}), j = /* @__PURE__ */ ((a) => (a.ALL_DIALER_STATUS = "AllDialersStatus", a.ALL_EXTENSION_STATUS = "AllExtensionsStatus", a.ALL_USERS_STATUS = "AllUsersStatus", a.CONNECT = "connect", a.DISCONNECT = "disconnect", a.CONNECT_ERROR_EVENT = "connect_error", a.EXTENSION_EVENT = "ExtensionEvent", a.KEEP_ALIVE = "keepalive", a.KEEP_ALIVE_RESPONSE = "keepaliveResponse", a.LOGIN_STATUS = "loginStatus", a.LOGIN_SUCCESS = "loginSuccess", a.QUEUE_EVENT = "QueueEvent", a.ONLINE_STATUS_EVENT = "onlineStatusEvent", a.DIALER_EVENT = "DialerEvent", a.EXTENSIONS_UPDATED = "ExtensionsUpdated", a))(j || {}), Oe = /* @__PURE__ */ ((a) => (a.NEWCALL = "NEWCALL", a.ANSWER = "ANSWER", a.HOLD = "HOLD", a.UNHOLD = "UNHOLD", a.HANGUP = "HANGUP", a.USER_STATUS_UPDATE = "userStatusUpdate", a))(Oe || {}), et = /* @__PURE__ */ ((a) => (a.NORMAL_HANGUP = "Normal hangup", a.USER_BUSY = "User busy", a.CALL_REJECTED = "Call Rejected", a.UNALLOCATED_NUMBER = "Unallocated (unassigned) number", a.UNKNOWN = "Unknown", a.NO_USER_RESPONDING = "No user responding", a.USER_ALERTING = "User alerting, no answer", a.ANSWERED_ELSEWHERE = "Answered elsewhere", a))(et || {}), tt = /* @__PURE__ */ ((a) => (a.ANSWER = "ANSWER", a.ABANDONED = "ABANDONED", a.EXIT = "EXIT", a.JOIN = "JOIN", a))(tt || {});
|
|
2579
2580
|
class le {
|
|
2580
2581
|
static mapExtensionEvent(t) {
|
|
2581
2582
|
var f, l;
|
|
@@ -2583,7 +2584,7 @@ class le {
|
|
|
2583
2584
|
let s, o;
|
|
2584
2585
|
t.data.currentCall && (o = this.mapExtensionCall(t, t.data.currentCall));
|
|
2585
2586
|
const h = this.mapExtensionData(t, t.data);
|
|
2586
|
-
return e ===
|
|
2587
|
+
return e === Oe.HANGUP ? s = {
|
|
2587
2588
|
...t,
|
|
2588
2589
|
reason: e,
|
|
2589
2590
|
data: {
|
|
@@ -2750,46 +2751,79 @@ class le {
|
|
|
2750
2751
|
};
|
|
2751
2752
|
}
|
|
2752
2753
|
}
|
|
2753
|
-
var
|
|
2754
|
+
var _e = /* @__PURE__ */ ((a) => (a.UPDATE_MONITORED_EXTENSIONS = "updateMonitoredExtensions", a.KEEP_ALIVE = "keepalive", a))(_e || {});
|
|
2754
2755
|
class nt {
|
|
2756
|
+
/**
|
|
2757
|
+
* Creates an instance of SocketIoClass and sets up network event listeners.
|
|
2758
|
+
* Automatically handles offline/online network state changes for both
|
|
2759
|
+
* browser and web worker environments.
|
|
2760
|
+
*
|
|
2761
|
+
* @param eventsSdkClass - The events SDK instance for managing connections and events
|
|
2762
|
+
*/
|
|
2755
2763
|
constructor(t) {
|
|
2764
|
+
/** The active Socket.IO connection instance */
|
|
2756
2765
|
X(this, "io");
|
|
2766
|
+
/** The Socket.IO function used to create connections based on version */
|
|
2757
2767
|
X(this, "ioFunction");
|
|
2768
|
+
/** Timestamp of the last received event, used for keep-alive calculations */
|
|
2758
2769
|
X(this, "lastEventTimestamp", (/* @__PURE__ */ new Date()).getTime());
|
|
2770
|
+
/** Flag indicating whether automatic reconnection should be attempted */
|
|
2759
2771
|
X(this, "doReconnect", !0);
|
|
2772
|
+
/** Interval handle for the keep-alive mechanism */
|
|
2760
2773
|
X(this, "keepAliveInterval");
|
|
2774
|
+
/** Interval handle for reconnection attempts */
|
|
2761
2775
|
X(this, "keepReconnectInterval");
|
|
2776
|
+
/** Timeout handle for delayed reconnection attempts */
|
|
2762
2777
|
X(this, "keepReconnectTimeout");
|
|
2778
|
+
/** Flag indicating current connection status */
|
|
2763
2779
|
X(this, "connected", !1);
|
|
2764
|
-
|
|
2765
|
-
this
|
|
2780
|
+
/** Current reconnection delay in seconds, increases with failed attempts */
|
|
2781
|
+
X(this, "reconnectionTime", Ne.reconnectionDelay);
|
|
2782
|
+
/** Maximum reconnection delay in seconds, prevents indefinite delays */
|
|
2783
|
+
X(this, "maxReconnectionDelay", 120);
|
|
2784
|
+
this.eventsSdkClass = t, this.eventsSdkClass = t, this.reconnectionTime = t.options.reconnectionDelay, typeof window < "u" && (window.addEventListener("offline", () => {
|
|
2766
2785
|
this.closeAllConnections();
|
|
2767
2786
|
}), window.addEventListener("online", () => {
|
|
2768
2787
|
setTimeout(() => {
|
|
2769
2788
|
this.keepReconnectTimeout && clearTimeout(this.keepReconnectTimeout), this.eventsSdkClass.connect(te.NEXT);
|
|
2770
|
-
},
|
|
2789
|
+
}, 500);
|
|
2771
2790
|
})), typeof self < "u" && typeof window > "u" && typeof global > "u" && (self.addEventListener("offline", () => {
|
|
2772
2791
|
this.closeAllConnections();
|
|
2773
2792
|
}), self.addEventListener("online", () => {
|
|
2774
2793
|
setTimeout(() => {
|
|
2775
2794
|
this.keepReconnectTimeout && clearTimeout(this.keepReconnectTimeout), this.eventsSdkClass.connect(te.NEXT);
|
|
2776
|
-
},
|
|
2795
|
+
}, 500);
|
|
2777
2796
|
}));
|
|
2778
2797
|
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Determines and sets the appropriate Socket.IO function based on client version.
|
|
2800
|
+
* Parses the version string and maps it to the corresponding socket implementation.
|
|
2801
|
+
*
|
|
2802
|
+
* @param Client - Version string containing the client version (e.g., "client-v1.2.3")
|
|
2803
|
+
*/
|
|
2779
2804
|
getSocketIoFunction(t) {
|
|
2780
2805
|
const e = t.split("v="), s = "v".concat(e[e.length - 1]).replaceAll(".", "_");
|
|
2781
2806
|
this.ioFunction = Je.getSocketVersion(s);
|
|
2782
2807
|
}
|
|
2808
|
+
/**
|
|
2809
|
+
* Initializes a new Socket.IO connection with authentication and configuration.
|
|
2810
|
+
* Sets up connection options including transport method, timeout, and authentication token.
|
|
2811
|
+
*/
|
|
2783
2812
|
initSocketConnection() {
|
|
2784
2813
|
const t = this.eventsSdkClass.authClass.token, e = this.eventsSdkClass.options.protocol, s = this.eventsSdkClass.server;
|
|
2785
2814
|
try {
|
|
2786
2815
|
const o = s ? s.Domain : this.eventsSdkClass.URL, h = s ? `${e}://${o}` : this.eventsSdkClass.URL, f = {
|
|
2787
2816
|
reconnection: !1,
|
|
2817
|
+
// Manual reconnection handling
|
|
2788
2818
|
upgrade: !1,
|
|
2819
|
+
// Prevent transport upgrades
|
|
2789
2820
|
transports: ["websocket"],
|
|
2821
|
+
// Force WebSocket transport
|
|
2790
2822
|
forceNew: !0,
|
|
2823
|
+
// Always create new connection
|
|
2791
2824
|
query: {
|
|
2792
2825
|
token: t
|
|
2826
|
+
// Include auth token in connection
|
|
2793
2827
|
},
|
|
2794
2828
|
timeout: this.eventsSdkClass.options.timeout
|
|
2795
2829
|
};
|
|
@@ -2807,47 +2841,119 @@ class nt {
|
|
|
2807
2841
|
this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o);
|
|
2808
2842
|
}
|
|
2809
2843
|
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Clears the keep-alive interval to stop periodic ping messages.
|
|
2846
|
+
* Used when disconnecting or cleaning up resources.
|
|
2847
|
+
*/
|
|
2810
2848
|
clearKeepAliveInterval() {
|
|
2811
2849
|
this.keepAliveInterval && clearInterval(this.keepAliveInterval);
|
|
2812
2850
|
}
|
|
2851
|
+
/**
|
|
2852
|
+
* Initializes the keep-alive mechanism to maintain connection health.
|
|
2853
|
+
* Sends periodic ping messages when no events have been received
|
|
2854
|
+
* within the configured timeout period.
|
|
2855
|
+
*/
|
|
2813
2856
|
initKeepAlive() {
|
|
2814
2857
|
this.keepAliveInterval && clearInterval(this.keepAliveInterval), this.keepAliveInterval = setInterval(async () => {
|
|
2815
2858
|
if ((/* @__PURE__ */ new Date()).getTime() > this.lastEventTimestamp + this.eventsSdkClass.options.keepAliveTimeout && this.io && this.eventsSdkClass.authClass.token) {
|
|
2816
|
-
this.eventsSdkClass.emit(
|
|
2859
|
+
this.eventsSdkClass.emit(_e.KEEP_ALIVE, this.eventsSdkClass.authClass.token), this.eventsSdkClass.loggerClass.keepAliveEmit();
|
|
2817
2860
|
return;
|
|
2818
2861
|
}
|
|
2819
2862
|
}, this.eventsSdkClass.options.keepAliveTimeout);
|
|
2820
2863
|
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Closes all active connections and cleans up resources.
|
|
2866
|
+
* Terminates socket connection, stops logging, and clears session storage.
|
|
2867
|
+
*/
|
|
2821
2868
|
closeAllConnections() {
|
|
2822
2869
|
var t;
|
|
2823
2870
|
this.io && (this.io.close(), (t = this.io) == null || t.disconnect(), this.io = void 0), this.eventsSdkClass.loggerClass.stop(), ae.clearSessionStorage();
|
|
2824
2871
|
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Sets up event listeners for all Socket.IO events.
|
|
2874
|
+
* Maps socket events to corresponding handler methods for processing.
|
|
2875
|
+
*/
|
|
2825
2876
|
initSocketEvents() {
|
|
2826
2877
|
this.io && this.io.on(j.LOGIN_SUCCESS, (t) => this.onLoginSuccessEvent(t, j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT, (t) => this.onQueueEvent(t, j.QUEUE_EVENT)).on(j.EXTENSION_EVENT, (t) => this.onExtensionEvent(t, j.EXTENSION_EVENT)).on(j.DIALER_EVENT, (t) => this.onDialerEvent(t, j.DIALER_EVENT)).on(j.LOGIN_STATUS, (t) => this.onLoginStatusEvent(t, j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS, (t) => this.onAllExtensionStatus(t, j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS, (t) => this.onAllDialerStatus(t, j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE, (t) => this.onKeepAliveResponse(t)).on(j.EXTENSIONS_UPDATED, (t) => this.onExtensionsUpdatedEvent(t, j.EXTENSIONS_UPDATED)).on(j.CONNECT, () => this.onConnect()).on(j.DISCONNECT, (t) => this.onDisconnect(t)).on(j.CONNECT_ERROR_EVENT, (t) => this.onConnectError(t));
|
|
2827
2878
|
}
|
|
2879
|
+
/**
|
|
2880
|
+
* Handles successful login events from the server.
|
|
2881
|
+
* Logs the event and forwards it to the event emitter.
|
|
2882
|
+
*
|
|
2883
|
+
* @param data - Login success event data
|
|
2884
|
+
* @param eventName - The event name for logging purposes
|
|
2885
|
+
*/
|
|
2828
2886
|
onLoginSuccessEvent(t, e) {
|
|
2829
2887
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2830
2888
|
}
|
|
2889
|
+
/**
|
|
2890
|
+
* Handles queue events from the server.
|
|
2891
|
+
* Maps the event data and forwards it to the event emitter.
|
|
2892
|
+
*
|
|
2893
|
+
* @param data - Queue event data
|
|
2894
|
+
* @param eventName - The event name for logging purposes
|
|
2895
|
+
*/
|
|
2831
2896
|
onQueueEvent(t, e) {
|
|
2832
2897
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapQueueEvent(t));
|
|
2833
2898
|
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Handles extension events from the server.
|
|
2901
|
+
* Maps and validates event data before forwarding to the event emitter.
|
|
2902
|
+
*
|
|
2903
|
+
* @param data - Extension event data
|
|
2904
|
+
* @param eventName - The event name for logging purposes
|
|
2905
|
+
*/
|
|
2834
2906
|
onExtensionEvent(t, e) {
|
|
2835
2907
|
const s = le.mapExtensionEvent(t);
|
|
2836
2908
|
s && (this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, s));
|
|
2837
2909
|
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Handles dialer events from the server.
|
|
2912
|
+
* Logs the event and forwards it to the event emitter.
|
|
2913
|
+
*
|
|
2914
|
+
* @param data - Dialer event data
|
|
2915
|
+
* @param eventName - The event name for logging purposes
|
|
2916
|
+
*/
|
|
2838
2917
|
onDialerEvent(t, e) {
|
|
2839
2918
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2840
2919
|
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Handles login status events from the server.
|
|
2922
|
+
* Maps the event data and forwards it to the event emitter.
|
|
2923
|
+
*
|
|
2924
|
+
* @param data - Login status event data
|
|
2925
|
+
* @param eventName - The event name for logging purposes
|
|
2926
|
+
*/
|
|
2841
2927
|
onLoginStatusEvent(t, e) {
|
|
2842
2928
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapLoginStatusEvent(t));
|
|
2843
2929
|
}
|
|
2930
|
+
/**
|
|
2931
|
+
* Handles all extension status events from the server.
|
|
2932
|
+
* Maps the event data and forwards it to the event emitter.
|
|
2933
|
+
*
|
|
2934
|
+
* @param data - All extension status event data
|
|
2935
|
+
* @param eventName - The event name for logging purposes
|
|
2936
|
+
*/
|
|
2844
2937
|
onAllExtensionStatus(t, e) {
|
|
2845
2938
|
const s = le.mapAllExtensionStatus(t);
|
|
2846
2939
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, s);
|
|
2847
2940
|
}
|
|
2941
|
+
/**
|
|
2942
|
+
* Handles all dialer status events from the server.
|
|
2943
|
+
* Logs the event and forwards it to the event emitter.
|
|
2944
|
+
*
|
|
2945
|
+
* @param data - All dialer status event data
|
|
2946
|
+
* @param eventName - The event name for logging purposes
|
|
2947
|
+
*/
|
|
2848
2948
|
onAllDialerStatus(t, e) {
|
|
2849
2949
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2850
2950
|
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Handles keep-alive response events from the server.
|
|
2953
|
+
* Manages connection health and triggers reconnection if needed.
|
|
2954
|
+
*
|
|
2955
|
+
* @param data - Keep-alive response event data
|
|
2956
|
+
*/
|
|
2851
2957
|
onKeepAliveResponse(t) {
|
|
2852
2958
|
if (this.eventsSdkClass.loggerClass.keepAliveResponse(t), t.errorCode) {
|
|
2853
2959
|
this.initSocketConnection();
|
|
@@ -2855,32 +2961,61 @@ class nt {
|
|
|
2855
2961
|
}
|
|
2856
2962
|
this.connected ? this.lastEventTimestamp = (/* @__PURE__ */ new Date()).getTime() : this.initSocketConnection();
|
|
2857
2963
|
}
|
|
2964
|
+
/**
|
|
2965
|
+
* Handles extension update events from the server.
|
|
2966
|
+
* Logs the event and forwards it to the event emitter.
|
|
2967
|
+
*
|
|
2968
|
+
* @param data - Extensions updated event data
|
|
2969
|
+
* @param eventName - The event name for logging purposes
|
|
2970
|
+
*/
|
|
2858
2971
|
onExtensionsUpdatedEvent(t, e) {
|
|
2859
2972
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2860
2973
|
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Handles successful socket connection events.
|
|
2976
|
+
* Updates connection state, clears reconnection timers, and starts logging.
|
|
2977
|
+
*/
|
|
2861
2978
|
onConnect() {
|
|
2862
|
-
this.connected = !0, this.keepReconnectInterval && clearInterval(this.keepReconnectInterval), this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2979
|
+
this.connected = !0, this.reconnectionTime = this.eventsSdkClass.options.reconnectionDelay, this.keepReconnectInterval && clearInterval(this.keepReconnectInterval), this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2863
2980
|
connectionStatus: re.CONNECTED
|
|
2864
2981
|
}), this.eventsSdkClass.loggerClass.start().then(() => {
|
|
2865
2982
|
this.eventsSdkClass.loggerClass.sdkConnectionSuccess();
|
|
2866
2983
|
});
|
|
2867
2984
|
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Handles socket disconnection events.
|
|
2987
|
+
* Manages reconnection logic with exponential backoff strategy.
|
|
2988
|
+
*
|
|
2989
|
+
* @param reason - The reason for disconnection
|
|
2990
|
+
*/
|
|
2868
2991
|
onDisconnect(t) {
|
|
2869
2992
|
this.connected = !1, this.doReconnect && (this.closeAllConnections(), this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2870
2993
|
connectionStatus: this.doReconnect ? re.TRYING_TO_CONNECT : re.DISCONNECTED
|
|
2871
2994
|
}), this.eventsSdkClass.loggerClass.sdkDisconnect([t]), this.keepReconnectTimeout = setTimeout(
|
|
2872
2995
|
() => {
|
|
2873
|
-
this.reconnectionTime =
|
|
2996
|
+
this.reconnectionTime = Math.min(
|
|
2997
|
+
this.reconnectionTime * 2,
|
|
2998
|
+
this.maxReconnectionDelay
|
|
2999
|
+
), this.reconnectionTime > this.maxReconnectionDelay && (this.reconnectionTime = this.eventsSdkClass.options.reconnectionDelay), this.eventsSdkClass.connect(te.NEXT);
|
|
2874
3000
|
},
|
|
2875
3001
|
this.reconnectionTime * 1e3
|
|
2876
3002
|
));
|
|
2877
3003
|
}
|
|
3004
|
+
/**
|
|
3005
|
+
* Handles socket connection error events.
|
|
3006
|
+
* Manages reconnection attempts with exponential backoff strategy.
|
|
3007
|
+
*
|
|
3008
|
+
* @param data - Error information from the connection attempt
|
|
3009
|
+
*/
|
|
2878
3010
|
onConnectError(t) {
|
|
2879
3011
|
this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2880
3012
|
connectionStatus: this.doReconnect ? re.TRYING_TO_CONNECT : re.DISCONNECTED
|
|
2881
3013
|
}), this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(t), this.keepReconnectTimeout = setTimeout(
|
|
2882
3014
|
() => {
|
|
2883
|
-
this.reconnectionTime =
|
|
3015
|
+
this.reconnectionTime = Math.min(
|
|
3016
|
+
this.reconnectionTime * 2,
|
|
3017
|
+
this.maxReconnectionDelay
|
|
3018
|
+
), this.reconnectionTime > this.maxReconnectionDelay && (this.reconnectionTime = this.eventsSdkClass.options.reconnectionDelay), this.eventsSdkClass.connect(te.NEXT);
|
|
2884
3019
|
},
|
|
2885
3020
|
this.reconnectionTime * 1e3
|
|
2886
3021
|
);
|
|
@@ -2902,7 +3037,7 @@ class rt {
|
|
|
2902
3037
|
this.eventsSdkClass.options.loggerSocketConnection && (t = this.eventsSdkClass.options.loggerSocketConnection), this.eventsSdkClass.socketIoClass.ioFunction && !t && (t = this.eventsSdkClass.socketIoClass.ioFunction(
|
|
2903
3038
|
this.eventsSdkClass.options.loggerServer,
|
|
2904
3039
|
this.eventsSdkClass.options.loggerConnectOptions
|
|
2905
|
-
)), t && (this.storageLogger = new
|
|
3040
|
+
)), t && (this.storageLogger = new Ue({
|
|
2906
3041
|
socket: t,
|
|
2907
3042
|
loggerOptions: this.eventsSdkClass.options.loggerConfig
|
|
2908
3043
|
}));
|
|
@@ -3108,8 +3243,8 @@ class ct {
|
|
|
3108
3243
|
X(this, "socket");
|
|
3109
3244
|
X(this, "mainServer");
|
|
3110
3245
|
X(this, "alreadyAttemptedOtherServers", []);
|
|
3111
|
-
X(this, "authClass", new
|
|
3112
|
-
X(this, "socketIoClass"
|
|
3246
|
+
X(this, "authClass", new qe(this));
|
|
3247
|
+
X(this, "socketIoClass");
|
|
3113
3248
|
X(this, "loggerClass", new rt(this));
|
|
3114
3249
|
X(this, "eventEmitterClass", new st(this));
|
|
3115
3250
|
X(this, "getCircularReplacer", () => {
|
|
@@ -3126,9 +3261,9 @@ class ct {
|
|
|
3126
3261
|
};
|
|
3127
3262
|
});
|
|
3128
3263
|
this.options = {
|
|
3129
|
-
...
|
|
3264
|
+
...Ne,
|
|
3130
3265
|
...t
|
|
3131
|
-
};
|
|
3266
|
+
}, this.socketIoClass = new nt(this);
|
|
3132
3267
|
}
|
|
3133
3268
|
on(t, e) {
|
|
3134
3269
|
this.eventEmitterClass.on(t, e);
|
|
@@ -3193,11 +3328,11 @@ export {
|
|
|
3193
3328
|
Qe as DirectionEnum,
|
|
3194
3329
|
Ze as DoNotCallMeStatusCodeEnum,
|
|
3195
3330
|
j as EventsEnum,
|
|
3196
|
-
|
|
3331
|
+
Oe as ExtensionEventReasonEnum,
|
|
3197
3332
|
et as ExtensionHangupCauseEnum,
|
|
3198
3333
|
Z as LoginType,
|
|
3199
3334
|
tt as QueueEventReasonEnum,
|
|
3200
|
-
|
|
3335
|
+
_e as ServerListenerEventsEnum,
|
|
3201
3336
|
te as ServerParameter,
|
|
3202
3337
|
ct as default
|
|
3203
3338
|
};
|