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