@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 CHANGED
@@ -1683,30 +1683,34 @@ declare const getEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Pr
1683
1683
  * this will return only the **metadata** the caller is allowed to view.
1684
1684
  *
1685
1685
  * @group Envelope Documents
1686
- * @api GET /envelopes/:id Get envelope document
1687
- * @apiParam string(format: 'uuid') id The ID of the document to retrieve.
1686
+ * @api GET /v2/envelope-documents/:id Get envelope document
1687
+ * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1688
1688
  * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
1689
1689
  */
1690
- declare const getEnvelopeDocument: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<IEnvelopeDocument>;
1690
+ declare const getEnvelopeDocument: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<IEnvelopeDocument>;
1691
+ /**
1692
+ * Download a document directly.
1693
+ */
1694
+ declare const downloadDocument: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<any>;
1691
1695
  /**
1692
- * Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
1693
- * be accessed immediately and never shared. Content-Disposition will be set to "download".
1696
+ * Get an envelope document's metadata, or the document itself. If no "type" parameter is specified,
1697
+ * the document metadata is returned. If "type" is set to "file", the document binary content is
1698
+ * returned with Content-Type set to the MIME type of the file. If "type" is set to "download", a
1699
+ * string download link will be returned. If "type" is set to "preview" a string preview link will
1700
+ * be returned. This link expires quickly, so it should be accessed immediately and never shared.
1694
1701
  *
1695
1702
  * @group Envelope Documents
1696
- * @api GET /envelopes/:envelope_id/envelope_documents/:document_id Preview, Download, or Link to a Document
1697
- * @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
1703
+ * @api GET /v2/envelope-documents/:document_id Preview, Download, or Link to a Document
1698
1704
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1699
- * @apiQuery boolean download? Set to true to generate a download link (content-disposition: download).
1700
- * @apiQuery boolean preview? Set to true to generate a preview link (content-disposition: inline).
1701
- * @apiQuery boolean file? Set to true to return the raw binary BLOB data of the file rather than a link.
1705
+ * @apiQuery string(enum:'file'|'download'|'preview') type? Download the file directly, generate a download link, or generate a preview link.
1702
1706
  * @apiSuccess string . The generated link.
1703
1707
  */
1704
- declare const getDocumentDownloadLink: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<string>;
1708
+ declare const getDocumentDownloadLink: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<string>;
1705
1709
  /**
1706
1710
  * Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
1707
1711
  * be accessed immediately and never shared. Content-Disposition will be set to "inline".
1708
1712
  */
1709
- declare const getDocumentPreviewLink: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<string>;
1713
+ declare const getDocumentPreviewLink: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<string>;
1710
1714
  /**
1711
1715
  * Cancel an Envelope.
1712
1716
  *
@@ -1721,6 +1725,8 @@ declare const cancelEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) =>
1721
1725
  * Get (binary download) a file attached to an Envelope. It is important to use this method
1722
1726
  * rather than a direct A HREF or similar link to set the authorization headers for the
1723
1727
  * request.
1728
+ *
1729
+ * @deprecated Use getDocumentPreviewLink/getDocumentDownloadLink/downloadDocument instead.
1724
1730
  */
1725
1731
  declare const getEnvelopeFile: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<any>;
1726
1732
  /**
@@ -2137,14 +2143,30 @@ declare const delegateRecipient: (endpoint: VerdocsEndpoint, envelopeId: string,
2137
2143
  * @apiSuccess IRecipient . The updated Recipient.
2138
2144
  */
2139
2145
  declare const updateRecipient: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, params: IUpdateRecipientParams) => Promise<IRecipient>;
2146
+ /**
2147
+ * Check to see if the profile ID owns the envelope.
2148
+ */
2149
+ declare const isEnvelopeOwner: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2150
+ /**
2151
+ * Check to see if the profile ID is a recipient within the envelope.
2152
+ */
2153
+ declare const isEnvelopeRecipient: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2154
+ /**
2155
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2156
+ */
2157
+ declare const canAccessEnvelope: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2140
2158
  /**
2141
2159
  * Check to see if the user owns the envelope.
2142
2160
  */
