@voicenter-team/events-sdk 0.0.94 → 0.0.95
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 +9 -9
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.es.js +133 -117
- 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,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Gr = Object.defineProperty;
|
|
2
|
+
var Jr = (t, e, r) => e in t ? Gr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var J = (t, e, r) => (Jr(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
4
|
import $r from "ws";
|
|
5
5
|
function Hr(t) {
|
|
6
6
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
@@ -172,12 +172,12 @@ class Re {
|
|
|
172
172
|
}
|
|
173
173
|
class en {
|
|
174
174
|
constructor(e) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
J(this, "delay", 1e3);
|
|
176
|
+
J(this, "lastLoginTimestamp");
|
|
177
|
+
J(this, "token");
|
|
178
|
+
J(this, "refreshToken");
|
|
179
|
+
J(this, "tokenExpiry");
|
|
180
|
+
J(this, "storageKey");
|
|
181
181
|
this.eventsSdkClass = e, this.eventsSdkClass = e, this.storageKey = "";
|
|
182
182
|
}
|
|
183
183
|
async login() {
|
|
@@ -2752,15 +2752,15 @@ class We {
|
|
|
2752
2752
|
var wr = /* @__PURE__ */ ((t) => (t.UPDATE_MONITORED_EXTENSIONS = "updateMonitoredExtensions", t.KEEP_ALIVE = "keepalive", t))(wr || {});
|
|
2753
2753
|
class mn {
|
|
2754
2754
|
constructor(e) {
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2755
|
+
J(this, "io");
|
|
2756
|
+
J(this, "ioFunction");
|
|
2757
|
+
J(this, "lastEventTimestamp", (/* @__PURE__ */ new Date()).getTime());
|
|
2758
|
+
J(this, "doReconnect", !0);
|
|
2759
|
+
J(this, "keepAliveInterval");
|
|
2760
|
+
J(this, "keepReconnectInterval");
|
|
2761
|
+
J(this, "keepReconnectTimeout");
|
|
2762
|
+
J(this, "connected", !1);
|
|
2763
|
+
J(this, "reconnectionTime", 20);
|
|
2764
2764
|
this.eventsSdkClass = e, this.eventsSdkClass = e, typeof window < "u" && (window.addEventListener("offline", () => {
|
|
2765
2765
|
this.closeAllConnections();
|
|
2766
2766
|
}), window.addEventListener("online", () => {
|
|
@@ -3005,9 +3005,9 @@ function On(t) {
|
|
|
3005
3005
|
return t >= _e ? Math.round(t / _e) + "d" : t >= Be ? Math.round(t / Be) + "h" : t >= Ie ? Math.round(t / Ie) + "m" : t >= Le ? Math.round(t / Le) + "s" : t + "ms";
|
|
3006
3006
|
}
|
|
3007
3007
|
function Rn(t) {
|
|
3008
|
-
return
|
|
3008
|
+
return Ge(t, _e, "day") || Ge(t, Be, "hour") || Ge(t, Ie, "minute") || Ge(t, Le, "second") || t + " ms";
|
|
3009
3009
|
}
|
|
3010
|
-
function
|
|
3010
|
+
function Ge(t, e, r) {
|
|
3011
3011
|
if (!(t < e))
|
|
3012
3012
|
return t < e * 1.5 ? Math.floor(t / e) + " " + r : Math.ceil(t / e) + " " + r + "s";
|
|
3013
3013
|
}
|
|
@@ -3279,9 +3279,9 @@ function Pn(t) {
|
|
|
3279
3279
|
return t >= Pe ? Math.round(t / Pe) + "d" : t >= De ? Math.round(t / De) + "h" : t >= Ue ? Math.round(t / Ue) + "m" : t >= Fe ? Math.round(t / Fe) + "s" : t + "ms";
|
|
3280
3280
|
}
|
|
3281
3281
|
function jn(t) {
|
|
3282
|
-
return
|
|
3282
|
+
return Je(t, Pe, "day") || Je(t, De, "hour") || Je(t, Ue, "minute") || Je(t, Fe, "second") || t + " ms";
|
|
3283
3283
|
}
|
|
3284
|
-
function
|
|
3284
|
+
function Je(t, e, r) {
|
|
3285
3285
|
if (!(t < e))
|
|
3286
3286
|
return t < e * 1.5 ? Math.floor(t / e) + " " + r : Math.ceil(t / e) + " " + r + "s";
|
|
3287
3287
|
}
|
|
@@ -3534,11 +3534,11 @@ var qn = xt.exports, Er = { exports: {} };
|
|
|
3534
3534
|
})(Er);
|
|
3535
3535
|
var Se = Er.exports, rt = {}, zn = {}.toString, Dt = Array.isArray || function(t) {
|
|
3536
3536
|
return zn.call(t) == "[object Array]";
|
|
3537
|
-
}, Ar =
|
|
3537
|
+
}, Ar = Jn, Xn = typeof Buffer == "function" && typeof Buffer.isBuffer == "function", Wn = typeof ArrayBuffer == "function", Gn = function(t) {
|
|
3538
3538
|
return typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t.buffer instanceof ArrayBuffer;
|
|
3539
3539
|
};
|
|
3540
|
-
function
|
|
3541
|
-
return Xn && Buffer.isBuffer(t) || Wn && (t instanceof ArrayBuffer ||
|
|
3540
|
+
function Jn(t) {
|
|
3541
|
+
return Xn && Buffer.isBuffer(t) || Wn && (t instanceof ArrayBuffer || Gn(t));
|
|
3542
3542
|
}
|
|
3543
3543
|
var Pt = Dt, Tr = Ar, Nr = Object.prototype.toString, $n = typeof Blob == "function" || typeof Blob < "u" && Nr.call(Blob) === "[object BlobConstructor]", Hn = typeof File == "function" || typeof File < "u" && Nr.call(File) === "[object FileConstructor]";
|
|
3544
3544
|
rt.deconstructPacket = function(t) {
|
|
@@ -4750,11 +4750,11 @@ function ar() {
|
|
|
4750
4750
|
for (var t in Q.requests)
|
|
4751
4751
|
Q.requests.hasOwnProperty(t) && Q.requests[t].abort();
|
|
4752
4752
|
}
|
|
4753
|
-
var xo = zt.exports,
|
|
4753
|
+
var xo = zt.exports, Gt = Ur, Oo = st, cr = Mt, Ro = Ae, Lo = /\n/g, Io = /\\n/g, He;
|
|
4754
4754
|
function Bo() {
|
|
4755
4755
|
}
|
|
4756
4756
|
function Ae(t) {
|
|
4757
|
-
|
|
4757
|
+
Gt.call(this, t), this.query = this.query || {}, He || (He = cr.___eio = cr.___eio || []), this.index = He.length;
|
|
4758
4758
|
var e = this;
|
|
4759
4759
|
He.push(function(r) {
|
|
4760
4760
|
e.onData(r);
|
|
@@ -4762,10 +4762,10 @@ function Ae(t) {
|
|
|
4762
4762
|
e.script && (e.script.onerror = Bo);
|
|
4763
4763
|
}, !1);
|
|
4764
4764
|
}
|
|
4765
|
-
Oo(Ae,
|
|
4765
|
+
Oo(Ae, Gt);
|
|
4766
4766
|
Ae.prototype.supportsBinary = !1;
|
|
4767
4767
|
Ae.prototype.doClose = function() {
|
|
4768
|
-
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), this.form && (this.form.parentNode.removeChild(this.form), this.form = null, this.iframe = null),
|
|
4768
|
+
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), this.form && (this.form.parentNode.removeChild(this.form), this.form = null, this.iframe = null), Gt.prototype.doClose.call(this);
|
|
4769
4769
|
};
|
|
4770
4770
|
Ae.prototype.doPoll = function() {
|
|
4771
4771
|
var t = this, e = document.createElement("script");
|
|
@@ -4819,7 +4819,7 @@ const _o = {}, Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
4819
4819
|
__proto__: null,
|
|
4820
4820
|
default: _o
|
|
4821
4821
|
}, Symbol.toStringTag, { value: "Module" })), Uo = /* @__PURE__ */ kn(Fo);
|
|
4822
|
-
var
|
|
4822
|
+
var Jt = Xt(), Do = Ce, Po = ot(), jo = st, Mo = Br, qo = it("engine.io-client:websocket"), Ze, $t;
|
|
4823
4823
|
typeof WebSocket < "u" ? Ze = WebSocket : typeof self < "u" && (Ze = self.WebSocket || self.MozWebSocket);
|
|
4824
4824
|
if (typeof window > "u")
|
|
4825
4825
|
try {
|
|
@@ -4829,9 +4829,9 @@ if (typeof window > "u")
|
|
|
4829
4829
|
var we = Ze || $t, zo = se;
|
|
4830
4830
|
function se(t) {
|
|
4831
4831
|
var e = t && t.forceBase64;
|
|
4832
|
-
e && (this.supportsBinary = !1), this.perMessageDeflate = t.perMessageDeflate, this.usingBrowserWebSocket = Ze && !t.forceNode, this.protocols = t.protocols, this.usingBrowserWebSocket || (we = $t),
|
|
4832
|
+
e && (this.supportsBinary = !1), this.perMessageDeflate = t.perMessageDeflate, this.usingBrowserWebSocket = Ze && !t.forceNode, this.protocols = t.protocols, this.usingBrowserWebSocket || (we = $t), Jt.call(this, t);
|
|
4833
4833
|
}
|
|
4834
|
-
jo(se,
|
|
4834
|
+
jo(se, Jt);
|
|
4835
4835
|
se.prototype.name = "websocket";
|
|
4836
4836
|
se.prototype.supportsBinary = !0;
|
|
4837
4837
|
se.prototype.doOpen = function() {
|
|
@@ -4886,7 +4886,7 @@ se.prototype.write = function(t) {
|
|
|
4886
4886
|
}
|
|
4887
4887
|
};
|
|
4888
4888
|
se.prototype.onClose = function() {
|
|
4889
|
-
|
|
4889
|
+
Jt.prototype.onClose.call(this);
|
|
4890
4890
|
};
|
|
4891
4891
|
se.prototype.doClose = function() {
|
|
4892
4892
|
typeof this.ws < "u" && this.ws.close();
|
|
@@ -4900,9 +4900,9 @@ se.prototype.uri = function() {
|
|
|
4900
4900
|
se.prototype.check = function() {
|
|
4901
4901
|
return !!we && !("__initialize" in we && this.name === se.prototype.name);
|
|
4902
4902
|
};
|
|
4903
|
-
var Xo = qt, Wo = xo,
|
|
4903
|
+
var Xo = qt, Wo = xo, Go = Ro, Jo = zo;
|
|
4904
4904
|
nt.polling = $o;
|
|
4905
|
-
nt.websocket =
|
|
4905
|
+
nt.websocket = Jo;
|
|
4906
4906
|
function $o(t) {
|
|
4907
4907
|
var e, r = !1, n = !1, o = t.jsonp !== !1;
|
|
4908
4908
|
if (typeof location < "u") {
|
|
@@ -4913,7 +4913,7 @@ function $o(t) {
|
|
|
4913
4913
|
return new Wo(t);
|
|
4914
4914
|
if (!o)
|
|
4915
4915
|
throw new Error("JSONP disabled");
|
|
4916
|
-
return new
|
|
4916
|
+
return new Go(t);
|
|
4917
4917
|
}
|
|
4918
4918
|
var Ho = [].indexOf, Pr = function(t, e) {
|
|
4919
4919
|
if (Ho)
|
|
@@ -4922,20 +4922,20 @@ var Ho = [].indexOf, Pr = function(t, e) {
|
|
|
4922
4922
|
if (t[r] === e)
|
|
4923
4923
|
return r;
|
|
4924
4924
|
return -1;
|
|
4925
|
-
}, Vo = nt, Ko = Se, Y = it("engine.io-client:socket"), Yo = Pr, jr = Ce, hr = Sr, Qo = ot(), Zo =
|
|
4926
|
-
function
|
|
4927
|
-
if (!(this instanceof
|
|
4928
|
-
return new
|
|
4925
|
+
}, Vo = nt, Ko = Se, Y = it("engine.io-client:socket"), Yo = Pr, jr = Ce, hr = Sr, Qo = ot(), Zo = G;
|
|
4926
|
+
function G(t, e) {
|
|
4927
|
+
if (!(this instanceof G))
|
|
4928
|
+
return new G(t, e);
|
|
4929
4929
|
e = e || {}, t && typeof t == "object" && (e = t, t = null), t ? (t = hr(t), e.hostname = t.host, e.secure = t.protocol === "https" || t.protocol === "wss", e.port = t.port, t.query && (e.query = t.query)) : e.host && (e.hostname = hr(e.host).host), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.agent = e.agent || !1, this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? 443 : 80), this.query = e.query || {}, typeof this.query == "string" && (this.query = Qo.decode(this.query)), this.upgrade = e.upgrade !== !1, this.path = (e.path || "/engine.io").replace(/\/$/, "") + "/", this.forceJSONP = !!e.forceJSONP, this.jsonp = e.jsonp !== !1, this.forceBase64 = !!e.forceBase64, this.enablesXDR = !!e.enablesXDR, this.withCredentials = e.withCredentials !== !1, this.timestampParam = e.timestampParam || "t", this.timestampRequests = e.timestampRequests, this.transports = e.transports || ["polling", "websocket"], this.transportOptions = e.transportOptions || {}, this.readyState = "", this.writeBuffer = [], this.prevBufferLen = 0, this.policyPort = e.policyPort || 843, this.rememberUpgrade = e.rememberUpgrade || !1, this.binaryType = null, this.onlyBinaryUpgrades = e.onlyBinaryUpgrades, this.perMessageDeflate = e.perMessageDeflate !== !1 ? e.perMessageDeflate || {} : !1, this.perMessageDeflate === !0 && (this.perMessageDeflate = {}), this.perMessageDeflate && this.perMessageDeflate.threshold == null && (this.perMessageDeflate.threshold = 1024), this.pfx = e.pfx || void 0, this.key = e.key || void 0, this.passphrase = e.passphrase || void 0, this.cert = e.cert || void 0, this.ca = e.ca || void 0, this.ciphers = e.ciphers || void 0, this.rejectUnauthorized = e.rejectUnauthorized === void 0 ? !0 : e.rejectUnauthorized, this.forceNode = !!e.forceNode, this.isReactNative = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", (typeof self > "u" || this.isReactNative) && (e.extraHeaders && Object.keys(e.extraHeaders).length > 0 && (this.extraHeaders = e.extraHeaders), e.localAddress && (this.localAddress = e.localAddress)), this.id = null, this.upgrades = null, this.pingInterval = null, this.pingTimeout = null, this.pingIntervalTimer = null, this.pingTimeoutTimer = null, this.open();
|
|
4930
4930
|
}
|
|
4931
|
-
|
|
4932
|
-
Ko(
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4931
|
+
G.priorWebsocketSuccess = !1;
|
|
4932
|
+
Ko(G.prototype);
|
|
4933
|
+
G.protocol = jr.protocol;
|
|
4934
|
+
G.Socket = G;
|
|
4935
|
+
G.Transport = Xt();
|
|
4936
|
+
G.transports = nt;
|
|
4937
|
+
G.parser = Ce;
|
|
4938
|
+
G.prototype.createTransport = function(t) {
|
|
4939
4939
|
Y('creating transport "%s"', t);
|
|
4940
4940
|
var e = es(this.query);
|
|
4941
4941
|
e.EIO = jr.protocol, e.transport = t;
|
|
@@ -4980,9 +4980,9 @@ function es(t) {
|
|
|
4980
4980
|
t.hasOwnProperty(r) && (e[r] = t[r]);
|
|
4981
4981
|
return e;
|
|
4982
4982
|
}
|
|
4983
|
-
|
|
4983
|
+
G.prototype.open = function() {
|
|
4984
4984
|
var t;
|
|
4985
|
-
if (this.rememberUpgrade &&
|
|
4985
|
+
if (this.rememberUpgrade && G.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1)
|
|
4986
4986
|
t = "websocket";
|
|
4987
4987
|
else if (this.transports.length === 0) {
|
|
4988
4988
|
var e = this;
|
|
@@ -5001,7 +5001,7 @@ W.prototype.open = function() {
|
|
|
5001
5001
|
}
|
|
5002
5002
|
t.open(), this.setTransport(t);
|
|
5003
5003
|
};
|
|
5004
|
-
|
|
5004
|
+
G.prototype.setTransport = function(t) {
|
|
5005
5005
|
Y("setting transport %s", t.name);
|
|
5006
5006
|
var e = this;
|
|
5007
5007
|
this.transport && (Y("clearing existing transport %s", this.transport.name), this.transport.removeAllListeners()), this.transport = t, t.on("drain", function() {
|
|
@@ -5014,10 +5014,10 @@ W.prototype.setTransport = function(t) {
|
|
|
5014
5014
|
e.onClose("transport close");
|
|
5015
5015
|
});
|
|
5016
5016
|
};
|
|
5017
|
-
|
|
5017
|
+
G.prototype.probe = function(t) {
|
|
5018
5018
|
Y('probing transport "%s"', t);
|
|
5019
5019
|
var e = this.createTransport(t, { probe: 1 }), r = !1, n = this;
|
|
5020
|
-
|
|
5020
|
+
G.priorWebsocketSuccess = !1;
|
|
5021
5021
|
function o() {
|
|
5022
5022
|
if (n.onlyBinaryUpgrades) {
|
|
5023
5023
|
var h = !this.supportsBinary && n.transport.supportsBinary;
|
|
@@ -5028,7 +5028,7 @@ W.prototype.probe = function(t) {
|
|
|
5028
5028
|
if (c.type === "pong" && c.data === "probe") {
|
|
5029
5029
|
if (Y('probe transport "%s" pong', t), n.upgrading = !0, n.emit("upgrading", e), !e)
|
|
5030
5030
|
return;
|
|
5031
|
-
|
|
5031
|
+
G.priorWebsocketSuccess = e.name === "websocket", Y('pausing current transport "%s"', n.transport.name), n.transport.pause(function() {
|
|
5032
5032
|
r || n.readyState !== "closed" && (Y("changing transport and sending upgrade packet"), u(), n.setTransport(e), e.send([{ type: "upgrade" }]), n.emit("upgrade", e), e = null, n.upgrading = !1, n.flush());
|
|
5033
5033
|
});
|
|
5034
5034
|
} else {
|
|
@@ -5059,14 +5059,14 @@ W.prototype.probe = function(t) {
|
|
|
5059
5059
|
}
|
|
5060
5060
|
e.once("open", o), e.once("error", l), e.once("close", p), this.once("close", f), this.once("upgrading", i), e.open();
|
|
5061
5061
|
};
|
|
5062
|
-
|
|
5063
|
-
if (Y("socket open"), this.readyState = "open",
|
|
5062
|
+
G.prototype.onOpen = function() {
|
|
5063
|
+
if (Y("socket open"), this.readyState = "open", G.priorWebsocketSuccess = this.transport.name === "websocket", this.emit("open"), this.flush(), this.readyState === "open" && this.upgrade && this.transport.pause) {
|
|
5064
5064
|
Y("starting upgrade probes");
|
|
5065
5065
|
for (var t = 0, e = this.upgrades.length; t < e; t++)
|
|
5066
5066
|
this.probe(this.upgrades[t]);
|
|
5067
5067
|
}
|
|
5068
5068
|
};
|
|
5069
|
-
|
|
5069
|
+
G.prototype.onPacket = function(t) {
|
|
5070
5070
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing")
|
|
5071
5071
|
switch (Y('socket receive: type "%s", data "%s"', t.type, t.data), this.emit("packet", t), this.emit("heartbeat"), t.type) {
|
|
5072
5072
|
case "open":
|
|
@@ -5086,38 +5086,38 @@ W.prototype.onPacket = function(t) {
|
|
|
5086
5086
|
else
|
|
5087
5087
|
Y('packet received with socket readyState "%s"', this.readyState);
|
|
5088
5088
|
};
|
|
5089
|
-
|
|
5089
|
+
G.prototype.onHandshake = function(t) {
|
|
5090
5090
|
this.emit("handshake", t), this.id = t.sid, this.transport.query.sid = t.sid, this.upgrades = this.filterUpgrades(t.upgrades), this.pingInterval = t.pingInterval, this.pingTimeout = t.pingTimeout, this.onOpen(), this.readyState !== "closed" && (this.setPing(), this.removeListener("heartbeat", this.onHeartbeat), this.on("heartbeat", this.onHeartbeat));
|
|
5091
5091
|
};
|
|
5092
|
-
|
|
5092
|
+
G.prototype.onHeartbeat = function(t) {
|
|
5093
5093
|
clearTimeout(this.pingTimeoutTimer);
|
|
5094
5094
|
var e = this;
|
|
5095
5095
|
e.pingTimeoutTimer = setTimeout(function() {
|
|
5096
5096
|
e.readyState !== "closed" && e.onClose("ping timeout");
|
|
5097
5097
|
}, t || e.pingInterval + e.pingTimeout);
|
|
5098
5098
|
};
|
|
5099
|
-
|
|
5099
|
+
G.prototype.setPing = function() {
|
|
5100
5100
|
var t = this;
|
|
5101
5101
|
clearTimeout(t.pingIntervalTimer), t.pingIntervalTimer = setTimeout(function() {
|
|
5102
5102
|
Y("writing ping packet - expecting pong within %sms", t.pingTimeout), t.ping(), t.onHeartbeat(t.pingTimeout);
|
|
5103
5103
|
}, t.pingInterval);
|
|
5104
5104
|
};
|
|
5105
|
-
|
|
5105
|
+
G.prototype.ping = function() {
|
|
5106
5106
|
var t = this;
|
|
5107
5107
|
this.sendPacket("ping", function() {
|
|
5108
5108
|
t.emit("ping");
|
|
5109
5109
|
});
|
|
5110
5110
|
};
|
|
5111
|
-
|
|
5111
|
+
G.prototype.onDrain = function() {
|
|
5112
5112
|
this.writeBuffer.splice(0, this.prevBufferLen), this.prevBufferLen = 0, this.writeBuffer.length === 0 ? this.emit("drain") : this.flush();
|
|
5113
5113
|
};
|
|
5114
|
-
|
|
5114
|
+
G.prototype.flush = function() {
|
|
5115
5115
|
this.readyState !== "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length && (Y("flushing %d packets in socket", this.writeBuffer.length), this.transport.send(this.writeBuffer), this.prevBufferLen = this.writeBuffer.length, this.emit("flush"));
|
|
5116
5116
|
};
|
|
5117
|
-
|
|
5117
|
+
G.prototype.write = G.prototype.send = function(t, e, r) {
|
|
5118
5118
|
return this.sendPacket("message", t, e, r), this;
|
|
5119
5119
|
};
|
|
5120
|
-
|
|
5120
|
+
G.prototype.sendPacket = function(t, e, r, n) {
|
|
5121
5121
|
if (typeof e == "function" && (n = e, e = void 0), typeof r == "function" && (n = r, r = null), !(this.readyState === "closing" || this.readyState === "closed")) {
|
|
5122
5122
|
r = r || {}, r.compress = r.compress !== !1;
|
|
5123
5123
|
var o = {
|
|
@@ -5128,7 +5128,7 @@ W.prototype.sendPacket = function(t, e, r, n) {
|
|
|
5128
5128
|
this.emit("packetCreate", o), this.writeBuffer.push(o), n && this.once("flush", n), this.flush();
|
|
5129
5129
|
}
|
|
5130
5130
|
};
|
|
5131
|
-
|
|
5131
|
+
G.prototype.close = function() {
|
|
5132
5132
|
if (this.readyState === "opening" || this.readyState === "open") {
|
|
5133
5133
|
this.readyState = "closing";
|
|
5134
5134
|
var t = this;
|
|
@@ -5147,17 +5147,17 @@ W.prototype.close = function() {
|
|
|
5147
5147
|
}
|
|
5148
5148
|
return this;
|
|
5149
5149
|
};
|
|
5150
|
-
|
|
5151
|
-
Y("socket error %j", t),
|
|
5150
|
+
G.prototype.onError = function(t) {
|
|
5151
|
+
Y("socket error %j", t), G.priorWebsocketSuccess = !1, this.emit("error", t), this.onClose("transport error", t);
|
|
5152
5152
|
};
|
|
5153
|
-
|
|
5153
|
+
G.prototype.onClose = function(t, e) {
|
|
5154
5154
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
5155
5155
|
Y('socket close with reason: "%s"', t);
|
|
5156
5156
|
var r = this;
|
|
5157
5157
|
clearTimeout(this.pingIntervalTimer), clearTimeout(this.pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), this.readyState = "closed", this.id = null, this.emit("close", t, e), r.writeBuffer = [], r.prevBufferLen = 0;
|
|
5158
5158
|
}
|
|
5159
5159
|
};
|
|
5160
|
-
|
|
5160
|
+
G.prototype.filterUpgrades = function(t) {
|
|
5161
5161
|
for (var e = [], r = 0, n = t.length; r < n; r++)
|
|
5162
5162
|
~Yo(this.transports, t[r]) && e.push(t[r]);
|
|
5163
5163
|
return e;
|
|
@@ -5647,7 +5647,7 @@ const ks = {
|
|
|
5647
5647
|
MODIFY: "modify",
|
|
5648
5648
|
ERROR: "error",
|
|
5649
5649
|
VIEW: "view"
|
|
5650
|
-
},
|
|
5650
|
+
}, W = {
|
|
5651
5651
|
INFO: "info",
|
|
5652
5652
|
WARNING: "warning",
|
|
5653
5653
|
ERROR: "error",
|
|
@@ -5660,24 +5660,24 @@ class Ss {
|
|
|
5660
5660
|
* @param options The configuration of the logger.
|
|
5661
5661
|
*/
|
|
5662
5662
|
constructor(e) {
|
|
5663
|
-
H(this, "logToConsole"), H(this, "overloadGlobalConsole"), H(this, "system"), H(this, "socketEmitInterval"), H(this, "storageId"), H(this, "loggerLevel",
|
|
5664
|
-
[
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5663
|
+
H(this, "logToConsole"), H(this, "overloadGlobalConsole"), H(this, "system"), H(this, "socketEmitInterval"), H(this, "storageId"), H(this, "loggerLevel", W.DEBUG), H(this, "loggerLevelMap", {
|
|
5664
|
+
[W.DEBUG]: [
|
|
5665
|
+
W.DEBUG,
|
|
5666
|
+
W.INFO,
|
|
5667
|
+
W.WARNING,
|
|
5668
|
+
W.ERROR
|
|
5669
5669
|
],
|
|
5670
|
-
[
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5670
|
+
[W.INFO]: [
|
|
5671
|
+
W.INFO,
|
|
5672
|
+
W.WARNING,
|
|
5673
|
+
W.ERROR
|
|
5674
5674
|
],
|
|
5675
|
-
[
|
|
5676
|
-
|
|
5677
|
-
|
|
5675
|
+
[W.WARNING]: [
|
|
5676
|
+
W.WARNING,
|
|
5677
|
+
W.ERROR
|
|
5678
5678
|
],
|
|
5679
|
-
[
|
|
5680
|
-
|
|
5679
|
+
[W.ERROR]: [
|
|
5680
|
+
W.ERROR
|
|
5681
5681
|
]
|
|
5682
5682
|
}), H(this, "emitInProgress"), H(this, "queue"), H(this, "processing"), H(this, "storageInitialized"), H(this, "interval"), H(this, "logIndex"), H(this, "socket"), H(this, "requestUrl"), H(this, "staticObject", {}), H(this, "localObject", {}), H(this, "isGetItemAsync"), H(this, "isSetItemAsync"), H(this, "getItem"), H(this, "setItem"), H(this, "parseLog"), H(this, "_logMethod"), H(this, "_warnMethod"), H(this, "_errorMethod"), H(this, "_debugMethod");
|
|
5683
5683
|
const { loggerOptions: r } = e;
|
|
@@ -5937,7 +5937,7 @@ class Ss {
|
|
|
5937
5937
|
* @return void
|
|
5938
5938
|
*/
|
|
5939
5939
|
log(e) {
|
|
5940
|
-
if (!this.isLogLevelAllowed(
|
|
5940
|
+
if (!this.isLogLevelAllowed(W.INFO))
|
|
5941
5941
|
return;
|
|
5942
5942
|
const r = {
|
|
5943
5943
|
...this.populateMetaData(),
|
|
@@ -5951,7 +5951,7 @@ class Ss {
|
|
|
5951
5951
|
* @return void
|
|
5952
5952
|
*/
|
|
5953
5953
|
warn(e) {
|
|
5954
|
-
if (!this.isLogLevelAllowed(
|
|
5954
|
+
if (!this.isLogLevelAllowed(W.WARNING))
|
|
5955
5955
|
return;
|
|
5956
5956
|
const r = ["WARN", e];
|
|
5957
5957
|
this.queue.push(r), this.logToConsole && this._warnMethod.apply(re, [e]), this.processQueue();
|
|
@@ -5962,7 +5962,7 @@ class Ss {
|
|
|
5962
5962
|
* @return void
|
|
5963
5963
|
*/
|
|
5964
5964
|
error(e) {
|
|
5965
|
-
if (!this.isLogLevelAllowed(
|
|
5965
|
+
if (!this.isLogLevelAllowed(W.ERROR))
|
|
5966
5966
|
return;
|
|
5967
5967
|
const r = ["ERROR", e];
|
|
5968
5968
|
this.queue.push(r), this.logToConsole && this._errorMethod.apply(re, [e]), this.processQueue();
|
|
@@ -5973,7 +5973,7 @@ class Ss {
|
|
|
5973
5973
|
* @return void
|
|
5974
5974
|
*/
|
|
5975
5975
|
debug(e) {
|
|
5976
|
-
if (!this.isLogLevelAllowed(
|
|
5976
|
+
if (!this.isLogLevelAllowed(W.DEBUG))
|
|
5977
5977
|
return;
|
|
5978
5978
|
const r = ["DEBUG", e];
|
|
5979
5979
|
this.queue.push(r), this.logToConsole && this._debugMethod.apply(re, [e]), this.processQueue();
|
|
@@ -6011,7 +6011,7 @@ class Ss {
|
|
|
6011
6011
|
}
|
|
6012
6012
|
class Es {
|
|
6013
6013
|
constructor(e) {
|
|
6014
|
-
|
|
6014
|
+
J(this, "storageLogger");
|
|
6015
6015
|
this.eventsSdkClass = e, this.eventsSdkClass = e;
|
|
6016
6016
|
}
|
|
6017
6017
|
init() {
|
|
@@ -6037,7 +6037,23 @@ class Es {
|
|
|
6037
6037
|
this.storageLogger && this.storageLogger.stop();
|
|
6038
6038
|
}
|
|
6039
6039
|
log(e) {
|
|
6040
|
-
this.eventsSdkClass.options.useLogger
|
|
6040
|
+
if (this.eventsSdkClass.options.useLogger)
|
|
6041
|
+
if (this.storageLogger)
|
|
6042
|
+
switch (e.Level) {
|
|
6043
|
+
case W.INFO:
|
|
6044
|
+
this.storageLogger.log(e);
|
|
6045
|
+
break;
|
|
6046
|
+
case W.DEBUG:
|
|
6047
|
+
this.storageLogger.debug(e);
|
|
6048
|
+
break;
|
|
6049
|
+
case W.WARNING:
|
|
6050
|
+
this.storageLogger.warn(e);
|
|
6051
|
+
break;
|
|
6052
|
+
case W.ERROR:
|
|
6053
|
+
this.storageLogger.error(e);
|
|
6054
|
+
}
|
|
6055
|
+
else
|
|
6056
|
+
e.Level === W.INFO ? console.log(e) : e.Level === W.ERROR && console.error(e);
|
|
6041
6057
|
}
|
|
6042
6058
|
sdkConnectionSuccess() {
|
|
6043
6059
|
const e = {
|
|
@@ -6052,7 +6068,7 @@ class Es {
|
|
|
6052
6068
|
isShowClient: !1,
|
|
6053
6069
|
Status: "Connection established",
|
|
6054
6070
|
StatusCode: 200,
|
|
6055
|
-
Level:
|
|
6071
|
+
Level: W.INFO,
|
|
6056
6072
|
LogType: ce.INFO
|
|
6057
6073
|
});
|
|
6058
6074
|
}
|
|
@@ -6063,7 +6079,7 @@ class Es {
|
|
|
6063
6079
|
isShowClient: !1,
|
|
6064
6080
|
Status: "Connection closed",
|
|
6065
6081
|
StatusCode: 200,
|
|
6066
|
-
Level:
|
|
6082
|
+
Level: W.INFO,
|
|
6067
6083
|
LogType: ce.INFO
|
|
6068
6084
|
});
|
|
6069
6085
|
}
|
|
@@ -6074,7 +6090,7 @@ class Es {
|
|
|
6074
6090
|
isShowClient: !1,
|
|
6075
6091
|
Status: "Switching Protocols",
|
|
6076
6092
|
StatusCode: 101,
|
|
6077
|
-
Level:
|
|
6093
|
+
Level: W.INFO,
|
|
6078
6094
|
LogType: ce.INFO
|
|
6079
6095
|
});
|
|
6080
6096
|
}
|
|
@@ -6085,7 +6101,7 @@ class Es {
|
|
|
6085
6101
|
isShowClient: !1,
|
|
6086
6102
|
Status: "Connection error",
|
|
6087
6103
|
StatusCode: 500,
|
|
6088
|
-
Level:
|
|
6104
|
+
Level: W.ERROR,
|
|
6089
6105
|
LogType: ce.ERROR
|
|
6090
6106
|
});
|
|
6091
6107
|
}
|
|
@@ -6096,7 +6112,7 @@ class Es {
|
|
|
6096
6112
|
isShowClient: !1,
|
|
6097
6113
|
Status: "External login error",
|
|
6098
6114
|
StatusCode: r || 400,
|
|
6099
|
-
Level:
|
|
6115
|
+
Level: W.ERROR,
|
|
6100
6116
|
LogType: ce.ERROR
|
|
6101
6117
|
});
|
|
6102
6118
|
}
|
|
@@ -6107,7 +6123,7 @@ class Es {
|
|
|
6107
6123
|
isShowClient: !1,
|
|
6108
6124
|
Status: "Get settings error",
|
|
6109
6125
|
StatusCode: 400,
|
|
6110
|
-
Level:
|
|
6126
|
+
Level: W.ERROR,
|
|
6111
6127
|
LogType: ce.ERROR
|
|
6112
6128
|
});
|
|
6113
6129
|
}
|
|
@@ -6118,7 +6134,7 @@ class Es {
|
|
|
6118
6134
|
isShowClient: !1,
|
|
6119
6135
|
Status: "Get settings error",
|
|
6120
6136
|
StatusCode: 400,
|
|
6121
|
-
Level:
|
|
6137
|
+
Level: W.ERROR,
|
|
6122
6138
|
LogType: ce.ERROR
|
|
6123
6139
|
});
|
|
6124
6140
|
}
|
|
@@ -6127,7 +6143,7 @@ class Es {
|
|
|
6127
6143
|
Message: `Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,
|
|
6128
6144
|
ActionName: ae.WSCONNECT,
|
|
6129
6145
|
isShowClient: !1,
|
|
6130
|
-
Level:
|
|
6146
|
+
Level: W.INFO,
|
|
6131
6147
|
LogType: ce.INFO
|
|
6132
6148
|
});
|
|
6133
6149
|
}
|
|
@@ -6138,7 +6154,7 @@ class Es {
|
|
|
6138
6154
|
isShowClient: !1,
|
|
6139
6155
|
Status: "Successful",
|
|
6140
6156
|
StatusCode: 200,
|
|
6141
|
-
Level:
|
|
6157
|
+
Level: W.INFO,
|
|
6142
6158
|
LogType: ce.INFO
|
|
6143
6159
|
});
|
|
6144
6160
|
}
|
|
@@ -6156,14 +6172,14 @@ class Es {
|
|
|
6156
6172
|
ActionName: ae.WSCONNECT,
|
|
6157
6173
|
isShowClient: !1,
|
|
6158
6174
|
Status: "Successful",
|
|
6159
|
-
Level:
|
|
6175
|
+
Level: W.DEBUG,
|
|
6160
6176
|
LogType: ce.INFO
|
|
6161
6177
|
});
|
|
6162
6178
|
}
|
|
6163
6179
|
}
|
|
6164
6180
|
class As {
|
|
6165
6181
|
constructor(e) {
|
|
6166
|
-
|
|
6182
|
+
J(this, "listeners", {
|
|
6167
6183
|
[j.ALL_EXTENSION_STATUS]: [],
|
|
6168
6184
|
[j.ALL_DIALER_STATUS]: [],
|
|
6169
6185
|
[j.ALL_USERS_STATUS]: [],
|
|
@@ -6176,7 +6192,7 @@ class As {
|
|
|
6176
6192
|
[j.ONLINE_STATUS_EVENT]: [],
|
|
6177
6193
|
[j.EXTENSIONS_UPDATED]: []
|
|
6178
6194
|
});
|
|
6179
|
-
|
|
6195
|
+
J(this, "allListeners", []);
|
|
6180
6196
|
this.eventsSdkClass = e, this.eventsSdkClass = e;
|
|
6181
6197
|
}
|
|
6182
6198
|
on(e, r) {
|
|
@@ -6207,19 +6223,19 @@ class As {
|
|
|
6207
6223
|
}
|
|
6208
6224
|
class xs {
|
|
6209
6225
|
constructor(e) {
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6226
|
+
J(this, "options");
|
|
6227
|
+
J(this, "servers", []);
|
|
6228
|
+
J(this, "URLList", []);
|
|
6229
|
+
J(this, "server");
|
|
6230
|
+
J(this, "URL");
|
|
6231
|
+
J(this, "socket");
|
|
6232
|
+
J(this, "mainServer");
|
|
6233
|
+
J(this, "alreadyAttemptedOtherServers", []);
|
|
6234
|
+
J(this, "authClass", new en(this));
|
|
6235
|
+
J(this, "socketIoClass", new mn(this));
|
|
6236
|
+
J(this, "loggerClass", new Es(this));
|
|
6237
|
+
J(this, "eventEmitterClass", new As(this));
|
|
6238
|
+
J(this, "getCircularReplacer", () => {
|
|
6223
6239
|
const e = /* @__PURE__ */ new WeakSet();
|
|
6224
6240
|
return (r, n) => {
|
|
6225
6241
|
if (!(r === "socket" || r === "io" || r === "nsps")) {
|