@verdocs/js-sdk 4.1.9 → 4.1.10

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
@@ -1765,52 +1765,66 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
1765
1765
  /**
1766
1766
  * An Organization is the top level object for ownership for Members, Documents, and Templates.
1767
1767
  *
1768
+ * NOTE: There is no call specifically to create an organization. Every organization must have
1769
+ * at least one "owner" type member. To create a new organization, call createProfile() with
1770
+ * the desired new orgName to create. The caller will become the first owner of the new org, and
1771
+ * can then invite new members to join as well.
1772
+ *
1773
+ * NOTE: There is no call to delete an organization. For safety, this is a manual process. Please
1774
+ * contact support@verdocs.com if you wish to completely delete an organization and all its records.
1775
+ *
1768
1776
  * @module
1769
1777
  */
1770
1778
  /**
1771
1779
  * Get a list of organizations the caller is a member of.
1780
+ *
1781
+ * ```typescript
1782
+ * import {getOrganizations} from '@verdocs/js-sdk';
1783
+ *
1784
+ * const organizations = await getOrganizations(VerdocsEndpoint.getDefault());
1785
+ * ```
1772
1786
  */
1773
1787
  const getOrganizations = (endpoint) => endpoint.api //
1774
1788
  .get('/v2/organizations')
1775
1789
  .then((r) => r.data);
1776
1790
  /**
1777
1791
  * Get an organization by ID.
1792
+ *
1793
+ * ```typescript
1794
+ * import {getOrganization} from '@verdocs/js-sdk';
1795
+ *
1796
+ * const organizations = await getOrganization(VerdocsEndpoint.getDefault(), 'ORGID');
1797
+ * ```
1778
1798
  */
1779
1799
  const getOrganization = (endpoint, organizationId) => endpoint.api //
1780
1800
  .get(`/v2/organizations/${organizationId}`)
1781
1801
  .then((r) => r.data);
1782
1802
  /**
1783
- * Create an organization.
1784
- */
1785
- const createOrganization = (endpoint) => endpoint.api //
1786
- .post('/v2/organizations')
1787
- .then((r) => r.data);
1788
- /**
1789
- * Delete an organization.
1790
- */
1791
- const deleteOrganization = (endpoint, organizationId) => endpoint.api //
1792
- .delete(`/v2/organizations/${organizationId}`)
1793
- .then((r) => r.data);
1794
- /**
1795
- * Update an organization.
1803
+ * Update an organization. This can only be called by an admin or owner.
1804
+ *
1805
+ * ```typescript
1806
+ * import {updateOrganization} from '@verdocs/js-sdk';
1807
+ *
1808
+ * const organizations = await updateOrganization(VerdocsEndpoint.getDefault(), organizationId, {name:'ORGNAME'});
1809
+ * ```
1796
1810
  */
1797
1811
  const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
1798
1812
  .patch(`/v2/organizations/${organizationId}`, params)
1799
1813
  .then((r) => r.data);
1800
1814
  /**
1801
- * Update the organization's logo. This can only be called by an admin or owner of the organization.
1815
+ * Update the organization's logo. This can only be called by an admin or owner.
1802
1816
  *
1803
1817
  * ```typescript
1804
1818
  * import {uploadOrganizationLogo} from '@verdocs/js-sdk';
1805
1819
  *
1806
- * await uploadOrganizationLogo((VerdocsEndpoint.getDefault(), file);
1820
+ * await uploadOrganizationLogo((VerdocsEndpoint.getDefault(), organizationId, file);
1807
1821
  * ```
1808
1822
  */
