@opexa/portal-sdk 0.59.83 → 0.59.84

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/index.js CHANGED
@@ -721,7 +721,7 @@ var SessionManagerCookie = class {
721
721
  if (val) {
722
722
  try {
723
723
  const stored = JSON.parse(val);
724
- if (stored.version === 4) return await this.verifyV4();
724
+ if (stored.version === 4) return await this.verifyV4(stored.session);
725
725
  } catch {
726
726
  }
727
727
  }
@@ -736,9 +736,10 @@ var SessionManagerCookie = class {
736
736
  }
737
737
  return v;
738
738
  }
739
- async verifyV4() {
739
+ async verifyV4(session) {
740
740
  if (!this.v4AccessToken || !this.v4AccessTokenExpiresAt || isAfter(/* @__PURE__ */ new Date(), new Date(this.v4AccessTokenExpiresAt))) {
741
- return true;
741
+ const res = await this.refreshV4(session);
742
+ return res.ok;
742
743
  }
743
744
  const v = await this.authService.verifySession(this.v4AccessToken);
744
745
  if (!v) {
@@ -1188,7 +1189,7 @@ var SessionManager = class {
1188
1189
  if (val) {
1189
1190
  try {
1190
1191
  const stored = JSON.parse(val);
1191
- if (stored.version === 4) return await this.verifyV4();
1192
+ if (stored.version === 4) return await this.verifyV4(stored.session);
1192
1193
  } catch {
1193
1194
  }
1194
1195
  }
@@ -1203,9 +1204,10 @@ var SessionManager = class {
1203
1204
  }
1204
1205
  return v;
1205
1206
  }
1206
- async verifyV4() {
1207
+ async verifyV4(session) {
1207
1208
  if (!this.v4AccessToken || !this.v4AccessTokenExpiresAt || isAfter(/* @__PURE__ */ new Date(), new Date(this.v4AccessTokenExpiresAt))) {
1208
- return true;
1209
+ const res = await this.refreshV4(session);
1210
+ return res.ok;
1209
1211
  }
1210
1212
  const v = await this.authService.verifySession(this.v4AccessToken);
1211
1213
  if (!v) {