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