@verdocs/js-sdk 4.0.11 → 4.1.1

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
@@ -1217,7 +1217,19 @@ const getEnvelopeRecipients = async (endpoint, envelopeId) => endpoint.api //
1217
1217
  */
1218
1218
  const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
1219
1219
  .get(`/envelopes/${envelopeId}`)
1220
- .then((r) => r.data);
1220
+ .then((r) => {
1221
+ const envelope = r.data;
1222
+ // Post-process the envelope to upgrade to new data fields
1223
+ envelope.documents?.forEach((document) => {
1224
+ if (!document.order) {
1225
+ document.order = 0;
1226
+ }
1227
+ if (document.page_numbers) {
1228
+ document.pages = document.page_numbers;
1229
+ }
1230
+ });
1231
+ return envelope;
1232
+ });
1221
1233
  /**
1222
1234
  * Get an Envelope Document
1223
1235
  */
@@ -1573,61 +1585,61 @@ const deleteSignature = (endpoint, signatureId) => endpoint.api //
1573
1585
  * Get a list of keys for a given organization. The caller must have admin access to the organization.
1574
1586
  *
1575
1587
  * ```typescript
1576
- * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
1588
+ * import {ApiKeys} from '@verdocs/js-sdk';
1577
1589
  *
1578
1590
  * const keys = await ApiKeys.getKeys(ORGID);
1579
1591
  * ```
1580
1592
  */
1581
- const getApiKeys = (endpoint, organizationId) => endpoint.api //
1582
- .get(`/organizations/${organizationId}/api_key`)
1593
+ const getApiKeys = (endpoint) => endpoint.api //
1594
+ .get(`/v2/api-keys`)
1583
1595
  .then((r) => r.data);
1584
1596
  /**
1585
1597
  * Create an API key.
1586
1598
  *
1587
1599
  * ```typescript
1588
- * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
1600
+ * import {ApiKeys} from '@verdocs/js-sdk';
1589
1601
  *
1590
1602
  * await ApiKeys.createKey(ORGID, {name: NEWNAME});
1591
1603
  * ```
1592
1604
  */
1593
- const createApiKey = (endpoint, organizationId, params) => endpoint.api //
1594
- .post(`/organizations/${organizationId}/api_key`, params)
1605
+ const createApiKey = (endpoint, params) => endpoint.api //
1606
+ .post('/v2/api-keys', params)
1595
1607
  .then((r) => r.data);
1596
1608
  /**
1597
1609
  * Rotate the secret for an API key. The caller must have admin access to the organization.
1598
1610
  *
1599
1611
  * ```typescript
1600
- * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
1612
+ * import {ApiKeys} from '@verdocs/js-sdk';
1601
1613
  *
1602
1614
  * const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID);
1603
1615
  * ```
1604
1616
  */
1605
- const rotateApiKey = (endpoint, organizationId, clientId) => endpoint.api //
1606
- .put(`/organizations/${organizationId}/api_key/${clientId}/rotate`)
1617
+ const rotateApiKey = (endpoint, clientId) => endpoint.api //
1618
+ .post(`/v2/api-keys/${clientId}/rotate`)
1607
1619
  .then((r) => r.data);
1608
1620
  /**
1609
1621
  * Update an API key to change its assigned Profile ID or Name.
1610
1622
  *
1611
1623
  * ```typescript
1612
- * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
1624
+ * import {ApiKeys} from '@verdocs/js-sdk';
1613
1625
  *
1614
1626
  * await ApiKeys.updateKey(ORGID, CLIENTID, {name: NEWNAME});
1615
1627
  * ```
1616
1628
  */
1617
- const updateApiKey = (endpoint, organizationId, clientId, params) => endpoint.api //
1618
- .patch(`/organizations/${organizationId}/api_key/${clientId}`, params)
1629
+ const updateApiKey = (endpoint, clientId, params) => endpoint.api //
1630
+ .patch(`/v2/api-keys/${clientId}`, params)
1619
1631
  .then((r) => r.data);
1620
1632
  /**
1621
1633
  * Delete an API key.
1622
1634
  *
1623
1635
  * ```typescript
1624
- * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
1636
+ * import {ApiKeys} from '@verdocs/js-sdk';
1625
1637
  *
1626
1638
  * await ApiKeys.deleteKey(ORGID, CLIENTID);
1627
1639
  * ```
1628
1640
  */