1809
- const uploadOrganizationLogo = (endpoint, file, onUploadProgress) => {
1823
+ const uploadOrganizationLogo = (endpoint, organizationId, file, onUploadProgress) => {
1810
1824
  const formData = new FormData();
1811
- formData.append('document', file, file.name);
1825
+ formData.append('logo', file, file.name);
1812
1826
  return endpoint.api //
1813
- .post(`/v2/organizations/logo`, formData, {
1827
+ .patch(`/v2/organizations/${organizationId}`, formData, {
1814
1828
  timeout: 120000,
1815
1829
  onUploadProgress: (event) => {
1816
1830
  const total = event.total || 1;
@@ -1821,19 +1835,19 @@ const uploadOrganizationLogo = (endpoint, file, onUploadProgress) => {
1821
1835
  .then((r) => r.data);
1822
1836
  };
1823
1837
  /**
1824
- * Update the organization's thumbnail. This can only be called by an admin or owner of the organization.
1838
+ * Update the organization's thumbnail. This can only be called by an admin or owner.
1825
1839
  *
1826
1840
  * ```typescript
1827
1841
  * import {uploadOrganizationThumbnail} from '@verdocs/js-sdk';
1828
1842
  *
1829
- * await uploadOrganizationThumbnail((VerdocsEndpoint.getDefault(), file);
1843
+ * await uploadOrganizationThumbnail((VerdocsEndpoint.getDefault(), organizationId, file);
1830
1844
  * ```
1831
1845
  */
1832
- const uploadOrganizationThumbnail = (endpoint, file, onUploadProgress) => {
1846
+ const uploadOrganizationThumbnail = (endpoint, organizationId, file, onUploadProgress) => {
1833
1847
  const formData = new FormData();
1834
- formData.append('document', file, file.name);
1848
+ formData.append('thumbnail', file, file.name);
1835
1849
  return endpoint.api //
1836
- .post(`/v2/organizations/thumbnail`, formData, {
1850
+ .patch(`/v2/organizations/${organizationId}`, formData, {
1837
1851
  timeout: 120000,
1838
1852
  onUploadProgress: (event) => {
1839
1853
  const total = event.total || 1;
@@ -2660,7 +2674,7 @@ const getProfiles = (endpoint) => endpoint.api //
2660
2674
  * ```typescript
2661
2675
  * import {getCurrentProfile} from '@verdocs/js-sdk';
2662
2676
  *
2663
- * const profiles = await getCurrentProfile();
2677
+ * const profiles = await getCurrentProfile(VerdocsEndpoint.getDefault());
2664
2678
  * ```
2665
2679
  */
2666
2680
  const getCurrentProfile = (endpoint) => endpoint.api //
@@ -2668,12 +2682,11 @@ const getCurrentProfile = (endpoint) => endpoint.api //
2668
2682
  .then((r) => (r.data || []).find((profile) => profile.current));
2669
2683
  /**
2670
2684
  * Get a profile. The caller must have admin access to the given profile.
2671
- * TODO: Add a "public" profile endpoint for public pages
2672
2685
  *
2673
2686
  * ```typescript
2674
2687
  * import {getProfile} from '@verdocs/js-sdk';
2675
2688
  *
2676
- * const profile = await getProfile('PROFILEID');
2689
+ * const profile = await getProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2677
2690
  * ```
2678
2691
  */
2679
2692
  const getProfile = (endpoint, profileId) => endpoint.api //
@@ -2687,7 +2700,7 @@ const getProfile = (endpoint, profileId) => endpoint.api //
2687
2700
  * ```typescript
2688
2701
  * import {switchProfile} from '@verdocs/js-sdk';
2689
2702
  *
2690
- * const newProfile = await switchProfile('PROFILEID');
2703
+ * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2691
2704
  * ```
2692
2705
  */
2693
2706
  const switchProfile = (endpoint, profileId) => endpoint.api //
@@ -2700,7 +2713,7 @@ const switchProfile = (endpoint, profileId) => endpoint.api //
2700
2713
  * ```typescript
2701
2714
  * import {updateProfile} from '@verdocs/js-sdk/Users';
2702
2715
  *
2703
- * const newProfile = await updateProfile('PROFILEID');
2716
+ * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2704
2717
  * ```
2705
2718
  */
2706
2719
  const updateProfile = (endpoint, profileId, params) => endpoint.api //
@@ -2713,7 +2726,7 @@ const updateProfile = (endpoint, profileId, params) => endpoint.api //
2713
2726
  * ```typescript
2714
2727
  * import {deleteProfile} from '@verdocs/js-sdk';
2715
2728
  *
2716
- * await deleteProfile('PROFILEID');
2729
+ * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2717
2730
  * ```
2718
2731
  */
2719
2732
  const deleteProfile = (endpoint, profileId) => endpoint.api //
@@ -2737,7 +2750,7 @@ const deleteProfile = (endpoint, profileId) => endpoint.api //
2737
2750
  * ```typescript
2738
2751
  * import {createProfile} from '@verdocs/js-sdk';
2739
2752
  *
2740
- * const newSession = await createProfile({
2753
+ * const newSession = await createProfile(VerdocsEndpoint.getDefault(), {
2741
2754
  * orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
2742
2755
  * });
2743
2756
  * ```
@@ -2769,5 +2782,5 @@ const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
2769
2782
  .then((r) => r.data);
2770
2783
  };
2771
2784
 
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, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, uploadOrganizationLogo, uploadOrganizationThumbnail, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2785
+ export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, 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, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, uploadOrganizationLogo, uploadOrganizationThumbnail, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2773
2786
  //# sourceMappingURL=index.mjs.map