2143
2161
  declare const userIsEnvelopeOwner: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2144
2162
  /**
2145
- * Check to see if the user owns the envelope.
2163
+ * Check to see if the user is a recipient within the envelope.
2146
2164
  */
2147
2165
  declare const userIsEnvelopeRecipient: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2166
+ /**
2167
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2168
+ */
2169
+ declare const useCanAccessEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2148
2170
  /**
2149
2171
  * Check to see if the envelope has pending actions.
2150
2172
  */
@@ -3833,4 +3855,4 @@ declare const decodeJWTBody: (token: string) => any;
3833
3855
  * the presence of the `document_id` field, which will only be present for signing sessions.
3834
3856
  */
3835
3857
  declare const decodeAccessTokenBody: (token: string) => TSession;
3836
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, 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, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipientStatus, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, resendInvitation, delegateRecipient, updateRecipient, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, 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, 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, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, 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, sortFields, 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 };
3858
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, 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, downloadDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipientStatus, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, resendInvitation, delegateRecipient, updateRecipient, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, 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, 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, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, 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, sortFields, 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
@@ -1683,30 +1683,34 @@ declare const getEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Pr
1683
1683
  * this will return only the **metadata** the caller is allowed to view.
1684
1684
  *
1685
1685
  * @group Envelope Documents
1686
- * @api GET /envelopes/:id Get envelope document
1687
- * @apiParam string(format: 'uuid') id The ID of the document to retrieve.
1686
+ * @api GET /v2/envelope-documents/:id Get envelope document
1687
+ * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1688
1688
  * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
1689
1689
  */
1690
- declare const getEnvelopeDocument: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<IEnvelopeDocument>;
1690
+ declare const getEnvelopeDocument: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<IEnvelopeDocument>;
1691
+ /**
1692
+ * Download a document directly.
1693
+ */
1694
+ declare const downloadDocument: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<any>;
1691
1695
  /**
1692
- * Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
1693
- * be accessed immediately and never shared. Content-Disposition will be set to "download".
1696
+ * Get an envelope document's metadata, or the document itself. If no "type" parameter is specified,
1697
+ * the document metadata is returned. If "type" is set to "file", the document binary content is
1698
+ * returned with Content-Type set to the MIME type of the file. If "type" is set to "download", a
1699
+ * string download link will be returned. If "type" is set to "preview" a string preview link will
1700
+ * be returned. This link expires quickly, so it should be accessed immediately and never shared.
1694
1701
  *
1695
1702
  * @group Envelope Documents
1696
- * @api GET /envelopes/:envelope_id/envelope_documents/:document_id Preview, Download, or Link to a Document
1697
- * @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
1703
+ * @api GET /v2/envelope-documents/:document_id Preview, Download, or Link to a Document
1698
1704
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1699
- * @apiQuery boolean download? Set to true to generate a download link (content-disposition: download).
1700
- * @apiQuery boolean preview? Set to true to generate a preview link (content-disposition: inline).
1701
- * @apiQuery boolean file? Set to true to return the raw binary BLOB data of the file rather than a link.
1705
+ * @apiQuery string(enum:'file'|'download'|'preview') type? Download the file directly, generate a download link, or generate a preview link.
1702
1706
  * @apiSuccess string . The generated link.
1703
1707
  */
1704
- declare const getDocumentDownloadLink: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<string>;
1708
+ declare const getDocumentDownloadLink: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<string>;
1705
1709
  /**
1706
1710
  * Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
1707
1711
  * be accessed immediately and never shared. Content-Disposition will be set to "inline".
1708
1712
  */