1629
- const deleteApiKey = (endpoint, organizationId, clientId) => endpoint.api //
1630
- .delete(`/organizations/${organizationId}/api_key/${clientId}`)
1641
+ const deleteApiKey = (endpoint, clientId) => endpoint.api //
1642
+ .delete(`/v2/api-keys/${clientId}`)
1631
1643
  .then((r) => r.data);
1632
1644
 
1633
1645
  /**
@@ -1643,52 +1655,37 @@ const deleteApiKey = (endpoint, organizationId, clientId) => endpoint.api //
1643
1655
  * Get a list of groups for a given organization. The caller must have admin access to the organization.
1644
1656
  *
1645
1657
  * ```typescript
1646
- * import {Groups} from '@verdocs/js-sdk/Organizations';
1647
- *
1648
- * const groups = await Groups.getGroups(ORGID);
1649
- * ```
1650
- */
1651
- const getGroups = (endpoint, organizationId) => endpoint.api //
1652
- .get(`/organizations/${organizationId}/groups`)
1653
- .then((r) => r.data);
1654
- /**
1655
- * Get a single group by name. Returns a detail record.
1656
- *
1657
- * ```typescript
1658
- * import {Groups} from '@verdocs/js-sdk/Organizations';
1658
+ * import {getGroups} from '@verdocs/js-sdk';
1659
1659
  *
1660
- * const groups = await Groups.getGroups(ORGID);
1660
+ * const groups = await getGroups(ORGID);
1661
1661
  * ```
1662
1662
  */
1663
- const getGroupByName = (endpoint, organizationId, name) => endpoint.api //
1664
- .get(`/organizations/${organizationId}/groups`, { params: { name } })
1663
+ const getGroups = (endpoint) => endpoint.api //
1664
+ .get(`/v2/organization-groups`)
1665
1665
  .then((r) => r.data);
1666
1666
  /**
1667
- * Get the details for a group.
1667
+ * Get the details for a group, including its member profiles and list of permissions.
1668
1668
  *
1669
1669
  * ```typescript
1670
- * import {Groups} from '@verdocs/js-sdk/Organizations';
1670
+ * import {getGroup} from '@verdocs/js-sdk/v2/organization-groups';
1671
1671
  *
1672
- * const groups = await Groups.getGroups(ORGID);
1672
+ * const groups = await getGroup(GROUPID);
1673
1673
  * ```
1674
1674
  */
1675
- const getGroup = (endpoint, organizationId, groupId) => endpoint.api //
1676
- .get(`/organizations/${organizationId}/groups/${groupId}`)
1677
- .then((r) => r.data);
1678
- const getGroupMembers = (endpoint, organizationId, groupId) => endpoint.api //
1679
- .get(`/organizations/${organizationId}/groups/${groupId}/members`)
1675
+ const getGroup = (endpoint, groupId) => endpoint.api //
1676
+ .get(`/v2/organization-groups/${groupId}`)
1680
1677
  .then((r) => r.data);
1681
- const addGroupMembers = (endpoint, organizationId, groupId, params) => endpoint.api //
1682
- .post(`/organizations/${organizationId}/groups/${groupId}/members`, params)
1678
+ const createGroup = (endpoint, name) => endpoint.api //
1679
+ .post('/v2/organization-groups', { name })
1683
1680
  .then((r) => r.data);
1684
- const deleteGroupMembers = (endpoint, organizationId, groupId, params) => endpoint.api //
1685
- .put(`/organizations/${organizationId}/groups/${groupId}/delete_members`, params)
1681
+ const addGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1682
+ .post(`/v2/organization-groups/${groupId}/members`, { profile_id })
1686
1683
  .then((r) => r.data);
1687
- const addGroupPermission = (endpoint, organizationId, groupId, permission) => endpoint.api //
1688
- .post(`/organizations/${organizationId}/groups/${groupId}/permissions/${permission}`, {})
1684
+ const deleteGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1685
+ .delete(`/v2/organization-groups/${groupId}/members/${profile_id}`)
1689
1686
  .then((r) => r.data);
