@verdocs/js-sdk 4.1.6 → 4.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1383,6 +1383,35 @@ const createInitials = (endpoint, name, initials) => {
1383
1383
  .then((r) => r.data);
1384
1384
  };
1385
1385
 
1386
+ /**
1387
+ * Get the current KBA status. Note that this may only be called by the recipient and requires a
1388
+ * valid signing session to proceed. Although the Recipient object itself contains indications of
1389
+ * whether KBA is required, it will not contain the current status of the process. If
1390
+ * `recipient.kba_method` is set (not null), and `recipient.kba_completed` is false, this endpoint
1391
+ * should be called to determine the next KBA step required.
1392
+ */
1393
+ const getKbaStatus = (endpoint, envelopeId, roleName) => endpoint.api //
1394
+ .get(`/v2/kba/${envelopeId}/${encodeURIComponent(roleName)}`)
1395
+ .then((r) => r.data);
1396
+ /**
1397
+ * Submit a response to a KBA PIN challenge.
1398
+ */
1399
+ const submitKbaPin = (endpoint, envelopeId, roleName, pin) => endpoint.api //
1400
+ .post(`/v2/kba/pin`, { envelopeId, roleName, pin })
1401
+ .then((r) => r.data);
1402
+ /**
1403
+ * Submit an identity response to a KBA challenge.
1404
+ */
1405
+ const submitKbaIdentity = (endpoint, envelopeId, roleName, identity) => endpoint.api //
1406
+ .post(`/v2/kba/identity`, { envelopeId, roleName, identity })
1407
+ .then((r) => r.data);
1408
+ /**
1409
+ * Submit an identity response to a KBA challenge.
1410
+ */
1411
+ const submitKbaChallengeResponse = (endpoint, envelopeId, roleName, response) => endpoint.api //
1412
+ .post(`/v2/kba/response`, { envelopeId, roleName, response })
1413
+ .then((r) => r.data);
1414
+
1386
1415
  /**
1387
1416
  * Update a recipient's status block
1388
1417
  */
@@ -1768,6 +1797,52 @@ const deleteOrganization = (endpoint, organizationId) => endpoint.api //
1768
1797
  const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
1769
1798
  .patch(`/v2/organizations/${organizationId}`, params)
1770
1799
  .then((r) => r.data);
1800
+ /**
1801
+ * Update the organization's logo. This can only be called by an admin or owner of the organization.
1802
+ *
1803
+ * ```typescript
1804
+ * import {uploadOrganizationLogo} from '@verdocs/js-sdk';
1805
+ *
1806
+ * await uploadOrganizationLogo((VerdocsEndpoint.getDefault(), file);
1807
+ * ```
1808
+ */
1809
+ const uploadOrganizationLogo = (endpoint, file, onUploadProgress) => {
1810
+ const formData = new FormData();
1811
+ formData.append('document', file, file.name);
1812
+ return endpoint.api //
1813
+ .post(`/v2/organizations/logo`, formData, {
1814
+ timeout: 120000,
1815
+ onUploadProgress: (event) => {
1816
+ const total = event.total || 1;
1817
+ const loaded = event.loaded || 0;
1818
+ onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
1819
+ },
1820
+ })
1821
+ .then((r) => r.data);
1822
+ };
1823
+ /**
1824
+ * Update the organization's thumbnail. This can only be called by an admin or owner of the organization.
1825
+ *
1826
+ * ```typescript
1827
+ * import {uploadOrganizationThumbnail} from '@verdocs/js-sdk';
1828
+ *
1829
+ * await uploadOrganizationThumbnail((VerdocsEndpoint.getDefault(), file);
1830
+ * ```
1831
+ */
1832
+ const uploadOrganizationThumbnail = (endpoint, file, onUploadProgress) => {
1833
+ const formData = new FormData();
1834
+ formData.append('document', file, file.name);
1835
+ return endpoint.api //
1836
+ .post(`/v2/organizations/thumbnail`, formData, {
1837
+ timeout: 120000,
1838
+ onUploadProgress: (event) => {
1839
+ const total = event.total || 1;
1840
+ const loaded = event.loaded || 0;
1841
+ onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
1842
+ },
1843
+ })
1844
+ .then((r) => r.data);
1845
+ };
1771
1846
 
1772
1847
  /**
1773
1848
  * Webhooks are callback triggers from Verdocs to your servers that notify your applications
@@ -2670,6 +2745,29 @@ const deleteProfile = (endpoint, profileId) => endpoint.api //
2670
2745
  const createProfile = (endpoint, params) => endpoint.api //
2671
2746
  .post('/v2/profiles', params)
2672
2747
  .then((r) => r.data);
2748
+ /**
2749
+ * Update the caller's profile photo. This can only be called for the user's "current" profile.
2750
+ *
2751
+ * ```typescript
2752
+ * import {uploadProfilePhoto} from '@verdocs/js-sdk';
2753
+ *
2754
+ * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), file);
2755
+ * ```
2756
+ */
2757
+ const uploadProfilePhoto = (endpoint, file, onUploadProgress) => {
2758
+ const formData = new FormData();
2759
+ formData.append('document', file, file.name);
2760
+ return endpoint.api //
2761
+ .post(`/v2/profiles/picture`, formData, {
2762
+ timeout: 120000,
2763
+ onUploadProgress: (event) => {
2764
+ const total = event.total || 1;
2765
+ const loaded = event.loaded || 0;
2766
+ onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
2767
+ },
2768
+ })
2769
+ .then((r) => r.data);
2770
+ };
2673
2771
 
2674
- export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganization, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganization, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopesByTemplateId, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateOwnerInfo, getTemplateReminder, getTemplateRole, getTemplateRoleFields, getTemplateRoles, getTemplateTags, getTemplates, getTemplatesSummary, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listEnvelopes, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchEnvelopes, searchTemplates, sendDelegate, setWebhooks, switchProfile, throttledGetEnvelope, throttledGetTemplate, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationMember, updateProfile, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2772
+ export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganization, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganization, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopesByTemplateId, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStatus, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateOwnerInfo, getTemplateReminder, getTemplateRole, getTemplateRoleFields, getTemplateRoles, getTemplateTags, getTemplates, getTemplatesSummary, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listEnvelopes, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchEnvelopes, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, throttledGetEnvelope, throttledGetTemplate, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationMember, updateProfile, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, uploadOrganizationLogo, uploadOrganizationThumbnail, uploadProfilePhoto, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2675
2773
  //# sourceMappingURL=index.mjs.map