@verdocs/js-sdk 4.2.74 → 4.2.76
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 +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -23
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1111,9 +1111,7 @@ class VerdocsEndpoint {
|
|
|
1111
1111
|
static getDefault() {
|
|
1112
1112
|
if (!globalThis$1[ENDPOINT_KEY]) {
|
|
1113
1113
|
globalThis$1[ENDPOINT_KEY] = new VerdocsEndpoint();
|
|
1114
|
-
// window.console.debug('[JS_SDK] Created default endpoint', globalThis[ENDPOINT_KEY].baseURL);
|
|
1115
1114
|
}
|
|
1116
|
-
window?.console?.debug('[JS_SDK] Getting default endpoint', globalThis$1[ENDPOINT_KEY].endpointId);
|
|
1117
1115
|
return globalThis$1[ENDPOINT_KEY];
|
|
1118
1116
|
}
|
|
1119
1117
|
/**
|
|
@@ -1287,27 +1285,26 @@ class VerdocsEndpoint {
|
|
|
1287
1285
|
if (this.persist) {
|
|
1288
1286
|
localStorage.setItem(this.sessionStorageKey(), token);
|
|
1289
1287
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}
|
|
1288
|
+
// NOTE: We don't attempt to de-dupe session/network operations because there are cases where we
|
|
1289
|
+
// operate within an IFRAME and multiple siblings need to operate on the same session. This happens
|
|
1290
|
+
// a lot in Storybook but may also happen in other environments as well. Rather than try to coordinate
|
|
1291
|
+
// something weird that might break (e.g. in a mobile app), we just allow the dupe calls. We generate
|
|
1292
|
+
// a unique ID for each endpoint just to help with debugging. It should not be taken as a bug if more
|
|
1293
|
+
// than one endpoint ID is seen within the app's logs.
|
|
1294
|
+
window?.console?.debug('[JS_SDK] Loading current profile...', this.endpointId, this.sub, session.sub);
|
|
1295
|
+
this.sub = session.sub;
|
|
1296
|
+
getCurrentProfile(this)
|
|
1297
|
+
.then((r) => {
|
|
1298
|
+
window?.console?.debug('[JS_SDK] Loaded profile', this.endpointId, r);
|
|
1299
|
+
this.profile = r || null;
|
|
1300
|
+
this.notifySessionListeners();
|
|
1301
|
+
})
|
|
1302
|
+
.catch((e) => {
|
|
1303
|
+
this.profile = null;
|
|
1304
|
+
this.sub = null;
|
|
1305
|
+
window?.console?.warn('Unable to load profile', e);
|
|
1306
|
+
this.notifySessionListeners();
|
|
1307
|
+
});
|
|
1311
1308
|
return this;
|
|
1312
1309
|
}
|
|
1313
1310
|
/**
|
|
@@ -1371,6 +1368,9 @@ class VerdocsEndpoint {
|
|
|
1371
1368
|
this.nextListenerId++;
|
|
1372
1369
|
const listenerSymbol = Symbol.for('' + this.nextListenerId);
|
|
1373
1370
|
this.sessionListeners.set(listenerSymbol, listener);
|
|
1371
|
+
// Perform an immediate notification in case this listener subscribed after the endpoint's session was
|
|
1372
|
+
// already loaded.
|
|
1373
|
+
listener(this, this.session, this.profile);
|
|
1374
1374
|
return () => {
|
|
1375
1375
|
this.sessionListeners.delete(listenerSymbol);
|
|
1376
1376
|
};
|