1709
- declare const getDocumentPreviewLink: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<string>;
1713
+ declare const getDocumentPreviewLink: (endpoint: VerdocsEndpoint, _envelopeId: string, documentId: string) => Promise<string>;
1710
1714
  /**
1711
1715
  * Cancel an Envelope.
1712
1716
  *
@@ -1721,6 +1725,8 @@ declare const cancelEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) =>
1721
1725
  * Get (binary download) a file attached to an Envelope. It is important to use this method
1722
1726
  * rather than a direct A HREF or similar link to set the authorization headers for the
1723
1727
  * request.
1728
+ *
1729
+ * @deprecated Use getDocumentPreviewLink/getDocumentDownloadLink/downloadDocument instead.
1724
1730
  */
1725
1731
  declare const getEnvelopeFile: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<any>;
1726
1732
  /**
@@ -2137,14 +2143,30 @@ declare const delegateRecipient: (endpoint: VerdocsEndpoint, envelopeId: string,
2137
2143
  * @apiSuccess IRecipient . The updated Recipient.
2138
2144
  */
2139
2145
  declare const updateRecipient: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, params: IUpdateRecipientParams) => Promise<IRecipient>;
2146
+ /**
2147
+ * Check to see if the profile ID owns the envelope.
2148
+ */
2149
+ declare const isEnvelopeOwner: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2150
+ /**
2151
+ * Check to see if the profile ID is a recipient within the envelope.
2152
+ */
2153
+ declare const isEnvelopeRecipient: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2154
+ /**
2155
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2156
+ */
2157
+ declare const canAccessEnvelope: (profile_id: string | null | undefined, envelope: IEnvelope) => boolean;
2140
2158
  /**
2141
2159
  * Check to see if the user owns the envelope.
2142
2160
  */
2143
2161
  declare const userIsEnvelopeOwner: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2144
2162
  /**
2145
- * Check to see if the user owns the envelope.
2163
+ * Check to see if the user is a recipient within the envelope.
2146
2164
  */
2147
2165
  declare const userIsEnvelopeRecipient: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2166
+ /**
2167
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2168
+ */
2169
+ declare const useCanAccessEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
2148
2170
  /**
2149
2171
  * Check to see if the envelope has pending actions.
2150
2172
  */
@@ -3833,4 +3855,4 @@ declare const decodeJWTBody: (token: string) => any;
3833
3855
  * the presence of the `document_id` field, which will only be present for signing sessions.
3834
3856
  */
3835
3857
  declare const decodeAccessTokenBody: (token: string) => TSession;
3836
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, 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, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipientStatus, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, resendInvitation, delegateRecipient, updateRecipient, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, 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, 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, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, 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, sortFields, 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 };
3858
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, 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, downloadDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipientStatus, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, resendInvitation, delegateRecipient, updateRecipient, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, 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, 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, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, 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, sortFields, 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
@@ -1606,35 +1606,41 @@ const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
1606
1606
  * this will return only the **metadata** the caller is allowed to view.
1607
1607
  *
1608
1608
  * @group Envelope Documents
1609
- * @api GET /envelopes/:id Get envelope document
1610
- * @apiParam string(format: 'uuid') id The ID of the document to retrieve.
1609
+ * @api GET /v2/envelope-documents/:id Get envelope document
1610
+ * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1611
1611
  * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
1612
1612
  */
