@verdocs/js-sdk 5.1.4 → 5.1.5

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
@@ -1179,6 +1179,7 @@ const requestLogger = (r) => {
1179
1179
  // TODO: Re-activate logging via an isomorphic approach
1180
1180
  return r;
1181
1181
  };
1182
+ const isBrowser = typeof globalThis$1.window !== 'undefined';
1182
1183
  /**
1183
1184
  * VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
1184
1185
  * Endpoints can be used for isolated session tasks.
@@ -1204,7 +1205,7 @@ class VerdocsEndpoint {
1204
1205
  environment = 'verdocs';
1205
1206
  sessionType = 'user';
1206
1207
  persist = true;
1207
- baseURL = BETA_ORIGINS.includes(window?.location?.origin || '') ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
1208
+ baseURL = BETA_ORIGINS.includes(globalThis$1.window?.location?.origin || '') ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
1208
1209
  clientID = 'not-set';
1209
1210
  timeout = 60000;
1210
1211
  token = null;
@@ -1421,8 +1422,8 @@ class VerdocsEndpoint {
1421
1422
  this.sessionType = sessionType;
1422
1423
  if (this.sessionType === 'user') {
1423
1424
  this.api.defaults.headers.common.Authorization = `Bearer ${token}`;
1424
- if (this.persist) {
1425
- localStorage.setItem(this.sessionStorageKey(), token);
1425
+ if (this.persist && isBrowser) {
1426
+ globalThis$1.localStorage.setItem(this.sessionStorageKey(), token);
1426
1427
  }
1427
1428
  }
1428
1429
  else {