@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/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 = M(this.config.userToken), r = (s.exp || 0) * 1e3, i = Date.now();
1058
- if (r <= i)
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 u = await this.config.authenticateOptions.refreshUserToken(
1060
+ const l = await this.config.authenticateOptions.refreshUserToken(
1061
1061
  this.config.userToken,
1062
- s
1062
+ r
1063
1063
  );
1064
- u && typeof u == "string" && (await this.config.identify(
1064
+ l && typeof l == "string" && (await this.config.identify(
1065
1065
  this.config.distinctId,
1066
- u,
1066
+ l,
1067
1067
  this.config.authenticateOptions
1068
- ), this.socket.auth["x-ss-signature"] = u, setTimeout(() => {
1068
+ ), this.socket.auth["x-ss-signature"] = l, setTimeout(() => {
1069
1069
  this.socket.connect();
1070
1070
  }, 1e3));
1071
1071
  } catch {