@verdocs/js-sdk 4.2.68 → 4.2.71

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
@@ -1100,12 +1100,14 @@ class VerdocsEndpoint {
1100
1100
  }
1101
1101
  setDefault() {
1102
1102
  globalThis$1[ENDPOINT_KEY] = this;
1103
+ window?.console?.debug('[JS_SDK] Set default endpoint', ENDPOINT_KEY, globalThis$1);
1103
1104
  }
1104
1105
  static getDefault() {
1105
1106
  if (!globalThis$1[ENDPOINT_KEY]) {
1106
1107
  globalThis$1[ENDPOINT_KEY] = new VerdocsEndpoint();
1107
1108
  // window.console.debug('[JS_SDK] Created default endpoint', globalThis[ENDPOINT_KEY].baseURL);
1108
1109
  }
1110
+ window?.console?.debug('[JS_SDK] Getting default endpoint', ENDPOINT_KEY, globalThis$1);
1109
1111
  return globalThis$1[ENDPOINT_KEY];
1110
1112
  }
1111
1113
  /**
@@ -1280,12 +1282,17 @@ class VerdocsEndpoint {
1280
1282
  localStorage.setItem(this.sessionStorageKey(), token);
1281
1283
  }
1282
1284
  if (this.sub !== session.sub) {
1285
+ // The main purpose for this var is to prevent dupe getCurrentProfile calls and the trigger for the dupe
1286
+ // is usually two components calling loadSession() at the same time to ensure we've done all we could
1287
+ // to load it. We expose it in case it's useful, but have to set it here instead of in the async callbacks
1288
+ // even though their might be a brief window of time where it's set but something might go wrong (profile
1289
+ // doesn't load) because we need it to serve that original purpose more.
1290
+ this.sub = session.sub;
1283
1291
  window?.console?.debug('[JS_SDK] userId changed, loading current profile...', session.sub);
1284
1292
  getCurrentProfile(this)
1285
1293
  .then((r) => {
1286
1294
  window?.console?.debug('[JS_SDK] Loaded profile', r);
1287
1295
  this.profile = r || null;
1288
- this.sub = session.sub;
1289
1296
  this.notifySessionListeners();
1290
1297
  })
1291
1298
  .catch((e) => {