1613
- const getEnvelopeDocument = async (endpoint, envelopeId, documentId) => endpoint.api //
1614
- .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}`)
1613
+ const getEnvelopeDocument = async (endpoint, _envelopeId, documentId) => endpoint.api //
1614
+ .get(`/v2/envelope-documents/${documentId}`)
1615
+ .then((r) => r.data);
1616
+ /**
1617
+ * Download a document directly.
1618
+ */
1619
+ const downloadDocument = async (endpoint, _envelopeId, documentId) => endpoint.api //
1620
+ .get(`/v2/envelope-documents/${documentId}?type=file`, { responseType: 'blob' })
1615
1621
  .then((r) => r.data);
1616
1622
  /**
1617
- * Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
1618
- * be accessed immediately and never shared. Content-Disposition will be set to "download".
1623
+ * Get an envelope document's metadata, or the document itself. If no "type" parameter is specified,
1624
+ * the document metadata is returned. If "type" is set to "file", the document binary content is
1625
+ * returned with Content-Type set to the MIME type of the file. If "type" is set to "download", a
1626
+ * string download link will be returned. If "type" is set to "preview" a string preview link will
1627
+ * be returned. This link expires quickly, so it should be accessed immediately and never shared.
1619
1628
  *
1620
1629
  * @group Envelope Documents
1621
- * @api GET /envelopes/:envelope_id/envelope_documents/:document_id Preview, Download, or Link to a Document
1622
- * @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
1630
+ * @api GET /v2/envelope-documents/:document_id Preview, Download, or Link to a Document
1623
1631
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1624
- * @apiQuery boolean download? Set to true to generate a download link (content-disposition: download).
1625
- * @apiQuery boolean preview? Set to true to generate a preview link (content-disposition: inline).
1626
- * @apiQuery boolean file? Set to true to return the raw binary BLOB data of the file rather than a link.
1632
+ * @apiQuery string(enum:'file'|'download'|'preview') type? Download the file directly, generate a download link, or generate a preview link.
1627
1633
  * @apiSuccess string . The generated link.
1628
1634
  */
1629
- const getDocumentDownloadLink = async (endpoint, envelopeId, documentId) => endpoint.api //
1630
- .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}?download=true`)
1635
+ const getDocumentDownloadLink = async (endpoint, _envelopeId, documentId) => endpoint.api //
1636
+ .get(`/v2/envelope-documents/${documentId}?type=download`)
1631
1637
  .then((r) => r.data);
1632
1638
  /**
1633
1639
  * Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
1634
1640
  * be accessed immediately and never shared. Content-Disposition will be set to "inline".
1635
1641
  */
1636
- const getDocumentPreviewLink = async (endpoint, envelopeId, documentId) => endpoint.api //
1637
- .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}?preview=true`)
1642
+ const getDocumentPreviewLink = async (endpoint, _envelopeId, documentId) => endpoint.api //
1643
+ .get(`/v2/envelope-documents/${documentId}?type=preview`)
1638
1644
  .then((r) => r.data);
1639
1645
  /**
1640
1646
  * Cancel an Envelope.
@@ -1652,9 +1658,11 @@ const cancelEnvelope = async (endpoint, envelopeId) => endpoint.api //
1652
1658
  * Get (binary download) a file attached to an Envelope. It is important to use this method
1653
1659
  * rather than a direct A HREF or similar link to set the authorization headers for the
1654
1660
  * request.
1661
+ *
1662
+ * @deprecated Use getDocumentPreviewLink/getDocumentDownloadLink/downloadDocument instead.
1655
1663
  */
1656
1664
  const getEnvelopeFile = async (endpoint, envelopeId, documentId) => endpoint.api //
1657
- .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}?file=true`, { responseType: 'blob' })
1665
+ .get(`/v2/envelope-documents/${documentId}?type=file`, { responseType: 'blob' })
1658
1666
  .then((r) => r.data);
1659
1667
  /**
1660
1668
  * Update an envelope. Currently, only reminder settings may be changed.
@@ -2041,14 +2049,30 @@ const updateRecipient = (endpoint, envelopeId, roleName, params) => endpoint.api
2041
2049
  *
2042
2050
  * @module
2043
2051
  */