1690
- const deleteGroupPermission = (endpoint, organizationId, groupId, permission) => endpoint.api //
1691
- .delete(`/organizations/${organizationId}/groups/${groupId}/permissions/${permission}`)
1687
+ const updateGroup = (endpoint, groupId, params) => endpoint.api //
1688
+ .patch(`/v2/organization-groups/${groupId}`, params)
1692
1689
  .then((r) => r.data);
1693
1690
 
1694
1691
  /**
@@ -1696,32 +1693,26 @@ const deleteGroupPermission = (endpoint, organizationId, groupId, permission) =>
1696
1693
  *
1697
1694
  * @module
1698
1695
  */
1699
- const getOrganizationInvitations = (endpoint, organizationId) => endpoint.api //
1700
- .get(`/organizations/${organizationId}/invitation`)
1701
- .then((r) => r.data);
1702
- const createOrganizationInvitation = (endpoint, organizationId, params) => endpoint.api //
1703
- .post(`/organizations/${organizationId}/invitation`, params)
1704
- .then((r) => r.data);
1705
- const deleteOrganizationInvitation = (endpoint, organizationId, email) => endpoint.api //
1706
- .delete(`/organizations/${organizationId}/invitation/${email}`)
1696
+ const getOrganizationInvitations = (endpoint) => endpoint.api //
1697
+ .get(`/v2/organization-invitations`)
1707
1698
  .then((r) => r.data);
1708
- const updateOrganizationInvitation = (endpoint, organizationId, email, params) => endpoint.api //
1709
- .patch(`/organizations/${organizationId}/invitation/${email}`, params)
1699
+ const createOrganizationInvitation = (endpoint, params) => endpoint.api //
1700
+ .post(`/v2/organization-invitations`, params)
1710
1701
  .then((r) => r.data);
1711
- const resendOrganizationInvitation = (endpoint, organizationId, email) => endpoint.api //
1712
- .post(`/organizations/${organizationId}/invitation/${email}/resend`)
1702
+ const deleteOrganizationInvitation = (endpoint, email) => endpoint.api //
1703
+ .delete(`/v2/organization-invitations/${email}`)
1713
1704
  .then((r) => r.data);
1714
- const getOrganizationInvitation = (endpoint, organizationId, email, token) => endpoint.api //
1715
- .get(`/organizations/${organizationId}/invitation/${email}/accept/${token}`)
1705
+ const updateOrganizationInvitation = (endpoint, email, params) => endpoint.api //
1706
+ .patch(`/v2/organization-invitations/${email}`, params)
1716
1707
  .then((r) => r.data);
1717
- const acceptOrganizationInvitation = (endpoint, organizationId, email, token) => endpoint.api //
1718
- .post(`/organizations/${organizationId}/invitation/${email}/accept/${token}`)
1708
+ const resendOrganizationInvitation = (endpoint, email) => endpoint.api //
1709
+ .post('/v2/organization-invitations/resend', { email })
1719
1710
  .then((r) => r.data);
1720
- const declineOrganizationInvitation = (endpoint, organizationId, email, token) => endpoint.api //
1721
- .post(`/organizations/${organizationId}/invitation/${email}/decline/${token}`)
1711
+ const acceptOrganizationInvitation = (endpoint, email, token) => endpoint.api //
1712
+ .post('/v2/organization-invitations/accept', { email, token })
1722
1713
  .then((r) => r.data);
1723
- const claimNewUser = (endpoint, organizationId, email, token) => endpoint.api //
1724
- .put(`/organizations/${organizationId}/invitation/${email}/token/${token}/new_user`)
1714
+ const declineOrganizationInvitation = (endpoint, email, token) => endpoint.api //
1715
+ .post('/v2/organization-invitations/decline', { email, token })
1725
1716
  .then((r) => r.data);
1726
1717
 
1727
1718
  /**
@@ -1729,20 +1720,14 @@ const claimNewUser = (endpoint, organizationId, email, token) => endpoint.api //
1729
1720
  *
1730
1721
  * @module
1731
1722
  */
