@verdocs/js-sdk 6.0.2 → 6.0.4
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 +36 -14
- package/dist/index.d.ts +36 -14
- package/dist/index.js +47 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -19
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1604,35 +1604,41 @@ const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
|
|
|
1604
1604
|
* this will return only the **metadata** the caller is allowed to view.
|
|
1605
1605
|
*
|
|
1606
1606
|
* @group Envelope Documents
|
|
1607
|
-
* @api GET /
|
|
1608
|
-
* @apiParam string(format: 'uuid')
|
|
1607
|
+
* @api GET /v2/envelope-documents/:id Get envelope document
|
|
1608
|
+
* @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
|
|
1609
1609
|
* @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
|
|
1610
1610
|
*/
|
|
1611
|
-
const getEnvelopeDocument = async (endpoint,
|
|
1612
|
-
.get(`/
|
|
1611
|
+
const getEnvelopeDocument = async (endpoint, _envelopeId, documentId) => endpoint.api //
|
|
1612
|
+
.get(`/v2/envelope-documents/${documentId}`)
|
|
1613
|
+
.then((r) => r.data);
|
|
1614
|
+
/**
|
|
1615
|
+
* Download a document directly.
|
|
1616
|
+
*/
|
|
1617
|
+
const downloadDocument = async (endpoint, _envelopeId, documentId) => endpoint.api //
|
|
1618
|
+
.get(`/v2/envelope-documents/${documentId}?type=file`, { responseType: 'blob' })
|
|
1613
1619
|
.then((r) => r.data);
|
|
1614
1620
|
/**
|
|
1615
|
-
* Get
|
|
1616
|
-
*
|
|
1621
|
+
* Get an envelope document's metadata, or the document itself. If no "type" parameter is specified,
|
|
1622
|
+
* the document metadata is returned. If "type" is set to "file", the document binary content is
|
|
1623
|
+
* returned with Content-Type set to the MIME type of the file. If "type" is set to "download", a
|
|
1624
|
+
* string download link will be returned. If "type" is set to "preview" a string preview link will
|
|
1625
|
+
* be returned. This link expires quickly, so it should be accessed immediately and never shared.
|
|
1617
1626
|
*
|
|
1618
1627
|
* @group Envelope Documents
|
|
1619
|
-
* @api GET /
|
|
1620
|
-
* @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
|
|
1628
|
+
* @api GET /v2/envelope-documents/:document_id Preview, Download, or Link to a Document
|
|
1621
1629
|
* @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
|
|
1622
|
-
* @apiQuery
|
|
1623
|
-
* @apiQuery boolean preview? Set to true to generate a preview link (content-disposition: inline).
|
|
1624
|
-
* @apiQuery boolean file? Set to true to return the raw binary BLOB data of the file rather than a link.
|
|
1630
|
+
* @apiQuery string(enum:'file'|'download'|'preview') type? Download the file directly, generate a download link, or generate a preview link.
|
|
1625
1631
|
* @apiSuccess string . The generated link.
|
|
1626
1632
|
*/
|
|
1627
|
-
const getDocumentDownloadLink = async (endpoint,
|
|
1628
|
-
.get(`/
|
|
1633
|
+
const getDocumentDownloadLink = async (endpoint, _envelopeId, documentId) => endpoint.api //
|
|
1634
|
+
.get(`/v2/envelope-documents/${documentId}?type=download`)
|
|
1629
1635
|
.then((r) => r.data);
|
|
1630
1636
|
/**
|
|
1631
1637
|
* Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
|
|
1632
1638
|
* be accessed immediately and never shared. Content-Disposition will be set to "inline".
|
|
1633
1639
|
*/
|
|
1634
|
-
const getDocumentPreviewLink = async (endpoint,
|
|
1635
|
-
.get(`/
|
|
1640
|
+
const getDocumentPreviewLink = async (endpoint, _envelopeId, documentId) => endpoint.api //
|
|
1641
|
+
.get(`/v2/envelope-documents/${documentId}?type=preview`)
|
|
1636
1642
|
.then((r) => r.data);
|
|
1637
1643
|
/**
|
|
1638
1644
|
* Cancel an Envelope.
|
|
@@ -1650,9 +1656,11 @@ const cancelEnvelope = async (endpoint, envelopeId) => endpoint.api //
|
|
|
1650
1656
|
* Get (binary download) a file attached to an Envelope. It is important to use this method
|
|
1651
1657
|
* rather than a direct A HREF or similar link to set the authorization headers for the
|
|
1652
1658
|
* request.
|
|
1659
|
+
*
|
|
1660
|
+
* @deprecated Use getDocumentPreviewLink/getDocumentDownloadLink/downloadDocument instead.
|
|
1653
1661
|
*/
|
|
1654
1662
|
const getEnvelopeFile = async (endpoint, envelopeId, documentId) => endpoint.api //
|
|
1655
|
-
.get(`/
|
|
1663
|
+
.get(`/v2/envelope-documents/${documentId}?type=file`, { responseType: 'blob' })
|
|
1656
1664
|
.then((r) => r.data);
|
|
1657
1665
|
/**
|
|
1658
1666
|
* Update an envelope. Currently, only reminder settings may be changed.
|
|
@@ -2039,14 +2047,30 @@ const updateRecipient = (endpoint, envelopeId, roleName, params) => endpoint.api
|
|
|
2039
2047
|
*
|
|
2040
2048
|
* @module
|
|
2041
2049
|
*/
|
|
2050
|
+
/**
|
|
2051
|
+
* Check to see if the profile ID owns the envelope.
|
|
2052
|
+
*/
|
|
2053
|
+
const isEnvelopeOwner = (profile_id, envelope) => envelope.profile_id === profile_id;
|
|
2054
|
+
/**
|
|
2055
|
+
* Check to see if the profile ID is a recipient within the envelope.
|
|
2056
|
+
*/
|
|
2057
|
+
const isEnvelopeRecipient = (profile_id, envelope) => (envelope.recipients || []).some((recipient) => recipient.profile_id === profile_id);
|
|
2058
|
+
/**
|
|
2059
|
+
* Check to see if the profile ID is the envelope's sender or one of the recipients.
|
|
2060
|
+
*/
|
|
2061
|
+
const canAccessEnvelope = (profile_id, envelope) => isEnvelopeOwner(profile_id, envelope) || isEnvelopeRecipient(profile_id, envelope);
|
|
2042
2062
|
/**
|
|
2043
2063
|
* Check to see if the user owns the envelope.
|
|
2044
2064
|
*/
|
|
2045
2065
|
const userIsEnvelopeOwner = (profile, envelope) => envelope.profile_id === profile?.id;
|
|
2046
2066
|
/**
|
|
2047
|
-
* Check to see if the user
|
|
2067
|
+
* Check to see if the user is a recipient within the envelope.
|
|
2068
|
+
*/
|
|
2069
|
+
const userIsEnvelopeRecipient = (profile, envelope) => (envelope.recipients || []).some((recipient) => recipient.profile_id === profile?.id);
|
|
2070
|
+
/**
|
|
2071
|
+
* Check to see if the profile ID is the envelope's sender or one of the recipients.
|
|
2048
2072
|
*/
|
|
2049
|
-
const
|
|
2073
|
+
const useCanAccessEnvelope = (profile, envelope) => userIsEnvelopeOwner(profile, envelope) || userIsEnvelopeRecipient(profile, envelope);
|
|
2050
2074
|
/**
|
|
2051
2075
|
* Check to see if the envelope has pending actions.
|
|
2052
2076
|
*/
|
|
@@ -3685,5 +3709,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
|
|
|
3685
3709
|
const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
|
|
3686
3710
|
const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
|
|
3687
3711
|
|
|
3688
|
-
export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, deleteTemplateTag, downloadBlob, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopes, getFieldAttachment, 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, getSignature, getSignatures, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, setWebhooks, sortFields, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateRecipientStatus, updateTemplate, 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, verifySigner };
|
|
3712
|
+
export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canAccessEnvelope, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, deleteTemplateTag, downloadBlob, downloadDocument, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopes, getFieldAttachment, 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, getSignature, getSignatures, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isEnvelopeOwner, isEnvelopeRecipient, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, setWebhooks, sortFields, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateRecipientStatus, 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 };
|
|
3689
3713
|
//# sourceMappingURL=index.mjs.map
|