@verdocs/js-sdk 5.1.2 → 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 +2 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -14
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1176,8 +1176,7 @@ const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
|
|
|
1176
1176
|
const ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
|
|
1177
1177
|
const BETA_ORIGINS = ['https://beta.verdocs.com', 'https://stage.verdocs.com', 'http://localhost:6006', 'http://localhost:5173'];
|
|
1178
1178
|
const requestLogger = (r) => {
|
|
1179
|
-
//
|
|
1180
|
-
console.debug(`[JS-SDK] ${r.method.toUpperCase()} ${r.baseURL}${r.url}`, r.data ? JSON.stringify(r.data) : '');
|
|
1179
|
+
// TODO: Re-activate logging via an isomorphic approach
|
|
1181
1180
|
return r;
|
|
1182
1181
|
};
|
|
1183
1182
|
/**
|
|
@@ -1250,7 +1249,6 @@ class VerdocsEndpoint {
|
|
|
1250
1249
|
}
|
|
1251
1250
|
setDefault() {
|
|
1252
1251
|
globalThis$1[ENDPOINT_KEY] = this;
|
|
1253
|
-
window?.console?.debug('[JS_SDK] Set default endpoint', this.endpointId);
|
|
1254
1252
|
}
|
|
1255
1253
|
static getDefault() {
|
|
1256
1254
|
if (!globalThis$1[ENDPOINT_KEY]) {
|
|
@@ -1411,15 +1409,12 @@ class VerdocsEndpoint {
|
|
|
1411
1409
|
*/
|
|
1412
1410
|
setToken(token, sessionType = 'user') {
|
|
1413
1411
|
if (!token) {
|
|
1414
|
-
window?.console?.log('[JS_SDK] Clearing token');
|
|
1415
1412
|
return this.clearSession();
|
|
1416
1413
|
}
|
|
1417
1414
|
const session = decodeAccessTokenBody(token);
|
|
1418
1415
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
1419
|
-
window?.console?.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
1420
1416
|
return this.clearSession();
|
|
1421
1417
|
}
|
|
1422
|
-
window?.console?.log('[JS_SDK] Setting token', sessionType);
|
|
1423
1418
|
this.token = token;
|
|
1424
1419
|
this.session = session;
|
|
1425
1420
|
this.sub = session.sub;
|
|
@@ -1437,17 +1432,14 @@ class VerdocsEndpoint {
|
|
|
1437
1432
|
// this.api.defaults.headers.common.Authorization = `Bearer ${token}`;
|
|
1438
1433
|
}
|
|
1439
1434
|
if (this.sessionType === 'user') {
|
|
1440
|
-
window?.console?.debug('[JS_SDK] Loading current profile...', this.endpointId, this.sub, session.sub);
|
|
1441
1435
|
getCurrentProfile(this)
|
|
1442
1436
|
.then((r) => {
|
|
1443
|
-
window?.console?.debug('[JS_SDK] Loaded profile', this.endpointId, r);
|
|
1444
1437
|
this.profile = r || null;
|
|
1445
1438
|
this.notifySessionListeners();
|
|
1446
1439
|
})
|
|
1447
1440
|
.catch((e) => {
|
|
1448
1441
|
this.profile = null;
|
|
1449
1442
|
this.sub = null;
|
|
1450
|
-
window?.console?.warn('Unable to load profile', e);
|
|
1451
1443
|
// We can't clear the token verdocs-auth may be using temporarily during registration
|
|
1452
1444
|
if (this.persist) {
|
|
1453
1445
|
this.clearSession();
|
|
@@ -1473,7 +1465,6 @@ class VerdocsEndpoint {
|
|
|
1473
1465
|
* Clear the active session.
|
|
1474
1466
|
*/
|
|
1475
1467
|
clearSession() {
|
|
1476
|
-
window?.console?.debug('[JS_SDK] Clearing session', this.endpointId);
|
|
1477
1468
|
if (this.persist) {
|
|
1478
1469
|
localStorage.removeItem(this.sessionStorageKey());
|
|
1479
1470
|
}
|
|
@@ -1490,7 +1481,6 @@ class VerdocsEndpoint {
|
|
|
1490
1481
|
* Clear the active signing session.
|
|
1491
1482
|
*/
|
|
1492
1483
|
clearSignerSession() {
|
|
1493
|
-
window?.console?.debug('[JS_SDK] Clearing signer session', this.endpointId);
|
|
1494
1484
|
if (this.persist) {
|
|
1495
1485
|
localStorage.removeItem(this.sessionStorageKey());
|
|
1496
1486
|
}
|
|
@@ -1538,7 +1528,6 @@ class VerdocsEndpoint {
|
|
|
1538
1528
|
}
|
|
1539
1529
|
const token = localStorage.getItem(this.sessionStorageKey());
|
|
1540
1530
|
if (!token) {
|
|
1541
|
-
window?.console?.debug('[JS_SDK] No cached session found', this.endpointId);
|
|
1542
1531
|
return this.clearSession();
|
|
1543
1532
|
}
|
|
1544
1533
|
// We sometimes get multiple loadSession calls from stacked components all needing to just ensure
|
|
@@ -2614,7 +2603,7 @@ const getOrganizationChildren = (endpoint, organizationId) => endpoint.api //
|
|
|
2614
2603
|
* @apiSuccess TOrganizationUsage . Usage data grouped by organization ID
|
|
2615
2604
|
*/
|
|
2616
2605
|
const getOrganizationUsage = (endpoint, organizationId, params) => endpoint.api //
|
|
2617
|
-
.get(`/v2/organizations/${organizationId}/
|
|
2606
|
+
.get(`/v2/organizations/${organizationId}/usage`, { params })
|
|
2618
2607
|
.then((r) => r.data);
|
|
2619
2608
|
/**
|
|
2620
2609
|
* Create an organization. The caller will be assigned an "Owner" profile in the new organization,
|
|
@@ -3345,7 +3334,6 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
3345
3334
|
* @apiSuccess ITemplate . The requested template
|
|
3346
3335
|
*/
|
|
3347
3336
|
const getTemplate = (endpoint, templateId) => {
|
|
3348
|
-
window?.console?.log('[JS_SDK] Loading template', templateId);
|
|
3349
3337
|
return endpoint.api //
|
|
3350
3338
|
.get(`/v2/templates/${templateId}`)
|
|
3351
3339
|
.then((r) => {
|