1732
- const getOrganizationMembers = (endpoint, organizationId) => endpoint.api //
1733
- .get(`/organizations/${organizationId}/profiles`)
1723
+ const getOrganizationMembers = (endpoint) => endpoint.api //
1724
+ .get(`/v2/organization-members`)
1734
1725
  .then((r) => r.data);
1735
- const deleteOrganizationMember = (endpoint, organizationId, profileId) => endpoint.api //
1736
- .delete(`/organizations/${organizationId}/profiles/${profileId}`)
1726
+ const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
1727
+ .delete(`/v2/organization-members/${profileId}`)
1737
1728
  .then((r) => r.data);
1738
- const addOrganizationMemberRole = (endpoint, organizationId, profileId, roleId) => endpoint.api //
1739
- .post(`/organizations/${organizationId}/profiles/${profileId}/role/${roleId}`)
1740
- .then((r) => r.data);
1741
- const deleteOrganizationMemberRole = (endpoint, organizationId, profileId, roleId) => endpoint.api //
1742
- .delete(`/organizations/${organizationId}/profiles/${profileId}/role/${roleId}`)
1743
- .then((r) => r.data);
1744
- const getOrganizationMemberPlans = (endpoint, organizationId, profileId) => endpoint.api //
1745
- .get(`/organizations/${organizationId}/profiles/${profileId}/plans`)
1729
+ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api //
1730
+ .patch(`/v2/organization-members/${profileId}`, params)
1746
1731
  .then((r) => r.data);
1747
1732
 
1748
1733
  /**
@@ -1751,41 +1736,53 @@ const getOrganizationMemberPlans = (endpoint, organizationId, profileId) => endp
1751
1736
  * @module
1752
1737
  */
1753
1738
  /**
1754
- * Get a list of organizations the user has access to.
1739
+ * Get a list of organizations the caller is a member of.
1755
1740
  */
1756
1741
  const getOrganizations = (endpoint) => endpoint.api //
1757
- .get('/organizations')
1742
+ .get('/v2/organizations')
1743
+ .then((r) => r.data);
1744
+ /**
1745
+ * Get an organization by ID.
1746
+ */
1747
+ const getOrganization = (endpoint, organizationId) => endpoint.api //
1748
+ .get(`/v2/organizations/${organizationId}`)
1758
1749
  .then((r) => r.data);
1759
1750
  /**
1760
1751
  * Create an organization.
1761
1752
  */
1762
1753
  const createOrganization = (endpoint) => endpoint.api //
1763
- .post('/organizations')
1754
+ .post('/v2/organizations')
1764
1755
  .then((r) => r.data);
1765
1756
  /**
1766
1757
  * Delete an organization.
1767
1758
  */
1768
1759
  const deleteOrganization = (endpoint, organizationId) => endpoint.api //
1769
- .delete(`/organizations/${organizationId}`)
1770
- .then((r) => r.data);
1771
- /**
1772
- * Get an organization by ID.
1773
- */
1774
- const getOrganization = (endpoint, organizationId) => endpoint.api //
1775
- .get(`/organizations/${organizationId}`)
1760
+ .delete(`/v2/organizations/${organizationId}`)
1776
1761
  .then((r) => r.data);
1777
1762
  /**
1778
1763
  * Update an organization.
1779
1764
  */
1780
1765
  const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
1781
- .patch(`/organizations/${organizationId}`, params)
1766
+ .patch(`/v2/organizations/${organizationId}`, params)
1782
1767
  .then((r) => r.data);
1783
1768
 
1769
+ /**
1770
+ * Webhooks are callback triggers from Verdocs to your servers that notify your applications
1771
+ * of various events, such as signing operations.
1772
+ *
1773
+ * @module
1774
+ */
1775
+ /**
1776
+ * Get the registered Webhooks for the caller's organization.
1777
+ */
1784
1778
  const getWebhooks = (endpoint) => endpoint.api //
1785
1779
  .get(`/v2/webhooks/organization`)
1786
1780
  .then((r) => r.data);
1781
+ /**
1782
+ * Update the registered Webhooks for the caller's organization.
1783
+ */
1787
1784
  const setWebhooks = (endpoint, params) => endpoint.api //
1788
- .post(`/v2/webhooks/organization`, params)
1785
+ .patch(`/v2/webhooks/organization`, params)
1789
1786
  .then((r) => r.data);
