@verdocs/js-sdk 6.6.2 → 6.7.0

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
@@ -236,6 +236,17 @@ interface INotification {
236
236
  time: string;
237
237
  profile?: IProfile;
238
238
  }
239
+ interface INotificationTemplate {
240
+ id: string;
241
+ organization_id: string;
242
+ type: TNotificationType;
243
+ event_name: TEventName;
244
+ template_id?: string;
245
+ html_template?: string;
246
+ text_template?: string;
247
+ template?: ITemplate;
248
+ organization: IOrganization;
249
+ }
239
250
  //////////////////////////////////////// IAM //////////////////////////////
240
251
  interface IApiKey {
241
252
  client_id: string;
@@ -508,7 +519,7 @@ type TAccessKey = IInPersonAccessKey | IInAppAccessKey | IEmailAccessKey | ISMSA
508
519
  interface IEnvelope {
509
520
  /** Unique identifier for the envelope (UUID) */
510
521
  id: string;
511
- /** Current status of the envelope. Note that 'complete', 'declined', and 'canceled' are immutable/permanent end states. */
522
+ /** Current status of the envelope. Note that 'complete', 'declined', and 'canceled' are immutable/permanent end states. Also, 'complete' does NOT mean "fully signed in all aspects" (see "signed" for that). 'complete' means complete from a user's perspective: all required data has been submitted and workflow steps completed. */
512
523
  status: TEnvelopeStatus;
513
524
  /** ID of the envelope's creator. */
514
525
  profile_id: string;
@@ -540,7 +551,7 @@ interface IEnvelope {
540
551
  expires_at?: string;
541
552
  /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
542
553
  visibility: "private" | "shared";
543
- /** If true, the attachments have been signed with the Verdocs AATL signing certificate. */
554
+ /** If true, the envelope is fully submitted, processed, certificate-generated, and all documents have been stamped and signed. */
544
555
  signed: boolean;
545
556
  /**
546
557
  * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Envelopes back to
@@ -581,6 +592,8 @@ interface IEnvelopeDocument {
581
592
  mime: string;
582
593
  /** File size (bytes) */
583
594
  size: number;
595
+ /** Whether the file has been signed. Note that document.signed is different from envelope.signed. Documents are signed first, then the certificate is created and signed, then the envelope is finally marked signed. */
596
+ signed: boolean;
584
597
  /** Collection of width/height dimensions for each page */
585
598
  page_sizes: {
586
599
  width: number;
@@ -1062,6 +1075,8 @@ type TUsageType = "envelope" | "envelope_canceled" | "envelope_completed" | "env
1062
1075
  * Methods for authenticating webhook requests.
1063
1076
  */
1064
1077
  type TWebhookAuthMethod = "none" | "hmac" | "client_credentials";
1078
+ type TNotificationType = "sms" | "email" | "app";
1079
+ type TEventName = "invitation:canceled" | "transaction:completed" | "envelope:failed" | "envelope:expired" | "envelope:declined" | "envelope:cc" | "recipient:reminder" | "transaction:requested" | "envelope:delegated" | "envelope:completed" | "transaction:canceled" | "user:invited" | "recipient:invited" | "envelope:canceled" | "transaction:sent" | "envelope:signed" | "email:verify" | "email:otp" | "password:reset" | "recipient:question";
1065
1080
  declare const FIELD_TYPES: TFieldType[];
1066
1081
  declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
1067
1082
  declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
@@ -2325,6 +2340,17 @@ interface ISetWebhookRequest {
2325
2340
  auth_method: TWebhookAuthMethod;
2326
2341
  events: Record<TWebhookEvent, boolean>;
2327
2342
  }
2343
+ interface ICreateNotificationTemplateRequest {
2344
+ type: TNotificationType;
2345
+ event_name: TEventName;
2346
+ template_id?: string;
2347
+ html_template?: string;
2348
+ text_template?: string;
2349
+ }
2350
+ interface IUpdateNotificationTemplateRequest {
2351
+ html_template?: string;
2352
+ text_template?: string;
2353
+ }
2328
2354
  /**
2329
2355
  * Get a list of keys for a given organization. The caller must have admin access to the organization.
2330
2356
  *
@@ -3001,6 +3027,93 @@ declare const deleteOrganizationMember: (endpoint: VerdocsEndpoint, profileId: s
3001
3027
  * @apiSuccess IProfile . The updated profile for the member.
3002
3028
  */
3003
3029
  declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Partial<Pick<IProfile, "roles" | "first_name" | "last_name">>) => Promise<IProfile>;
3030
+ /**
3031
+ * Get all notification templates for the caller's organization.
3032
+ *
3033
+ * ```typescript
3034
+ * import {getNotificationTemplates} from '@verdocs/js-sdk';
3035
+ *
3036
+ * const templates = await getNotificationTemplates();
3037
+ * ```
3038
+ *
3039
+ * @group Notifications
3040
+ * @api GET /v2/notifications/templates Get notification templates
3041
+ * @apiSuccess array(items: INotificationTemplate) . A list of notification templates for the caller's organization.
3042
+ */
3043
+ declare const getNotificationTemplates: (endpoint: VerdocsEndpoint) => Promise<INotificationTemplate[]>;
3044
+ /**
3045
+ * Get a single notification template by ID.
3046
+ *
3047
+ * ```typescript
3048
+ * import {getNotificationTemplate} from '@verdocs/js-sdk';
3049
+ *
3050
+ * const template = await getNotificationTemplate(TEMPLATEID);
3051
+ * ```
3052
+ *
3053
+ * @group Notifications
3054
+ * @api GET /v2/notifications/templates/:id Get notification template
3055
+ * @apiParam string(format:uuid) id The notification template ID
3056
+ * @apiSuccess INotificationTemplate . The requested notification template.
3057
+ */
3058
+ declare const getNotificationTemplate: (endpoint: VerdocsEndpoint, id: string) => Promise<INotificationTemplate>;
3059
+ /**
3060
+ * Create a notification template. Only one template may exist per combination of type and
3061
+ * event_name. At least one of `html_template` or `text_template` must be provided.
3062
+ *
3063
+ * ```typescript
3064
+ * import {createNotificationTemplate} from '@verdocs/js-sdk';
3065
+ *
3066
+ * const template = await createNotificationTemplate({
3067
+ * type: 'email',
3068
+ * event_name: 'recipient:invited',
3069
+ * html_template: '<p>You have been invited to sign a document.</p>',
3070
+ * });
3071
+ * ```
3072
+ *
3073
+ * @group Notifications
3074
+ * @api POST /v2/notifications/templates Create notification template
3075
+ * @apiBody string(enum:'sms'|'email'|'app') type The notification channel type.
3076
+ * @apiBody string event_name The event that triggers this notification.
3077
+ * @apiBody string template_id? Optional reference to an associated template.
3078
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3079
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3080
+ * @apiSuccess INotificationTemplate . The newly-created notification template.
3081
+ */
3082
+ declare const createNotificationTemplate: (endpoint: VerdocsEndpoint, params: ICreateNotificationTemplateRequest) => Promise<INotificationTemplate>;
3083
+ /**
3084
+ * Update a notification template. At least one of `html_template` or `text_template` must be provided.
3085
+ *
3086
+ * ```typescript
3087
+ * import {updateNotificationTemplate} from '@verdocs/js-sdk';
3088
+ *
3089
+ * const updated = await updateNotificationTemplate(TEMPLATEID, {
3090
+ * html_template: '<p>Updated content.</p>',
3091
+ * });
3092
+ * ```
3093
+ *
3094
+ * @group Notifications
3095
+ * @api PATCH /v2/notifications/templates/:id Update notification template
3096
+ * @apiParam string(format:uuid) id The notification template ID
3097
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3098
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3099
+ * @apiSuccess INotificationTemplate . The updated notification template.
3100
+ */
3101
+ declare const updateNotificationTemplate: (endpoint: VerdocsEndpoint, id: string, params: IUpdateNotificationTemplateRequest) => Promise<INotificationTemplate>;
3102
+ /**
3103
+ * Delete a notification template.
3104
+ *
3105
+ * ```typescript
3106
+ * import {deleteNotificationTemplate} from '@verdocs/js-sdk';
3107
+ *
3108
+ * await deleteNotificationTemplate(TEMPLATEID);
3109
+ * ```
3110
+ *
3111
+ * @group Notification Templates
3112
+ * @api DELETE /v2/notifications/templates/:id Delete notification template
3113
+ * @apiParam string(format:uuid) id The notification template ID
3114
+ * @apiSuccess string . Success.
3115
+ */
3116
+ declare const deleteNotificationTemplate: (endpoint: VerdocsEndpoint, id: string) => Promise<any>;
3004
3117
  /**
3005
3118
  * Get an organization by ID. Note that this endpoint will return only a subset of fields
3006
3119
  * if the caller is not a member of the organization (the public fields).
@@ -3738,9 +3851,9 @@ declare const deleteTemplateDocument: (endpoint: VerdocsEndpoint, documentId: st
3738
3851
  * this will return only the **metadata** the caller is allowed to view.
3739
3852
  *
3740
3853
  * @group Template Documents
3741
- * @api GET /v2/envelope-documents/:id Get envelope document
3854
+ * @api GET /v2/template-documents/:id Get envelope document
3742
3855
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
3743
- * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
3856
+ * @apiSuccess ITemplateDocument . The detailed metadata for the document requested
3744
3857
  */
3745
3858
  declare const getTemplateDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<ITemplateDocument>;
3746
3859
  /**
@@ -3930,4 +4043,4 @@ declare const decodeJWTBody: (token: string) => any;
3930
4043
  * the presence of the `document_id` field, which will only be present for signing sessions.
3931
4044
  */
3932
4045
  declare const decodeAccessTokenBody: (token: string) => TSession;
3933
- 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, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, 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, 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, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, 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 };
4046
+ 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 };
package/dist/index.d.ts CHANGED
@@ -236,6 +236,17 @@ interface INotification {
236
236
  time: string;
237
237
  profile?: IProfile;
238
238
  }
239
+ interface INotificationTemplate {
240
+ id: string;
241
+ organization_id: string;
242
+ type: TNotificationType;
243
+ event_name: TEventName;
244
+ template_id?: string;
245
+ html_template?: string;
246
+ text_template?: string;
247
+ template?: ITemplate;
248
+ organization: IOrganization;
249
+ }
239
250
  //////////////////////////////////////// IAM //////////////////////////////
240
251
  interface IApiKey {
241
252
  client_id: string;
@@ -508,7 +519,7 @@ type TAccessKey = IInPersonAccessKey | IInAppAccessKey | IEmailAccessKey | ISMSA
508
519
  interface IEnvelope {
509
520
  /** Unique identifier for the envelope (UUID) */
510
521
  id: string;
511
- /** Current status of the envelope. Note that 'complete', 'declined', and 'canceled' are immutable/permanent end states. */
522
+ /** Current status of the envelope. Note that 'complete', 'declined', and 'canceled' are immutable/permanent end states. Also, 'complete' does NOT mean "fully signed in all aspects" (see "signed" for that). 'complete' means complete from a user's perspective: all required data has been submitted and workflow steps completed. */
512
523
  status: TEnvelopeStatus;
513
524
  /** ID of the envelope's creator. */
514
525
  profile_id: string;
@@ -540,7 +551,7 @@ interface IEnvelope {
540
551
  expires_at?: string;
541
552
  /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
542
553
  visibility: "private" | "shared";
543
- /** If true, the attachments have been signed with the Verdocs AATL signing certificate. */
554
+ /** If true, the envelope is fully submitted, processed, certificate-generated, and all documents have been stamped and signed. */
544
555
  signed: boolean;
545
556
  /**
546
557
  * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Envelopes back to
@@ -581,6 +592,8 @@ interface IEnvelopeDocument {
581
592
  mime: string;
582
593
  /** File size (bytes) */
583
594
  size: number;
595
+ /** Whether the file has been signed. Note that document.signed is different from envelope.signed. Documents are signed first, then the certificate is created and signed, then the envelope is finally marked signed. */
596
+ signed: boolean;
584
597
  /** Collection of width/height dimensions for each page */
585
598
  page_sizes: {
586
599
  width: number;
@@ -1062,6 +1075,8 @@ type TUsageType = "envelope" | "envelope_canceled" | "envelope_completed" | "env
1062
1075
  * Methods for authenticating webhook requests.
1063
1076
  */
1064
1077
  type TWebhookAuthMethod = "none" | "hmac" | "client_credentials";
1078
+ type TNotificationType = "sms" | "email" | "app";
1079
+ type TEventName = "invitation:canceled" | "transaction:completed" | "envelope:failed" | "envelope:expired" | "envelope:declined" | "envelope:cc" | "recipient:reminder" | "transaction:requested" | "envelope:delegated" | "envelope:completed" | "transaction:canceled" | "user:invited" | "recipient:invited" | "envelope:canceled" | "transaction:sent" | "envelope:signed" | "email:verify" | "email:otp" | "password:reset" | "recipient:question";
1065
1080
  declare const FIELD_TYPES: TFieldType[];
1066
1081
  declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
1067
1082
  declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
@@ -2325,6 +2340,17 @@ interface ISetWebhookRequest {
2325
2340
  auth_method: TWebhookAuthMethod;
2326
2341
  events: Record<TWebhookEvent, boolean>;
2327
2342
  }
2343
+ interface ICreateNotificationTemplateRequest {
2344
+ type: TNotificationType;
2345
+ event_name: TEventName;
2346
+ template_id?: string;
2347
+ html_template?: string;
2348
+ text_template?: string;
2349
+ }
2350
+ interface IUpdateNotificationTemplateRequest {
2351
+ html_template?: string;
2352
+ text_template?: string;
2353
+ }
2328
2354
  /**
2329
2355
  * Get a list of keys for a given organization. The caller must have admin access to the organization.
2330
2356
  *
@@ -3001,6 +3027,93 @@ declare const deleteOrganizationMember: (endpoint: VerdocsEndpoint, profileId: s
3001
3027
  * @apiSuccess IProfile . The updated profile for the member.
3002
3028
  */
3003
3029
  declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Partial<Pick<IProfile, "roles" | "first_name" | "last_name">>) => Promise<IProfile>;
3030
+ /**
3031
+ * Get all notification templates for the caller's organization.
3032
+ *
3033
+ * ```typescript
3034
+ * import {getNotificationTemplates} from '@verdocs/js-sdk';
3035
+ *
3036
+ * const templates = await getNotificationTemplates();
3037
+ * ```
3038
+ *
3039
+ * @group Notifications
3040
+ * @api GET /v2/notifications/templates Get notification templates
3041
+ * @apiSuccess array(items: INotificationTemplate) . A list of notification templates for the caller's organization.
3042
+ */
3043
+ declare const getNotificationTemplates: (endpoint: VerdocsEndpoint) => Promise<INotificationTemplate[]>;
3044
+ /**
3045
+ * Get a single notification template by ID.
3046
+ *
3047
+ * ```typescript
3048
+ * import {getNotificationTemplate} from '@verdocs/js-sdk';
3049
+ *
3050
+ * const template = await getNotificationTemplate(TEMPLATEID);
3051
+ * ```
3052
+ *
3053
+ * @group Notifications
3054
+ * @api GET /v2/notifications/templates/:id Get notification template
3055
+ * @apiParam string(format:uuid) id The notification template ID
3056
+ * @apiSuccess INotificationTemplate . The requested notification template.
3057
+ */
3058
+ declare const getNotificationTemplate: (endpoint: VerdocsEndpoint, id: string) => Promise<INotificationTemplate>;
3059
+ /**
3060
+ * Create a notification template. Only one template may exist per combination of type and
3061
+ * event_name. At least one of `html_template` or `text_template` must be provided.
3062
+ *
3063
+ * ```typescript
3064
+ * import {createNotificationTemplate} from '@verdocs/js-sdk';
3065
+ *
3066
+ * const template = await createNotificationTemplate({
3067
+ * type: 'email',
3068
+ * event_name: 'recipient:invited',
3069
+ * html_template: '<p>You have been invited to sign a document.</p>',
3070
+ * });
3071
+ * ```
3072
+ *
3073
+ * @group Notifications
3074
+ * @api POST /v2/notifications/templates Create notification template
3075
+ * @apiBody string(enum:'sms'|'email'|'app') type The notification channel type.
3076
+ * @apiBody string event_name The event that triggers this notification.
3077
+ * @apiBody string template_id? Optional reference to an associated template.
3078
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3079
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3080
+ * @apiSuccess INotificationTemplate . The newly-created notification template.
3081
+ */
3082
+ declare const createNotificationTemplate: (endpoint: VerdocsEndpoint, params: ICreateNotificationTemplateRequest) => Promise<INotificationTemplate>;
3083
+ /**
3084
+ * Update a notification template. At least one of `html_template` or `text_template` must be provided.
3085
+ *
3086
+ * ```typescript
3087
+ * import {updateNotificationTemplate} from '@verdocs/js-sdk';
3088
+ *
3089
+ * const updated = await updateNotificationTemplate(TEMPLATEID, {
3090
+ * html_template: '<p>Updated content.</p>',
3091
+ * });
3092
+ * ```
3093
+ *
3094
+ * @group Notifications
3095
+ * @api PATCH /v2/notifications/templates/:id Update notification template
3096
+ * @apiParam string(format:uuid) id The notification template ID
3097
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3098
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3099
+ * @apiSuccess INotificationTemplate . The updated notification template.
3100
+ */
3101
+ declare const updateNotificationTemplate: (endpoint: VerdocsEndpoint, id: string, params: IUpdateNotificationTemplateRequest) => Promise<INotificationTemplate>;
3102
+ /**
3103
+ * Delete a notification template.
3104
+ *
3105
+ * ```typescript
3106
+ * import {deleteNotificationTemplate} from '@verdocs/js-sdk';
3107
+ *
3108
+ * await deleteNotificationTemplate(TEMPLATEID);
3109
+ * ```
3110
+ *
3111
+ * @group Notification Templates
3112
+ * @api DELETE /v2/notifications/templates/:id Delete notification template
3113
+ * @apiParam string(format:uuid) id The notification template ID
3114
+ * @apiSuccess string . Success.
3115
+ */
3116
+ declare const deleteNotificationTemplate: (endpoint: VerdocsEndpoint, id: string) => Promise<any>;
3004
3117
  /**
3005
3118
  * Get an organization by ID. Note that this endpoint will return only a subset of fields
3006
3119
  * if the caller is not a member of the organization (the public fields).
@@ -3738,9 +3851,9 @@ declare const deleteTemplateDocument: (endpoint: VerdocsEndpoint, documentId: st
3738
3851
  * this will return only the **metadata** the caller is allowed to view.
3739
3852
  *
3740
3853
  * @group Template Documents
3741
- * @api GET /v2/envelope-documents/:id Get envelope document
3854
+ * @api GET /v2/template-documents/:id Get envelope document
3742
3855
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
3743
- * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
3856
+ * @apiSuccess ITemplateDocument . The detailed metadata for the document requested
3744
3857
  */
3745
3858
  declare const getTemplateDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<ITemplateDocument>;
3746
3859
  /**
@@ -3930,4 +4043,4 @@ declare const decodeJWTBody: (token: string) => any;
3930
4043
  * the presence of the `document_id` field, which will only be present for signing sessions.
3931
4044
  */
3932
4045
  declare const decodeAccessTokenBody: (token: string) => TSession;
3933
- 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, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, 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, 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, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, 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 };
4046
+ 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 };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var axios = require('axios');
4
3
  var axiosRetry = require('axios-retry');
4
+ var axios = require('axios');
5
5
 
6
6
  const WEBHOOK_EVENTS = [
7
7
  'envelope_created',
@@ -2537,9 +2537,9 @@ const deleteTemplateDocument = (endpoint, documentId) => endpoint.api //
2537
2537
  * this will return only the **metadata** the caller is allowed to view.
2538
2538
  *
2539
2539
  * @group Template Documents
2540
- * @api GET /v2/envelope-documents/:id Get envelope document
2540
+ * @api GET /v2/template-documents/:id Get envelope document
2541
2541
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
2542
- * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
2542
+ * @apiSuccess ITemplateDocument . The detailed metadata for the document requested
2543
2543
  */
2544
2544
  const getTemplateDocument = async (endpoint, documentId) => endpoint.api //
2545
2545
  .get(`/v2/template-documents/${documentId}`)
@@ -3477,6 +3477,112 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
3477
3477
  .patch(`/v2/organization-members/${profileId}`, params)
3478
3478
  .then((r) => r.data);
3479
3479
 
3480
+ /**
3481
+ * Notification Templates allow organizations to customize the email and SMS notifications
3482
+ * sent during signing workflows. Each template is tied to a specific event (e.g. recipient invited,
3483
+ * envelope completed) and notification type (email, sms, etc). The caller must have admin access
3484
+ * to the organization.
3485
+ *
3486
+ * @module
3487
+ */
3488
+ /**
3489
+ * Get all notification templates for the caller's organization.
3490
+ *
3491
+ * ```typescript
3492
+ * import {getNotificationTemplates} from '@verdocs/js-sdk';
3493
+ *
3494
+ * const templates = await getNotificationTemplates();
3495
+ * ```
3496
+ *
3497
+ * @group Notifications
3498
+ * @api GET /v2/notifications/templates Get notification templates
3499
+ * @apiSuccess array(items: INotificationTemplate) . A list of notification templates for the caller's organization.
3500
+ */
3501
+ const getNotificationTemplates = (endpoint) => endpoint.api //
3502
+ .get(`/v2/notifications/templates`)
3503
+ .then((r) => r.data);
3504
+ /**
3505
+ * Get a single notification template by ID.
3506
+ *
3507
+ * ```typescript
3508
+ * import {getNotificationTemplate} from '@verdocs/js-sdk';
3509
+ *
3510
+ * const template = await getNotificationTemplate(TEMPLATEID);
3511
+ * ```
3512
+ *
3513
+ * @group Notifications
3514
+ * @api GET /v2/notifications/templates/:id Get notification template
3515
+ * @apiParam string(format:uuid) id The notification template ID
3516
+ * @apiSuccess INotificationTemplate . The requested notification template.
3517
+ */
3518
+ const getNotificationTemplate = (endpoint, id) => endpoint.api //
3519
+ .get(`/v2/notifications/templates/${id}`)
3520
+ .then((r) => r.data);
3521
+ /**
3522
+ * Create a notification template. Only one template may exist per combination of type and
3523
+ * event_name. At least one of `html_template` or `text_template` must be provided.
3524
+ *
3525
+ * ```typescript
3526
+ * import {createNotificationTemplate} from '@verdocs/js-sdk';
3527
+ *
3528
+ * const template = await createNotificationTemplate({
3529
+ * type: 'email',
3530
+ * event_name: 'recipient:invited',
3531
+ * html_template: '<p>You have been invited to sign a document.</p>',
3532
+ * });
3533
+ * ```
3534
+ *
3535
+ * @group Notifications
3536
+ * @api POST /v2/notifications/templates Create notification template
3537
+ * @apiBody string(enum:'sms'|'email'|'app') type The notification channel type.
3538
+ * @apiBody string event_name The event that triggers this notification.
3539
+ * @apiBody string template_id? Optional reference to an associated template.
3540
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3541
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3542
+ * @apiSuccess INotificationTemplate . The newly-created notification template.
3543
+ */
3544
+ const createNotificationTemplate = (endpoint, params) => endpoint.api //
3545
+ .post(`/v2/notifications/templates`, params)
3546
+ .then((r) => r.data);
3547
+ /**
3548
+ * Update a notification template. At least one of `html_template` or `text_template` must be provided.
3549
+ *
3550
+ * ```typescript
3551
+ * import {updateNotificationTemplate} from '@verdocs/js-sdk';
3552
+ *
3553
+ * const updated = await updateNotificationTemplate(TEMPLATEID, {
3554
+ * html_template: '<p>Updated content.</p>',
3555
+ * });
3556
+ * ```
3557
+ *
3558
+ * @group Notifications
3559
+ * @api PATCH /v2/notifications/templates/:id Update notification template
3560
+ * @apiParam string(format:uuid) id The notification template ID
3561
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3562
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3563
+ * @apiSuccess INotificationTemplate . The updated notification template.
3564
+ */
3565
+ const updateNotificationTemplate = (endpoint, id, params) => endpoint.api //
3566
+ .patch(`/v2/notifications/templates/${id}`, params)
3567
+ .then((r) => r.data);
3568
+ /**
3569
+ * Delete a notification template.
3570
+ *
3571
+ * ```typescript
3572
+ * import {deleteNotificationTemplate} from '@verdocs/js-sdk';
3573
+ *
3574
+ * await deleteNotificationTemplate(TEMPLATEID);
3575
+ * ```
3576
+ *
3577
+ * @group Notification Templates
3578
+ * @api DELETE /v2/notifications/templates/:id Delete notification template
3579
+ * @apiParam string(format:uuid) id The notification template ID
3580
+ * @apiSuccess string . Success.
3581
+ */
3582
+ const deleteNotificationTemplate = (endpoint, id) => endpoint.api //
3583
+ .delete(`/v2/notifications/templates/${id}`)
3584
+ .then((r) => r.data);
3585
+
3480
3586
  /**
3481
3587
  * An Organization is the top level object for ownership for Members, Documents, and Templates.
3482
3588
  *
@@ -3808,6 +3914,7 @@ exports.createEnvelope = createEnvelope;
3808
3914
  exports.createField = createField;
3809
3915
  exports.createGroup = createGroup;
3810
3916
  exports.createInitials = createInitials;
3917
+ exports.createNotificationTemplate = createNotificationTemplate;
3811
3918
  exports.createOrganization = createOrganization;
3812
3919
  exports.createOrganizationContact = createOrganizationContact;
3813
3920
  exports.createOrganizationInvitation = createOrganizationInvitation;
@@ -3826,6 +3933,7 @@ exports.deleteEnvelopeFieldAttachment = deleteEnvelopeFieldAttachment;
3826
3933
  exports.deleteField = deleteField;
3827
3934
  exports.deleteGroup = deleteGroup;
3828
3935
  exports.deleteGroupMember = deleteGroupMember;
3936
+ exports.deleteNotificationTemplate = deleteNotificationTemplate;
3829
3937
  exports.deleteOrganization = deleteOrganization;
3830
3938
  exports.deleteOrganizationContact = deleteOrganizationContact;
3831
3939
  exports.deleteOrganizationInvitation = deleteOrganizationInvitation;
@@ -3869,6 +3977,8 @@ exports.getKbaStep = getKbaStep;
3869
3977
  exports.getMatchingCountry = getMatchingCountry;
3870
3978
  exports.getMyUser = getMyUser;
3871
3979
  exports.getNextRecipient = getNextRecipient;
3980
+ exports.getNotificationTemplate = getNotificationTemplate;
3981
+ exports.getNotificationTemplates = getNotificationTemplates;
3872
3982
  exports.getNotifications = getNotifications;
3873
3983
  exports.getOrganization = getOrganization;
3874
3984
  exports.getOrganizationChildren = getOrganizationChildren;
@@ -3943,6 +4053,7 @@ exports.updateEnvelope = updateEnvelope;
3943
4053
  exports.updateEnvelopeField = updateEnvelopeField;
3944
4054
  exports.updateField = updateField;
3945
4055
  exports.updateGroup = updateGroup;
4056
+ exports.updateNotificationTemplate = updateNotificationTemplate;
3946
4057
  exports.updateOrganization = updateOrganization;
3947
4058
  exports.updateOrganizationContact = updateOrganizationContact;
3948
4059
  exports.updateOrganizationInvitation = updateOrganizationInvitation;