@verdocs/js-sdk 4.2.79 → 4.2.81
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -5
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -49,6 +49,33 @@ const WEBHOOK_EVENTS = [
|
|
|
49
49
|
'template_deleted',
|
|
50
50
|
'template_used',
|
|
51
51
|
];
|
|
52
|
+
const ALL_PERMISSIONS = [
|
|
53
|
+
'template:creator:create:public',
|
|
54
|
+
'template:creator:create:org',
|
|
55
|
+
'template:creator:create:personal',
|
|
56
|
+
'template:creator:delete',
|
|
57
|
+
'template:creator:visibility',
|
|
58
|
+
'template:member:read',
|
|
59
|
+
'template:member:write',
|
|
60
|
+
'template:member:delete',
|
|
61
|
+
'template:member:visibility',
|
|
62
|
+
'owner:add',
|
|
63
|
+
'owner:remove',
|
|
64
|
+
'admin:add',
|
|
65
|
+
'admin:remove',
|
|
66
|
+
'member:view',
|
|
67
|
+
'member:add',
|
|
68
|
+
'member:remove',
|
|
69
|
+
'org:create',
|
|
70
|
+
'org:view',
|
|
71
|
+
'org:update',
|
|
72
|
+
'org:delete',
|
|
73
|
+
'org:transfer',
|
|
74
|
+
'org:list',
|
|
75
|
+
'envelope:create',
|
|
76
|
+
'envelope:cancel',
|
|
77
|
+
'envelope:view',
|
|
78
|
+
];
|
|
52
79
|
|
|
53
80
|
/**
|
|
54
81
|
* Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
|
|
@@ -1272,8 +1299,10 @@ class VerdocsEndpoint {
|
|
|
1272
1299
|
*/
|
|
1273
1300
|
setToken(token) {
|
|
1274
1301
|
if (!token) {
|
|
1302
|
+
window.console.log('[JS_SDK] Clearing token');
|
|
1275
1303
|
return this.clearSession();
|
|
1276
1304
|
}
|
|
1305
|
+
window.console.log('[JS_SDK] Setting token', token.length);
|
|
1277
1306
|
const session = decodeAccessTokenBody(token);
|
|
1278
1307
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
1279
1308
|
window.console.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
@@ -1308,7 +1337,7 @@ class VerdocsEndpoint {
|
|
|
1308
1337
|
this.profile = null;
|
|
1309
1338
|
this.sub = null;
|
|
1310
1339
|
window?.console?.warn('Unable to load profile', e);
|
|
1311
|
-
this.
|
|
1340
|
+
this.clearSession();
|
|
1312
1341
|
});
|
|
1313
1342
|
return this;
|
|
1314
1343
|
}
|
|
@@ -1373,9 +1402,10 @@ class VerdocsEndpoint {
|
|
|
1373
1402
|
this.nextListenerId++;
|
|
1374
1403
|
const listenerSymbol = Symbol.for('' + this.nextListenerId);
|
|
1375
1404
|
this.sessionListeners.set(listenerSymbol, listener);
|
|
1376
|
-
// Perform an immediate notification
|
|
1377
|
-
|
|
1378
|
-
|
|
1405
|
+
// Perform an immediate notification if this listener subscribed after the session was already loaded.
|
|
1406
|
+
if (this.profile) {
|
|
1407
|
+
listener(this, this.session, this.profile);
|
|
1408
|
+
}
|
|
1379
1409
|
return () => {
|
|
1380
1410
|
this.sessionListeners.delete(listenerSymbol);
|
|
1381
1411
|
};
|
|
@@ -1390,6 +1420,7 @@ class VerdocsEndpoint {
|
|
|
1390
1420
|
}
|
|
1391
1421
|
const token = localStorage.getItem(this.sessionStorageKey());
|
|
1392
1422
|
if (!token) {
|
|
1423
|
+
window?.console?.debug('[JS_SDK] No cached session found', this.endpointId);
|
|
1393
1424
|
return this.clearSession();
|
|
1394
1425
|
}
|
|
1395
1426
|
// We sometimes get multiple loadSession calls from stacked components all needing to just ensure
|
|
@@ -2888,5 +2919,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
|
|
|
2888
2919
|
const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
|
|
2889
2920
|
const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
|
|
2890
2921
|
|
|
2891
|
-
export { AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeReminder, getEnvelopes, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, sendDelegate, setWebhooks, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
|
|
2922
|
+
export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeReminder, getEnvelopes, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, sendDelegate, setWebhooks, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
|
|
2892
2923
|
//# sourceMappingURL=index.mjs.map
|