1790
1787
 
1791
1788
  /**
@@ -2155,7 +2152,27 @@ const getTemplates = (endpoint, params) => endpoint.api //
2155
2152
  */
2156
2153
  const getTemplate = (endpoint, templateId) => endpoint.api //
2157
2154
  .get(`/templates/${templateId}`)
2158
- .then((r) => r.data);
2155
+ .then((r) => {
2156
+ const template = r.data;
2157
+ // Post-process the template to upgrade to new data fields
2158
+ if (!template.documents && template.template_documents) {
2159
+ template.documents = template.template_documents;
2160
+ }
2161
+ template.documents?.forEach((document) => {
2162
+ if (!document.order) {
2163
+ document.order = 0;
2164
+ }
2165
+ if (document.page_numbers) {
2166
+ document.pages = document.page_numbers;
2167
+ }
2168
+ });
2169
+ template.fields?.forEach((field) => {
2170
+ if (field.setting) {
2171
+ field.settings = field.setting;
2172
+ }
2173
+ });
2174
+ return template;
2175
+ });
2159
2176
  /**
2160
2177
  * Get owner information for a template.
2161
2178
  *
@@ -2469,7 +2486,7 @@ const authenticateUser = (endpoint, params) => endpoint.api //
2469
2486
  * NodeJS server-side applications. Never expose your Client Secret in a Web or Mobile app!** Also note
2470
2487
  * that access tokens may be cached by server-side apps (and this is recommended) but do expire after 2
2471
2488
  * hours. This expiration may change based on future security needs. Application developers are encouraged
2472
- * to check the `exp` expiration field in the response accessToken and renew tokens after they expire.
2489
+ * to check the `exp` expiration field in the response, and renew tokens after they expire.
2473
2490
  *
2474
2491
  * ```typescript
2475
2492
  * import {Auth} from '@verdocs/js-sdk/Auth';
@@ -2482,23 +2499,6 @@ const authenticateUser = (endpoint, params) => endpoint.api //
2482
2499
  const authenticateApp = (endpoint, params) => endpoint.api //
2483
2500
  .post('/authentication/login_client', {}, { headers: params })
2484
2501
  .then((r) => r.data);
2485
- /**
2486
- * Validate a token. Only Verdocs tokens will be accepted. Most applications can decode tokens locally,
2487
- * because tokens will be validated when API calls are made anyway. However, high-security applications
2488
- * may use this endpoint to check if a token has been revoked.
2489
- *
2490
- * ```typescript
2491
- * import {Auth} from '@verdocs/js-sdk/Auth';
2492
- *
2493
- * const {valid} = await Auth.validateToken({ token });
2494
- * if (!valid) {
2495
- * window.alert('Session invalid or expired. Please re-authenticate.');
2496
- * }
2497
- * ```
2498
- */
2499
- const validateToken = (endpoint, params) => endpoint.api //
2500
- .post('/token/isValid', params)
2501
- .then((r) => r.data);
2502
2502
  /**
2503
2503
  * If called before the session expires, this will refresh the caller's session and tokens.
2504
2504
  *
@@ -2514,7 +2514,7 @@ const refreshTokens = (endpoint) => endpoint.api //
2514
2514
  .get('/token')
2515
2515
  .then((r) => r.data);
2516
2516
  /**
2517
- * Update the caller's password. To help prevent CSRF attack vectors, the user's old password and email address are required.
2517
+ * Update the caller's password when the old password is known (typically for logged-in users).
2518
2518
  *
2519
2519
  * ```typescript
2520
2520
  * import {Auth} from '@verdocs/js-sdk/Auth';
@@ -2525,11 +2525,11 @@ const refreshTokens = (endpoint) => endpoint.api //
2525
2525
  * }
2526
2526
  * ```
2527
2527
  */
2528
- const updatePassword = (endpoint, params) => endpoint.api //
2528
+ const changePassword = (endpoint, params) => endpoint.api //
2529
2529
  .put('/user/update_password', params)
2530
2530
  .then((r) => r.data);
