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