@suprsend/web-sdk 4.0.3 → 4.0.4
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.js +7 -7
- package/dist/es/index.js.map +1 -1
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -1054,18 +1054,18 @@ class ne {
|
|
|
1054
1054
|
this.socket.on("connect_error", async (e) => {
|
|
1055
1055
|
var t;
|
|
1056
1056
|
if (e.message === "Authentication Error: wrong auth token" && ((t = this.config.authenticateOptions) != null && t.refreshUserToken) && this.config.userToken) {
|
|
1057
|
-
const s =
|
|
1058
|
-
if (
|
|
1057
|
+
const s = this.socket.auth["x-ss-signature"], r = M(s), i = (r.exp || 0) * 1e3, c = Date.now();
|
|
1058
|
+
if (i <= c)
|
|
1059
1059
|
try {
|
|
1060
|
-
const
|
|
1060
|
+
const l = await this.config.authenticateOptions.refreshUserToken(
|
|
1061
1061
|
this.config.userToken,
|
|
1062
|
-
|
|
1062
|
+
r
|
|
1063
1063
|
);
|
|
1064
|
-
|
|
1064
|
+
l && typeof l == "string" && (await this.config.identify(
|
|
1065
1065
|
this.config.distinctId,
|
|
1066
|
-
|
|
1066
|
+
l,
|
|
1067
1067
|
this.config.authenticateOptions
|
|
1068
|
-
), this.socket.auth["x-ss-signature"] =
|
|
1068
|
+
), this.socket.auth["x-ss-signature"] = l, setTimeout(() => {
|
|
1069
1069
|
this.socket.connect();
|
|
1070
1070
|
}, 1e3));
|
|
1071
1071
|
} catch {
|