2531
2531
  /**
2532
- * Reset the caller's password.
2532
+ * Request a password reset, when the old password is not known (typically in login forms).
2533
2533
  *
2534
2534
  * ```typescript
2535
2535
  * import {Auth} from '@verdocs/js-sdk/Auth';
@@ -2543,18 +2543,6 @@ const updatePassword = (endpoint, params) => endpoint.api //
2543
2543
  const resetPassword = (endpoint, params) => endpoint.api //
2544
2544
  .post('/user/reset_password', params)
2545
2545
  .then((r) => r.data);
2546
- /**
2547
- * Update the caller's email address.
2548
- *
2549
- * ```typescript
2550
- * import {Auth} from '@verdocs/js-sdk/Auth';
2551
- *
2552
- * const {profiles} = await Auth.updateEmail({ email: newEmail });
2553
- * ```
2554
- */
2555
- const updateEmail = (endpoint, params) => endpoint.api //
2556
- .put('/user/update_email', params)
2557
- .then((r) => r.data);
2558
2546
  /**
2559
2547
  * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
2560
2548
  * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
@@ -2571,15 +2559,9 @@ const updateEmail = (endpoint, params) => endpoint.api //
2571
2559
  const resendVerification = (endpoint, accessToken) => endpoint.api //
2572
2560
  .post('/user/email_verification', {}, accessToken ? { headers: { Authorization: `Bearer ${accessToken}` } } : {})
2573
2561
  .then((r) => r.data);
2574
- const createUser = (endpoint, params) => endpoint.api //
2575
- .post('/user', params)
2576
- .then((r) => r.data);
2577
-
2578
- // TODO
2579
- const billingPlaceholder = {};
2580
2562
 
2581
2563
  const getNotifications = async (endpoint) => endpoint.api //
2582
- .get('/notifications')
2564
+ .get('/v2/notifications')
2583
2565
  .then((r) => r.data);
2584
2566
 
2585
2567
  /**
@@ -2592,7 +2574,7 @@ const getNotifications = async (endpoint) => endpoint.api //
2592
2574
  * ```
2593
2575
  */
2594
2576
  const getProfiles = (endpoint) => endpoint.api //
2595
- .get('/profiles')
2577
+ .get('/v2/profiles')
2596
2578
  .then((r) => r.data);
2597
2579
  /**
2598
2580
  * Get the user's available profiles. The current profile will be marked with `current: true`.
@@ -2604,20 +2586,8 @@ const getProfiles = (endpoint) => endpoint.api //
2604
2586
  * ```
2605
2587
  */
2606
2588
  const getCurrentProfile = (endpoint) => endpoint.api //
2607
- .get('/profiles')
2589
+ .get('/v2/profiles')
2608
2590
  .then((r) => (r.data || []).find((profile) => profile.current));
2609
- /**
2610
- * Get a list of system roles.
2611
- *
2612
- * ```typescript
2613
- * import {Profiles} from '@verdocs/js-sdk/Users';
2614
- *
2615
- * const roles = await Profiles.getRoles();
2616
- * ```
2617
- */
2618
- const getRoles = (endpoint) => endpoint.api //
2619
- .get('/roles')
2620
- .then((r) => r.data);
2621
2591
  /**
2622
2592
  * Create a profile. If the caller does not have a "current" profile set, the new profile will be made current.
2623
2593
  *
@@ -2628,7 +2598,7 @@ const getRoles = (endpoint) => endpoint.api //
2628
2598
  * ```
2629
2599
  */
2630
2600
  const createProfile = (endpoint, params) => endpoint.api //
2631
- .post('/profiles', params)
2601
+ .post('/v2/profiles', params)
2632
2602
  .then((r) => r.data);
2633
2603
  /**
2634
2604
  * Get a profile. The caller must have admin access to the given profile.
@@ -2641,19 +2611,7 @@ const createProfile = (endpoint, params) => endpoint.api //
2641
2611
  * ```
2642
2612
  */
2643
2613
  const getProfile = (endpoint, profileId) => endpoint.api //
