@verdocs/js-sdk 5.1.3 → 5.1.4
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 +1 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -13
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1174,8 +1174,7 @@ const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
|
|
|
1174
1174
|
const ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
|
|
1175
1175
|
const BETA_ORIGINS = ['https://beta.verdocs.com', 'https://stage.verdocs.com', 'http://localhost:6006', 'http://localhost:5173'];
|
|
1176
1176
|
const requestLogger = (r) => {
|
|
1177
|
-
//
|
|
1178
|
-
console.debug(`[JS-SDK] ${r.method.toUpperCase()} ${r.baseURL}${r.url}`, r.data ? JSON.stringify(r.data) : '');
|
|
1177
|
+
// TODO: Re-activate logging via an isomorphic approach
|
|
1179
1178
|
return r;
|
|
1180
1179
|
};
|
|
1181
1180
|
/**
|
|
@@ -1248,7 +1247,6 @@ class VerdocsEndpoint {
|
|
|
1248
1247
|
}
|
|
1249
1248
|
setDefault() {
|
|
1250
1249
|
globalThis$1[ENDPOINT_KEY] = this;
|
|
1251
|
-
window?.console?.debug('[JS_SDK] Set default endpoint', this.endpointId);
|
|
1252
1250
|
}
|
|
1253
1251
|
static getDefault() {
|
|
1254
1252
|
if (!globalThis$1[ENDPOINT_KEY]) {
|
|
@@ -1409,15 +1407,12 @@ class VerdocsEndpoint {
|
|
|
1409
1407
|
*/
|
|
1410
1408
|
setToken(token, sessionType = 'user') {
|
|
1411
1409
|
if (!token) {
|
|
1412
|
-
window?.console?.log('[JS_SDK] Clearing token');
|
|
1413
1410
|
return this.clearSession();
|
|
1414
1411
|
}
|
|
1415
1412
|
const session = decodeAccessTokenBody(token);
|
|
1416
1413
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
1417
|
-
window?.console?.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
1418
1414
|
return this.clearSession();
|
|
1419
1415
|
}
|
|
1420
|
-
window?.console?.log('[JS_SDK] Setting token', sessionType);
|
|
1421
1416
|
this.token = token;
|
|
1422
1417
|
this.session = session;
|
|
1423
1418
|
this.sub = session.sub;
|
|
@@ -1435,17 +1430,14 @@ class VerdocsEndpoint {
|
|
|
1435
1430
|
// this.api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
|
1436
1431
|
}
|
|
1437
1432
|
if (this.sessionType === 'user') {
|
|
1438
|
-
window?.console?.debug('[JS_SDK] Loading current profile...', this.endpointId, this.sub, session.sub);
|
|
1439
1433
|
getCurrentProfile(this)
|
|
1440
1434
|
.then((r) => {
|
|
1441
|
-
window?.console?.debug('[JS_SDK] Loaded profile', this.endpointId, r);
|
|
1442
1435
|
this.profile = r || null;
|
|
1443
1436
|
this.notifySessionListeners();
|
|
1444
1437
|
})
|
|
1445
1438
|
.catch((e) => {
|
|
1446
1439
|
this.profile = null;
|
|
1447
1440
|
this.sub = null;
|
|
1448
|
-
window?.console?.warn('Unable to load profile', e);
|
|
1449
1441
|
// We can't clear the token verdocs-auth may be using temporarily during registration
|
|
1450
1442
|
if (this.persist) {
|
|
1451
1443
|
this.clearSession();
|
|
@@ -1471,7 +1463,6 @@ class VerdocsEndpoint {
|
|
|
1471
1463
|
* Clear the active session.
|
|
1472
1464
|
*/
|
|
1473
1465
|
clearSession() {
|
|
1474
|
-
window?.console?.debug('[JS_SDK] Clearing session', this.endpointId);
|
|
1475
1466
|
if (this.persist) {
|
|
1476
1467
|
localStorage.removeItem(this.sessionStorageKey());
|
|
1477
1468
|
}
|
|
@@ -1488,7 +1479,6 @@ class VerdocsEndpoint {
|
|
|
1488
1479
|
* Clear the active signing session.
|
|
1489
1480
|
*/
|
|
1490
1481
|
clearSignerSession() {
|
|
1491
|
-
window?.console?.debug('[JS_SDK] Clearing signer session', this.endpointId);
|
|
1492
1482
|
if (this.persist) {
|
|
1493
1483
|
localStorage.removeItem(this.sessionStorageKey());
|
|
1494
1484
|
}
|
|
@@ -1536,7 +1526,6 @@ class VerdocsEndpoint {
|
|
|
1536
1526
|
}
|
|
1537
1527
|
const token = localStorage.getItem(this.sessionStorageKey());
|
|
1538
1528
|
if (!token) {
|
|
1539
|
-
window?.console?.debug('[JS_SDK] No cached session found', this.endpointId);
|
|
1540
1529
|
return this.clearSession();
|
|
1541
1530
|
}
|
|
1542
1531
|
// We sometimes get multiple loadSession calls from stacked components all needing to just ensure
|
|
@@ -3343,7 +3332,6 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
3343
3332
|
* @apiSuccess ITemplate . The requested template
|
|
3344
3333
|
*/
|
|
3345
3334
|
const getTemplate = (endpoint, templateId) => {
|
|
3346
|
-
window?.console?.log('[JS_SDK] Loading template', templateId);
|
|
3347
3335
|
return endpoint.api //
|
|
3348
3336
|
.get(`/v2/templates/${templateId}`)
|
|
3349
3337
|
.then((r) => {
|