@verdocs/js-sdk 6.6.3 → 6.7.1

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import axios from 'axios';
2
1
  import axiosRetry from 'axios-retry';
2
+ import axios from 'axios';
3
3
 
4
4
  const WEBHOOK_EVENTS = [
5
5
  'envelope_created',
@@ -16,6 +16,12 @@ const WEBHOOK_EVENTS = [
16
16
  'recipient_delegated',
17
17
  'kba_event',
18
18
  'entitlement_used',
19
+ 'recipient_invited',
20
+ 'recipient_reminded',
21
+ 'recipient_auth_fail',
22
+ 'recipient_disclosure_accepted',
23
+ 'recipient_docs_downloaded',
24
+ 'recipient_invite_failed',
19
25
  ];
20
26
 
21
27
  const FIELD_TYPES = [
@@ -2535,9 +2541,9 @@ const deleteTemplateDocument = (endpoint, documentId) => endpoint.api //
2535
2541
  * this will return only the **metadata** the caller is allowed to view.
2536
2542
  *
2537
2543
  * @group Template Documents
2538
- * @api GET /v2/envelope-documents/:id Get envelope document
2544
+ * @api GET /v2/template-documents/:id Get envelope document
2539
2545
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
2540
- * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
2546
+ * @apiSuccess ITemplateDocument . The detailed metadata for the document requested
2541
2547
  */
2542
2548
  const getTemplateDocument = async (endpoint, documentId) => endpoint.api //
2543
2549
  .get(`/v2/template-documents/${documentId}`)
@@ -3475,6 +3481,112 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
3475
3481
  .patch(`/v2/organization-members/${profileId}`, params)
3476
3482
  .then((r) => r.data);
3477
3483
 
3484
+ /**
3485
+ * Notification Templates allow organizations to customize the email and SMS notifications
3486
+ * sent during signing workflows. Each template is tied to a specific event (e.g. recipient invited,
3487
+ * envelope completed) and notification type (email, sms, etc). The caller must have admin access
3488
+ * to the organization.
3489
+ *
3490
+ * @module
3491
+ */
3492
+ /**
3493
+ * Get all notification templates for the caller's organization.
3494
+ *
3495
+ * ```typescript
3496
+ * import {getNotificationTemplates} from '@verdocs/js-sdk';
3497
+ *
3498
+ * const templates = await getNotificationTemplates();
3499
+ * ```
3500
+ *
3501
+ * @group Notifications
3502
+ * @api GET /v2/notifications/templates Get notification templates
3503
+ * @apiSuccess array(items: INotificationTemplate) . A list of notification templates for the caller's organization.
3504
+ */
3505
+ const getNotificationTemplates = (endpoint) => endpoint.api //
3506
+ .get(`/v2/notifications/templates`)
3507
+ .then((r) => r.data);
3508
+ /**
3509
+ * Get a single notification template by ID.
3510
+ *
3511
+ * ```typescript
3512
+ * import {getNotificationTemplate} from '@verdocs/js-sdk';
3513
+ *
3514
+ * const template = await getNotificationTemplate(TEMPLATEID);
3515
+ * ```
3516
+ *
3517
+ * @group Notifications
3518
+ * @api GET /v2/notifications/templates/:id Get notification template
3519
+ * @apiParam string(format:uuid) id The notification template ID
3520
+ * @apiSuccess INotificationTemplate . The requested notification template.
3521
+ */
3522
+ const getNotificationTemplate = (endpoint, id) => endpoint.api //
3523
+ .get(`/v2/notifications/templates/${id}`)
3524
+ .then((r) => r.data);
3525
+ /**
3526
+ * Create a notification template. Only one template may exist per combination of type and
3527
+ * event_name. At least one of `html_template` or `text_template` must be provided.
3528
+ *
3529
+ * ```typescript
3530
+ * import {createNotificationTemplate} from '@verdocs/js-sdk';
3531
+ *
3532
+ * const template = await createNotificationTemplate({
3533
+ * type: 'email',
3534
+ * event_name: 'recipient:invited',
3535
+ * html_template: '<p>You have been invited to sign a document.</p>',
3536
+ * });
3537
+ * ```
3538
+ *
3539
+ * @group Notifications
3540
+ * @api POST /v2/notifications/templates Create notification template
3541
+ * @apiBody string(enum:'sms'|'email'|'app') type The notification channel type.
3542
+ * @apiBody string event_name The event that triggers this notification.
3543
+ * @apiBody string template_id? Optional reference to an associated template.
3544
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3545
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3546
+ * @apiSuccess INotificationTemplate . The newly-created notification template.
3547
+ */
3548
+ const createNotificationTemplate = (endpoint, params) => endpoint.api //
3549
+ .post(`/v2/notifications/templates`, params)
3550
+ .then((r) => r.data);
3551
+ /**
3552
+ * Update a notification template. At least one of `html_template` or `text_template` must be provided.
3553
+ *
3554
+ * ```typescript
3555
+ * import {updateNotificationTemplate} from '@verdocs/js-sdk';
3556
+ *
3557
+ * const updated = await updateNotificationTemplate(TEMPLATEID, {
3558
+ * html_template: '<p>Updated content.</p>',
3559
+ * });
3560
+ * ```
3561
+ *
3562
+ * @group Notifications
3563
+ * @api PATCH /v2/notifications/templates/:id Update notification template
3564
+ * @apiParam string(format:uuid) id The notification template ID
3565
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3566
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3567
+ * @apiSuccess INotificationTemplate . The updated notification template.
3568
+ */
3569
+ const updateNotificationTemplate = (endpoint, id, params) => endpoint.api //
3570
+ .patch(`/v2/notifications/templates/${id}`, params)
3571
+ .then((r) => r.data);
3572
+ /**
3573
+ * Delete a notification template.
3574
+ *
3575
+ * ```typescript
3576
+ * import {deleteNotificationTemplate} from '@verdocs/js-sdk';
3577
+ *
3578
+ * await deleteNotificationTemplate(TEMPLATEID);
3579
+ * ```
3580
+ *
3581
+ * @group Notification Templates
3582
+ * @api DELETE /v2/notifications/templates/:id Delete notification template
3583
+ * @apiParam string(format:uuid) id The notification template ID
3584
+ * @apiSuccess string . Success.
3585
+ */
3586
+ const deleteNotificationTemplate = (endpoint, id) => endpoint.api //
3587
+ .delete(`/v2/notifications/templates/${id}`)
3588
+ .then((r) => r.data);
3589
+
3478
3590
  /**
3479
3591
  * An Organization is the top level object for ownership for Members, Documents, and Templates.
3480
3592
  *
@@ -3779,5 +3891,5 @@ const rotateWebhookSecret = (endpoint) => endpoint.api //
3779
3891
  .put(`/v2/webhooks/rotate-secret`)
3780
3892
  .then((r) => r.data);
3781
3893
 
3782
- export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_DISCLOSURES, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, askQuestion, authenticate, blobToBase64, canAccessEnvelope, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, downloadBlob, downloadEnvelopeDocument, downloadTemplateDocument, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getApiKeys, getCountryByCode, getCurrentProfile, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPageDisplayUri, getEnvelopeDocumentPreviewLink, getEnvelopeFile, getEnvelopes, getEnvelopesZip, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationChildren, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizationUsage, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getTemplate, getTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentPreviewLink, getTemplateDocumentThumbnail, getTemplates, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isEnvelopeOwner, isEnvelopeRecipient, isFieldFilled, isFieldValid, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidInput, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, remindRecipient, rescale, resendOrganizationInvitation, resendVerification, resetPassword, resetRecipient, rotateApiKey, rotateWebhookSecret, setWebhooks, sortDocuments, sortFields, sortRecipients, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleTemplateStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateRole, uploadEnvelopeFieldAttachment, useCanAccessEnvelope, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail, verifySigner };
3894
+ export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_DISCLOSURES, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, askQuestion, authenticate, blobToBase64, canAccessEnvelope, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createNotificationTemplate, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteNotificationTemplate, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, downloadBlob, downloadEnvelopeDocument, downloadTemplateDocument, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getApiKeys, getCountryByCode, getCurrentProfile, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPageDisplayUri, getEnvelopeDocumentPreviewLink, getEnvelopeFile, getEnvelopes, getEnvelopesZip, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotificationTemplate, getNotificationTemplates, getNotifications, getOrganization, getOrganizationChildren, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizationUsage, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getTemplate, getTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentPreviewLink, getTemplateDocumentThumbnail, getTemplates, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isEnvelopeOwner, isEnvelopeRecipient, isFieldFilled, isFieldValid, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidInput, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, remindRecipient, rescale, resendOrganizationInvitation, resendVerification, resetPassword, resetRecipient, rotateApiKey, rotateWebhookSecret, setWebhooks, sortDocuments, sortFields, sortRecipients, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleTemplateStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateField, updateGroup, updateNotificationTemplate, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateRole, uploadEnvelopeFieldAttachment, useCanAccessEnvelope, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail, verifySigner };
3783
3895
  //# sourceMappingURL=index.mjs.map