2644
- .get(`/profiles/${profileId}`)
2645
- .then((r) => r.data);
2646
- /**
2647
- * Get a profile's groups.
2648
- *
2649
- * ```typescript
2650
- * import {Profiles} from '@verdocs/js-sdk/Users';
2651
- *
2652
- * const groups = await Profiles.getProfileGroups('PROFILEID');
2653
- * ```
2654
- */
2655
- const getProfileGroups = (endpoint, profileId) => endpoint.api //
2656
- .get(`/profiles/${profileId}/groups`)
2614
+ .get(`/v2/profiles/${profileId}`)
2657
2615
  .then((r) => r.data);
2658
2616
  /**
2659
2617
  * Switch the caller's "current" profile. The current profile is used for permissions checking and profile_id field settings
@@ -2666,7 +2624,7 @@ const getProfileGroups = (endpoint, profileId) => endpoint.api //
2666
2624
  * ```
2667
2625
  */
2668
2626
  const switchProfile = (endpoint, profileId) => endpoint.api //
2669
- .post(`/profiles/${profileId}/switch`)
2627
+ .post(`/v2/profiles/${profileId}/switch`)
2670
2628
  .then((r) => r.data);
2671
2629
  /**
2672
2630
  * Update a profile. For future expansion, the profile ID to update is required, but currently this must also be the
@@ -2679,11 +2637,8 @@ const switchProfile = (endpoint, profileId) => endpoint.api //
2679
2637
  * ```
2680
2638
  */
2681
2639
  const updateProfile = (endpoint, profileId, params) => endpoint.api //
2682
- .put(`/profiles/${profileId}`, params, { baseURL: endpoint.getBaseURLv2() })
2640
+ .patch(`/v2/profiles/${profileId}`, params)
2683
2641
  .then((r) => r.data);
2684
- // endpoint.api //
2685
- // .post<IEnvelopeSummaries>('/envelopes/list', params, {baseURL: endpoint.getBaseURLv2()})
2686
- // .then((r) => r.data);
2687
2642
  /**
2688
2643
  * Delete a profile. If the requested profile is the caller's curent profile, the next available profile will be selected.
2689
2644
  *
@@ -2694,7 +2649,7 @@ const updateProfile = (endpoint, profileId, params) => endpoint.api //
2694
2649
  * ```
2695
2650
  */
2696
2651
  const deleteProfile = (endpoint, profileId) => endpoint.api //
2697
- .delete(`/profiles/${profileId}`)
2652
+ .delete(`/v2/profiles/${profileId}`)
2698
2653
  .then((r) => r.data);
2699
2654
  /**
2700
2655
  * Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
@@ -2708,12 +2663,12 @@ const deleteProfile = (endpoint, profileId) => endpoint.api //
2708
2663
  * });
2709
2664
  * ```
2710
2665
  */
2711
- const createBusinessAccount = (endpoint, params) => endpoint.api //
2666
+ const createAccount = (endpoint, params) => endpoint.api //
2712
2667
  .post('/user/business', params)
2713
2668
  .then((r) => r.data);
2714
2669
  const recordSignupSurvey = (endpoint, params) => endpoint.api //
2715
2670
  .post('/user/signup', params)
2716
2671
  .then((r) => r.data);
2717
2672
 
2718
- export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMembers, addGroupPermission, addOrganizationMemberRole, addTemplateTag, authenticateApp, authenticateUser, billingPlaceholder, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, claimNewUser, convertToE164, createApiKey, createBusinessAccount, createEnvelope, createEnvelopeReminder, createField, createInitials, createOrganization, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, createUser, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMembers, deleteGroupPermission, deleteOrganization, deleteOrganizationInvitation, deleteOrganizationMember, deleteOrganizationMemberRole, 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, getGroupByName, getGroupMembers, getGroups, getInPersonLink, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMemberPlans, getOrganizationMembers, getOrganizations, getPlusOneCountry, getProfile, getProfileGroups, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getRoles, 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, recordSignupSurvey, refreshTokens, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchEnvelopes, searchTemplates, sendDelegate, setWebhooks, switchProfile, throttledGetEnvelope, throttledGetTemplate, timePeriod, toggleStar, updateApiKey, updateEmail, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateOrganization, updateOrganizationInvitation, updatePassword, 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, validateToken };
2673
+ export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticateApp, authenticateUser, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createAccount, 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, 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, recordSignupSurvey, refreshTokens, 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 };
2719
2674
  //# sourceMappingURL=index.mjs.map