@verdocs/js-sdk 5.0.14 → 5.0.15
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 +50 -14
- package/dist/index.d.ts +50 -14
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -1
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -153,10 +153,10 @@ interface ISigningSession {
|
|
|
153
153
|
email: string;
|
|
154
154
|
iat: number;
|
|
155
155
|
exp: number;
|
|
156
|
-
"https://verdocs.com/session_type": "signing";
|
|
157
|
-
"https://verdocs.com/key_type": TAccessKeyType;
|
|
158
|
-
"https://verdocs.com/envelope_id": string;
|
|
159
|
-
"https://verdocs.com/role_name": string;
|
|
156
|
+
["https://verdocs.com/session_type"]: "signing";
|
|
157
|
+
["https://verdocs.com/key_type"]: TAccessKeyType;
|
|
158
|
+
["https://verdocs.com/envelope_id"]: string;
|
|
159
|
+
["https://verdocs.com/role_name"]: string;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform.
|
|
@@ -165,19 +165,19 @@ interface IUserSession {
|
|
|
165
165
|
jti: string;
|
|
166
166
|
aud: string;
|
|
167
167
|
iss: string;
|
|
168
|
-
sub: string; //
|
|
168
|
+
sub: string; // Verdocs user_id
|
|
169
169
|
email: string;
|
|
170
170
|
iat: number;
|
|
171
171
|
exp: number;
|
|
172
|
-
session_type: "user";
|
|
173
|
-
profile_id: string;
|
|
174
|
-
organization_id: string;
|
|
175
|
-
global_admin: boolean;
|
|
172
|
+
["https://verdocs.com/session_type"]: "user";
|
|
173
|
+
["https://verdocs.com/profile_id"]: string;
|
|
174
|
+
["https://verdocs.com/organization_id"]: string;
|
|
175
|
+
["https://verdocs.com/global_admin"]: boolean;
|
|
176
176
|
}
|
|
177
177
|
interface IIdToken {
|
|
178
178
|
aud: string;
|
|
179
179
|
iss: string;
|
|
180
|
-
sub: string; //
|
|
180
|
+
sub: string; // Verdocs user_id
|
|
181
181
|
email: string;
|
|
182
182
|
organization_id: string;
|
|
183
183
|
first_name: string;
|
|
@@ -267,6 +267,19 @@ interface IOAuth2App {
|
|
|
267
267
|
organization?: IOrganization;
|
|
268
268
|
profile?: IProfile;
|
|
269
269
|
}
|
|
270
|
+
interface IEntitlement {
|
|
271
|
+
id: string;
|
|
272
|
+
organization_id: string;
|
|
273
|
+
feature: TEntitlement;
|
|
274
|
+
contract_id?: string | null;
|
|
275
|
+
notes?: string | null;
|
|
276
|
+
starts_at: string;
|
|
277
|
+
ends_at: string;
|
|
278
|
+
monthly_max: number;
|
|
279
|
+
yearly_max: number;
|
|
280
|
+
created_at: string;
|
|
281
|
+
organization?: IOrganization;
|
|
282
|
+
}
|
|
270
283
|
interface IOrganization {
|
|
271
284
|
/** The unique ID of the organization */
|
|
272
285
|
id: string;
|
|
@@ -284,9 +297,6 @@ interface IOrganization {
|
|
|
284
297
|
thumbnail_url?: string | null;
|
|
285
298
|
primary_color?: string | null;
|
|
286
299
|
secondary_color?: string | null;
|
|
287
|
-
entitlements?: Record<string, any> | null;
|
|
288
|
-
mtd_usage?: Record<string, any> | null;
|
|
289
|
-
ytd_usage?: Record<string, any> | null;
|
|
290
300
|
data?: Record<string, any> | null;
|
|
291
301
|
/** Creation date/time. */
|
|
292
302
|
created_at: string;
|
|
@@ -295,6 +305,7 @@ interface IOrganization {
|
|
|
295
305
|
api_keys?: IApiKey[];
|
|
296
306
|
groups?: IGroup[];
|
|
297
307
|
oauth2_apps?: IOAuth2App[];
|
|
308
|
+
entitlements?: IEntitlement[];
|
|
298
309
|
organization_invitations?: IOrganizationInvitation[];
|
|
299
310
|
profiles?: IProfile[];
|
|
300
311
|
webhooks?: IWebhook[];
|
|
@@ -949,6 +960,7 @@ type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "
|
|
|
949
960
|
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
950
961
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
951
962
|
type TKBAMethod = "pin" | "kba" | "id" | "sms" | "" | null;
|
|
963
|
+
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
|
|
952
964
|
declare const FIELD_TYPES: TFieldType[];
|
|
953
965
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
954
966
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2656,6 +2668,30 @@ declare const updateOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId
|
|
|
2656
2668
|
* ```
|
|
2657
2669
|
*/
|
|
2658
2670
|
declare const updateOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IOrganization>;
|
|
2671
|
+
declare const getEntitlements: (endpoint: VerdocsEndpoint) => Promise<IEntitlement[]>;
|
|
2672
|
+
/**
|
|
2673
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2674
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2675
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2676
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2677
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2678
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2679
|
+
*
|
|
2680
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2681
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2682
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2683
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2684
|
+
* limits, etc.
|
|
2685
|
+
*
|
|
2686
|
+
* ```typescript
|
|
2687
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2688
|
+
*
|
|
2689
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2690
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2691
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2692
|
+
* ```
|
|
2693
|
+
*/
|
|
2694
|
+
declare const getActiveEntitlements: (endpoint: VerdocsEndpoint) => Promise<Partial<Record<TEntitlement, IEntitlement>>>;
|
|
2659
2695
|
/**
|
|
2660
2696
|
* Get the registered Webhook configuration for the caller's organization.
|
|
2661
2697
|
*
|
|
@@ -3397,4 +3433,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3397
3433
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3398
3434
|
*/
|
|
3399
3435
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3400
|
-
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
|
3436
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, TEntitlement, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
package/dist/index.d.ts
CHANGED
|
@@ -153,10 +153,10 @@ interface ISigningSession {
|
|
|
153
153
|
email: string;
|
|
154
154
|
iat: number;
|
|
155
155
|
exp: number;
|
|
156
|
-
"https://verdocs.com/session_type": "signing";
|
|
157
|
-
"https://verdocs.com/key_type": TAccessKeyType;
|
|
158
|
-
"https://verdocs.com/envelope_id": string;
|
|
159
|
-
"https://verdocs.com/role_name": string;
|
|
156
|
+
["https://verdocs.com/session_type"]: "signing";
|
|
157
|
+
["https://verdocs.com/key_type"]: TAccessKeyType;
|
|
158
|
+
["https://verdocs.com/envelope_id"]: string;
|
|
159
|
+
["https://verdocs.com/role_name"]: string;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform.
|
|
@@ -165,19 +165,19 @@ interface IUserSession {
|
|
|
165
165
|
jti: string;
|
|
166
166
|
aud: string;
|
|
167
167
|
iss: string;
|
|
168
|
-
sub: string; //
|
|
168
|
+
sub: string; // Verdocs user_id
|
|
169
169
|
email: string;
|
|
170
170
|
iat: number;
|
|
171
171
|
exp: number;
|
|
172
|
-
session_type: "user";
|
|
173
|
-
profile_id: string;
|
|
174
|
-
organization_id: string;
|
|
175
|
-
global_admin: boolean;
|
|
172
|
+
["https://verdocs.com/session_type"]: "user";
|
|
173
|
+
["https://verdocs.com/profile_id"]: string;
|
|
174
|
+
["https://verdocs.com/organization_id"]: string;
|
|
175
|
+
["https://verdocs.com/global_admin"]: boolean;
|
|
176
176
|
}
|
|
177
177
|
interface IIdToken {
|
|
178
178
|
aud: string;
|
|
179
179
|
iss: string;
|
|
180
|
-
sub: string; //
|
|
180
|
+
sub: string; // Verdocs user_id
|
|
181
181
|
email: string;
|
|
182
182
|
organization_id: string;
|
|
183
183
|
first_name: string;
|
|
@@ -267,6 +267,19 @@ interface IOAuth2App {
|
|
|
267
267
|
organization?: IOrganization;
|
|
268
268
|
profile?: IProfile;
|
|
269
269
|
}
|
|
270
|
+
interface IEntitlement {
|
|
271
|
+
id: string;
|
|
272
|
+
organization_id: string;
|
|
273
|
+
feature: TEntitlement;
|
|
274
|
+
contract_id?: string | null;
|
|
275
|
+
notes?: string | null;
|
|
276
|
+
starts_at: string;
|
|
277
|
+
ends_at: string;
|
|
278
|
+
monthly_max: number;
|
|
279
|
+
yearly_max: number;
|
|
280
|
+
created_at: string;
|
|
281
|
+
organization?: IOrganization;
|
|
282
|
+
}
|
|
270
283
|
interface IOrganization {
|
|
271
284
|
/** The unique ID of the organization */
|
|
272
285
|
id: string;
|
|
@@ -284,9 +297,6 @@ interface IOrganization {
|
|
|
284
297
|
thumbnail_url?: string | null;
|
|
285
298
|
primary_color?: string | null;
|
|
286
299
|
secondary_color?: string | null;
|
|
287
|
-
entitlements?: Record<string, any> | null;
|
|
288
|
-
mtd_usage?: Record<string, any> | null;
|
|
289
|
-
ytd_usage?: Record<string, any> | null;
|
|
290
300
|
data?: Record<string, any> | null;
|
|
291
301
|
/** Creation date/time. */
|
|
292
302
|
created_at: string;
|
|
@@ -295,6 +305,7 @@ interface IOrganization {
|
|
|
295
305
|
api_keys?: IApiKey[];
|
|
296
306
|
groups?: IGroup[];
|
|
297
307
|
oauth2_apps?: IOAuth2App[];
|
|
308
|
+
entitlements?: IEntitlement[];
|
|
298
309
|
organization_invitations?: IOrganizationInvitation[];
|
|
299
310
|
profiles?: IProfile[];
|
|
300
311
|
webhooks?: IWebhook[];
|
|
@@ -949,6 +960,7 @@ type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "
|
|
|
949
960
|
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
950
961
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
951
962
|
type TKBAMethod = "pin" | "kba" | "id" | "sms" | "" | null;
|
|
963
|
+
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
|
|
952
964
|
declare const FIELD_TYPES: TFieldType[];
|
|
953
965
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
954
966
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2656,6 +2668,30 @@ declare const updateOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId
|
|
|
2656
2668
|
* ```
|
|
2657
2669
|
*/
|
|
2658
2670
|
declare const updateOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IOrganization>;
|
|
2671
|
+
declare const getEntitlements: (endpoint: VerdocsEndpoint) => Promise<IEntitlement[]>;
|
|
2672
|
+
/**
|
|
2673
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2674
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2675
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2676
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2677
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2678
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2679
|
+
*
|
|
2680
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2681
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2682
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2683
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2684
|
+
* limits, etc.
|
|
2685
|
+
*
|
|
2686
|
+
* ```typescript
|
|
2687
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2688
|
+
*
|
|
2689
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2690
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2691
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2692
|
+
* ```
|
|
2693
|
+
*/
|
|
2694
|
+
declare const getActiveEntitlements: (endpoint: VerdocsEndpoint) => Promise<Partial<Record<TEntitlement, IEntitlement>>>;
|
|
2659
2695
|
/**
|
|
2660
2696
|
* Get the registered Webhook configuration for the caller's organization.
|
|
2661
2697
|
*
|
|
@@ -3397,4 +3433,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3397
3433
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3398
3434
|
*/
|
|
3399
3435
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3400
|
-
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
|
3436
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, TEntitlement, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
package/dist/index.js
CHANGED
|
@@ -2656,6 +2656,45 @@ const updateOrganizationThumbnail = (endpoint, organizationId, file, onUploadPro
|
|
|
2656
2656
|
})
|
|
2657
2657
|
.then((r) => r.data);
|
|
2658
2658
|
};
|
|
2659
|
+
const getEntitlements = async (endpoint) => endpoint.api.get(`/v2/organizations/entitlements`).then((r) => r.data);
|
|
2660
|
+
/**
|
|
2661
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2662
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2663
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2664
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2665
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2666
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2667
|
+
*
|
|
2668
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2669
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2670
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2671
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2672
|
+
* limits, etc.
|
|
2673
|
+
*
|
|
2674
|
+
* ```typescript
|
|
2675
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2676
|
+
*
|
|
2677
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2678
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2679
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2680
|
+
* ```
|
|
2681
|
+
*/
|
|
2682
|
+
const getActiveEntitlements = async (endpoint) => {
|
|
2683
|
+
if (!endpoint.session) {
|
|
2684
|
+
throw new Error('No active session');
|
|
2685
|
+
}
|
|
2686
|
+
const now = new Date();
|
|
2687
|
+
const allEntitlements = await getEntitlements(endpoint);
|
|
2688
|
+
const activeEntitlements = {};
|
|
2689
|
+
allEntitlements.forEach((entitlement) => {
|
|
2690
|
+
const start = new Date(entitlement.starts_at);
|
|
2691
|
+
const end = new Date(entitlement.ends_at);
|
|
2692
|
+
if (now >= start && now <= end && !activeEntitlements[entitlement.feature]) {
|
|
2693
|
+
activeEntitlements[entitlement.feature] = entitlement;
|
|
2694
|
+
}
|
|
2695
|
+
});
|
|
2696
|
+
return activeEntitlements;
|
|
2697
|
+
};
|
|
2659
2698
|
|
|
2660
2699
|
/**
|
|
2661
2700
|
* Webhooks are callback triggers from Verdocs to your servers that notify your applications
|
|
@@ -3604,12 +3643,14 @@ exports.formatFullName = formatFullName;
|
|
|
3604
3643
|
exports.formatInitials = formatInitials;
|
|
3605
3644
|
exports.formatShortTimeAgo = formatShortTimeAgo;
|
|
3606
3645
|
exports.fullNameToInitials = fullNameToInitials;
|
|
3646
|
+
exports.getActiveEntitlements = getActiveEntitlements;
|
|
3607
3647
|
exports.getAllTags = getAllTags;
|
|
3608
3648
|
exports.getApiKeys = getApiKeys;
|
|
3609
3649
|
exports.getCountryByCode = getCountryByCode;
|
|
3610
3650
|
exports.getCurrentProfile = getCurrentProfile;
|
|
3611
3651
|
exports.getDocumentDownloadLink = getDocumentDownloadLink;
|
|
3612
3652
|
exports.getDocumentPreviewLink = getDocumentPreviewLink;
|
|
3653
|
+
exports.getEntitlements = getEntitlements;
|
|
3613
3654
|
exports.getEnvelope = getEnvelope;
|
|
3614
3655
|
exports.getEnvelopeDocument = getEnvelopeDocument;
|
|
3615
3656
|
exports.getEnvelopeDocumentPageDisplayUri = getEnvelopeDocumentPageDisplayUri;
|