@voicenter-team/events-sdk 0.0.71 → 0.0.72
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 +4 -4
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.es.js +258 -249
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +5 -5
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +5 -5
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var xr = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
2
|
+
var Rr = (t, e, r) => e in t ? xr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var K = (t, e, r) => (Rr(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import Ir from "ws";
|
|
5
5
|
function Br(t) {
|
|
6
6
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
7
7
|
}
|
|
@@ -147,8 +147,8 @@ function Ur(t) {
|
|
|
147
147
|
})();
|
|
148
148
|
var Dr = er.exports;
|
|
149
149
|
const Pr = /* @__PURE__ */ Br(Dr);
|
|
150
|
-
var
|
|
151
|
-
class
|
|
150
|
+
var mt = /* @__PURE__ */ ((t) => (t.MAIN = "main", t.NEXT = "next", t))(mt || {}), ht = /* @__PURE__ */ ((t) => (t.USER = "User", t.TOKEN = "Token", t))(ht || {});
|
|
151
|
+
class Rt {
|
|
152
152
|
static async getSessionStorageDataByKey(e, r = !0) {
|
|
153
153
|
if (typeof chrome < "u" && typeof chrome.storage < "u") {
|
|
154
154
|
const n = await chrome.storage.session.get(e);
|
|
@@ -227,7 +227,7 @@ function Kr(t, e) {
|
|
|
227
227
|
o && (r[o] = i);
|
|
228
228
|
}), r;
|
|
229
229
|
}
|
|
230
|
-
var fe = { exports: {} }, de = { exports: {} },
|
|
230
|
+
var fe = { exports: {} }, de = { exports: {} }, It = 1e3, Bt = It * 60, _t = Bt * 60, Lt = _t * 24, Hr = Lt * 365.25, Jr = function(t, e) {
|
|
231
231
|
e = e || {};
|
|
232
232
|
var r = typeof t;
|
|
233
233
|
if (r === "string" && t.length > 0)
|
|
@@ -273,7 +273,7 @@ function Vr(t) {
|
|
|
273
273
|
case "secs":
|
|
274
274
|
case "sec":
|
|
275
275
|
case "s":
|
|
276
|
-
return r *
|
|
276
|
+
return r * It;
|
|
277
277
|
case "milliseconds":
|
|
278
278
|
case "millisecond":
|
|
279
279
|
case "msecs":
|
|
@@ -287,10 +287,10 @@ function Vr(t) {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
function $r(t) {
|
|
290
|
-
return t >= Lt ? Math.round(t / Lt) + "d" : t >= _t ? Math.round(t / _t) + "h" : t >= Bt ? Math.round(t / Bt) + "m" : t >=
|
|
290
|
+
return t >= Lt ? Math.round(t / Lt) + "d" : t >= _t ? Math.round(t / _t) + "h" : t >= Bt ? Math.round(t / Bt) + "m" : t >= It ? Math.round(t / It) + "s" : t + "ms";
|
|
291
291
|
}
|
|
292
292
|
function Gr(t) {
|
|
293
|
-
return Dt(t, Lt, "day") || Dt(t, _t, "hour") || Dt(t, Bt, "minute") || Dt(t,
|
|
293
|
+
return Dt(t, Lt, "day") || Dt(t, _t, "hour") || Dt(t, Bt, "minute") || Dt(t, It, "second") || t + " ms";
|
|
294
294
|
}
|
|
295
295
|
function Dt(t, e, r) {
|
|
296
296
|
if (!(t < e))
|
|
@@ -1286,7 +1286,7 @@ for (; gt < qt; gt++)
|
|
|
1286
1286
|
fr[lr[gt]] = gt;
|
|
1287
1287
|
Oe.encode = ve;
|
|
1288
1288
|
Oe.decode = An;
|
|
1289
|
-
var dr = Oe, yr = Ne(), Tn = Ht(), gr = kt, Nn = Jt, On = dr,
|
|
1289
|
+
var dr = Oe, yr = Ne(), Tn = Ht(), gr = kt, Nn = Jt, On = dr, ct = lt("engine.io-client:polling"), mr = pt, xn = function() {
|
|
1290
1290
|
var t = Ae, e = new t({ xdomain: !1 });
|
|
1291
1291
|
return e.responseType != null;
|
|
1292
1292
|
}();
|
|
@@ -1303,37 +1303,37 @@ pt.prototype.pause = function(t) {
|
|
|
1303
1303
|
var e = this;
|
|
1304
1304
|
this.readyState = "pausing";
|
|
1305
1305
|
function r() {
|
|
1306
|
-
|
|
1306
|
+
ct("paused"), e.readyState = "paused", t();
|
|
1307
1307
|
}
|
|
1308
1308
|
if (this.polling || !this.writable) {
|
|
1309
1309
|
var n = 0;
|
|
1310
|
-
this.polling && (
|
|
1311
|
-
|
|
1312
|
-
})), this.writable || (
|
|
1313
|
-
|
|
1310
|
+
this.polling && (ct("we are currently polling - waiting to pause"), n++, this.once("pollComplete", function() {
|
|
1311
|
+
ct("pre-pause polling complete"), --n || r();
|
|
1312
|
+
})), this.writable || (ct("we are currently writing - waiting to pause"), n++, this.once("drain", function() {
|
|
1313
|
+
ct("pre-pause writing complete"), --n || r();
|
|
1314
1314
|
}));
|
|
1315
1315
|
} else
|
|
1316
1316
|
r();
|
|
1317
1317
|
};
|
|
1318
1318
|
pt.prototype.poll = function() {
|
|
1319
|
-
|
|
1319
|
+
ct("polling"), this.polling = !0, this.doPoll(), this.emit("poll");
|
|
1320
1320
|
};
|
|
1321
1321
|
pt.prototype.onData = function(t) {
|
|
1322
1322
|
var e = this;
|
|
1323
|
-
|
|
1323
|
+
ct("polling got data %s", t);
|
|
1324
1324
|
var r = function(n, o, i) {
|
|
1325
1325
|
if (e.readyState === "opening" && n.type === "open" && e.onOpen(), n.type === "close")
|
|
1326
1326
|
return e.onClose(), !1;
|
|
1327
1327
|
e.onPacket(n);
|
|
1328
1328
|
};
|
|
1329
|
-
gr.decodePayload(t, this.socket.binaryType, r), this.readyState !== "closed" && (this.polling = !1, this.emit("pollComplete"), this.readyState === "open" ? this.poll() :
|
|
1329
|
+
gr.decodePayload(t, this.socket.binaryType, r), this.readyState !== "closed" && (this.polling = !1, this.emit("pollComplete"), this.readyState === "open" ? this.poll() : ct('ignoring poll - transport state "%s"', this.readyState));
|
|
1330
1330
|
};
|
|
1331
1331
|
pt.prototype.doClose = function() {
|
|
1332
1332
|
var t = this;
|
|
1333
1333
|
function e() {
|
|
1334
|
-
|
|
1334
|
+
ct("writing close packet"), t.write([{ type: "close" }]);
|
|
1335
1335
|
}
|
|
1336
|
-
this.readyState === "open" ? (
|
|
1336
|
+
this.readyState === "open" ? (ct("transport open - closing"), e()) : (ct("transport not open - deferring close"), this.once("open", e));
|
|
1337
1337
|
};
|
|
1338
1338
|
pt.prototype.write = function(t) {
|
|
1339
1339
|
var e = this;
|
|
@@ -1351,7 +1351,7 @@ pt.prototype.uri = function() {
|
|
|
1351
1351
|
var n = this.hostname.indexOf(":") !== -1;
|
|
1352
1352
|
return e + "://" + (n ? "[" + this.hostname + "]" : this.hostname) + r + this.path + t;
|
|
1353
1353
|
};
|
|
1354
|
-
var
|
|
1354
|
+
var Rn = Ae, vr = mr, In = St, Bn = Jt, ke = lt("engine.io-client:polling-xhr"), _n = Ee;
|
|
1355
1355
|
Te.exports = Et;
|
|
1356
1356
|
Te.exports.Request = Y;
|
|
1357
1357
|
function We() {
|
|
@@ -1385,11 +1385,11 @@ Et.prototype.doPoll = function() {
|
|
|
1385
1385
|
function Y(t) {
|
|
1386
1386
|
this.method = t.method || "GET", this.uri = t.uri, this.xd = !!t.xd, this.xs = !!t.xs, this.async = t.async !== !1, this.data = t.data !== void 0 ? t.data : null, this.agent = t.agent, this.isBinary = t.isBinary, this.supportsBinary = t.supportsBinary, this.enablesXDR = t.enablesXDR, this.withCredentials = t.withCredentials, this.requestTimeout = t.requestTimeout, this.pfx = t.pfx, this.key = t.key, this.passphrase = t.passphrase, this.cert = t.cert, this.ca = t.ca, this.ciphers = t.ciphers, this.rejectUnauthorized = t.rejectUnauthorized, this.extraHeaders = t.extraHeaders, this.create();
|
|
1387
1387
|
}
|
|
1388
|
-
|
|
1388
|
+
In(Y.prototype);
|
|
1389
1389
|
Y.prototype.create = function() {
|
|
1390
1390
|
var t = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
|
|
1391
1391
|
t.pfx = this.pfx, t.key = this.key, t.passphrase = this.passphrase, t.cert = this.cert, t.ca = this.ca, t.ciphers = this.ciphers, t.rejectUnauthorized = this.rejectUnauthorized;
|
|
1392
|
-
var e = this.xhr = new
|
|
1392
|
+
var e = this.xhr = new Rn(t), r = this;
|
|
1393
1393
|
try {
|
|
1394
1394
|
ke("xhr open %s: %s", this.method, this.uri), e.open(this.method, this.uri, this.async);
|
|
1395
1395
|
try {
|
|
@@ -1554,19 +1554,19 @@ const qn = {}, zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
1554
1554
|
__proto__: null,
|
|
1555
1555
|
default: qn
|
|
1556
1556
|
}, Symbol.toStringTag, { value: "Module" })), Xn = /* @__PURE__ */ qr(zn);
|
|
1557
|
-
var
|
|
1557
|
+
var Re = Ne(), Wn = kt, Kn = Ht(), Hn = Jt, Jn = dr, Vn = lt("engine.io-client:websocket"), zt, Ie;
|
|
1558
1558
|
typeof WebSocket < "u" ? zt = WebSocket : typeof self < "u" && (zt = self.WebSocket || self.MozWebSocket);
|
|
1559
1559
|
if (typeof window > "u")
|
|
1560
1560
|
try {
|
|
1561
|
-
|
|
1561
|
+
Ie = Xn;
|
|
1562
1562
|
} catch {
|
|
1563
1563
|
}
|
|
1564
|
-
var wt = zt ||
|
|
1564
|
+
var wt = zt || Ie, $n = st;
|
|
1565
1565
|
function st(t) {
|
|
1566
1566
|
var e = t && t.forceBase64;
|
|
1567
|
-
e && (this.supportsBinary = !1), this.perMessageDeflate = t.perMessageDeflate, this.usingBrowserWebSocket = zt && !t.forceNode, this.protocols = t.protocols, this.usingBrowserWebSocket || (wt =
|
|
1567
|
+
e && (this.supportsBinary = !1), this.perMessageDeflate = t.perMessageDeflate, this.usingBrowserWebSocket = zt && !t.forceNode, this.protocols = t.protocols, this.usingBrowserWebSocket || (wt = Ie), Re.call(this, t);
|
|
1568
1568
|
}
|
|
1569
|
-
Hn(st,
|
|
1569
|
+
Hn(st, Re);
|
|
1570
1570
|
st.prototype.name = "websocket";
|
|
1571
1571
|
st.prototype.supportsBinary = !0;
|
|
1572
1572
|
st.prototype.doOpen = function() {
|
|
@@ -1621,7 +1621,7 @@ st.prototype.write = function(t) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
};
|
|
1623
1623
|
st.prototype.onClose = function() {
|
|
1624
|
-
|
|
1624
|
+
Re.prototype.onClose.call(this);
|
|
1625
1625
|
};
|
|
1626
1626
|
st.prototype.doClose = function() {
|
|
1627
1627
|
typeof this.ws < "u" && this.ws.close();
|
|
@@ -2080,10 +2080,10 @@ Tt.prototype.setMax = function(t) {
|
|
|
2080
2080
|
Tt.prototype.setJitter = function(t) {
|
|
2081
2081
|
this.jitter = t;
|
|
2082
2082
|
};
|
|
2083
|
-
var lo = co, fo = Sr(), yo = St, go = Xt, ft = Cr, Ct = wr, Z = lt("socket.io-client:manager"), Er = kr, mo = uo, Ar = Object.prototype.hasOwnProperty, Qe =
|
|
2084
|
-
function
|
|
2085
|
-
if (!(this instanceof
|
|
2086
|
-
return new
|
|
2083
|
+
var lo = co, fo = Sr(), yo = St, go = Xt, ft = Cr, Ct = wr, Z = lt("socket.io-client:manager"), Er = kr, mo = uo, Ar = Object.prototype.hasOwnProperty, Qe = H;
|
|
2084
|
+
function H(t, e) {
|
|
2085
|
+
if (!(this instanceof H))
|
|
2086
|
+
return new H(t, e);
|
|
2087
2087
|
t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.nsps = {}, this.subs = [], this.opts = e, this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor(e.randomizationFactor || 0.5), this.backoff = new mo({
|
|
2088
2088
|
min: this.reconnectionDelay(),
|
|
2089
2089
|
max: this.reconnectionDelayMax(),
|
|
@@ -2092,41 +2092,41 @@ function K(t, e) {
|
|
|
2092
2092
|
var r = e.parser || go;
|
|
2093
2093
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this.autoConnect = e.autoConnect !== !1, this.autoConnect && this.open();
|
|
2094
2094
|
}
|
|
2095
|
-
|
|
2095
|
+
H.prototype.emitAll = function() {
|
|
2096
2096
|
this.emit.apply(this, arguments);
|
|
2097
2097
|
for (var t in this.nsps)
|
|
2098
2098
|
Ar.call(this.nsps, t) && this.nsps[t].emit.apply(this.nsps[t], arguments);
|
|
2099
2099
|
};
|
|
2100
|
-
|
|
2100
|
+
H.prototype.updateSocketIds = function() {
|
|
2101
2101
|
for (var t in this.nsps)
|
|
2102
2102
|
Ar.call(this.nsps, t) && (this.nsps[t].id = this.generateId(t));
|
|
2103
2103
|
};
|
|
2104
|
-
|
|
2104
|
+
H.prototype.generateId = function(t) {
|
|
2105
2105
|
return (t === "/" ? "" : t + "#") + this.engine.id;
|
|
2106
2106
|
};
|
|
2107
|
-
yo(
|
|
2108
|
-
|
|
2107
|
+
yo(H.prototype);
|
|
2108
|
+
H.prototype.reconnection = function(t) {
|
|
2109
2109
|
return arguments.length ? (this._reconnection = !!t, this) : this._reconnection;
|
|
2110
2110
|
};
|
|
2111
|
-
|
|
2111
|
+
H.prototype.reconnectionAttempts = function(t) {
|
|
2112
2112
|
return arguments.length ? (this._reconnectionAttempts = t, this) : this._reconnectionAttempts;
|
|
2113
2113
|
};
|
|
2114
|
-
|
|
2114
|
+
H.prototype.reconnectionDelay = function(t) {
|
|
2115
2115
|
return arguments.length ? (this._reconnectionDelay = t, this.backoff && this.backoff.setMin(t), this) : this._reconnectionDelay;
|
|
2116
2116
|
};
|
|
2117
|
-
|
|
2117
|
+
H.prototype.randomizationFactor = function(t) {
|
|
2118
2118
|
return arguments.length ? (this._randomizationFactor = t, this.backoff && this.backoff.setJitter(t), this) : this._randomizationFactor;
|
|
2119
2119
|
};
|
|
2120
|
-
|
|
2120
|
+
H.prototype.reconnectionDelayMax = function(t) {
|
|
2121
2121
|
return arguments.length ? (this._reconnectionDelayMax = t, this.backoff && this.backoff.setMax(t), this) : this._reconnectionDelayMax;
|
|
2122
2122
|
};
|
|
2123
|
-
|
|
2123
|
+
H.prototype.timeout = function(t) {
|
|
2124
2124
|
return arguments.length ? (this._timeout = t, this) : this._timeout;
|
|
2125
2125
|
};
|
|
2126
|
-
|
|
2126
|
+
H.prototype.maybeReconnectOnOpen = function() {
|
|
2127
2127
|
!this.reconnecting && this._reconnection && this.backoff.attempts === 0 && this.reconnect();
|
|
2128
2128
|
};
|
|
2129
|
-
|
|
2129
|
+
H.prototype.open = H.prototype.connect = function(t, e) {
|
|
2130
2130
|
if (Z("readyState %s", this.readyState), ~this.readyState.indexOf("open"))
|
|
2131
2131
|
return this;
|
|
2132
2132
|
Z("opening %s", this.uri), this.engine = lo(this.uri, this.opts);
|
|
@@ -2155,27 +2155,27 @@ K.prototype.open = K.prototype.connect = function(t, e) {
|
|
|
2155
2155
|
}
|
|
2156
2156
|
return this.subs.push(o), this.subs.push(i), this;
|
|
2157
2157
|
};
|
|
2158
|
-
|
|
2158
|
+
H.prototype.onopen = function() {
|
|
2159
2159
|
Z("open"), this.cleanup(), this.readyState = "open", this.emit("open");
|
|
2160
2160
|
var t = this.engine;
|
|
2161
2161
|
this.subs.push(ft(t, "data", Ct(this, "ondata"))), this.subs.push(ft(t, "ping", Ct(this, "onping"))), this.subs.push(ft(t, "pong", Ct(this, "onpong"))), this.subs.push(ft(t, "error", Ct(this, "onerror"))), this.subs.push(ft(t, "close", Ct(this, "onclose"))), this.subs.push(ft(this.decoder, "decoded", Ct(this, "ondecoded")));
|
|
2162
2162
|
};
|
|
2163
|
-
|
|
2163
|
+
H.prototype.onping = function() {
|
|
2164
2164
|
this.lastPing = /* @__PURE__ */ new Date(), this.emitAll("ping");
|
|
2165
2165
|
};
|
|
2166
|
-
|
|
2166
|
+
H.prototype.onpong = function() {
|
|
2167
2167
|
this.emitAll("pong", /* @__PURE__ */ new Date() - this.lastPing);
|
|
2168
2168
|
};
|
|
2169
|
-
|
|
2169
|
+
H.prototype.ondata = function(t) {
|
|
2170
2170
|
this.decoder.add(t);
|
|
2171
2171
|
};
|
|
2172
|
-
|
|
2172
|
+
H.prototype.ondecoded = function(t) {
|
|
2173
2173
|
this.emit("packet", t);
|
|
2174
2174
|
};
|
|
2175
|
-
|
|
2175
|
+
H.prototype.onerror = function(t) {
|
|
2176
2176
|
Z("error", t), this.emitAll("error", t);
|
|
2177
2177
|
};
|
|
2178
|
-
|
|
2178
|
+
H.prototype.socket = function(t, e) {
|
|
2179
2179
|
var r = this.nsps[t];
|
|
2180
2180
|
if (!r) {
|
|
2181
2181
|
r = new fo(this, t, e), this.nsps[t] = r;
|
|
@@ -2189,11 +2189,11 @@ K.prototype.socket = function(t, e) {
|
|
|
2189
2189
|
}
|
|
2190
2190
|
return r;
|
|
2191
2191
|
};
|
|
2192
|
-
|
|
2192
|
+
H.prototype.destroy = function(t) {
|
|
2193
2193
|
var e = Er(this.connecting, t);
|
|
2194
2194
|
~e && this.connecting.splice(e, 1), !this.connecting.length && this.close();
|
|
2195
2195
|
};
|
|
2196
|
-
|
|
2196
|
+
H.prototype.packet = function(t) {
|
|
2197
2197
|
Z("writing packet %j", t);
|
|
2198
2198
|
var e = this;
|
|
2199
2199
|
t.query && t.type === 0 && (t.nsp += "?" + t.query), e.encoding ? e.packetBuffer.push(t) : (e.encoding = !0, this.encoder.encode(t, function(r) {
|
|
@@ -2202,13 +2202,13 @@ K.prototype.packet = function(t) {
|
|
|
2202
2202
|
e.encoding = !1, e.processPacketQueue();
|
|
2203
2203
|
}));
|
|
2204
2204
|
};
|
|
2205
|
-
|
|
2205
|
+
H.prototype.processPacketQueue = function() {
|
|
2206
2206
|
if (this.packetBuffer.length > 0 && !this.encoding) {
|
|
2207
2207
|
var t = this.packetBuffer.shift();
|
|
2208
2208
|
this.packet(t);
|
|
2209
2209
|
}
|
|
2210
2210
|
};
|
|
2211
|
-
|
|
2211
|
+
H.prototype.cleanup = function() {
|
|
2212
2212
|
Z("cleanup");
|
|
2213
2213
|
for (var t = this.subs.length, e = 0; e < t; e++) {
|
|
2214
2214
|
var r = this.subs.shift();
|
|
@@ -2216,13 +2216,13 @@ K.prototype.cleanup = function() {
|
|
|
2216
2216
|
}
|
|
2217
2217
|
this.packetBuffer = [], this.encoding = !1, this.lastPing = null, this.decoder.destroy();
|
|
2218
2218
|
};
|
|
2219
|
-
|
|
2219
|
+
H.prototype.close = H.prototype.disconnect = function() {
|
|
2220
2220
|
Z("disconnect"), this.skipReconnect = !0, this.reconnecting = !1, this.readyState === "opening" && this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.engine && this.engine.close();
|
|
2221
2221
|
};
|
|
2222
|
-
|
|
2222
|
+
H.prototype.onclose = function(t) {
|
|
2223
2223
|
Z("onclose"), this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.emit("close", t), this._reconnection && !this.skipReconnect && this.reconnect();
|
|
2224
2224
|
};
|
|
2225
|
-
|
|
2225
|
+
H.prototype.reconnect = function() {
|
|
2226
2226
|
if (this.reconnecting || this.skipReconnect)
|
|
2227
2227
|
return this;
|
|
2228
2228
|
var t = this;
|
|
@@ -2243,7 +2243,7 @@ K.prototype.reconnect = function() {
|
|
|
2243
2243
|
});
|
|
2244
2244
|
}
|
|
2245
2245
|
};
|
|
2246
|
-
|
|
2246
|
+
H.prototype.onreconnect = function() {
|
|
2247
2247
|
var t = this.backoff.attempts;
|
|
2248
2248
|
this.reconnecting = !1, this.backoff.reset(), this.updateSocketIds(), this.emitAll("reconnect", t);
|
|
2249
2249
|
};
|
|
@@ -2342,7 +2342,7 @@ const xo = {
|
|
|
2342
2342
|
logToConsole: !0,
|
|
2343
2343
|
overloadGlobalConsole: !1,
|
|
2344
2344
|
socketEmitInterval: 6e4
|
|
2345
|
-
},
|
|
2345
|
+
}, it = {
|
|
2346
2346
|
CREATE: "Create",
|
|
2347
2347
|
READ: "Read",
|
|
2348
2348
|
UPDATE: "Update",
|
|
@@ -2362,7 +2362,7 @@ const xo = {
|
|
|
2362
2362
|
CHECK: "Check",
|
|
2363
2363
|
WEBHOOK: "Webhook",
|
|
2364
2364
|
WSCONNECT: "WSConnect"
|
|
2365
|
-
},
|
|
2365
|
+
}, Ro = {
|
|
2366
2366
|
Create: 1,
|
|
2367
2367
|
Read: 2,
|
|
2368
2368
|
Update: 3,
|
|
@@ -2382,7 +2382,7 @@ const xo = {
|
|
|
2382
2382
|
Check: 17,
|
|
2383
2383
|
Webhook: 18,
|
|
2384
2384
|
WSConnect: 19
|
|
2385
|
-
},
|
|
2385
|
+
}, at = {
|
|
2386
2386
|
INFO: "info",
|
|
2387
2387
|
WARNING: "warning",
|
|
2388
2388
|
MODIFY: "modify",
|
|
@@ -2395,7 +2395,7 @@ const xo = {
|
|
|
2395
2395
|
DEBUG: "debug"
|
|
2396
2396
|
};
|
|
2397
2397
|
let rt = console;
|
|
2398
|
-
class
|
|
2398
|
+
class Io {
|
|
2399
2399
|
/**
|
|
2400
2400
|
* Initialize storage logger
|
|
2401
2401
|
* @param options The configuration of the logger.
|
|
@@ -2495,7 +2495,7 @@ class Ro {
|
|
|
2495
2495
|
const r = {
|
|
2496
2496
|
...e
|
|
2497
2497
|
}, n = r.ActionName;
|
|
2498
|
-
return n && (r.ActionID =
|
|
2498
|
+
return n && (r.ActionID = Ro[n]), r;
|
|
2499
2499
|
}
|
|
2500
2500
|
/**
|
|
2501
2501
|
* Used to set a static object which will be send in every message
|
|
@@ -2693,12 +2693,12 @@ class Ro {
|
|
|
2693
2693
|
}
|
|
2694
2694
|
class Bo {
|
|
2695
2695
|
constructor(e) {
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2696
|
+
K(this, "delay", 1e3);
|
|
2697
|
+
K(this, "lastLoginTimestamp");
|
|
2698
|
+
K(this, "token");
|
|
2699
|
+
K(this, "refreshToken");
|
|
2700
|
+
K(this, "tokenExpiry");
|
|
2701
|
+
K(this, "storageKey");
|
|
2702
2702
|
this.eventsSdkClass = e, this.eventsSdkClass = e, this.storageKey = "";
|
|
2703
2703
|
}
|
|
2704
2704
|
async login() {
|
|
@@ -2714,13 +2714,13 @@ class Bo {
|
|
|
2714
2714
|
return;
|
|
2715
2715
|
this.updateLastLoginTimestamp();
|
|
2716
2716
|
const r = await this.checkLoginStatus(this.storageKey);
|
|
2717
|
-
return r || (
|
|
2717
|
+
return r || (Rt.clearSessionStorage(), await this.userLoginFunction(e, this.storageKey, this.eventsSdkClass.options.loginType));
|
|
2718
2718
|
}
|
|
2719
2719
|
updateLastLoginTimestamp() {
|
|
2720
2720
|
this.lastLoginTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
2721
2721
|
}
|
|
2722
2722
|
async checkLoginStatus(e) {
|
|
2723
|
-
const r = await
|
|
2723
|
+
const r = await Rt.getSessionStorageDataByKey(e);
|
|
2724
2724
|
if (r)
|
|
2725
2725
|
return r;
|
|
2726
2726
|
}
|
|
@@ -2739,7 +2739,7 @@ class Bo {
|
|
|
2739
2739
|
n
|
|
2740
2740
|
), u = {
|
|
2741
2741
|
...o.Data.Socket
|
|
2742
|
-
}), await
|
|
2742
|
+
}), await Rt.updateSessionStorageKey(r, u), u;
|
|
2743
2743
|
}
|
|
2744
2744
|
onLoginResponse(e) {
|
|
2745
2745
|
if (!this.eventsSdkClass.options.isNewStack && this.eventsSdkClass.options.servers && (this.eventsSdkClass.servers = [...this.eventsSdkClass.options.servers], this.eventsSdkClass.server = this.eventsSdkClass.servers.reduce(
|
|
@@ -2752,7 +2752,7 @@ class Bo {
|
|
|
2752
2752
|
throw new Error("Socket servers not defined");
|
|
2753
2753
|
if (this.eventsSdkClass.options.isNewStack && !this.eventsSdkClass.servers.length)
|
|
2754
2754
|
throw new Error("Socket servers not defined");
|
|
2755
|
-
this.eventsSdkClass.server && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`), !this.eventsSdkClass.server && this.eventsSdkClass.URLList.length && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`), e.IdentityCode && (this.token = e.IdentityCode, this.eventsSdkClass.connect(
|
|
2755
|
+
this.eventsSdkClass.server && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`), !this.eventsSdkClass.server && this.eventsSdkClass.URLList.length && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`), e.IdentityCode && (this.token = e.IdentityCode, this.eventsSdkClass.connect(mt.MAIN)), e.Token && (this.token = e.Token, this.eventsSdkClass.connect(mt.MAIN)), e.RefreshToken && e.IdentityCodeExpiry && this.eventsSdkClass.options.loginType === ht.USER && (this.refreshToken = e.RefreshToken, this.tokenExpiry = e.IdentityCodeExpiry, this.handleTokenExpiry()), e.RefreshToken && e.TokenExpiry && this.normalizeLoginType(this.eventsSdkClass.options.loginType) === ht.USER && (this.refreshToken = e.RefreshToken, this.tokenExpiry = e.TokenExpiry, this.handleTokenExpiry());
|
|
2756
2756
|
}
|
|
2757
2757
|
handleTokenExpiry() {
|
|
2758
2758
|
if (!this.eventsSdkClass.options.refreshTokenUrl)
|
|
@@ -2784,7 +2784,7 @@ class Bo {
|
|
|
2784
2784
|
this.refreshToken
|
|
2785
2785
|
)).Data.Socket
|
|
2786
2786
|
};
|
|
2787
|
-
this.onLoginResponse(i), await
|
|
2787
|
+
this.onLoginResponse(i), await Rt.updateSessionStorageKey(this.storageKey, i);
|
|
2788
2788
|
}
|
|
2789
2789
|
},
|
|
2790
2790
|
n
|
|
@@ -2794,48 +2794,46 @@ class Bo {
|
|
|
2794
2794
|
if (!e)
|
|
2795
2795
|
throw new Error("loginUrl not provided");
|
|
2796
2796
|
let u;
|
|
2797
|
-
this.eventsSdkClass.options.isNewStack ? i ===
|
|
2798
|
-
identityType:
|
|
2797
|
+
this.eventsSdkClass.options.isNewStack ? i === ht.TOKEN ? u = JSON.stringify({
|
|
2798
|
+
identityType: ht.TOKEN,
|
|
2799
2799
|
token: n
|
|
2800
2800
|
}) : u = JSON.stringify({
|
|
2801
|
-
identityType:
|
|
2801
|
+
identityType: ht.USER,
|
|
2802
2802
|
username: o,
|
|
2803
2803
|
password: r
|
|
2804
|
-
}) : this.eventsSdkClass.options.loginType ===
|
|
2804
|
+
}) : this.eventsSdkClass.options.loginType === ht.TOKEN ? (u = JSON.stringify({ token: n }), e = `${e}/${ht.TOKEN}`) : (u = JSON.stringify({
|
|
2805
2805
|
email: o,
|
|
2806
2806
|
pin: r
|
|
2807
|
-
}), e = `${e}/${
|
|
2807
|
+
}), e = `${e}/${ht.USER}`);
|
|
2808
|
+
let h;
|
|
2808
2809
|
try {
|
|
2809
|
-
const
|
|
2810
|
+
const f = await fetch(e, {
|
|
2810
2811
|
method: "POST",
|
|
2811
2812
|
headers: {
|
|
2812
2813
|
"Content-Type": "application/json"
|
|
2813
2814
|
},
|
|
2814
2815
|
body: u
|
|
2815
2816
|
});
|
|
2816
|
-
if (!
|
|
2817
|
-
throw new Error("Bad body request. Login type or isNewStack values not correct or not provided");
|
|
2818
|
-
if (!
|
|
2819
|
-
throw new Error("Unauthorized. Invalid token provided");
|
|
2820
|
-
if (!
|
|
2821
|
-
throw new Error("Forbidden. Identity token not provided or not valid");
|
|
2822
|
-
const
|
|
2823
|
-
if (
|
|
2824
|
-
throw new Error(
|
|
2825
|
-
return
|
|
2826
|
-
} catch (
|
|
2817
|
+
if (!f.ok && f.status === 400)
|
|
2818
|
+
throw h = 400, new Error("Bad body request. Login type or isNewStack values not correct or not provided");
|
|
2819
|
+
if (!f.ok && f.status === 401)
|
|
2820
|
+
throw h = 401, new Error("Unauthorized. Invalid token provided");
|
|
2821
|
+
if (!f.ok && f.status === 403)
|
|
2822
|
+
throw h = 403, new Error("Forbidden. Identity token not provided or not valid");
|
|
2823
|
+
const c = await f.json();
|
|
2824
|
+
if (c.error)
|
|
2825
|
+
throw new Error(c.error);
|
|
2826
|
+
return c;
|
|
2827
|
+
} catch (f) {
|
|
2827
2828
|
throw this.eventsSdkClass.loggerClass.log({
|
|
2828
|
-
Message: `External login request error with the login type ${
|
|
2829
|
-
|
|
2830
|
-
pin: r
|
|
2831
|
-
}}`,
|
|
2832
|
-
ActionName: at.WSCONNECT,
|
|
2829
|
+
Message: `External login request error with the login type ${i} ${i === ht.TOKEN ? n : o}`,
|
|
2830
|
+
ActionName: it.WSCONNECT,
|
|
2833
2831
|
isShowClient: !1,
|
|
2834
2832
|
Status: "External login error",
|
|
2835
|
-
StatusCode: 400,
|
|
2833
|
+
StatusCode: h || 400,
|
|
2836
2834
|
Level: tt.ERROR,
|
|
2837
|
-
LogType:
|
|
2838
|
-
}),
|
|
2835
|
+
LogType: at.ERROR
|
|
2836
|
+
}), f;
|
|
2839
2837
|
}
|
|
2840
2838
|
}
|
|
2841
2839
|
async getSettings(e) {
|
|
@@ -2853,12 +2851,12 @@ class Bo {
|
|
|
2853
2851
|
} catch (r) {
|
|
2854
2852
|
throw this.eventsSdkClass.loggerClass.log({
|
|
2855
2853
|
Message: `Get settings error with token ${e}, error: ${r}`,
|
|
2856
|
-
ActionName:
|
|
2854
|
+
ActionName: it.WSCONNECT,
|
|
2857
2855
|
isShowClient: !1,
|
|
2858
2856
|
Status: "Get settings error",
|
|
2859
2857
|
StatusCode: 400,
|
|
2860
2858
|
Level: tt.ERROR,
|
|
2861
|
-
LogType:
|
|
2859
|
+
LogType: at.ERROR
|
|
2862
2860
|
}), r;
|
|
2863
2861
|
}
|
|
2864
2862
|
}
|
|
@@ -2874,12 +2872,12 @@ class Bo {
|
|
|
2874
2872
|
} catch (n) {
|
|
2875
2873
|
throw this.eventsSdkClass.loggerClass.log({
|
|
2876
2874
|
Message: `Refresh token error with old refresh token ${r}, url: ${e}, error: ${n}`,
|
|
2877
|
-
ActionName:
|
|
2875
|
+
ActionName: it.WSCONNECT,
|
|
2878
2876
|
isShowClient: !1,
|
|
2879
2877
|
Status: "Get settings error",
|
|
2880
2878
|
StatusCode: 400,
|
|
2881
2879
|
Level: tt.ERROR,
|
|
2882
|
-
LogType:
|
|
2880
|
+
LogType: at.ERROR
|
|
2883
2881
|
}), n;
|
|
2884
2882
|
}
|
|
2885
2883
|
}
|
|
@@ -2922,7 +2920,7 @@ const _o = {
|
|
|
2922
2920
|
}
|
|
2923
2921
|
};
|
|
2924
2922
|
function Lo() {
|
|
2925
|
-
return typeof window < "u" && (typeof window.navigator > "u" || typeof window.navigator.userAgent > "u") && (window.navigator.userAgent = "react-native"), typeof self > "u" && typeof global == "object" && (global.self = global, global.WebSocket =
|
|
2923
|
+
return typeof window < "u" && (typeof window.navigator > "u" || typeof window.navigator.userAgent > "u") && (window.navigator.userAgent = "react-native"), typeof self > "u" && typeof global == "object" && (global.self = global, global.WebSocket = Ir, typeof self.navigator > "u" && (self.navigator = { userAgent: "node" })), function t(e, r, n) {
|
|
2926
2924
|
function o(h, f) {
|
|
2927
2925
|
if (!r[h]) {
|
|
2928
2926
|
if (!e[h]) {
|
|
@@ -4762,25 +4760,25 @@ function Lo() {
|
|
|
4762
4760
|
}, {}],
|
|
4763
4761
|
47: [function(t, e, r) {
|
|
4764
4762
|
(function(n) {
|
|
4765
|
-
function o(
|
|
4766
|
-
if (o[
|
|
4767
|
-
return o[
|
|
4763
|
+
function o(R) {
|
|
4764
|
+
if (o[R] !== h)
|
|
4765
|
+
return o[R];
|
|
4768
4766
|
var U;
|
|
4769
|
-
if (
|
|
4767
|
+
if (R == "bug-string-char-index")
|
|
4770
4768
|
U = !1;
|
|
4771
|
-
else if (
|
|
4769
|
+
else if (R == "json")
|
|
4772
4770
|
U = o("json-stringify") && o("json-parse");
|
|
4773
4771
|
else {
|
|
4774
|
-
var
|
|
4775
|
-
if (
|
|
4772
|
+
var I, F = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
|
|
4773
|
+
if (R == "json-stringify") {
|
|
4776
4774
|
var N = l.stringify, D = typeof N == "function" && p;
|
|
4777
4775
|
if (D) {
|
|
4778
|
-
(
|
|
4776
|
+
(I = function() {
|
|
4779
4777
|
return 1;
|
|
4780
|
-
}).toJSON =
|
|
4778
|
+
}).toJSON = I;
|
|
4781
4779
|
try {
|
|
4782
|
-
D = N(0) === "0" && N(new Number()) === "0" && N(new String()) == '""' && N(f) === h && N(h) === h && N() === h && N(
|
|
4783
|
-
\f\r `] }) == F && N(null,
|
|
4780
|
+
D = N(0) === "0" && N(new Number()) === "0" && N(new String()) == '""' && N(f) === h && N(h) === h && N() === h && N(I) === "1" && N([I]) == "[1]" && N([h]) == "[null]" && N(null) == "null" && N([h, f, null]) == "[null,null,null]" && N({ a: [I, !0, !1, null, `\0\b
|
|
4781
|
+
\f\r `] }) == F && N(null, I) === "1" && N([1, 2], null, 1) == `[
|
|
4784
4782
|
1,
|
|
4785
4783
|
2
|
|
4786
4784
|
]` && N(/* @__PURE__ */ new Date(-864e13)) == '"-271821-04-20T00:00:00.000Z"' && N(/* @__PURE__ */ new Date(864e13)) == '"+275760-09-13T00:00:00.000Z"' && N(/* @__PURE__ */ new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && N(/* @__PURE__ */ new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
|
@@ -4790,13 +4788,13 @@ function Lo() {
|
|
|
4790
4788
|
}
|
|
4791
4789
|
U = D;
|
|
4792
4790
|
}
|
|
4793
|
-
if (
|
|
4791
|
+
if (R == "json-parse") {
|
|
4794
4792
|
var P = l.parse;
|
|
4795
4793
|
if (typeof P == "function")
|
|
4796
4794
|
try {
|
|
4797
4795
|
if (P("0") === 0 && !P(!1)) {
|
|
4798
|
-
|
|
4799
|
-
var L =
|
|
4796
|
+
I = P(F);
|
|
4797
|
+
var L = I.a.length == 5 && I.a[0] === 1;
|
|
4800
4798
|
if (L) {
|
|
4801
4799
|
try {
|
|
4802
4800
|
L = !P('" "');
|
|
@@ -4820,7 +4818,7 @@ function Lo() {
|
|
|
4820
4818
|
U = L;
|
|
4821
4819
|
}
|
|
4822
4820
|
}
|
|
4823
|
-
return o[
|
|
4821
|
+
return o[R] = !!U;
|
|
4824
4822
|
}
|
|
4825
4823
|
var i, u, h, f = {}.toString, c = typeof JSON == "object" && JSON, l = typeof r == "object" && r && !r.nodeType && r;
|
|
4826
4824
|
l && c ? (l.stringify = c.stringify, l.parse = c.parse) : l = n.JSON = c || {};
|
|
@@ -4832,31 +4830,31 @@ function Lo() {
|
|
|
4832
4830
|
if (!o("json")) {
|
|
4833
4831
|
var a = "[object Function]", s = "[object Date]", d = "[object Number]", y = "[object String]", g = "[object Array]", w = "[object Boolean]", B = o("bug-string-char-index");
|
|
4834
4832
|
if (!p)
|
|
4835
|
-
var _ = Math.floor, b = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], S = function(
|
|
4836
|
-
return b[U] + 365 * (
|
|
4833
|
+
var _ = Math.floor, b = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], S = function(R, U) {
|
|
4834
|
+
return b[U] + 365 * (R - 1970) + _((R - 1969 + (U = +(U > 1))) / 4) - _((R - 1901 + U) / 100) + _((R - 1601 + U) / 400);
|
|
4837
4835
|
};
|
|
4838
|
-
(i = {}.hasOwnProperty) || (i = function(
|
|
4839
|
-
var U,
|
|
4840
|
-
return (
|
|
4836
|
+
(i = {}.hasOwnProperty) || (i = function(R) {
|
|
4837
|
+
var U, I = {};
|
|
4838
|
+
return (I.__proto__ = null, I.__proto__ = { toString: 1 }, I).toString != f ? i = function(F) {
|
|
4841
4839
|
var N = this.__proto__, D = F in (this.__proto__ = null, this);
|
|
4842
4840
|
return this.__proto__ = N, D;
|
|
4843
|
-
} : (U =
|
|
4841
|
+
} : (U = I.constructor, i = function(F) {
|
|
4844
4842
|
var N = (this.constructor || U).prototype;
|
|
4845
4843
|
return F in this && !(F in N && this[F] === N[F]);
|
|
4846
|
-
}),
|
|
4844
|
+
}), I = null, i.call(this, R);
|
|
4847
4845
|
});
|
|
4848
|
-
var m = { boolean: 1, number: 1, string: 1, undefined: 1 }, C = function(
|
|
4849
|
-
var
|
|
4850
|
-
return
|
|
4846
|
+
var m = { boolean: 1, number: 1, string: 1, undefined: 1 }, C = function(R, U) {
|
|
4847
|
+
var I = typeof R[U];
|
|
4848
|
+
return I == "object" ? !!R[U] : !m[I];
|
|
4851
4849
|
};
|
|
4852
|
-
if (u = function(
|
|
4853
|
-
var
|
|
4854
|
-
(
|
|
4850
|
+
if (u = function(R, U) {
|
|
4851
|
+
var I, F, N, D = 0;
|
|
4852
|
+
(I = function() {
|
|
4855
4853
|
this.valueOf = 0;
|
|
4856
|
-
}).prototype.valueOf = 0, F = new
|
|
4854
|
+
}).prototype.valueOf = 0, F = new I();
|
|
4857
4855
|
for (N in F)
|
|
4858
4856
|
i.call(F, N) && D++;
|
|
4859
|
-
return
|
|
4857
|
+
return I = F = null, D ? u = D == 2 ? function(P, L) {
|
|
4860
4858
|
var M, J = {}, nt = f.call(P) == a;
|
|
4861
4859
|
for (M in P)
|
|
4862
4860
|
nt && M == "prototype" || i.call(J, M) || !(J[M] = 1) || !i.call(P, M) || L(M);
|
|
@@ -4871,14 +4869,14 @@ function Lo() {
|
|
|
4871
4869
|
nt && M == "prototype" || !ot.call(P, M) || L(M);
|
|
4872
4870
|
for (J = F.length; M = F[--J]; ot.call(P, M) && L(M))
|
|
4873
4871
|
;
|
|
4874
|
-
}), u(
|
|
4872
|
+
}), u(R, U);
|
|
4875
4873
|
}, !o("json-stringify")) {
|
|
4876
|
-
var E = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }, v = "000000", k = function(
|
|
4877
|
-
return (v + (U || 0)).slice(-
|
|
4878
|
-
}, T = "\\u00", O = function(
|
|
4879
|
-
var U,
|
|
4880
|
-
for (D && (U =
|
|
4881
|
-
var P =
|
|
4874
|
+
var E = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }, v = "000000", k = function(R, U) {
|
|
4875
|
+
return (v + (U || 0)).slice(-R);
|
|
4876
|
+
}, T = "\\u00", O = function(R) {
|
|
4877
|
+
var U, I = '"', F = 0, N = R.length, D = N > 10 && B;
|
|
4878
|
+
for (D && (U = R.split("")); N > F; F++) {
|
|
4879
|
+
var P = R.charCodeAt(F);
|
|
4882
4880
|
switch (P) {
|
|
4883
4881
|
case 8:
|
|
4884
4882
|
case 9:
|
|
@@ -4887,26 +4885,26 @@ function Lo() {
|
|
|
4887
4885
|
case 13:
|
|
4888
4886
|
case 34:
|
|
4889
4887
|
case 92:
|
|
4890
|
-
|
|
4888
|
+
I += E[P];
|
|
4891
4889
|
break;
|
|
4892
4890
|
default:
|
|
4893
4891
|
if (32 > P) {
|
|
4894
|
-
|
|
4892
|
+
I += T + k(2, P.toString(16));
|
|
4895
4893
|
break;
|
|
4896
4894
|
}
|
|
4897
|
-
|
|
4895
|
+
I += D ? U[F] : B ? R.charAt(F) : R[F];
|
|
4898
4896
|
}
|
|
4899
4897
|
}
|
|
4900
|
-
return
|
|
4901
|
-
}, x = function(
|
|
4898
|
+
return I + '"';
|
|
4899
|
+
}, x = function(R, U, I, F, N, D, P) {
|
|
4902
4900
|
var L, M, J, nt, ot, Ot, Vt, $t, Gt, Yt, ut, Qt, Ut, xt, Zt, te;
|
|
4903
4901
|
try {
|
|
4904
|
-
L = U[
|
|
4902
|
+
L = U[R];
|
|
4905
4903
|
} catch {
|
|
4906
4904
|
}
|
|
4907
4905
|
if (typeof L == "object" && L)
|
|
4908
4906
|
if (M = f.call(L), M != s || i.call(L, "toJSON"))
|
|
4909
|
-
typeof L.toJSON == "function" && (M != d && M != y && M != g || i.call(L, "toJSON")) && (L = L.toJSON(
|
|
4907
|
+
typeof L.toJSON == "function" && (M != d && M != y && M != g || i.call(L, "toJSON")) && (L = L.toJSON(R));
|
|
4910
4908
|
else if (L > -1 / 0 && 1 / 0 > L) {
|
|
4911
4909
|
if (S) {
|
|
4912
4910
|
for (ot = _(L / 864e5), J = _(ot / 365.2425) + 1970 - 1; S(J + 1, 0) <= ot; J++)
|
|
@@ -4919,7 +4917,7 @@ function Lo() {
|
|
|
4919
4917
|
L = (0 >= J || J >= 1e4 ? (0 > J ? "-" : "+") + k(6, 0 > J ? -J : J) : k(4, J)) + "-" + k(2, nt + 1) + "-" + k(2, ot) + "T" + k(2, Vt) + ":" + k(2, $t) + ":" + k(2, Gt) + "." + k(3, Yt) + "Z";
|
|
4920
4918
|
} else
|
|
4921
4919
|
L = null;
|
|
4922
|
-
if (
|
|
4920
|
+
if (I && (L = I.call(U, R, L)), L === null)
|
|
4923
4921
|
return "null";
|
|
4924
4922
|
if (M = f.call(L), M == w)
|
|
4925
4923
|
return "" + L;
|
|
@@ -4933,14 +4931,14 @@ function Lo() {
|
|
|
4933
4931
|
throw TypeError();
|
|
4934
4932
|
if (P.push(L), ut = [], Zt = D, D += N, M == g) {
|
|
4935
4933
|
for (Ut = 0, xt = L.length; xt > Ut; Ut++)
|
|
4936
|
-
Qt = x(Ut, L,
|
|
4934
|
+
Qt = x(Ut, L, I, F, N, D, P), ut.push(Qt === h ? "null" : Qt);
|
|
4937
4935
|
te = ut.length ? N ? `[
|
|
4938
4936
|
` + D + ut.join(`,
|
|
4939
4937
|
` + D) + `
|
|
4940
4938
|
` + Zt + "]" : "[" + ut.join(",") + "]" : "[]";
|
|
4941
4939
|
} else
|
|
4942
4940
|
u(F || L, function(ee) {
|
|
4943
|
-
var Le = x(ee, L,
|
|
4941
|
+
var Le = x(ee, L, I, F, N, D, P);
|
|
4944
4942
|
Le !== h && ut.push(O(ee) + ":" + (N ? " " : "") + Le);
|
|
4945
4943
|
}), te = ut.length ? N ? `{
|
|
4946
4944
|
` + D + ut.join(`,
|
|
@@ -4949,7 +4947,7 @@ function Lo() {
|
|
|
4949
4947
|
return P.pop(), te;
|
|
4950
4948
|
}
|
|
4951
4949
|
};
|
|
4952
|
-
l.stringify = function(
|
|
4950
|
+
l.stringify = function(R, U, I) {
|
|
4953
4951
|
var F, N, D, P;
|
|
4954
4952
|
if (typeof U == "function" || typeof U == "object" && U) {
|
|
4955
4953
|
if ((P = f.call(U)) == a)
|
|
@@ -4960,14 +4958,14 @@ function Lo() {
|
|
|
4960
4958
|
;
|
|
4961
4959
|
}
|
|
4962
4960
|
}
|
|
4963
|
-
if (
|
|
4964
|
-
if ((P = f.call(
|
|
4965
|
-
if ((
|
|
4966
|
-
for (F = "",
|
|
4961
|
+
if (I)
|
|
4962
|
+
if ((P = f.call(I)) == d) {
|
|
4963
|
+
if ((I -= I % 1) > 0)
|
|
4964
|
+
for (F = "", I > 10 && (I = 10); F.length < I; F += " ")
|
|
4967
4965
|
;
|
|
4968
4966
|
} else
|
|
4969
|
-
P == y && (F =
|
|
4970
|
-
return x("", (L = {}, L[""] =
|
|
4967
|
+
P == y && (F = I.length <= 10 ? I : I.slice(0, 10));
|
|
4968
|
+
return x("", (L = {}, L[""] = R, L), N, D, F, "", []);
|
|
4971
4969
|
};
|
|
4972
4970
|
}
|
|
4973
4971
|
if (!o("json-parse")) {
|
|
@@ -4975,7 +4973,7 @@ function Lo() {
|
|
|
4975
4973
|
`, 102: "\f", 114: "\r" }, X = function() {
|
|
4976
4974
|
throw A = q = null, SyntaxError();
|
|
4977
4975
|
}, et = function() {
|
|
4978
|
-
for (var
|
|
4976
|
+
for (var R, U, I, F, N, D = q, P = D.length; P > A; )
|
|
4979
4977
|
switch (N = D.charCodeAt(A)) {
|
|
4980
4978
|
case 9:
|
|
4981
4979
|
case 10:
|
|
@@ -4989,9 +4987,9 @@ function Lo() {
|
|
|
4989
4987
|
case 93:
|
|
4990
4988
|
case 58:
|
|
4991
4989
|
case 44:
|
|
4992
|
-
return
|
|
4990
|
+
return R = B ? D.charAt(A) : D[A], A++, R;
|
|
4993
4991
|
case 34:
|
|
4994
|
-
for (
|
|
4992
|
+
for (R = "@", A++; P > A; )
|
|
4995
4993
|
if (N = D.charCodeAt(A), 32 > N)
|
|
4996
4994
|
X();
|
|
4997
4995
|
else if (N == 92)
|
|
@@ -5004,12 +5002,12 @@ function Lo() {
|
|
|
5004
5002
|
case 110:
|
|
5005
5003
|
case 102:
|
|
5006
5004
|
case 114:
|
|
5007
|
-
|
|
5005
|
+
R += $[N], A++;
|
|
5008
5006
|
break;
|
|
5009
5007
|
case 117:
|
|
5010
|
-
for (U = ++A,
|
|
5008
|
+
for (U = ++A, I = A + 4; I > A; A++)
|
|
5011
5009
|
N = D.charCodeAt(A), N >= 48 && 57 >= N || N >= 97 && 102 >= N || N >= 65 && 70 >= N || X();
|
|
5012
|
-
|
|
5010
|
+
R += j("0x" + D.slice(U, A));
|
|
5013
5011
|
break;
|
|
5014
5012
|
default:
|
|
5015
5013
|
X();
|
|
@@ -5019,24 +5017,24 @@ function Lo() {
|
|
|
5019
5017
|
break;
|
|
5020
5018
|
for (N = D.charCodeAt(A), U = A; N >= 32 && N != 92 && N != 34; )
|
|
5021
5019
|
N = D.charCodeAt(++A);
|
|
5022
|
-
|
|
5020
|
+
R += D.slice(U, A);
|
|
5023
5021
|
}
|
|
5024
5022
|
if (D.charCodeAt(A) == 34)
|
|
5025
|
-
return A++,
|
|
5023
|
+
return A++, R;
|
|
5026
5024
|
X();
|
|
5027
5025
|
default:
|
|
5028
5026
|
if (U = A, N == 45 && (F = !0, N = D.charCodeAt(++A)), N >= 48 && 57 >= N) {
|
|
5029
5027
|
for (N == 48 && (N = D.charCodeAt(A + 1), N >= 48 && 57 >= N) && X(), F = !1; P > A && (N = D.charCodeAt(A), N >= 48 && 57 >= N); A++)
|
|
5030
5028
|
;
|
|
5031
5029
|
if (D.charCodeAt(A) == 46) {
|
|
5032
|
-
for (
|
|
5030
|
+
for (I = ++A; P > I && (N = D.charCodeAt(I), N >= 48 && 57 >= N); I++)
|
|
5033
5031
|
;
|
|
5034
|
-
|
|
5032
|
+
I == A && X(), A = I;
|
|
5035
5033
|
}
|
|
5036
5034
|
if (N = D.charCodeAt(A), N == 101 || N == 69) {
|
|
5037
|
-
for (N = D.charCodeAt(++A), (N == 43 || N == 45) && A++,
|
|
5035
|
+
for (N = D.charCodeAt(++A), (N == 43 || N == 45) && A++, I = A; P > I && (N = D.charCodeAt(I), N >= 48 && 57 >= N); I++)
|
|
5038
5036
|
;
|
|
5039
|
-
|
|
5037
|
+
I == A && X(), A = I;
|
|
5040
5038
|
}
|
|
5041
5039
|
return +D.slice(U, A);
|
|
5042
5040
|
}
|
|
@@ -5049,42 +5047,42 @@ function Lo() {
|
|
|
5049
5047
|
X();
|
|
5050
5048
|
}
|
|
5051
5049
|
return "$";
|
|
5052
|
-
}, Nt = function(
|
|
5053
|
-
var U,
|
|
5054
|
-
if (
|
|
5055
|
-
if ((B ?
|
|
5056
|
-
return
|
|
5057
|
-
if (
|
|
5058
|
-
for (U = [];
|
|
5059
|
-
|
|
5050
|
+
}, Nt = function(R) {
|
|
5051
|
+
var U, I;
|
|
5052
|
+
if (R == "$" && X(), typeof R == "string") {
|
|
5053
|
+
if ((B ? R.charAt(0) : R[0]) == "@")
|
|
5054
|
+
return R.slice(1);
|
|
5055
|
+
if (R == "[") {
|
|
5056
|
+
for (U = []; R = et(), R != "]"; I || (I = !0))
|
|
5057
|
+
I && (R == "," ? (R = et(), R == "]" && X()) : X()), R == "," && X(), U.push(Nt(R));
|
|
5060
5058
|
return U;
|
|
5061
5059
|
}
|
|
5062
|
-
if (
|
|
5063
|
-
for (U = {};
|
|
5064
|
-
|
|
5060
|
+
if (R == "{") {
|
|
5061
|
+
for (U = {}; R = et(), R != "}"; I || (I = !0))
|
|
5062
|
+
I && (R == "," ? (R = et(), R == "}" && X()) : X()), (R == "," || typeof R != "string" || (B ? R.charAt(0) : R[0]) != "@" || et() != ":") && X(), U[R.slice(1)] = Nt(et());
|
|
5065
5063
|
return U;
|
|
5066
5064
|
}
|
|
5067
5065
|
X();
|
|
5068
5066
|
}
|
|
5069
|
-
return
|
|
5070
|
-
}, Be = function(
|
|
5071
|
-
var F = _e(
|
|
5072
|
-
F === h ? delete
|
|
5073
|
-
}, _e = function(
|
|
5074
|
-
var F, N =
|
|
5067
|
+
return R;
|
|
5068
|
+
}, Be = function(R, U, I) {
|
|
5069
|
+
var F = _e(R, U, I);
|
|
5070
|
+
F === h ? delete R[U] : R[U] = F;
|
|
5071
|
+
}, _e = function(R, U, I) {
|
|
5072
|
+
var F, N = R[U];
|
|
5075
5073
|
if (typeof N == "object" && N)
|
|
5076
5074
|
if (f.call(N) == g)
|
|
5077
5075
|
for (F = N.length; F--; )
|
|
5078
|
-
Be(N, F,
|
|
5076
|
+
Be(N, F, I);
|
|
5079
5077
|
else
|
|
5080
5078
|
u(N, function(D) {
|
|
5081
|
-
Be(N, D,
|
|
5079
|
+
Be(N, D, I);
|
|
5082
5080
|
});
|
|
5083
|
-
return
|
|
5081
|
+
return I.call(R, U, N);
|
|
5084
5082
|
};
|
|
5085
|
-
l.parse = function(
|
|
5086
|
-
var
|
|
5087
|
-
return A = 0, q = "" +
|
|
5083
|
+
l.parse = function(R, U) {
|
|
5084
|
+
var I, F;
|
|
5085
|
+
return A = 0, q = "" + R, I = Nt(et()), et() != "$" && X(), A = q = null, U && f.call(U) == a ? _e((F = {}, F[""] = I, F), "", U) : I;
|
|
5088
5086
|
};
|
|
5089
5087
|
}
|
|
5090
5088
|
}
|
|
@@ -5127,7 +5125,7 @@ const be = Object.entries(Do).reduce(
|
|
|
5127
5125
|
getSocketVersion: Tr,
|
|
5128
5126
|
makeSocketVersion: jo
|
|
5129
5127
|
};
|
|
5130
|
-
var qo = /* @__PURE__ */ ((t) => (t.RINGING = "Ringing", t.TALKING = "Talking", t.DIALING = "Dialing", t.HOLD = "Hold", t))(qo || {}), zo = /* @__PURE__ */ ((t) => (t.INCOMING = "Incoming", t.OUTGOING = "Outgoing", t))(zo || {}),
|
|
5128
|
+
var qo = /* @__PURE__ */ ((t) => (t.RINGING = "Ringing", t.TALKING = "Talking", t.DIALING = "Dialing", t.HOLD = "Hold", t))(qo || {}), zo = /* @__PURE__ */ ((t) => (t.INCOMING = "Incoming", t.OUTGOING = "Outgoing", t))(zo || {}), vt = /* @__PURE__ */ ((t) => (t.CONNECTED = "connected", t.DISCONNECTED = "disconnected", t.TRYING_TO_CONNECT = "tryingToConnect", t))(vt || {}), Xo = /* @__PURE__ */ ((t) => (t.AUTOMATIC = "Automatic", t.IVR = "IVR", t))(Xo || {}), Wo = /* @__PURE__ */ ((t) => (t.INCOMINC = "Incoming", t.OUTGOING = "Outgoing", t.SPY = "Spy", t.CLICK2CALL = "Click2Call", t))(Wo || {}), Ko = /* @__PURE__ */ ((t) => (t.RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID", t.RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID", t))(Ko || {}), z = /* @__PURE__ */ ((t) => (t.ALL_DIALER_STATUS = "AllDialersStatus", t.ALL_EXTENSION_STATUS = "AllExtensionsStatus", t.ALL_USERS_STATUS = "AllUsersStatus", t.CONNECT = "connect", t.DISCONNECT = "disconnect", t.CONNECT_ERROR_EVENT = "connect_error", t.EXTENSION_EVENT = "ExtensionEvent", t.KEEP_ALIVE = "keepalive", t.KEEP_ALIVE_RESPONSE = "keepaliveResponse", t.LOGIN_STATUS = "loginStatus", t.LOGIN_SUCCESS = "loginSuccess", t.QUEUE_EVENT = "QueueEvent", t.ONLINE_STATUS_EVENT = "onlineStatusEvent", t.DIALER_EVENT = "DialerEvent", t.EXTENSIONS_UPDATED = "ExtensionsUpdated", t))(z || {}), Nr = /* @__PURE__ */ ((t) => (t.NEWCALL = "NEWCALL", t.ANSWER = "ANSWER", t.HOLD = "HOLD", t.UNHOLD = "UNHOLD", t.HANGUP = "HANGUP", t.USER_STATUS_UPDATE = "userStatusUpdate", t))(Nr || {}), Ho = /* @__PURE__ */ ((t) => (t.NORMAL_HANGUP = "Normal hangup", t.USER_BUSY = "User busy", t.CALL_REJECTED = "Call Rejected", t.UNALLOCATED_NUMBER = "Unallocated (unassigned) number", t.UNKNOWN = "Unknown", t.NO_USER_RESPONDING = "No user responding", t.USER_ALERTING = "User alerting, no answer", t.ANSWERED_ELSEWHERE = "Answered elsewhere", t))(Ho || {}), Jo = /* @__PURE__ */ ((t) => (t.ANSWER = "ANSWER", t.ABANDONED = "ABANDONED", t.EXIT = "EXIT", t.JOIN = "JOIN", t))(Jo || {});
|
|
5131
5129
|
class pe {
|
|
5132
5130
|
static mapExtensionEvent(e) {
|
|
5133
5131
|
var u, h;
|
|
@@ -5269,14 +5267,20 @@ class pe {
|
|
|
5269
5267
|
var Or = /* @__PURE__ */ ((t) => (t.UPDATE_MONITORED_EXTENSIONS = "updateMonitoredExtensions", t.KEEP_ALIVE = "keepAlive", t))(Or || {});
|
|
5270
5268
|
class Vo {
|
|
5271
5269
|
constructor(e) {
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
this
|
|
5270
|
+
K(this, "io");
|
|
5271
|
+
K(this, "ioFunction");
|
|
5272
|
+
K(this, "lastEventTimestamp", (/* @__PURE__ */ new Date()).getTime());
|
|
5273
|
+
K(this, "doReconnect", !0);
|
|
5274
|
+
K(this, "keepAliveInterval");
|
|
5275
|
+
K(this, "keepReconnectInterval");
|
|
5276
|
+
K(this, "keepReconnectTimeout");
|
|
5277
|
+
K(this, "connected", !1);
|
|
5278
|
+
K(this, "reconnectionTime", 20);
|
|
5279
|
+
this.eventsSdkClass = e, this.eventsSdkClass = e, window.addEventListener("offline", () => {
|
|
5280
|
+
this.closeAllConnections();
|
|
5281
|
+
}), window.addEventListener("online", () => {
|
|
5282
|
+
this.keepReconnectTimeout && clearTimeout(this.keepReconnectTimeout), this.eventsSdkClass.connect(mt.NEXT);
|
|
5283
|
+
});
|
|
5280
5284
|
}
|
|
5281
5285
|
getSocketIoFunction(e) {
|
|
5282
5286
|
const r = e.split("v="), n = "v".concat(r[r.length - 1]).replaceAll(".", "_");
|
|
@@ -5290,7 +5294,7 @@ class Vo {
|
|
|
5290
5294
|
z.ONLINE_STATUS_EVENT,
|
|
5291
5295
|
{
|
|
5292
5296
|
attemptToConnect: i,
|
|
5293
|
-
connectionStatus:
|
|
5297
|
+
connectionStatus: vt.TRYING_TO_CONNECT
|
|
5294
5298
|
}
|
|
5295
5299
|
);
|
|
5296
5300
|
const u = {
|
|
@@ -5308,24 +5312,24 @@ class Vo {
|
|
|
5308
5312
|
}), this.ioFunction && i)
|
|
5309
5313
|
this.io = this.ioFunction(i, u), this.eventsSdkClass.loggerClass.log({
|
|
5310
5314
|
Message: `${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${o}`,
|
|
5311
|
-
ActionName:
|
|
5315
|
+
ActionName: it.WSCONNECT,
|
|
5312
5316
|
isShowClient: !1,
|
|
5313
5317
|
Status: "Switching Protocols",
|
|
5314
5318
|
StatusCode: 101,
|
|
5315
5319
|
Level: tt.INFO,
|
|
5316
|
-
LogType:
|
|
5320
|
+
LogType: at.INFO
|
|
5317
5321
|
});
|
|
5318
5322
|
else
|
|
5319
5323
|
throw new Error("Socket server url no defined");
|
|
5320
5324
|
} catch (o) {
|
|
5321
5325
|
this.eventsSdkClass.loggerClass.log({
|
|
5322
5326
|
Message: `${o}`,
|
|
5323
|
-
ActionName:
|
|
5327
|
+
ActionName: it.WSCONNECT,
|
|
5324
5328
|
isShowClient: !1,
|
|
5325
5329
|
Status: "Connection error",
|
|
5326
5330
|
StatusCode: 500,
|
|
5327
5331
|
Level: tt.ERROR,
|
|
5328
|
-
LogType:
|
|
5332
|
+
LogType: at.ERROR
|
|
5329
5333
|
});
|
|
5330
5334
|
}
|
|
5331
5335
|
}
|
|
@@ -5337,10 +5341,10 @@ class Vo {
|
|
|
5337
5341
|
if ((/* @__PURE__ */ new Date()).getTime() > this.lastEventTimestamp + this.eventsSdkClass.options.keepAliveTimeout && this.io && this.eventsSdkClass.authClass.token) {
|
|
5338
5342
|
this.eventsSdkClass.emit(Or.KEEP_ALIVE, this.eventsSdkClass.authClass.token), this.eventsSdkClass.loggerClass.log({
|
|
5339
5343
|
Message: `Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,
|
|
5340
|
-
ActionName:
|
|
5344
|
+
ActionName: it.WSCONNECT,
|
|
5341
5345
|
isShowClient: !1,
|
|
5342
5346
|
Level: tt.INFO,
|
|
5343
|
-
LogType:
|
|
5347
|
+
LogType: at.INFO
|
|
5344
5348
|
});
|
|
5345
5349
|
return;
|
|
5346
5350
|
}
|
|
@@ -5348,7 +5352,7 @@ class Vo {
|
|
|
5348
5352
|
}
|
|
5349
5353
|
closeAllConnections() {
|
|
5350
5354
|
var e;
|
|
5351
|
-
this.io && (this.io.close(), (e = this.io) == null || e.disconnect(), this.io = void 0),
|
|
5355
|
+
this.io && (this.io.close(), (e = this.io) == null || e.disconnect(), this.io = void 0), Rt.clearSessionStorage();
|
|
5352
5356
|
}
|
|
5353
5357
|
initSocketEvents() {
|
|
5354
5358
|
this.io && this.io.on(z.LOGIN_SUCCESS, (e) => this.onLoginSuccessEvent(e)).on(z.QUEUE_EVENT, (e) => this.onQueueEvent(e)).on(z.EXTENSION_EVENT, (e) => this.onExtensionEvent(e)).on(z.DIALER_EVENT, (e) => this.onDialerEvent(e)).on(z.LOGIN_STATUS, (e) => this.onLoginStatusEvent(e)).on(z.ALL_EXTENSION_STATUS, (e) => this.onAllExtensionStatus(e)).on(z.ALL_DIALER_STATUS, (e) => this.onAllDialerStatus(e)).on(z.KEEP_ALIVE_RESPONSE, (e) => this.onKeepAliveResponse(e)).on(z.EXTENSIONS_UPDATED, (e) => this.onExtensionsUpdatedEvent(e)).on(z.CONNECT, () => this.onConnect()).on(z.DISCONNECT, (e) => this.onDisconnect(e)).on(z.CONNECT_ERROR_EVENT, (e) => this.onConnectError(e));
|
|
@@ -5383,12 +5387,12 @@ class Vo {
|
|
|
5383
5387
|
}
|
|
5384
5388
|
this.eventsSdkClass.loggerClass.log({
|
|
5385
5389
|
Message: `Keep alive response: ${e}`,
|
|
5386
|
-
ActionName:
|
|
5390
|
+
ActionName: it.WSCONNECT,
|
|
5387
5391
|
isShowClient: !1,
|
|
5388
5392
|
Status: "Successful",
|
|
5389
5393
|
StatusCode: 200,
|
|
5390
5394
|
Level: tt.INFO,
|
|
5391
|
-
LogType:
|
|
5395
|
+
LogType: at.INFO
|
|
5392
5396
|
}), this.connected ? this.lastEventTimestamp = (/* @__PURE__ */ new Date()).getTime() : this.initSocketConnection();
|
|
5393
5397
|
}
|
|
5394
5398
|
onExtensionsUpdatedEvent(e) {
|
|
@@ -5396,52 +5400,57 @@ class Vo {
|
|
|
5396
5400
|
}
|
|
5397
5401
|
onConnect() {
|
|
5398
5402
|
this.keepReconnectInterval && clearInterval(this.keepReconnectInterval), this.connected = !0, this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT, {
|
|
5399
|
-
connectionStatus:
|
|
5403
|
+
connectionStatus: vt.CONNECTED
|
|
5400
5404
|
}), this.eventsSdkClass.loggerClass.log({
|
|
5401
5405
|
Message: `Sdk connected to the socket server ${this.eventsSdkClass.server && this.eventsSdkClass.server.Domain ? this.eventsSdkClass.server.Domain : this.eventsSdkClass.URL}`,
|
|
5402
|
-
ActionName:
|
|
5406
|
+
ActionName: it.WSCONNECT,
|
|
5403
5407
|
isShowClient: !1,
|
|
5404
5408
|
Status: "Connection established",
|
|
5405
5409
|
StatusCode: 200,
|
|
5406
5410
|
Level: tt.INFO,
|
|
5407
|
-
LogType:
|
|
5411
|
+
LogType: at.INFO
|
|
5408
5412
|
});
|
|
5409
5413
|
}
|
|
5410
5414
|
onDisconnect(e) {
|
|
5411
5415
|
this.connected = !1, this.closeAllConnections(), this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT, {
|
|
5412
|
-
connectionStatus: this.doReconnect ?
|
|
5416
|
+
connectionStatus: this.doReconnect ? vt.TRYING_TO_CONNECT : vt.DISCONNECTED
|
|
5413
5417
|
}), this.eventsSdkClass.loggerClass.log({
|
|
5414
5418
|
Message: `Sdk disconnected from the socket server ${this.eventsSdkClass.server && this.eventsSdkClass.server.Domain ? this.eventsSdkClass.server.Domain : this.eventsSdkClass.URL} (${e})`,
|
|
5415
|
-
ActionName:
|
|
5419
|
+
ActionName: it.WSCONNECT,
|
|
5416
5420
|
isShowClient: !1,
|
|
5417
5421
|
Status: "Connection closed",
|
|
5418
5422
|
StatusCode: 200,
|
|
5419
5423
|
Level: tt.INFO,
|
|
5420
|
-
LogType:
|
|
5421
|
-
}), this.doReconnect && this.
|
|
5424
|
+
LogType: at.INFO
|
|
5425
|
+
}), this.doReconnect && (this.keepReconnectTimeout = setTimeout(
|
|
5426
|
+
() => {
|
|
5427
|
+
this.reconnectionTime = this.reconnectionTime + 20, this.reconnectionTime > 120 && (this.reconnectionTime = 20), this.eventsSdkClass.connect(mt.NEXT);
|
|
5428
|
+
},
|
|
5429
|
+
this.reconnectionTime * 1e3
|
|
5430
|
+
));
|
|
5422
5431
|
}
|
|
5423
5432
|
onConnectError(e) {
|
|
5424
5433
|
this.eventsSdkClass.eventEmitterClass.emit(z.ONLINE_STATUS_EVENT, {
|
|
5425
|
-
connectionStatus: this.doReconnect ?
|
|
5434
|
+
connectionStatus: this.doReconnect ? vt.TRYING_TO_CONNECT : vt.DISCONNECTED
|
|
5426
5435
|
}), this.eventsSdkClass.loggerClass.log({
|
|
5427
5436
|
Message: `Sdk attempt to connect to the socket server ${this.eventsSdkClass.URL} failed (${e})`,
|
|
5428
|
-
ActionName:
|
|
5437
|
+
ActionName: it.WSCONNECT,
|
|
5429
5438
|
isShowClient: !1,
|
|
5430
5439
|
Status: "Connection attempt error",
|
|
5431
5440
|
StatusCode: 500,
|
|
5432
5441
|
Level: tt.ERROR,
|
|
5433
|
-
LogType:
|
|
5434
|
-
}), setTimeout(
|
|
5442
|
+
LogType: at.ERROR
|
|
5443
|
+
}), this.keepReconnectTimeout = setTimeout(
|
|
5435
5444
|
() => {
|
|
5436
|
-
this.eventsSdkClass.connect(
|
|
5445
|
+
this.reconnectionTime = this.reconnectionTime + 20, this.reconnectionTime > 60 && (this.reconnectionTime = 20), this.eventsSdkClass.connect(mt.NEXT);
|
|
5437
5446
|
},
|
|
5438
|
-
this.
|
|
5447
|
+
this.reconnectionTime * 1e3
|
|
5439
5448
|
);
|
|
5440
5449
|
}
|
|
5441
5450
|
}
|
|
5442
5451
|
class $o {
|
|
5443
5452
|
constructor(e) {
|
|
5444
|
-
|
|
5453
|
+
K(this, "storageLogger");
|
|
5445
5454
|
this.eventsSdkClass = e, this.eventsSdkClass = e;
|
|
5446
5455
|
}
|
|
5447
5456
|
init() {
|
|
@@ -5455,7 +5464,7 @@ class $o {
|
|
|
5455
5464
|
this.eventsSdkClass.options.loggerSocketConnection && (e = this.eventsSdkClass.options.loggerSocketConnection), this.eventsSdkClass.socketIoClass.ioFunction && !e && (e = this.eventsSdkClass.socketIoClass.ioFunction(
|
|
5456
5465
|
this.eventsSdkClass.options.loggerServer,
|
|
5457
5466
|
this.eventsSdkClass.options.loggerConnectOptions
|
|
5458
|
-
)), e && (this.storageLogger = new
|
|
5467
|
+
)), e && (this.storageLogger = new Io({
|
|
5459
5468
|
socket: e,
|
|
5460
5469
|
loggerOptions: this.eventsSdkClass.options.loggerConfig
|
|
5461
5470
|
}));
|
|
@@ -5475,18 +5484,18 @@ class $o {
|
|
|
5475
5484
|
this.log({
|
|
5476
5485
|
Message: "Sdk initialized with provided options",
|
|
5477
5486
|
Body: JSON.stringify(e, this.eventsSdkClass.getCircularReplacer()),
|
|
5478
|
-
ActionName:
|
|
5487
|
+
ActionName: it.WSCONNECT,
|
|
5479
5488
|
isShowClient: !1,
|
|
5480
5489
|
Status: "Sdk initialized",
|
|
5481
5490
|
StatusCode: 200,
|
|
5482
5491
|
Level: tt.INFO,
|
|
5483
|
-
LogType:
|
|
5492
|
+
LogType: at.INFO
|
|
5484
5493
|
});
|
|
5485
5494
|
}
|
|
5486
5495
|
}
|
|
5487
5496
|
class Go {
|
|
5488
5497
|
constructor(e) {
|
|
5489
|
-
|
|
5498
|
+
K(this, "listeners", {
|
|
5490
5499
|
[z.ALL_EXTENSION_STATUS]: [],
|
|
5491
5500
|
[z.ALL_DIALER_STATUS]: [],
|
|
5492
5501
|
[z.ALL_USERS_STATUS]: [],
|
|
@@ -5499,7 +5508,7 @@ class Go {
|
|
|
5499
5508
|
[z.ONLINE_STATUS_EVENT]: [],
|
|
5500
5509
|
[z.EXTENSIONS_UPDATED]: []
|
|
5501
5510
|
});
|
|
5502
|
-
|
|
5511
|
+
K(this, "allListeners", []);
|
|
5503
5512
|
this.eventsSdkClass = e, this.eventsSdkClass = e;
|
|
5504
5513
|
}
|
|
5505
5514
|
on(e, r) {
|
|
@@ -5530,19 +5539,19 @@ class Go {
|
|
|
5530
5539
|
}
|
|
5531
5540
|
class Zo {
|
|
5532
5541
|
constructor(e) {
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5542
|
+
K(this, "options");
|
|
5543
|
+
K(this, "servers", []);
|
|
5544
|
+
K(this, "URLList", []);
|
|
5545
|
+
K(this, "server");
|
|
5546
|
+
K(this, "URL");
|
|
5547
|
+
K(this, "socket");
|
|
5548
|
+
K(this, "mainServer");
|
|
5549
|
+
K(this, "alreadyAttemptedOtherServers", []);
|
|
5550
|
+
K(this, "authClass", new Bo(this));
|
|
5551
|
+
K(this, "socketIoClass", new Vo(this));
|
|
5552
|
+
K(this, "loggerClass", new $o(this));
|
|
5553
|
+
K(this, "eventEmitterClass", new Go(this));
|
|
5554
|
+
K(this, "getCircularReplacer", () => {
|
|
5546
5555
|
const e = /* @__PURE__ */ new WeakSet();
|
|
5547
5556
|
return (r, n) => {
|
|
5548
5557
|
if (!(r === "socket" || r === "io" || r === "nsps")) {
|
|
@@ -5567,7 +5576,7 @@ class Zo {
|
|
|
5567
5576
|
this.socketIoClass.io && this.socketIoClass.io.emit(e, ...r);
|
|
5568
5577
|
}
|
|
5569
5578
|
connect(e) {
|
|
5570
|
-
e ===
|
|
5579
|
+
e === mt.MAIN && this.findMainServer(), e === mt.NEXT && this.findNextServer(), this.socketIoClass.doReconnect = !0;
|
|
5571
5580
|
try {
|
|
5572
5581
|
this.loggerClass.init();
|
|
5573
5582
|
} catch (r) {
|
|
@@ -5617,14 +5626,14 @@ class Zo {
|
|
|
5617
5626
|
export {
|
|
5618
5627
|
qo as CallStatusEnum,
|
|
5619
5628
|
zo as CallTypeEnum,
|
|
5620
|
-
|
|
5629
|
+
vt as ConnectionStatusEnum,
|
|
5621
5630
|
Xo as DialerTypeEnum,
|
|
5622
5631
|
Wo as DirectionEnum,
|
|
5623
5632
|
Ko as DoNotCallMeStatusCodeEnum,
|
|
5624
5633
|
z as EventsEnum,
|
|
5625
5634
|
Nr as ExtensionEventReasonEnum,
|
|
5626
5635
|
Ho as ExtensionHangupCauseEnum,
|
|
5627
|
-
|
|
5636
|
+
ht as LoginType,
|
|
5628
5637
|
Jo as QueueEventReasonEnum,
|
|
5629
5638
|
Or as ServerListenerEventsEnum,
|
|
5630
5639
|
Zo as default
|