@verdocs/js-sdk 4.2.79 → 4.2.80
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 +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1272,8 +1272,10 @@ class VerdocsEndpoint {
|
|
|
1272
1272
|
*/
|
|
1273
1273
|
setToken(token) {
|
|
1274
1274
|
if (!token) {
|
|
1275
|
+
window.console.log('[JS_SDK] Clearing token');
|
|
1275
1276
|
return this.clearSession();
|
|
1276
1277
|
}
|
|
1278
|
+
window.console.log('[JS_SDK] Setting token', token.length);
|
|
1277
1279
|
const session = decodeAccessTokenBody(token);
|
|
1278
1280
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
1279
1281
|
window.console.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
@@ -1308,7 +1310,7 @@ class VerdocsEndpoint {
|
|
|
1308
1310
|
this.profile = null;
|
|
1309
1311
|
this.sub = null;
|
|
1310
1312
|
window?.console?.warn('Unable to load profile', e);
|
|
1311
|
-
this.
|
|
1313
|
+
this.clearSession();
|
|
1312
1314
|
});
|
|
1313
1315
|
return this;
|
|
1314
1316
|
}
|
|
@@ -1373,9 +1375,10 @@ class VerdocsEndpoint {
|
|
|
1373
1375
|
this.nextListenerId++;
|
|
1374
1376
|
const listenerSymbol = Symbol.for('' + this.nextListenerId);
|
|
1375
1377
|
this.sessionListeners.set(listenerSymbol, listener);
|
|
1376
|
-
// Perform an immediate notification
|
|
1377
|
-
|
|
1378
|
-
|
|
1378
|
+
// Perform an immediate notification if this listener subscribed after the session was already loaded.
|
|
1379
|
+
if (this.profile) {
|
|
1380
|
+
listener(this, this.session, this.profile);
|
|
1381
|
+
}
|
|
1379
1382
|
return () => {
|
|
1380
1383
|
this.sessionListeners.delete(listenerSymbol);
|
|
1381
1384
|
};
|
|
@@ -1390,6 +1393,7 @@ class VerdocsEndpoint {
|
|
|
1390
1393
|
}
|
|
1391
1394
|
const token = localStorage.getItem(this.sessionStorageKey());
|
|
1392
1395
|
if (!token) {
|
|
1396
|
+
window?.console?.debug('[JS_SDK] No cached session found', this.endpointId);
|
|
1393
1397
|
return this.clearSession();
|
|
1394
1398
|
}
|
|
1395
1399
|
// We sometimes get multiple loadSession calls from stacked components all needing to just ensure
|