@verdocs/js-sdk 6.4.3 → 6.4.5
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 +38 -28
- package/dist/index.d.ts +38 -28
- package/dist/index.js +42 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -45
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +2 -3
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -1862,6 +1862,43 @@ declare const getEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesP
|
|
|
1862
1862
|
* owner of each envelope. The returned ZIP file contains a folder for each envelope.
|
|
1863
1863
|
*/
|
|
1864
1864
|
declare const getEnvelopesZip: (endpoint: VerdocsEndpoint, envelope_ids: string[]) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
1867
|
+
* NOTE: This function mutates the input array.
|
|
1868
|
+
*/
|
|
1869
|
+
declare function sortFields(fields: {
|
|
1870
|
+
page?: number | null | undefined;
|
|
1871
|
+
x?: number | null | undefined;
|
|
1872
|
+
y?: number | null | undefined;
|
|
1873
|
+
height?: number | null | undefined;
|
|
1874
|
+
}[]): {
|
|
1875
|
+
page?: number | null | undefined;
|
|
1876
|
+
x?: number | null | undefined;
|
|
1877
|
+
y?: number | null | undefined;
|
|
1878
|
+
height?: number | null | undefined;
|
|
1879
|
+
}[];
|
|
1880
|
+
/**
|
|
1881
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1882
|
+
* NOTE: This function mutates the input array.
|
|
1883
|
+
*/
|
|
1884
|
+
declare function sortDocuments(documents: {
|
|
1885
|
+
order: number;
|
|
1886
|
+
created_at: Date | string;
|
|
1887
|
+
}[]): {
|
|
1888
|
+
order: number;
|
|
1889
|
+
created_at: Date | string;
|
|
1890
|
+
}[];
|
|
1891
|
+
/**
|
|
1892
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1893
|
+
* NOTE: This function mutates the input array.
|
|
1894
|
+
*/
|
|
1895
|
+
declare function sortRecipients(recipients?: {
|
|
1896
|
+
sequence: number;
|
|
1897
|
+
order: number;
|
|
1898
|
+
}[]): {
|
|
1899
|
+
sequence: number;
|
|
1900
|
+
order: number;
|
|
1901
|
+
}[] | undefined;
|
|
1865
1902
|
declare const isFieldFilled: (field: IEnvelopeField, allRecipientFields: IEnvelopeField[]) => boolean | "" | null;
|
|
1866
1903
|
// TODO: Only allow !required to bypass validation if the field is empty.
|
|
1867
1904
|
declare const isFieldValid: (field: IEnvelopeField, allRecipientFields: IEnvelopeField[]) => boolean | "" | null;
|
|
@@ -3764,33 +3801,6 @@ declare function getRLeft(x: number, ratio: number): number;
|
|
|
3764
3801
|
declare function getRValue(y: number, ratio: number): number;
|
|
3765
3802
|
declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
3766
3803
|
declare function rescale(r: number, n: number): number;
|
|
3767
|
-
/**
|
|
3768
|
-
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
3769
|
-
* NOTE: This function mutates the input array.
|
|
3770
|
-
*/
|
|
3771
|
-
declare function sortFields(fields: ITemplateField[] | IEnvelopeField[]): IEnvelopeField[] | ITemplateField[];
|
|
3772
|
-
/**
|
|
3773
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
3774
|
-
* NOTE: This function mutates the input array.
|
|
3775
|
-
*/
|
|
3776
|
-
declare function sortDocuments(documents: {
|
|
3777
|
-
order: number;
|
|
3778
|
-
created_at: Date | string;
|
|
3779
|
-
}[]): {
|
|
3780
|
-
order: number;
|
|
3781
|
-
created_at: Date | string;
|
|
3782
|
-
}[];
|
|
3783
|
-
/**
|
|
3784
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
3785
|
-
* NOTE: This function mutates the input array.
|
|
3786
|
-
*/
|
|
3787
|
-
declare function sortRecipients(recipients?: {
|
|
3788
|
-
sequence: number;
|
|
3789
|
-
order: number;
|
|
3790
|
-
}[]): {
|
|
3791
|
-
sequence: number;
|
|
3792
|
-
order: number;
|
|
3793
|
-
}[] | undefined;
|
|
3794
3804
|
interface IFileWithData {
|
|
3795
3805
|
lastModified: number;
|
|
3796
3806
|
size: number;
|
|
@@ -3876,4 +3886,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3876
3886
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3877
3887
|
*/
|
|
3878
3888
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3879
|
-
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, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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,
|
|
3889
|
+
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, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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
|
@@ -1862,6 +1862,43 @@ declare const getEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesP
|
|
|
1862
1862
|
* owner of each envelope. The returned ZIP file contains a folder for each envelope.
|
|
1863
1863
|
*/
|
|
1864
1864
|
declare const getEnvelopesZip: (endpoint: VerdocsEndpoint, envelope_ids: string[]) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
1867
|
+
* NOTE: This function mutates the input array.
|
|
1868
|
+
*/
|
|
1869
|
+
declare function sortFields(fields: {
|
|
1870
|
+
page?: number | null | undefined;
|
|
1871
|
+
x?: number | null | undefined;
|
|
1872
|
+
y?: number | null | undefined;
|
|
1873
|
+
height?: number | null | undefined;
|
|
1874
|
+
}[]): {
|
|
1875
|
+
page?: number | null | undefined;
|
|
1876
|
+
x?: number | null | undefined;
|
|
1877
|
+
y?: number | null | undefined;
|
|
1878
|
+
height?: number | null | undefined;
|
|
1879
|
+
}[];
|
|
1880
|
+
/**
|
|
1881
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1882
|
+
* NOTE: This function mutates the input array.
|
|
1883
|
+
*/
|
|
1884
|
+
declare function sortDocuments(documents: {
|
|
1885
|
+
order: number;
|
|
1886
|
+
created_at: Date | string;
|
|
1887
|
+
}[]): {
|
|
1888
|
+
order: number;
|
|
1889
|
+
created_at: Date | string;
|
|
1890
|
+
}[];
|
|
1891
|
+
/**
|
|
1892
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1893
|
+
* NOTE: This function mutates the input array.
|
|
1894
|
+
*/
|
|
1895
|
+
declare function sortRecipients(recipients?: {
|
|
1896
|
+
sequence: number;
|
|
1897
|
+
order: number;
|
|
1898
|
+
}[]): {
|
|
1899
|
+
sequence: number;
|
|
1900
|
+
order: number;
|
|
1901
|
+
}[] | undefined;
|
|
1865
1902
|
declare const isFieldFilled: (field: IEnvelopeField, allRecipientFields: IEnvelopeField[]) => boolean | "" | null;
|
|
1866
1903
|
// TODO: Only allow !required to bypass validation if the field is empty.
|
|
1867
1904
|
declare const isFieldValid: (field: IEnvelopeField, allRecipientFields: IEnvelopeField[]) => boolean | "" | null;
|
|
@@ -3764,33 +3801,6 @@ declare function getRLeft(x: number, ratio: number): number;
|
|
|
3764
3801
|
declare function getRValue(y: number, ratio: number): number;
|
|
3765
3802
|
declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
3766
3803
|
declare function rescale(r: number, n: number): number;
|
|
3767
|
-
/**
|
|
3768
|
-
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
3769
|
-
* NOTE: This function mutates the input array.
|
|
3770
|
-
*/
|
|
3771
|
-
declare function sortFields(fields: ITemplateField[] | IEnvelopeField[]): IEnvelopeField[] | ITemplateField[];
|
|
3772
|
-
/**
|
|
3773
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
3774
|
-
* NOTE: This function mutates the input array.
|
|
3775
|
-
*/
|
|
3776
|
-
declare function sortDocuments(documents: {
|
|
3777
|
-
order: number;
|
|
3778
|
-
created_at: Date | string;
|
|
3779
|
-
}[]): {
|
|
3780
|
-
order: number;
|
|
3781
|
-
created_at: Date | string;
|
|
3782
|
-
}[];
|
|
3783
|
-
/**
|
|
3784
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
3785
|
-
* NOTE: This function mutates the input array.
|
|
3786
|
-
*/
|
|
3787
|
-
declare function sortRecipients(recipients?: {
|
|
3788
|
-
sequence: number;
|
|
3789
|
-
order: number;
|
|
3790
|
-
}[]): {
|
|
3791
|
-
sequence: number;
|
|
3792
|
-
order: number;
|
|
3793
|
-
}[] | undefined;
|
|
3794
3804
|
interface IFileWithData {
|
|
3795
3805
|
lastModified: number;
|
|
3796
3806
|
size: number;
|
|
@@ -3876,4 +3886,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3876
3886
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3877
3887
|
*/
|
|
3878
3888
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3879
|
-
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, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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,
|
|
3889
|
+
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, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, sortFields, sortDocuments, sortRecipients, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, 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, rotateWebhookSecret, 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, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, 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, 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
|
@@ -270,51 +270,6 @@ function blobToBase64(image) {
|
|
|
270
270
|
function rescale(r, n) {
|
|
271
271
|
return r * n;
|
|
272
272
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
275
|
-
* NOTE: This function mutates the input array.
|
|
276
|
-
*/
|
|
277
|
-
function sortFields(fields) {
|
|
278
|
-
fields.sort((a, b) => {
|
|
279
|
-
const aPage = a.page || 0;
|
|
280
|
-
const bPage = b.page || 0;
|
|
281
|
-
const aX = a.x || 0;
|
|
282
|
-
const aY = (a.y || 0) + (a.height || 0);
|
|
283
|
-
const bX = b.x || 0;
|
|
284
|
-
const bY = (b.y || 0) + (b.height || 0);
|
|
285
|
-
if (aPage !== bPage) {
|
|
286
|
-
return aPage - bPage;
|
|
287
|
-
}
|
|
288
|
-
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
|
289
|
-
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
|
290
|
-
// the division is because no human makes perfect templates and frequently
|
|
291
|
-
// two fields on the "same line" will be slightly offset vertically.
|
|
292
|
-
const divaY = Math.floor(aY / 5);
|
|
293
|
-
const divbY = Math.floor(bY / 5);
|
|
294
|
-
if (divaY !== divbY) {
|
|
295
|
-
return divbY - divaY;
|
|
296
|
-
}
|
|
297
|
-
return aX - bX;
|
|
298
|
-
});
|
|
299
|
-
return fields;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
303
|
-
* NOTE: This function mutates the input array.
|
|
304
|
-
*/
|
|
305
|
-
function sortDocuments(documents) {
|
|
306
|
-
return documents.sort((a, b) =>
|
|
307
|
-
// The Date conversion is unnecessary 90% of the time but is safer, and this isn't something
|
|
308
|
-
// we do much of so in reality it has almmost no impact.
|
|
309
|
-
a.order !== b.order ? a.order - b.order : new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Utility function to sort documents by their order, falling back to created_at.
|
|
313
|
-
* NOTE: This function mutates the input array.
|
|
314
|
-
*/
|
|
315
|
-
function sortRecipients(recipients) {
|
|
316
|
-
return recipients?.sort((a, b) => (a.sequence !== b.sequence ? b.sequence - a.sequence : b.order - a.order));
|
|
317
|
-
}
|
|
318
273
|
|
|
319
274
|
/**
|
|
320
275
|
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
@@ -1813,6 +1768,48 @@ const getEnvelopes = (endpoint, params) => endpoint.api //
|
|
|
1813
1768
|
*/
|
|
1814
1769
|
const getEnvelopesZip = (endpoint, envelope_ids) => endpoint.api //
|
|
1815
1770
|
.get(`/v2/envelopes/zip/${envelope_ids.join(',')}`, { responseType: 'blob', timeout: 120000 });
|
|
1771
|
+
/**
|
|
1772
|
+
* Utility function to sort fields by page, then by Y coordinate, then by X coordinate.
|
|
1773
|
+
* NOTE: This function mutates the input array.
|
|
1774
|
+
*/
|
|
1775
|
+
function sortFields(fields) {
|
|
1776
|
+
fields.sort((a, b) => {
|
|
1777
|
+
const aPage = a.page || 0;
|
|
1778
|
+
const bPage = b.page || 0;
|
|
1779
|
+
const aX = a.x || 0;
|
|
1780
|
+
const aY = (a.y || 0) + (a.height || 0);
|
|
1781
|
+
const bX = b.x || 0;
|
|
1782
|
+
const bY = (b.y || 0) + (b.height || 0);
|
|
1783
|
+
if (aPage !== bPage) {
|
|
1784
|
+
return aPage - bPage;
|
|
1785
|
+
}
|
|
1786
|
+
const divaY = Math.floor(aY / 5);
|
|
1787
|
+
const divbY = Math.floor(bY / 5);
|
|
1788
|
+
if (divaY !== divbY) {
|
|
1789
|
+
// Unlike the other properties, Y coordinates have 0,0 at the BOTTOM LEFT corner, so
|
|
1790
|
+
// we need to sort descending (b first) on this one.
|
|
1791
|
+
return divbY - divaY;
|
|
1792
|
+
}
|
|
1793
|
+
return aX - bX;
|
|
1794
|
+
});
|
|
1795
|
+
return fields;
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1799
|
+
* NOTE: This function mutates the input array.
|
|
1800
|
+
*/
|
|
1801
|
+
function sortDocuments(documents) {
|
|
1802
|
+
// The Date conversion is unnecessary 90% of the time but is safer, and this isn't something
|
|
1803
|
+
// we do much of so in reality it has almmost no impact.
|
|
1804
|
+
return documents.sort((a, b) => a.order - b.order || new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Utility function to sort documents by their order, falling back to created_at.
|
|
1808
|
+
* NOTE: This function mutates the input array.
|
|
1809
|
+
*/
|
|
1810
|
+
function sortRecipients(recipients) {
|
|
1811
|
+
return recipients?.sort((a, b) => a.sequence - b.sequence || a.order - b.order);
|
|
1812
|
+
}
|
|
1816
1813
|
|
|
1817
1814
|
const canPerformTemplateAction = (profile, action, template) => {
|
|
1818
1815
|
if (!template && !action.includes('create')) {
|