@verdocs/js-sdk 6.6.3 → 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.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',
@@ -2535,9 +2535,9 @@ const deleteTemplateDocument = (endpoint, documentId) => endpoint.api //
2535
2535
  * this will return only the **metadata** the caller is allowed to view.
2536
2536
  *
2537
2537
  * @group Template Documents
2538
- * @api GET /v2/envelope-documents/:id Get envelope document
2538
+ * @api GET /v2/template-documents/:id Get envelope document
2539
2539
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
2540
- * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
2540
+ * @apiSuccess ITemplateDocument . The detailed metadata for the document requested
2541
2541
  */
2542
2542
  const getTemplateDocument = async (endpoint, documentId) => endpoint.api //
2543
2543
  .get(`/v2/template-documents/${documentId}`)
@@ -3475,6 +3475,112 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
3475
3475
  .patch(`/v2/organization-members/${profileId}`, params)
3476
3476
  .then((r) => r.data);
3477
3477
 
3478
+ /**
3479
+ * Notification Templates allow organizations to customize the email and SMS notifications
3480
+ * sent during signing workflows. Each template is tied to a specific event (e.g. recipient invited,
3481
+ * envelope completed) and notification type (email, sms, etc). The caller must have admin access
3482
+ * to the organization.
3483
+ *
3484
+ * @module
3485
+ */
3486
+ /**
3487
+ * Get all notification templates for the caller's organization.
3488
+ *
3489
+ * ```typescript
3490
+ * import {getNotificationTemplates} from '@verdocs/js-sdk';
3491
+ *
3492
+ * const templates = await getNotificationTemplates();
3493
+ * ```
3494
+ *
3495
+ * @group Notifications
3496
+ * @api GET /v2/notifications/templates Get notification templates
3497
+ * @apiSuccess array(items: INotificationTemplate) . A list of notification templates for the caller's organization.
3498
+ */
3499
+ const getNotificationTemplates = (endpoint) => endpoint.api //
3500
+ .get(`/v2/notifications/templates`)
3501
+ .then((r) => r.data);
3502
+ /**
3503
+ * Get a single notification template by ID.
3504
+ *
3505
+ * ```typescript
3506
+ * import {getNotificationTemplate} from '@verdocs/js-sdk';
3507
+ *
3508
+ * const template = await getNotificationTemplate(TEMPLATEID);
3509
+ * ```
3510
+ *
3511
+ * @group Notifications
3512
+ * @api GET /v2/notifications/templates/:id Get notification template
3513
+ * @apiParam string(format:uuid) id The notification template ID
3514
+ * @apiSuccess INotificationTemplate . The requested notification template.
3515
+ */
3516
+ const getNotificationTemplate = (endpoint, id) => endpoint.api //
3517
+ .get(`/v2/notifications/templates/${id}`)
3518
+ .then((r) => r.data);
3519
+ /**
3520
+ * Create a notification template. Only one template may exist per combination of type and
3521
+ * event_name. At least one of `html_template` or `text_template` must be provided.
3522
+ *
3523
+ * ```typescript
3524
+ * import {createNotificationTemplate} from '@verdocs/js-sdk';
3525
+ *
3526
+ * const template = await createNotificationTemplate({
3527
+ * type: 'email',
3528
+ * event_name: 'recipient:invited',
3529
+ * html_template: '<p>You have been invited to sign a document.</p>',
3530
+ * });
3531
+ * ```
3532
+ *
3533
+ * @group Notifications
3534
+ * @api POST /v2/notifications/templates Create notification template
3535
+ * @apiBody string(enum:'sms'|'email'|'app') type The notification channel type.
3536
+ * @apiBody string event_name The event that triggers this notification.
3537
+ * @apiBody string template_id? Optional reference to an associated template.
3538
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3539
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3540
+ * @apiSuccess INotificationTemplate . The newly-created notification template.
3541
+ */
3542
+ const createNotificationTemplate = (endpoint, params) => endpoint.api //
3543
+ .post(`/v2/notifications/templates`, params)
3544
+ .then((r) => r.data);
3545
+ /**
3546
+ * Update a notification template. At least one of `html_template` or `text_template` must be provided.
3547
+ *
3548
+ * ```typescript
3549
+ * import {updateNotificationTemplate} from '@verdocs/js-sdk';
3550
+ *
3551
+ * const updated = await updateNotificationTemplate(TEMPLATEID, {
3552
+ * html_template: '<p>Updated content.</p>',
3553
+ * });
3554
+ * ```
3555
+ *
3556
+ * @group Notifications
3557
+ * @api PATCH /v2/notifications/templates/:id Update notification template
3558
+ * @apiParam string(format:uuid) id The notification template ID
3559
+ * @apiBody string html_template? The HTML content for the notification. At least one of html_template or text_template is required.
3560
+ * @apiBody string text_template? The plain-text content for the notification. At least one of html_template or text_template is required.
3561
+ * @apiSuccess INotificationTemplate . The updated notification template.
3562
+ */
3563
+ const updateNotificationTemplate = (endpoint, id, params) => endpoint.api //
3564
+ .patch(`/v2/notifications/templates/${id}`, params)
3565
+ .then((r) => r.data);
3566
+ /**
3567
+ * Delete a notification template.
3568
+ *
3569
+ * ```typescript
3570
+ * import {deleteNotificationTemplate} from '@verdocs/js-sdk';
3571
+ *
3572
+ * await deleteNotificationTemplate(TEMPLATEID);
3573
+ * ```
3574
+ *
3575
+ * @group Notification Templates
3576
+ * @api DELETE /v2/notifications/templates/:id Delete notification template
3577
+ * @apiParam string(format:uuid) id The notification template ID
3578
+ * @apiSuccess string . Success.
3579
+ */
3580
+ const deleteNotificationTemplate = (endpoint, id) => endpoint.api //
3581
+ .delete(`/v2/notifications/templates/${id}`)
3582
+ .then((r) => r.data);
3583
+
3478
3584
  /**
3479
3585
  * An Organization is the top level object for ownership for Members, Documents, and Templates.
3480
3586
  *
@@ -3779,5 +3885,5 @@ const rotateWebhookSecret = (endpoint) => endpoint.api //
3779
3885
  .put(`/v2/webhooks/rotate-secret`)
3780
3886
  .then((r) => r.data);
3781
3887
 
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 };
3888
+ 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
3889
  //# sourceMappingURL=index.mjs.map