@verdocs/js-sdk 5.0.14 → 5.0.16
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 +60 -38
- package/dist/index.d.ts +60 -38
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -1
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +7 -7
- package/package.json +7 -7
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[];
|
|
@@ -678,28 +689,18 @@ interface IRecipient {
|
|
|
678
689
|
created_at: string;
|
|
679
690
|
updated_at: string;
|
|
680
691
|
last_attempt_at?: string;
|
|
692
|
+
/** The type of authentication required for this recipient. */
|
|
693
|
+
auth_method?: TRecipientAuthMethod;
|
|
681
694
|
/**
|
|
682
|
-
* If set
|
|
683
|
-
* created from this template. For privacy reasons, this field will only be visible to the creator
|
|
684
|
-
* of the envelope and the recipient referenced.
|
|
685
|
-
*/
|
|
686
|
-
kba_method?: TKBAMethod;
|
|
687
|
-
/**
|
|
688
|
-
* If KBA is set to "PIN" this will be set to the PIN code required. For security reasons, this
|
|
695
|
+
* If auth_method is set to "passcode" this is the passcode required. For security reasons, this
|
|
689
696
|
* field will only be visible to the creator of the envelope.
|
|
690
697
|
*/
|
|
691
|
-
|
|
698
|
+
passcode?: string | null;
|
|
692
699
|
/**
|
|
693
|
-
* If
|
|
694
|
-
*
|
|
700
|
+
* If authentication has been completed successfully, this will be set to 'complete'. This is a union type
|
|
701
|
+
* to allow for future expansion with authentication modules that may require multiple steps.
|
|
695
702
|
*/
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* If KBA has been completed (or partially successfully, this will contain metadata related to
|
|
699
|
-
* the questions and answers from the process. For privacy reasons, this field will only be visible
|
|
700
|
-
* to the recipient referenced.
|
|
701
|
-
*/
|
|
702
|
-
kba_details?: Record<string, any>;
|
|
703
|
+
auth_step?: TRecipientAuthStep | null;
|
|
703
704
|
envelope?: IEnvelope;
|
|
704
705
|
profile?: IProfile;
|
|
705
706
|
}
|
|
@@ -735,12 +736,6 @@ interface IRole {
|
|
|
735
736
|
*/
|
|
736
737
|
order: number;
|
|
737
738
|
delegator: boolean | null;
|
|
738
|
-
/**
|
|
739
|
-
* If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
|
|
740
|
-
* created from this template. Note that KBA details may not be specified here. They must be unique to
|
|
741
|
-
* each individual recipient and therefore cannot be set as defaults in the template.
|
|
742
|
-
*/
|
|
743
|
-
kba_method: TKBAMethod;
|
|
744
739
|
}
|
|
745
740
|
interface ISignature {
|
|
746
741
|
id: string;
|
|
@@ -948,7 +943,9 @@ type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certi
|
|
|
948
943
|
type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
|
|
949
944
|
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
950
945
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
951
|
-
type
|
|
946
|
+
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
|
|
947
|
+
type TRecipientAuthMethod = "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth" | null;
|
|
948
|
+
type TRecipientAuthStep = "complete" | null;
|
|
952
949
|
declare const FIELD_TYPES: TFieldType[];
|
|
953
950
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
954
951
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2656,6 +2653,30 @@ declare const updateOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId
|
|
|
2656
2653
|
* ```
|
|
2657
2654
|
*/
|
|
2658
2655
|
declare const updateOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IOrganization>;
|
|
2656
|
+
declare const getEntitlements: (endpoint: VerdocsEndpoint) => Promise<IEntitlement[]>;
|
|
2657
|
+
/**
|
|
2658
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2659
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2660
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2661
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2662
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2663
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2664
|
+
*
|
|
2665
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2666
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2667
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2668
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2669
|
+
* limits, etc.
|
|
2670
|
+
*
|
|
2671
|
+
* ```typescript
|
|
2672
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2673
|
+
*
|
|
2674
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2675
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2676
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2677
|
+
* ```
|
|
2678
|
+
*/
|
|
2679
|
+
declare const getActiveEntitlements: (endpoint: VerdocsEndpoint) => Promise<Partial<Record<TEntitlement, IEntitlement>>>;
|
|
2659
2680
|
/**
|
|
2660
2681
|
* Get the registered Webhook configuration for the caller's organization.
|
|
2661
2682
|
*
|
|
@@ -3302,6 +3323,7 @@ declare function nameToRGBA(str: string): string | undefined;
|
|
|
3302
3323
|
*/
|
|
3303
3324
|
declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
|
|
3304
3325
|
declare const formatShortTimeAgo: (val: any) => string;
|
|
3326
|
+
declare const collapseEntitlements: (entitlements: IEntitlement[]) => Partial<Record<TEntitlement, IEntitlement>>;
|
|
3305
3327
|
declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
3306
3328
|
declare function getRLeft(x: number, ratio: number): number;
|
|
3307
3329
|
declare function getRValue(y: number, ratio: number): number;
|
|
@@ -3397,4 +3419,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3397
3419
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3398
3420
|
*/
|
|
3399
3421
|
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,
|
|
3422
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, 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, collapseEntitlements, 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[];
|
|
@@ -678,28 +689,18 @@ interface IRecipient {
|
|
|
678
689
|
created_at: string;
|
|
679
690
|
updated_at: string;
|
|
680
691
|
last_attempt_at?: string;
|
|
692
|
+
/** The type of authentication required for this recipient. */
|
|
693
|
+
auth_method?: TRecipientAuthMethod;
|
|
681
694
|
/**
|
|
682
|
-
* If set
|
|
683
|
-
* created from this template. For privacy reasons, this field will only be visible to the creator
|
|
684
|
-
* of the envelope and the recipient referenced.
|
|
685
|
-
*/
|
|
686
|
-
kba_method?: TKBAMethod;
|
|
687
|
-
/**
|
|
688
|
-
* If KBA is set to "PIN" this will be set to the PIN code required. For security reasons, this
|
|
695
|
+
* If auth_method is set to "passcode" this is the passcode required. For security reasons, this
|
|
689
696
|
* field will only be visible to the creator of the envelope.
|
|
690
697
|
*/
|
|
691
|
-
|
|
698
|
+
passcode?: string | null;
|
|
692
699
|
/**
|
|
693
|
-
* If
|
|
694
|
-
*
|
|
700
|
+
* If authentication has been completed successfully, this will be set to 'complete'. This is a union type
|
|
701
|
+
* to allow for future expansion with authentication modules that may require multiple steps.
|
|
695
702
|
*/
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* If KBA has been completed (or partially successfully, this will contain metadata related to
|
|
699
|
-
* the questions and answers from the process. For privacy reasons, this field will only be visible
|
|
700
|
-
* to the recipient referenced.
|
|
701
|
-
*/
|
|
702
|
-
kba_details?: Record<string, any>;
|
|
703
|
+
auth_step?: TRecipientAuthStep | null;
|
|
703
704
|
envelope?: IEnvelope;
|
|
704
705
|
profile?: IProfile;
|
|
705
706
|
}
|
|
@@ -735,12 +736,6 @@ interface IRole {
|
|
|
735
736
|
*/
|
|
736
737
|
order: number;
|
|
737
738
|
delegator: boolean | null;
|
|
738
|
-
/**
|
|
739
|
-
* If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
|
|
740
|
-
* created from this template. Note that KBA details may not be specified here. They must be unique to
|
|
741
|
-
* each individual recipient and therefore cannot be set as defaults in the template.
|
|
742
|
-
*/
|
|
743
|
-
kba_method: TKBAMethod;
|
|
744
739
|
}
|
|
745
740
|
interface ISignature {
|
|
746
741
|
id: string;
|
|
@@ -948,7 +943,9 @@ type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certi
|
|
|
948
943
|
type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
|
|
949
944
|
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
950
945
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
951
|
-
type
|
|
946
|
+
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
|
|
947
|
+
type TRecipientAuthMethod = "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth" | null;
|
|
948
|
+
type TRecipientAuthStep = "complete" | null;
|
|
952
949
|
declare const FIELD_TYPES: TFieldType[];
|
|
953
950
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
954
951
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2656,6 +2653,30 @@ declare const updateOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId
|
|
|
2656
2653
|
* ```
|
|
2657
2654
|
*/
|
|
2658
2655
|
declare const updateOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IOrganization>;
|
|
2656
|
+
declare const getEntitlements: (endpoint: VerdocsEndpoint) => Promise<IEntitlement[]>;
|
|
2657
|
+
/**
|
|
2658
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2659
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2660
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2661
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2662
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2663
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2664
|
+
*
|
|
2665
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2666
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2667
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2668
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2669
|
+
* limits, etc.
|
|
2670
|
+
*
|
|
2671
|
+
* ```typescript
|
|
2672
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2673
|
+
*
|
|
2674
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2675
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2676
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2677
|
+
* ```
|
|
2678
|
+
*/
|
|
2679
|
+
declare const getActiveEntitlements: (endpoint: VerdocsEndpoint) => Promise<Partial<Record<TEntitlement, IEntitlement>>>;
|
|
2659
2680
|
/**
|
|
2660
2681
|
* Get the registered Webhook configuration for the caller's organization.
|
|
2661
2682
|
*
|
|
@@ -3302,6 +3323,7 @@ declare function nameToRGBA(str: string): string | undefined;
|
|
|
3302
3323
|
*/
|
|
3303
3324
|
declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
|
|
3304
3325
|
declare const formatShortTimeAgo: (val: any) => string;
|
|
3326
|
+
declare const collapseEntitlements: (entitlements: IEntitlement[]) => Partial<Record<TEntitlement, IEntitlement>>;
|
|
3305
3327
|
declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
3306
3328
|
declare function getRLeft(x: number, ratio: number): number;
|
|
3307
3329
|
declare function getRValue(y: number, ratio: number): number;
|
|
@@ -3397,4 +3419,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3397
3419
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3398
3420
|
*/
|
|
3399
3421
|
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,
|
|
3422
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, 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, collapseEntitlements, 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
|
@@ -232,6 +232,19 @@ const formatShortTimeAgo = (val) => {
|
|
|
232
232
|
return `${timeDiff}S`;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
+
const collapseEntitlements = (entitlements) => {
|
|
236
|
+
const now = new Date();
|
|
237
|
+
const activeEntitlements = {};
|
|
238
|
+
entitlements.forEach((entitlement) => {
|
|
239
|
+
const start = new Date(entitlement.starts_at);
|
|
240
|
+
const end = new Date(entitlement.ends_at);
|
|
241
|
+
if (now >= start && now <= end && !activeEntitlements[entitlement.feature]) {
|
|
242
|
+
activeEntitlements[entitlement.feature] = entitlement;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return activeEntitlements;
|
|
246
|
+
};
|
|
247
|
+
|
|
235
248
|
function getRTop(y, fieldHeight, iTextHeight, yRatio) {
|
|
236
249
|
return iTextHeight - (y + fieldHeight) * yRatio;
|
|
237
250
|
}
|
|
@@ -2656,6 +2669,36 @@ const updateOrganizationThumbnail = (endpoint, organizationId, file, onUploadPro
|
|
|
2656
2669
|
})
|
|
2657
2670
|
.then((r) => r.data);
|
|
2658
2671
|
};
|
|
2672
|
+
const getEntitlements = async (endpoint) => endpoint.api.get(`/v2/organizations/entitlements`).then((r) => r.data);
|
|
2673
|
+
/**
|
|
2674
|
+
* Largely intended to be used internally by Web SDK components but may be informative for other cases.
|
|
2675
|
+
* Entitlements are feature grants such as "ID-based KBA" that require paid contracts to enable, typically
|
|
2676
|
+
* because the underlying services that support them are fee-based. Entitlements may run concurrently,
|
|
2677
|
+
* and may have different start/end dates e.g. "ID-based KBA" may run 1/1/2026-12/31/2026 while
|
|
2678
|
+
* "SMS Authentication" may be added later and run 6/1/2026-5/31/2027. The entitlements list is a simple
|
|
2679
|
+
* array of enablements and may include entries that are not YET enabled or have now expired.
|
|
2680
|
+
*
|
|
2681
|
+
* In client code it is helpful to simply know "is XYZ feature currently enabled?" This function collapses
|
|
2682
|
+
* the entitlements list to a simplified dictionary of current/active entitlements. Note that it is async
|
|
2683
|
+
* because it calls the server to obtain the "most current" entitlements list. Existence of an entry in the
|
|
2684
|
+
* resulting dictionary implies the feature is active. Metadata inside each entry can be used to determine
|
|
2685
|
+
* limits, etc.
|
|
2686
|
+
*
|
|
2687
|
+
* ```typescript
|
|
2688
|
+
* import {getActiveEntitlements} from '@verdocs/js-sdk';
|
|
2689
|
+
*
|
|
2690
|
+
* const activeEntitlements = await getActiveEntitlements((VerdocsEndpoint.getDefault());
|
|
2691
|
+
* const isSMSEnabled = !!activeEntitlements.sms_auth;
|
|
2692
|
+
* const monthlyKBALimit = activeEntitlements.kba_auth?.monthly_max;
|
|
2693
|
+
* ```
|
|
2694
|
+
*/
|
|
2695
|
+
const getActiveEntitlements = async (endpoint) => {
|
|
2696
|
+
if (!endpoint.session) {
|
|
2697
|
+
throw new Error('No active session');
|
|
2698
|
+
}
|
|
2699
|
+
const entitlements = await getEntitlements(endpoint);
|
|
2700
|
+
return collapseEntitlements(entitlements);
|
|
2701
|
+
};
|
|
2659
2702
|
|
|
2660
2703
|
/**
|
|
2661
2704
|
* Webhooks are callback triggers from Verdocs to your servers that notify your applications
|
|
@@ -3555,6 +3598,7 @@ exports.canPerformTemplateAction = canPerformTemplateAction;
|
|
|
3555
3598
|
exports.cancelEnvelope = cancelEnvelope;
|
|
3556
3599
|
exports.capitalize = capitalize;
|
|
3557
3600
|
exports.changePassword = changePassword;
|
|
3601
|
+
exports.collapseEntitlements = collapseEntitlements;
|
|
3558
3602
|
exports.convertToE164 = convertToE164;
|
|
3559
3603
|
exports.createApiKey = createApiKey;
|
|
3560
3604
|
exports.createEnvelope = createEnvelope;
|
|
@@ -3604,12 +3648,14 @@ exports.formatFullName = formatFullName;
|
|
|
3604
3648
|
exports.formatInitials = formatInitials;
|
|
3605
3649
|
exports.formatShortTimeAgo = formatShortTimeAgo;
|
|
3606
3650
|
exports.fullNameToInitials = fullNameToInitials;
|
|
3651
|
+
exports.getActiveEntitlements = getActiveEntitlements;
|
|
3607
3652
|
exports.getAllTags = getAllTags;
|
|
3608
3653
|
exports.getApiKeys = getApiKeys;
|
|
3609
3654
|
exports.getCountryByCode = getCountryByCode;
|
|
3610
3655
|
exports.getCurrentProfile = getCurrentProfile;
|
|
3611
3656
|
exports.getDocumentDownloadLink = getDocumentDownloadLink;
|
|
3612
3657
|
exports.getDocumentPreviewLink = getDocumentPreviewLink;
|
|
3658
|
+
exports.getEntitlements = getEntitlements;
|
|
3613
3659
|
exports.getEnvelope = getEnvelope;
|
|
3614
3660
|
exports.getEnvelopeDocument = getEnvelopeDocument;
|
|
3615
3661
|
exports.getEnvelopeDocumentPageDisplayUri = getEnvelopeDocumentPageDisplayUri;
|