@verdocs/js-sdk 6.7.7 → 6.8.2

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 CHANGED
@@ -409,19 +409,32 @@ interface IProfile {
409
409
  }
410
410
  interface IUser {
411
411
  id: string;
412
+ /** Email address. */
412
413
  email: string;
414
+ /** If true, the email has been verified in some way (e.g. OTP verification or trusted third party. */
413
415
  email_verified: boolean;
416
+ /** Password hash, present only for type consistency. Marked optional, but will never be returned by the backend. */
414
417
  pass_hash?: string;
415
418
  first_name: string | null;
416
419
  last_name: string | null;
417
420
  phone: string | null;
418
421
  picture: string | null;
422
+ /** If set, the Azure B2C ID for the user. Generally set only for Teams/PowerAutomate users. */
419
423
  b2cId: string | null;
424
+ /** If set, the Google account ID for the user. Set only for users logging in via Google. */
420
425
  googleId: string | null;
426
+ /** If set, the Apple account ID for the user. Set only for users logging in via Apple. */
421
427
  appleId: string | null;
428
+ /** If set, the Github account ID for the user. Set only for users logging in via Github. */
422
429
  githubId?: string | null;
423
430
  created_at: string;
424
431
  updated_at: string;
432
+ /** True if the account is locked, typically due to failed sign-in attempts. Only visible to admins or owners. */
433
+ locked?: boolean;
434
+ /** Reason the account is locked. Only visible to admins or owners. */
435
+ lock_reason?: string | null;
436
+ /** Consecutive failed sign-in attempts. Only visible to admins or owners. */
437
+ login_failures?: number;
425
438
  }
426
439
  type IWebhookEvents = Record<TWebhookEvent, boolean>;
