@verdocs/js-sdk 5.1.0 → 5.1.1

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.mjs CHANGED
@@ -1203,7 +1203,7 @@ class VerdocsEndpoint {
1203
1203
  environment = 'verdocs';
1204
1204
  sessionType = 'user';
1205
1205
  persist = true;
1206
- baseURL = BETA_ORIGINS.includes(window.location.origin) ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
1206
+ baseURL = BETA_ORIGINS.includes(window?.location?.origin || '') ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
1207
1207
  clientID = 'not-set';
1208
1208
  timeout = 60000;
1209
1209
  token = null;
@@ -1409,15 +1409,15 @@ class VerdocsEndpoint {
1409
1409
  */
1410
1410
  setToken(token, sessionType = 'user') {
1411
1411
  if (!token) {
1412
- window.console.log('[JS_SDK] Clearing token');
1412
+ window?.console?.log('[JS_SDK] Clearing token');
1413
1413
  return this.clearSession();
1414
1414
  }
1415
1415
  const session = decodeAccessTokenBody(token);
1416
1416
  if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
1417
- window.console.warn('[JS_SDK] Ignoring attempt to use expired session token');
1417
+ window?.console?.warn('[JS_SDK] Ignoring attempt to use expired session token');
1418
1418
  return this.clearSession();
1419
1419
  }
1420
- window.console.log('[JS_SDK] Setting token', sessionType);
1420
+ window?.console?.log('[JS_SDK] Setting token', sessionType);
1421
1421
  this.token = token;
1422
1422
  this.session = session;
1423
1423
  this.sub = session.sub;