2052
+ /**
2053
+ * Check to see if the profile ID owns the envelope.
2054
+ */
2055
+ const isEnvelopeOwner = (profile_id, envelope) => envelope.profile_id === profile_id;
2056
+ /**
2057
+ * Check to see if the profile ID is a recipient within the envelope.
2058
+ */
2059
+ const isEnvelopeRecipient = (profile_id, envelope) => (envelope.recipients || []).some((recipient) => recipient.profile_id === profile_id);
2060
+ /**
2061
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2062
+ */
2063
+ const canAccessEnvelope = (profile_id, envelope) => isEnvelopeOwner(profile_id, envelope) || isEnvelopeRecipient(profile_id, envelope);
2044
2064
  /**
2045
2065
  * Check to see if the user owns the envelope.
2046
2066
  */
2047
2067
  const userIsEnvelopeOwner = (profile, envelope) => envelope.profile_id === profile?.id;
2048
2068
  /**
2049
- * Check to see if the user owns the envelope.
2069
+ * Check to see if the user is a recipient within the envelope.
2070
+ */
2071
+ const userIsEnvelopeRecipient = (profile, envelope) => (envelope.recipients || []).some((recipient) => recipient.profile_id === profile?.id);
2072
+ /**
2073
+ * Check to see if the profile ID is the envelope's sender or one of the recipients.
2050
2074
  */
2051
- const userIsEnvelopeRecipient = (profile, envelope) => envelope.profile_id === profile?.id;
2075
+ const useCanAccessEnvelope = (profile, envelope) => userIsEnvelopeOwner(profile, envelope) || userIsEnvelopeRecipient(profile, envelope);
2052
2076
  /**
2053
2077
  * Check to see if the envelope has pending actions.
2054
2078
  */
@@ -3701,6 +3725,7 @@ exports.addGroupMember = addGroupMember;
3701
3725
  exports.addTemplateTag = addTemplateTag;
3702
3726
  exports.authenticate = authenticate;
3703
3727
  exports.blobToBase64 = blobToBase64;
3728
+ exports.canAccessEnvelope = canAccessEnvelope;
3704
3729
  exports.canPerformTemplateAction = canPerformTemplateAction;
3705
3730
  exports.cancelEnvelope = cancelEnvelope;
3706
3731
  exports.capitalize = capitalize;
@@ -3742,6 +3767,7 @@ exports.deleteTemplateDocument = deleteTemplateDocument;
3742
3767
  exports.deleteTemplateRole = deleteTemplateRole;
3743
3768
  exports.deleteTemplateTag = deleteTemplateTag;
3744
3769
  exports.downloadBlob = downloadBlob;
3770
+ exports.downloadDocument = downloadDocument;
3745
3771
  exports.duplicateTemplate = duplicateTemplate;
3746
3772
  exports.envelopeIsActive = envelopeIsActive;
3747
3773
  exports.envelopeIsComplete = envelopeIsComplete;
@@ -3815,6 +3841,8 @@ exports.integerSequence = integerSequence;
3815
3841
  exports.isAmericanSamoa = isAmericanSamoa;
3816
3842
  exports.isCanada = isCanada;
3817
3843
  exports.isDominicanRepublic = isDominicanRepublic;
3844
+ exports.isEnvelopeOwner = isEnvelopeOwner;
3845
+ exports.isEnvelopeRecipient = isEnvelopeRecipient;
3818
3846
  exports.isFrenchGuiana = isFrenchGuiana;
3819
3847
  exports.isGuadeloupe = isGuadeloupe;
3820
3848
  exports.isMartinique = isMartinique;
@@ -3863,6 +3891,7 @@ exports.updateRecipientStatus = updateRecipientStatus;
3863
3891
  exports.updateTemplate = updateTemplate;
3864
3892
  exports.updateTemplateRole = updateTemplateRole;
3865
3893
  exports.uploadEnvelopeFieldAttachment = uploadEnvelopeFieldAttachment;
3894
+ exports.useCanAccessEnvelope = useCanAccessEnvelope;
3866
3895
  exports.userCanAct = userCanAct;
3867
3896
  exports.userCanBuildTemplate = userCanBuildTemplate;
3868
3897
  exports.userCanCancelEnvelope = userCanCancelEnvelope;