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