427
440
  interface IWebhook {
@@ -609,6 +622,7 @@ interface IEnvelopeField {
609
622
  required: boolean | null;
610
623
  /** If true, the field will be not be editable by the participant(s). NOTE: Fields may not be both required and readonly. */
611
624
  readonly: boolean | null;
625
+ // TODO: In the future, let's decide on the fate of the `settings` object
612
626
  /** @deprecated. Use top-level fields instead. */
613
627
  settings: IEnvelopeFieldSettings | null;
614
628
  validator: string | null;
@@ -680,6 +694,8 @@ interface IEnvelopeFieldSettings {
680
694
  /** Checkbox settings */
681
695
  minimum_checked?: number;
682
696
  maximum_checked?: number;
697
+ canvasHeight?: number;
698
+ canvasWidth?: number;
683
699
  }
684
700
  interface IEnvelopeHistory {
685
701
  id: string;
@@ -1014,7 +1030,7 @@ type TTemplateSender = "envelope_creator" | "template_owner";
1014
1030
  type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
1015
1031
  type TRecipientAction = "submit" | "decline" | "prepare" | "update";
1016
1032
  type TEnvelopeStatus = "complete" | "pending" | "in progress" | "declined" | "canceled";
1017
- type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined";
1033
+ type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined" | "failed";
1018
1034
  type TRecipientType = "signer" | "cc" | "approver";
1019
1035
  /**
1020
1036
  * Plans provide access to Verdocs product features.
@@ -2289,6 +2305,14 @@ declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IR
2289
2305
  * Returns true if the user can act.
2290
2306
  */
2291
2307
  declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
2308
+ /**
2309
+ * Get a recipient from an envelope via an email match.
2310
+ */
2311
+ declare const getRecipient: (email: string, envelope: IEnvelope) => IRecipient | undefined;
2312
+ /**
2313
+ * Get a recipient that can act from an envelope via an email match.
2314
+ */
2315
+ declare const getRecipientWithActions: (email: string, envelope: IEnvelope) => boolean | undefined;
2292
2316
  /**
2293
2317
  * Returns true if the user can act.
2294
2318
  */
@@ -3029,6 +3053,43 @@ declare const deleteOrganizationMember: (endpoint: VerdocsEndpoint, profileId: s
3029
3053
  * @apiSuccess IProfile . The updated profile for the member.
3030
3054
  */
3031
3055
  declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Partial<Pick<IProfile, "roles" | "first_name" | "last_name">>) => Promise<IProfile>;
3056
+ /**
3057
+ * Lock an organization member's account. The member will be unable to sign in until an admin
3058
+ * unlocks them or they complete the password-reset flow. Caller must be an admin or owner,
3059
+ * may not lock him/herself, and the target must have a linked user account.
3060
+ *
3061
+ * ```typescript
3062
+ * import {lockOrganizationMember} from '@verdocs/js-sdk';
3063
+ *
3064
+ * const result = await lockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID', 'Departed employee');
3065
+ * ```
3066
+ *
3067
+ * @group Organization Members
3068
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3069
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3070
+ * @apiBody string(enum:'lock') action Action to perform
3071
+ * @apiBody string reason Reason the account is being locked. Stored on the user record and shown to admins.
3072
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3073
+ */
3074
+ declare const lockOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, reason: string) => Promise<IProfile>;
3075
+ /**
3076
+ * Unlock a member whose account has been locked (typically after too many failed sign-in attempts
3077
+ * or via an earlier admin lock). Caller must be an admin or owner, may not unlock him/herself, and
3078
+ * the target must have a linked user account. Clears `locked`, `lock_reason`, and `login_failures`.
3079
+ *
3080
+ * ```typescript
3081
+ * import {unlockOrganizationMember} from '@verdocs/js-sdk';
3082
+ *
3083
+ * const result = await unlockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID');
3084
+ * ```
3085
+ *
3086
+ * @group Organization Members
3087
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3088
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3089
+ * @apiBody string(enum:'unlock') action Action to perform
3090
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3091
+ */
3092
+ declare const unlockOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IProfile>;
3032
3093
  /**
3033
3094
  * Get all notification templates for the caller's organization.
3034
3095
  *
@@ -4049,4 +4110,4 @@ declare const decodeJWTBody: (token: string) => any;
4049
4110
  * the presence of the `document_id` field, which will only be present for signing sessions.
4050
4111
  */
4051
4112
  declare const decodeAccessTokenBody: (token: string) => TSession;
4052
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, WEBHOOK_EVENTS, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, TWebhookAuthMethod, TNotificationType, TEventName, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, INotificationTemplate, 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, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, getNotificationTemplates, getNotificationTemplate, createNotificationTemplate, updateNotificationTemplate, deleteNotificationTemplate, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, ICreateNotificationTemplateRequest, IUpdateNotificationTemplateRequest, getWebhooks, setWebhooks, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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 };
4113
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, WEBHOOK_EVENTS, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, TWebhookAuthMethod, TNotificationType, TEventName, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, INotificationTemplate, 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, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, getRecipient, getRecipientWithActions, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, lockOrganizationMember, unlockOrganizationMember, getNotificationTemplates, getNotificationTemplate, createNotificationTemplate, updateNotificationTemplate, deleteNotificationTemplate, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, ICreateNotificationTemplateRequest, IUpdateNotificationTemplateRequest, getWebhooks, setWebhooks, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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
@@ -409,19 +409,32 @@ interface IProfile {
409
409
  }
410
410
  interface IUser {
411
411
  id: string;
412
+ /** Email address. */
412
413
  email: string;
414
+ /** If true, the email has been verified in some way (e.g. OTP verification or trusted third party. */
413
415
  email_verified: boolean;
416
+ /** Password hash, present only for type consistency. Marked optional, but will never be returned by the backend. */
414
417
  pass_hash?: string;
415
418
  first_name: string | null;
416
419
  last_name: string | null;
417
420
  phone: string | null;
418
421
  picture: string | null;
422
+ /** If set, the Azure B2C ID for the user. Generally set only for Teams/PowerAutomate users. */
419
423
  b2cId: string | null;
424
+ /** If set, the Google account ID for the user. Set only for users logging in via Google. */
420
425
  googleId: string | null;
426
+ /** If set, the Apple account ID for the user. Set only for users logging in via Apple. */
421
427
  appleId: string | null;
428
+ /** If set, the Github account ID for the user. Set only for users logging in via Github. */
422
429
  githubId?: string | null;
423
430
  created_at: string;
424
431
  updated_at: string;
432
+ /** True if the account is locked, typically due to failed sign-in attempts. Only visible to admins or owners. */
433
+ locked?: boolean;
434
+ /** Reason the account is locked. Only visible to admins or owners. */
435
+ lock_reason?: string | null;
436
+ /** Consecutive failed sign-in attempts. Only visible to admins or owners. */
437
+ login_failures?: number;
425
438
  }
426
439
  type IWebhookEvents = Record<TWebhookEvent, boolean>;
427
440
  interface IWebhook {
@@ -609,6 +622,7 @@ interface IEnvelopeField {
609
622
  required: boolean | null;
610
623
  /** If true, the field will be not be editable by the participant(s). NOTE: Fields may not be both required and readonly. */
611
624
  readonly: boolean | null;
625
+ // TODO: In the future, let's decide on the fate of the `settings` object
612
626
  /** @deprecated. Use top-level fields instead. */
613
627
  settings: IEnvelopeFieldSettings | null;
614
628
  validator: string | null;
@@ -680,6 +694,8 @@ interface IEnvelopeFieldSettings {
680
694
  /** Checkbox settings */
681
695
  minimum_checked?: number;
682
696
  maximum_checked?: number;
697
+ canvasHeight?: number;
698
+ canvasWidth?: number;
683
699
  }
684
700
  interface IEnvelopeHistory {
685
701
  id: string;
@@ -1014,7 +1030,7 @@ type TTemplateSender = "envelope_creator" | "template_owner";
1014
1030
  type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
1015
1031
  type TRecipientAction = "submit" | "decline" | "prepare" | "update";
1016
1032
  type TEnvelopeStatus = "complete" | "pending" | "in progress" | "declined" | "canceled";
1017
- type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined";
1033
+ type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined" | "failed";
1018
1034
  type TRecipientType = "signer" | "cc" | "approver";
1019
1035
  /**
1020
1036
  * Plans provide access to Verdocs product features.
@@ -2289,6 +2305,14 @@ declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IR
2289
2305
  * Returns true if the user can act.
2290
2306
  */
2291
2307
  declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
2308
+ /**
2309
+ * Get a recipient from an envelope via an email match.
2310
+ */
2311
+ declare const getRecipient: (email: string, envelope: IEnvelope) => IRecipient | undefined;
2312
+ /**
2313
+ * Get a recipient that can act from an envelope via an email match.
2314
+ */
2315
+ declare const getRecipientWithActions: (email: string, envelope: IEnvelope) => boolean | undefined;
2292
2316
  /**
2293
2317
  * Returns true if the user can act.
2294
2318
  */
@@ -3029,6 +3053,43 @@ declare const deleteOrganizationMember: (endpoint: VerdocsEndpoint, profileId: s
3029
3053
  * @apiSuccess IProfile . The updated profile for the member.
3030
3054
  */
3031
3055
  declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Partial<Pick<IProfile, "roles" | "first_name" | "last_name">>) => Promise<IProfile>;
3056
+ /**
3057
+ * Lock an organization member's account. The member will be unable to sign in until an admin
3058
+ * unlocks them or they complete the password-reset flow. Caller must be an admin or owner,
3059
+ * may not lock him/herself, and the target must have a linked user account.
3060
+ *
3061
+ * ```typescript
3062
+ * import {lockOrganizationMember} from '@verdocs/js-sdk';
3063
+ *
3064
+ * const result = await lockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID', 'Departed employee');
3065
+ * ```
3066
+ *
3067
+ * @group Organization Members
3068
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3069
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3070
+ * @apiBody string(enum:'lock') action Action to perform
3071
+ * @apiBody string reason Reason the account is being locked. Stored on the user record and shown to admins.
3072
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3073
+ */
3074
+ declare const lockOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, reason: string) => Promise<IProfile>;
3075
+ /**
3076
+ * Unlock a member whose account has been locked (typically after too many failed sign-in attempts
3077
+ * or via an earlier admin lock). Caller must be an admin or owner, may not unlock him/herself, and
3078
+ * the target must have a linked user account. Clears `locked`, `lock_reason`, and `login_failures`.
3079
+ *
3080
+ * ```typescript
3081
+ * import {unlockOrganizationMember} from '@verdocs/js-sdk';
3082
+ *
3083
+ * const result = await unlockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID');
3084
+ * ```
3085
+ *
3086
+ * @group Organization Members
3087
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3088
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3089
+ * @apiBody string(enum:'unlock') action Action to perform
3090
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3091
+ */
3092
+ declare const unlockOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IProfile>;
3032
3093
  /**
3033
3094
  * Get all notification templates for the caller's organization.
3034
3095
  *
@@ -4049,4 +4110,4 @@ declare const decodeJWTBody: (token: string) => any;
4049
4110
  * the presence of the `document_id` field, which will only be present for signing sessions.
4050
4111
  */
4051
4112
  declare const decodeAccessTokenBody: (token: string) => TSession;
4052
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, WEBHOOK_EVENTS, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, TWebhookAuthMethod, TNotificationType, TEventName, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, INotificationTemplate, 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, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, getNotificationTemplates, getNotificationTemplate, createNotificationTemplate, updateNotificationTemplate, deleteNotificationTemplate, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, ICreateNotificationTemplateRequest, IUpdateNotificationTemplateRequest, getWebhooks, setWebhooks, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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 };
4113
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, WEBHOOK_EVENTS, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, TWebhookAuthMethod, TNotificationType, TEventName, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, INotificationTemplate, 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, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, getRecipient, getRecipientWithActions, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, lockOrganizationMember, unlockOrganizationMember, getNotificationTemplates, getNotificationTemplate, createNotificationTemplate, updateNotificationTemplate, deleteNotificationTemplate, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, ICreateNotificationTemplateRequest, IUpdateNotificationTemplateRequest, getWebhooks, setWebhooks, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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
@@ -2155,6 +2155,12 @@ const userCanSendTemplate = (profile, template) => {
2155
2155
  case 'public':
2156
2156
  return true;
2157
2157
  }
2158
+ if (!template.roles || !template.roles.length) {
2159
+ return false;
2160
+ }
2161
+ if (!template.fields || !template.fields.length) {
2162
+ return false;
2163
+ }
2158
2164
  };
2159
2165
  /**
2160
2166
  * Confirm whether the user can create a new template.
@@ -2988,7 +2994,19 @@ const recipientCanAct = (recipient, recipientsWithActions) => recipient.sequence
2988
2994
  * Returns true if the user can act.
2989
2995
  */
2990
2996
  const userCanAct = (email, recipientsWithActions) => {
2991
- const recipient = recipientsWithActions.find((r) => r.email === email);
2997
+ const recipient = recipientsWithActions.find((r) => r.email?.toLowerCase() === email?.toLowerCase());
2998
+ return recipient && recipient.sequence === recipientsWithActions?.[0]?.sequence;
2999
+ };
3000
+ /**
3001
+ * Get a recipient from an envelope via an email match.
3002
+ */
3003
+ const getRecipient = (email, envelope) => (envelope.recipients || []).find((r) => r.email?.toLowerCase() === email?.toLowerCase());
3004
+ /**
3005
+ * Get a recipient that can act from an envelope via an email match.
3006
+ */
3007
+ const getRecipientWithActions = (email, envelope) => {
3008
+ const recipientsWithActions = getRecipientsWithActions(envelope);
3009
+ const recipient = recipientsWithActions.find((r) => r.email?.toLowerCase() === email?.toLowerCase());
2992
3010
  return recipient && recipient.sequence === recipientsWithActions?.[0]?.sequence;
2993
3011
  };
2994
3012
  /**
@@ -2999,7 +3017,7 @@ const userCanSignNow = (profile, envelope) => {
2999
3017
  return false;
3000
3018
  }
3001
3019
  const recipientsWithActions = getRecipientsWithActions(envelope);
3002
- const myRecipient = recipientsWithActions.find((r) => r.profile_id === profile?.id || r.email === profile?.email);
3020
+ const myRecipient = recipientsWithActions.find((r) => r.profile_id === profile?.id || r.email?.toLowerCase() === profile?.email?.toLowerCase());
3003
3021
  return (myRecipient &&
3004
3022
  envelopeIsActive(envelope) &&
3005
3023
  userIsEnvelopeRecipient(profile, envelope) &&
@@ -3488,6 +3506,47 @@ const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
3488
3506
  const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api //
3489
3507
  .patch(`/v2/organization-members/${profileId}`, params)
3490
3508
  .then((r) => r.data);
3509
+ /**
3510
+ * Lock an organization member's account. The member will be unable to sign in until an admin
3511
+ * unlocks them or they complete the password-reset flow. Caller must be an admin or owner,
3512
+ * may not lock him/herself, and the target must have a linked user account.
3513
+ *
3514
+ * ```typescript
3515
+ * import {lockOrganizationMember} from '@verdocs/js-sdk';
3516
+ *
3517
+ * const result = await lockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID', 'Departed employee');
3518
+ * ```
3519
+ *
3520
+ * @group Organization Members
3521
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3522
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3523
+ * @apiBody string(enum:'lock') action Action to perform
3524
+ * @apiBody string reason Reason the account is being locked. Stored on the user record and shown to admins.
3525
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3526
+ */
3527
+ const lockOrganizationMember = (endpoint, profileId, reason) => endpoint.api //
3528
+ .put(`/v2/organization-members/${profileId}`, { action: 'lock', reason })
3529
+ .then((r) => r.data);
3530
+ /**
3531
+ * Unlock a member whose account has been locked (typically after too many failed sign-in attempts
3532
+ * or via an earlier admin lock). Caller must be an admin or owner, may not unlock him/herself, and
3533
+ * the target must have a linked user account. Clears `locked`, `lock_reason`, and `login_failures`.
3534
+ *
3535
+ * ```typescript
3536
+ * import {unlockOrganizationMember} from '@verdocs/js-sdk';
3537
+ *
3538
+ * const result = await unlockOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID');
3539
+ * ```
3540
+ *
3541
+ * @group Organization Members
3542
+ * @api PUT /v2/organization-members/:profile_id Perform an operation on an organization member.
3543
+ * @apiParam string(format:uuid) profile_id The Profile ID to operate on.
3544
+ * @apiBody string(enum:'unlock') action Action to perform
3545
+ * @apiSuccess IProfile . The updated profile for the member, with the joined user record.
3546
+ */
3547
+ const unlockOrganizationMember = (endpoint, profileId) => endpoint.api //
3548
+ .put(`/v2/organization-members/${profileId}`, { action: 'unlock' })
3549
+ .then((r) => r.data);
3491
3550
 
3492
3551
  /**
3493
3552
  * Notification Templates allow organizations to customize the email and SMS notifications
@@ -4006,6 +4065,8 @@ exports.getRGBA = getRGBA;
4006
4065
  exports.getRLeft = getRLeft;
4007
4066
  exports.getRTop = getRTop;
4008
4067
  exports.getRValue = getRValue;
4068
+ exports.getRecipient = getRecipient;
4069
+ exports.getRecipientWithActions = getRecipientWithActions;
4009
4070
  exports.getRecipientsWithActions = getRecipientsWithActions;
4010
4071
  exports.getRoleColor = getRoleColor;
4011
4072
  exports.getTemplate = getTemplate;
@@ -4037,6 +4098,7 @@ exports.isValidInput = isValidInput;
4037
4098
  exports.isValidPhone = isValidPhone;
4038
4099
  exports.isValidRoleName = isValidRoleName;
4039
4100
  exports.isValidTag = isValidTag;
4101
+ exports.lockOrganizationMember = lockOrganizationMember;
4040
4102
  exports.nameToRGBA = nameToRGBA;
4041
4103
  exports.randomString = randomString;
4042
4104
  exports.recipientCanAct = recipientCanAct;
@@ -4060,6 +4122,7 @@ exports.submitKbaIdentity = submitKbaIdentity;
4060
4122
  exports.submitKbaPin = submitKbaPin;
4061
4123
  exports.switchProfile = switchProfile;
4062
4124
  exports.toggleTemplateStar = toggleTemplateStar;
4125
+ exports.unlockOrganizationMember = unlockOrganizationMember;
4063
4126
  exports.updateApiKey = updateApiKey;
4064
4127
  exports.updateEnvelope = updateEnvelope;
4065
4128
  exports.updateEnvelopeField = updateEnvelopeField;