@verdocs/js-sdk 4.2.10 → 4.2.11

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
@@ -2410,6 +2410,7 @@ const userCanSendTemplate = (profile, template) => {
2410
2410
  case 'organization_member':
2411
2411
  case 'organization_member_as_creator':
2412
2412
  return userIsTemplateCreator(profile, template) || template.organization_id === profile?.organization_id;
2413
+ // 'everyone' | 'everyone_as_creator';
2413
2414
  default:
2414
2415
  return true;
2415
2416
  }
@@ -2461,29 +2462,55 @@ const deleteTemplateReminder = (endpoint, templateId, reminderId) => endpoint.ap
2461
2462
  .then((r) => r.data);
2462
2463
 
2463
2464
  /**
2464
- * A "role" is an individual participant in a signing flow, such as a signer or CC contact. Roles are identified by
2465
- * their names, which must be unique (e.g. 'Recipient 1'). Template fields are assigned to roles for signing operations,
2466
- * so you may have 'Recipient 1 Signature 1' and so forth.
2465
+ * A "role" is an individual participant in a signing flow, such as a signer or CC contact.
2466
+ * A role is a placeholder that will eventually become a named recipient. For example, "Tenant 1"
2467
+ * might be replaced with "John Smith" when the document is sent out for signature.
2468
+ *
2469
+ * Role names must be unique within a template, e.g. 'Recipient 1'. They may contain any [a-zA-Z0-9_- ]
2470
+ * characters, although it is recommended to keep them simple and human-readable, and to avoid
2471
+ * spaces (although they are allowed). If spaces are used in role names, be sure to URL-encode them
2472
+ * when calling endpoints like `updateRole()` e.g. 'Recipient%201'.
2473
+ *
2474
+ * NOTE: Roles are always enumerated under Template objects, so there are no "list" or "get" endpoints
2475
+ * for them. To get a template's latest role list, simply call `getTemplate()`.
2467
2476
  *
2468
2477
  * @module
2469
2478
  */
2470
- const createTemplateRole = (endpoint, templateId, params) => endpoint.api //
2471
- .post(`/templates/${templateId}/roles`, params)
2472
- .then((r) => r.data);
2473
- const getTemplateRoles = (endpoint, templateId) => endpoint.api //
2474
- .get(`/templates/${templateId}/roles`)
2475
- .then((r) => r.data);
2476
- const getTemplateRole = (endpoint, templateId, roleName) => endpoint.api //
2477
- .get(`/templates/${templateId}/roles/${roleName}`)
2478
- .then((r) => r.data);
2479
- const updateTemplateRole = (endpoint, templateId, roleName, params) => endpoint.api //
2480
- .put(`/templates/${templateId}/roles/${roleName}`, params)
2479
+ /**
2480
+ * Create a role.
2481
+ *
2482
+ * ```typescript
2483
+ * import {createTemplateRole} from '@verdocs/js-sdk';
2484
+ *
2485
+ * const role = await createTemplateRole(VerdocsEndpoint.getDefault(), template_id, params...);
2486
+ * ```
2487
+ */
2488
+ const createTemplateRole = (endpoint, template_id, params) => endpoint.api //
2489
+ .post(`/v2/templates/${template_id}/roles`, params)
2481
2490
  .then((r) => r.data);
2482
- const deleteTemplateRole = (endpoint, templateId, roleName) => endpoint.api //
2483
- .delete(`/templates/${templateId}/roles/${roleName}`)
2491
+ /**
2492
+ * Update a role.
2493
+ *
2494
+ * ```typescript
2495
+ * import {updateTemplateRole} from '@verdocs/js-sdk';
2496
+ *
2497
+ * const role = await updateTemplateRole(VerdocsEndpoint.getDefault(), template_id, name, params...);
2498
+ * ```
2499
+ */
2500
+ const updateTemplateRole = (endpoint, template_id, name, params) => endpoint.api //
2501
+ .put(`/v2/templates/${template_id}/roles/${name}`, params)
2484
2502
  .then((r) => r.data);
2485
- const getTemplateRoleFields = (endpoint, templateId, roleName) => endpoint.api //
2486
- .get(`/templates/${templateId}/roles/${roleName}/fields`)
2503
+ /**
2504
+ * Delete a role.
2505
+ *
2506
+ * ```typescript
2507
+ * import {deleteTemplateRole} from '@verdocs/js-sdk';
2508
+ *
2509
+ * const profiles = await deleteTemplateRole(VerdocsEndpoint.getDefault(), template_id, name);
2510
+ * ```
2511
+ */
2512
+ const deleteTemplateRole = (endpoint, template_id, name) => endpoint.api //
2513
+ .delete(`/v2/templates/${template_id}/roles/${name}`)
2487
2514
  .then((r) => r.data);
2488
2515
 
2489
2516
  /**
@@ -2837,5 +2864,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
2837
2864
  const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
2838
2865
  const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
2839
2866
 
2840
- export { AtoB, Countries, RolePermissions, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopes, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateRole, getTemplateRoleFields, getTemplateRoles, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2867
+ export { AtoB, Countries, RolePermissions, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopes, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2841
2868
  //# sourceMappingURL=index.mjs.map