@verdocs/js-sdk 4.1.10 → 4.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1636,6 +1636,8 @@ interface IUpdateApiKeyRequest {
1636
1636
  }
1637
1637
  interface ICreateInvitationRequest {
1638
1638
  email: string;
1639
+ first_name: string;
1640
+ last_name: string;
1639
1641
  role: TRole;
1640
1642
  }
1641
1643
  interface ISetWebhookRequest {
@@ -1727,18 +1729,297 @@ declare const deleteGroupMember: (endpoint: VerdocsEndpoint, groupId: string, pr
1727
1729
  declare const updateGroup: (endpoint: VerdocsEndpoint, groupId: string, params: {
1728
1730
  permissions: TPermission[];
1729
1731
  }) => Promise<any>;
1732
+ interface IUpdateProfileRequest {
1733
+ first_name?: string;
1734
+ last_name?: string;
1735
+ // email?: string;
1736
+ phone?: string;
1737
+ permissions?: TPermission[];
1738
+ roles?: TRole[];
1739
+ }
1740
+ interface IAuthenticateResponse {
1741
+ access_token: string;
1742
+ id_token: string;
1743
+ refresh_token: string;
1744
+ expires_in: number;
1745
+ access_token_exp: number;
1746
+ refresh_token_exp: number;
1747
+ }
1748
+ interface IUpdatePasswordRequest {
1749
+ email: string;
1750
+ oldPassword: string;
1751
+ newPassword: string;
1752
+ }
1753
+ interface IUpdatePasswordResponse {
1754
+ status: TRequestStatus;
1755
+ /** Success or failure message */
1756
+ message: string;
1757
+ }
1758
+ interface ICreateAccountRequest {
1759
+ email: string;
1760
+ password: string;
1761
+ firstName: string;
1762
+ lastName: string;
1763
+ orgName: string;
1764
+ }
1765
+ interface IROPCRequest {
1766
+ grant_type: "password";
1767
+ username: string;
1768
+ password: string;
1769
+ client_id?: string;
1770
+ scope?: string;
1771
+ }
1772
+ interface IClientCredentialsRequest {
1773
+ grant_type: "client_credentials";
1774
+ client_id: string;
1775
+ client_secret: string;
1776
+ scope?: string;
1777
+ }
1778
+ interface IRefreshTokenRequest {
1779
+ grant_type: "refresh_token";
1780
+ refresh_token: string;
1781
+ client_id?: string;
1782
+ scope?: string;
1783
+ }
1784
+ type TAuthenticationRequest = IROPCRequest | IClientCredentialsRequest | IRefreshTokenRequest;
1785
+ /**
1786
+ * Authenticate to Verdocs.
1787
+ *
1788
+ * ```typescript
1789
+ * import {authenticate, VerdocsEndpoint} from '@verdocs/js-sdk';
1790
+ *
1791
+ * // Client-side call, suitable for Web and mobile apps:
1792
+ * const {access_token} = await Auth.authenticate({ username: 'test@test.com', password: 'PASSWORD', grant_type:'password' });
1793
+ * VerdocsEndpoint.getDefault().setAuthToken(access_token);
1794
+ *
1795
+ * // Server-side call, suitable for server apps. NEVER EXPOSE client_secret IN FRONT-END CODE:
1796
+ * const {access_token} = await Auth.authenticate({ client_id: '...', client_secret: '...', grant_type:'client_credentials' });
1797
+ * VerdocsEndpoint.getDefault().setAuthToken(access_token);
1798
+ * ```
1799
+ */
1800
+ declare const authenticate: (endpoint: VerdocsEndpoint, params: TAuthenticationRequest) => Promise<IAuthenticateResponse>;
1801
+ /**
1802
+ * If called before the session expires, this will refresh the caller's session and tokens.
1803
+ *
1804
+ * ```typescript
1805
+ * import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
1806
+ *
1807
+ * const {accessToken} = await Auth.refreshTokens();
1808
+ * VerdocsEndpoint.setAuthToken(accessToken);
1809
+ * ```
1810
+ */
1811
+ declare const refreshToken: (endpoint: VerdocsEndpoint, refreshToken: string) => Promise<IAuthenticateResponse>;
1812
+ /**
1813
+ * Update the caller's password when the old password is known (typically for logged-in users).
1814
+ *
1815
+ * ```typescript
1816
+ * import {changePassword} from '@verdocs/js-sdk';
1817
+ *
1818
+ * const {status, message} = await changePassword({ email, oldPassword, newPassword });
1819
+ * if (status !== 'OK') {
1820
+ * window.alert(`Password reset error: ${message}`);
1821
+ * }
1822
+ * ```
1823
+ */
1824
+ declare const changePassword: (endpoint: VerdocsEndpoint, params: IUpdatePasswordRequest) => Promise<IUpdatePasswordResponse>;
1825
+ /**
1826
+ * Request a password reset, when the old password is not known (typically in login forms).
1827
+ *
1828
+ * ```typescript
1829
+ * import {resetPassword} from '@verdocs/js-sdk';
1830
+ *
1831
+ * const {success} = await resetPassword({ email });
1832
+ * if (status !== 'OK') {
1833
+ * window.alert(`Please check your email for instructions on how to reset your password.`);
1834
+ * }
1835
+ * ```
1836
+ */
1837
+ declare const resetPassword: (endpoint: VerdocsEndpoint, params: {
1838
+ email: string;
1839
+ }) => Promise<{
1840
+ success: boolean;
1841
+ }>;
1842
+ /**
1843
+ * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
1844
+ * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
1845
+ * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
1846
+ * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
1847
+ * "anonymous" mode while verification is being performed.
1848
+ *
1849
+ * ```typescript
1850
+ * import {resendVerification} from '@verdocs/js-sdk';
1851
+ *
1852
+ * const result = await resendVerification();
1853
+ * ```
1854
+ */
1855
+ declare const verifyEmail: (endpoint: VerdocsEndpoint, email: string, code: string) => Promise<IAuthenticateResponse>;
1856
+ /**
1857
+ * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
1858
+ * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
1859
+ * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
1860
+ * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
1861
+ * "anonymous" mode while verification is being performed.
1862
+ *
1863
+ * ```typescript
1864
+ * import {resendVerification} from '@verdocs/js-sdk';
1865
+ *
1866
+ * const result = await resendVerification();
1867
+ * ```
1868
+ */
1869
+ declare const resendVerification: (endpoint: VerdocsEndpoint, accessToken?: string) => Promise<{
1870
+ result: "done";
1871
+ }>;
1872
+ declare const getNotifications: (endpoint: VerdocsEndpoint) => Promise<any>;
1873
+ /**
1874
+ * Get the user's available profiles. The current profile will be marked with `current: true`.
1875
+ *
1876
+ * ```typescript
1877
+ * import {getProfiles} from '@verdocs/js-sdk';
1878
+ *
1879
+ * const profiles = await getProfiles();
1880
+ * ```
1881
+ */
1882
+ declare const getProfiles: (endpoint: VerdocsEndpoint) => Promise<IProfile[]>;
1883
+ /**
1884
+ * Get the user's available profiles. The current profile will be marked with `current: true`.
1885
+ *
1886
+ * ```typescript
1887
+ * import {getCurrentProfile} from '@verdocs/js-sdk';
1888
+ *
1889
+ * const profiles = await getCurrentProfile(VerdocsEndpoint.getDefault());
1890
+ * ```
1891
+ */
1892
+ declare const getCurrentProfile: (endpoint: VerdocsEndpoint) => Promise<IProfile | undefined>;
1893
+ /**
1894
+ * Get a profile. The caller must have admin access to the given profile.
1895
+ *
1896
+ * ```typescript
1897
+ * import {getProfile} from '@verdocs/js-sdk';
1898
+ *
1899
+ * const profile = await getProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1900
+ * ```
1901
+ */
1902
+ declare const getProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IProfile>;
1903
+ /**
1904
+ * Switch the caller's "current" profile. The current profile is used for permissions checking
1905
+ * and profile_id field settings for most operations in Verdocs. It is important to select the
1906
+ * appropropriate profile before calling other API functions.
1907
+ *
1908
+ * ```typescript
1909
+ * import {switchProfile} from '@verdocs/js-sdk';
1910
+ *
1911
+ * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1912
+ * ```
1913
+ */
1914
+ declare const switchProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IAuthenticateResponse>;
1915
+ /**
1916
+ * Update a profile. For future expansion, the profile ID to update is required, but currently
1917
+ * this must also be the "current" profile for the caller.
1918
+ *
1919
+ * ```typescript
1920
+ * import {updateProfile} from '@verdocs/js-sdk/Users';
1921
+ *
1922
+ * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1923
+ * ```
1924
+ */
1925
+ declare const updateProfile: (endpoint: VerdocsEndpoint, profileId: string, params: IUpdateProfileRequest) => Promise<IProfile>;
1926
+ /**
1927
+ * Delete a profile. If the requested profile is the caller's curent profile, the next
1928
+ * available profile will be selected.
1929
+ *
1930
+ * ```typescript
1931
+ * import {deleteProfile} from '@verdocs/js-sdk';
1932
+ *
1933
+ * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1934
+ * ```
1935
+ */
1936
+ declare const deleteProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IAuthenticateResponse | {
1937
+ status: "OK";
1938
+ message: "Your last profile has been deleted. You are now logged out.";
1939
+ }>;
1940
+ /**
1941
+ * Create a new user account. Note that there are two registration paths for creation:
1942
+ * - Get invited to an organization, by an admin or owner of that org.
1943
+ * - Created a new organization. The caller will become the first owner of the new org.
1944
+ *
1945
+ * This endpoint is for the second path, so an organization name is required. It is NOT
1946
+ * required to be unique because it is very common for businesses to have the same names,
1947
+ * without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
1948
+ *
1949
+ * The new profile will automatically be set as the user's "current" profile, and new
1950
+ * session tokens will be returned to the caller. However, the caller's email may not yet
1951
+ * be verified. In that case, the caller will not yet be able to call other endpoints in
1952
+ * the Verdocs API. The caller will need to check their email for a verification code,
1953
+ * which should be submitted via the `verifyEmail` endpoint.
1954
+ *
1955
+ * ```typescript
1956
+ * import {createProfile} from '@verdocs/js-sdk';
1957
+ *
1958
+ * const newSession = await createProfile(VerdocsEndpoint.getDefault(), {
1959
+ * orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
1960
+ * });
1961
+ * ```
1962
+ */
1963
+ declare const createProfile: (endpoint: VerdocsEndpoint, params: ICreateAccountRequest) => Promise<{
1964
+ profile: IProfile;
1965
+ organization: IOrganization;
1966
+ }>;
1967
+ /**
1968
+ * Update the caller's profile photo. This can only be called for the user's "current" profile.
1969
+ *
1970
+ * ```typescript
1971
+ * import {uploadProfilePhoto} from '@verdocs/js-sdk';
1972
+ *
1973
+ * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
1974
+ * ```
1975
+ */
1976
+ declare const updateProfilePhoto: (endpoint: VerdocsEndpoint, profileId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
1730
1977
  /**
1731
1978
  * An invitation represents an opportunity for a Member to join an Organization.
1732
1979
  *
1733
1980
  * @module
1734
1981
  */
1982
+ /**
1983
+ * Get a list of invitations pending for the caller's organization. The caller must be an admin or owner.
1984
+ */
1735
1985
  declare const getOrganizationInvitations: (endpoint: VerdocsEndpoint) => Promise<IOrganizationInvitation[]>;
1986
+ /**
1987
+ * Invite a new user to join the organization.
1988
+ */
1736
1989
  declare const createOrganizationInvitation: (endpoint: VerdocsEndpoint, params: ICreateInvitationRequest) => Promise<IOrganizationInvitation>;
1990
+ /**
1991
+ * Delete an invitation. Note that no cancellation message will be sent. Invitations are also one-time-use.
1992
+ * If the invitee attempts to join after the invitation is deleted, accepted, or decline, they will be
1993
+ * shown an error.
1994
+ */
1737
1995
  declare const deleteOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string) => Promise<any>;
1738
- declare const updateOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, params: Partial<ICreateInvitationRequest>) => Promise<IOrganizationInvitation>;
1996
+ /**
1997
+ * Update an invitation. Note that email may not be changed after the invite is sent. To change
1998
+ * an invitee's email, delete the incorrect entry and create one with the correct value.
1999
+ */
2000
+ declare const updateOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, params: Pick<ICreateInvitationRequest, "role" | "first_name" | "last_name">) => Promise<IOrganizationInvitation>;
2001
+ /**
2002
+ * Send a reminder to the invitee to join the organization.
2003
+ */
1739
2004
  declare const resendOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string) => Promise<any>;
2005
+ /**
2006
+ * Get an invitation's details. This is generally used as the first step of accepting the invite.
2007
+ * A successful response will indicate that the invite token is still valid, and include some
2008
+ * metadata for the organization to style the acceptance screen.
2009
+ */
1740
2010
  declare const getOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, token: string) => Promise<IOrganizationInvitation>;
1741
- declare const acceptOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, token: string) => Promise<IProfile>;
2011
+ /**
2012
+ * Accept an invitation. This will automatically create an Auth0 user for the caller as well as a profile
2013
+ * with the appropriate role as specified in the invite. The profile will be set as "current" for the caller,
2014
+ * and session tokens will be returned to access the new profile. The profile's email_verified flag will
2015
+ * also be set to true.
2016
+ */
2017
+ declare const acceptOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, token: string) => Promise<IAuthenticateResponse>;
2018
+ /**
2019
+ * Decline an invitation. This will mark the status "declined," providing a visual indication to the
2020
+ * organization's admins that the invite was declined, preventing further invites from being created
2021
+ * to the same email address, and also preventing the invitee from receiving reminders to join.
2022
+ */
1742
2023
  declare const declineOrganizationInvitation: (endpoint: VerdocsEndpoint, email: string, token: string) => Promise<{
1743
2024
  status: "OK";
1744
2025
  }>;
@@ -1747,21 +2028,22 @@ declare const declineOrganizationInvitation: (endpoint: VerdocsEndpoint, email:
1747
2028
  *
1748
2029
  * @module
1749
2030
  */
2031
+ /**
2032
+ * Get a list of the members in the caller's organization.
2033
+ */
1750
2034
  declare const getOrganizationMembers: (endpoint: VerdocsEndpoint) => Promise<IProfile[]>;
2035
+ /**
2036
+ * Delete a member from the caller's organization. Note that the caller must be an admin or owner,
2037
+ * may not delete him/herself
2038
+ */
1751
2039
  declare const deleteOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string) => Promise<any>;
1752
- declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Pick<IProfile, "roles" | "permissions">) => Promise<any>;
1753
2040
  /**
1754
- * Get a list of organizations the caller is a member of.
1755
- *
1756
- * ```typescript
1757
- * import {getOrganizations} from '@verdocs/js-sdk';
1758
- *
1759
- * const organizations = await getOrganizations(VerdocsEndpoint.getDefault());
1760
- * ```
2041
+ * Update a member.
1761
2042
  */
1762
- declare const getOrganizations: (endpoint: VerdocsEndpoint) => Promise<IOrganization[]>;
2043
+ declare const updateOrganizationMember: (endpoint: VerdocsEndpoint, profileId: string, params: Pick<IProfile, "roles" | "first_name" | "last_name">) => Promise<any>;
1763
2044
  /**
1764
- * Get an organization by ID.
2045
+ * Get an organization by ID. Note that this endpoint will return only a subset of fields
2046
+ * if the caller is not a member of the organization (the public fields).
1765
2047
  *
1766
2048
  * ```typescript
1767
2049
  * import {getOrganization} from '@verdocs/js-sdk';
@@ -1784,22 +2066,22 @@ declare const updateOrganization: (endpoint: VerdocsEndpoint, organizationId: st
1784
2066
  * Update the organization's logo. This can only be called by an admin or owner.
1785
2067
  *
1786
2068
  * ```typescript
1787
- * import {uploadOrganizationLogo} from '@verdocs/js-sdk';
2069
+ * import {updateOrganizationLogo} from '@verdocs/js-sdk';
1788
2070
  *
1789
- * await uploadOrganizationLogo((VerdocsEndpoint.getDefault(), organizationId, file);
2071
+ * await updateOrganizationLogo((VerdocsEndpoint.getDefault(), organizationId, file);
1790
2072
  * ```
1791
2073
  */
1792
- declare const uploadOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
2074
+ declare const updateOrganizationLogo: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
1793
2075
  /**
1794
2076
  * Update the organization's thumbnail. This can only be called by an admin or owner.
1795
2077
  *
1796
2078
  * ```typescript
1797
- * import {uploadOrganizationThumbnail} from '@verdocs/js-sdk';
2079
+ * import {updateOrganizationThumbnail} from '@verdocs/js-sdk';
1798
2080
  *
1799
- * await uploadOrganizationThumbnail((VerdocsEndpoint.getDefault(), organizationId, file);
2081
+ * await updateOrganizationThumbnail((VerdocsEndpoint.getDefault(), organizationId, file);
1800
2082
  * ```
1801
2083
  */
1802
- declare const uploadOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
2084
+ declare const updateOrganizationThumbnail: (endpoint: VerdocsEndpoint, organizationId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
1803
2085
  /**
1804
2086
  * Get the registered Webhooks for the caller's organization.
1805
2087
  */
@@ -2462,249 +2744,4 @@ declare const isValidEmail: (email: string | undefined) => boolean;
2462
2744
  declare const isValidPhone: (phone: string | undefined) => boolean;
2463
2745
  declare const isValidRoleName: (value: string, roles: IRole[]) => boolean;
2464
2746
  declare const isValidTag: (value: string, tags: string[]) => boolean;
2465
- interface IUpdateProfileRequest {
2466
- first_name?: string;
2467
- last_name?: string;
2468
- // email?: string;
2469
- phone?: string;
2470
- permissions?: TPermission[];
2471
- roles?: TRole[];
2472
- }
2473
- interface IAuthenticateResponse {
2474
- access_token: string;
2475
- id_token: string;
2476
- refresh_token: string;
2477
- expires_in: number;
2478
- access_token_exp: number;
2479
- refresh_token_exp: number;
2480
- }
2481
- interface IUpdatePasswordRequest {
2482
- email: string;
2483
- oldPassword: string;
2484
- newPassword: string;
2485
- }
2486
- interface IUpdatePasswordResponse {
2487
- status: TRequestStatus;
2488
- /** Success or failure message */
2489
- message: string;
2490
- }
2491
- interface ICreateAccountRequest {
2492
- email: string;
2493
- password: string;
2494
- firstName: string;
2495
- lastName: string;
2496
- orgName: string;
2497
- }
2498
- interface IROPCRequest {
2499
- grant_type: "password";
2500
- username: string;
2501
- password: string;
2502
- client_id?: string;
2503
- scope?: string;
2504
- }
2505
- interface IClientCredentialsRequest {
2506
- grant_type: "client_credentials";
2507
- client_id: string;
2508
- client_secret: string;
2509
- scope?: string;
2510
- }
2511
- interface IRefreshTokenRequest {
2512
- grant_type: "refresh_token";
2513
- refresh_token: string;
2514
- client_id?: string;
2515
- scope?: string;
2516
- }
2517
- type TAuthenticationRequest = IROPCRequest | IClientCredentialsRequest | IRefreshTokenRequest;
2518
- /**
2519
- * Authenticate to Verdocs.
2520
- *
2521
- * ```typescript
2522
- * import {authenticate, VerdocsEndpoint} from '@verdocs/js-sdk';
2523
- *
2524
- * // Client-side call, suitable for Web and mobile apps:
2525
- * const {access_token} = await Auth.authenticate({ username: 'test@test.com', password: 'PASSWORD', grant_type:'password' });
2526
- * VerdocsEndpoint.getDefault().setAuthToken(access_token);
2527
- *
2528
- * // Server-side call, suitable for server apps. NEVER EXPOSE client_secret IN FRONT-END CODE:
2529
- * const {access_token} = await Auth.authenticate({ client_id: '...', client_secret: '...', grant_type:'client_credentials' });
2530
- * VerdocsEndpoint.getDefault().setAuthToken(access_token);
2531
- * ```
2532
- */
2533
- declare const authenticate: (endpoint: VerdocsEndpoint, params: TAuthenticationRequest) => Promise<IAuthenticateResponse>;
2534
- /**
2535
- * If called before the session expires, this will refresh the caller's session and tokens.
2536
- *
2537
- * ```typescript
2538
- * import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
2539
- *
2540
- * const {accessToken} = await Auth.refreshTokens();
2541
- * VerdocsEndpoint.setAuthToken(accessToken);
2542
- * ```
2543
- */
2544
- declare const refreshToken: (endpoint: VerdocsEndpoint, refreshToken: string) => Promise<IAuthenticateResponse>;
2545
- /**
2546
- * Update the caller's password when the old password is known (typically for logged-in users).
2547
- *
2548
- * ```typescript
2549
- * import {changePassword} from '@verdocs/js-sdk';
2550
- *
2551
- * const {status, message} = await changePassword({ email, oldPassword, newPassword });
2552
- * if (status !== 'OK') {
2553
- * window.alert(`Password reset error: ${message}`);
2554
- * }
2555
- * ```
2556
- */
2557
- declare const changePassword: (endpoint: VerdocsEndpoint, params: IUpdatePasswordRequest) => Promise<IUpdatePasswordResponse>;
2558
- /**
2559
- * Request a password reset, when the old password is not known (typically in login forms).
2560
- *
2561
- * ```typescript
2562
- * import {resetPassword} from '@verdocs/js-sdk';
2563
- *
2564
- * const {success} = await resetPassword({ email });
2565
- * if (status !== 'OK') {
2566
- * window.alert(`Please check your email for instructions on how to reset your password.`);
2567
- * }
2568
- * ```
2569
- */
2570
- declare const resetPassword: (endpoint: VerdocsEndpoint, params: {
2571
- email: string;
2572
- }) => Promise<{
2573
- success: boolean;
2574
- }>;
2575
- /**
2576
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
2577
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
2578
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
2579
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
2580
- * "anonymous" mode while verification is being performed.
2581
- *
2582
- * ```typescript
2583
- * import {resendVerification} from '@verdocs/js-sdk';
2584
- *
2585
- * const result = await resendVerification();
2586
- * ```
2587
- */
2588
- declare const verifyEmail: (endpoint: VerdocsEndpoint, email: string, code: string) => Promise<IAuthenticateResponse>;
2589
- /**
2590
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
2591
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
2592
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
2593
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
2594
- * "anonymous" mode while verification is being performed.
2595
- *
2596
- * ```typescript
2597
- * import {resendVerification} from '@verdocs/js-sdk';
2598
- *
2599
- * const result = await resendVerification();
2600
- * ```
2601
- */
2602
- declare const resendVerification: (endpoint: VerdocsEndpoint, accessToken?: string) => Promise<{
2603
- result: "done";
2604
- }>;
2605
- declare const getNotifications: (endpoint: VerdocsEndpoint) => Promise<any>;
2606
- /**
2607
- * Get the user's available profiles. The current profile will be marked with `current: true`.
2608
- *
2609
- * ```typescript
2610
- * import {getProfiles} from '@verdocs/js-sdk';
2611
- *
2612
- * const profiles = await getProfiles();
2613
- * ```
2614
- */
2615
- declare const getProfiles: (endpoint: VerdocsEndpoint) => Promise<IProfile[]>;
2616
- /**
2617
- * Get the user's available profiles. The current profile will be marked with `current: true`.
2618
- *
2619
- * ```typescript
2620
- * import {getCurrentProfile} from '@verdocs/js-sdk';
2621
- *
2622
- * const profiles = await getCurrentProfile(VerdocsEndpoint.getDefault());
2623
- * ```
2624
- */
2625
- declare const getCurrentProfile: (endpoint: VerdocsEndpoint) => Promise<IProfile | undefined>;
2626
- /**
2627
- * Get a profile. The caller must have admin access to the given profile.
2628
- *
2629
- * ```typescript
2630
- * import {getProfile} from '@verdocs/js-sdk';
2631
- *
2632
- * const profile = await getProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2633
- * ```
2634
- */
2635
- declare const getProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IProfile>;
2636
- /**
2637
- * Switch the caller's "current" profile. The current profile is used for permissions checking
2638
- * and profile_id field settings for most operations in Verdocs. It is important to select the
2639
- * appropropriate profile before calling other API functions.
2640
- *
2641
- * ```typescript
2642
- * import {switchProfile} from '@verdocs/js-sdk';
2643
- *
2644
- * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2645
- * ```
2646
- */
2647
- declare const switchProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IAuthenticateResponse>;
2648
- /**
2649
- * Update a profile. For future expansion, the profile ID to update is required, but currently
2650
- * this must also be the "current" profile for the caller.
2651
- *
2652
- * ```typescript
2653
- * import {updateProfile} from '@verdocs/js-sdk/Users';
2654
- *
2655
- * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2656
- * ```
2657
- */
2658
- declare const updateProfile: (endpoint: VerdocsEndpoint, profileId: string, params: IUpdateProfileRequest) => Promise<IProfile>;
2659
- /**
2660
- * Delete a profile. If the requested profile is the caller's curent profile, the next
2661
- * available profile will be selected.
2662
- *
2663
- * ```typescript
2664
- * import {deleteProfile} from '@verdocs/js-sdk';
2665
- *
2666
- * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2667
- * ```
2668
- */
2669
- declare const deleteProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IAuthenticateResponse | {
2670
- status: "OK";
2671
- message: "Your last profile has been deleted. You are now logged out.";
2672
- }>;
2673
- /**
2674
- * Create a new user account. Note that there are two registration paths for creation:
2675
- * - Get invited to an organization, by an admin or owner of that org.
2676
- * - Created a new organization. The caller will become the first owner of the new org.
2677
- *
2678
- * This endpoint is for the second path, so an organization name is required. It is NOT
2679
- * required to be unique because it is very common for businesses to have the same names,
2680
- * without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
2681
- *
2682
- * The new profile will automatically be set as the user's "current" profile, and new
2683
- * session tokens will be returned to the caller. However, the caller's email may not yet
2684
- * be verified. In that case, the caller will not yet be able to call other endpoints in
2685
- * the Verdocs API. The caller will need to check their email for a verification code,
2686
- * which should be submitted via the `verifyEmail` endpoint.
2687
- *
2688
- * ```typescript
2689
- * import {createProfile} from '@verdocs/js-sdk';
2690
- *
2691
- * const newSession = await createProfile(VerdocsEndpoint.getDefault(), {
2692
- * orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
2693
- * });
2694
- * ```
2695
- */
2696
- declare const createProfile: (endpoint: VerdocsEndpoint, params: ICreateAccountRequest) => Promise<{
2697
- profile: IProfile;
2698
- organization: IOrganization;
2699
- }>;
2700
- /**
2701
- * Update the caller's profile photo. This can only be called for the user's "current" profile.
2702
- *
2703
- * ```typescript
2704
- * import {uploadProfilePhoto} from '@verdocs/js-sdk';
2705
- *
2706
- * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
2707
- * ```
2708
- */
2709
- declare const updateProfilePhoto: (endpoint: VerdocsEndpoint, profileId: string, file: File, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<IProfile>;
2710
- export { TRequestStatus, TTemplateSenderType, TTemplatePermission, TTemplateAction, TAccountPermission, TOrgPermission, TApiKeyPermission, TPermission, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TRole, TSortTemplateBy, TAccessKeyType, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IReminder, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, IActivityEntry, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelopesSummary, IEnvelopeSearchParams, searchEnvelopes, ISigningSessionResult, getSigningSession, getEnvelopeRecipients, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, throttledGetEnvelope, ITimeRange, IListEnvelopesParams, listEnvelopes, getEnvelopesByTemplateId, createInitials, IRecipientKbaStatusNotRequired, IRecipientKbaStatusComplete, IRecipientKbaStatusPinRequired, IRecipientKbaStatusIdentityRequired, IRecipientKbaChallengeRequired, IRecipientKbaStatusFailed, TRecipientKbaStatus, getKbaStatus, submitKbaPin, IKbaIdentity, submitKbaIdentity, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, ISignerTokenResponse, getSignerToken, getInPersonLink, sendDelegate, resendInvitation, createEnvelopeReminder, getEnvelopeReminder, updateEnvelopeReminder, deleteEnvelopeReminder, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResultEntry, IEnvelopesSearchResult, IEnvelopesSummary, IDocumentSearchOptions, ICreateEnvelopeRole, IEnvelopeSummary, IEnvelopeSummaries, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeRequest, TEnvelopePermission, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getGroups, getGroup, createGroup, addGroupMember, deleteGroupMember, updateGroup, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganizations, getOrganization, updateOrganization, uploadOrganizationLogo, uploadOrganizationThumbnail, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, userHasPermissions, ISigningSessionRequest, ISigningSession, IUserSession, 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, ICreateTemplateReminderRequest, createTemplateReminder, getTemplateReminder, updateTemplateReminder, deleteTemplateReminder, createTemplateRole, getTemplateRoles, getTemplateRole, updateTemplateRole, deleteTemplateRole, getTemplateRoleFields, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, IGetTemplatesParams, getTemplates, getTemplate, getTemplateOwnerInfo, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, createTemplatev2, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, searchTemplates, ISearchTimeRange, IGetTemplateSummarySortBy, IGetTemplateSummaryParams, getTemplatesSummary, throttledGetTemplate, ITemplateListParams, listTemplates, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateSummary, ITemplateSearchParams, ITemplateSummaries, ITemplateTag, ITag, IStar, ITemplateOwnerInfo, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, verifyEmail, resendVerification, getNotifications, getProfiles, getCurrentProfile, getProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, IUpdateProfileRequest, IAuthenticateResponse, IUpdatePasswordRequest, IUpdatePasswordResponse, ICreateAccountRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, timePeriod, 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, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry, ITimePeriod };
2747
+ export { TRequestStatus, TTemplateSenderType, TTemplatePermission, TTemplateAction, TAccountPermission, TOrgPermission, TApiKeyPermission, TPermission, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TRole, TSortTemplateBy, TAccessKeyType, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IReminder, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, IActivityEntry, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelopesSummary, IEnvelopeSearchParams, searchEnvelopes, ISigningSessionResult, getSigningSession, getEnvelopeRecipients, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, throttledGetEnvelope, ITimeRange, IListEnvelopesParams, listEnvelopes, getEnvelopesByTemplateId, createInitials, IRecipientKbaStatusNotRequired, IRecipientKbaStatusComplete, IRecipientKbaStatusPinRequired, IRecipientKbaStatusIdentityRequired, IRecipientKbaChallengeRequired, IRecipientKbaStatusFailed, TRecipientKbaStatus, getKbaStatus, submitKbaPin, IKbaIdentity, submitKbaIdentity, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, ISignerTokenResponse, getSignerToken, getInPersonLink, sendDelegate, resendInvitation, createEnvelopeReminder, getEnvelopeReminder, updateEnvelopeReminder, deleteEnvelopeReminder, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResultEntry, IEnvelopesSearchResult, IEnvelopesSummary, IDocumentSearchOptions, ICreateEnvelopeRole, IEnvelopeSummary, IEnvelopeSummaries, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeRequest, TEnvelopePermission, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getGroups, getGroup, createGroup, addGroupMember, deleteGroupMember, updateGroup, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, updateOrganization, updateOrganizationLogo, updateOrganizationThumbnail, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, userHasPermissions, ISigningSessionRequest, ISigningSession, IUserSession, 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, ICreateTemplateReminderRequest, createTemplateReminder, getTemplateReminder, updateTemplateReminder, deleteTemplateReminder, createTemplateRole, getTemplateRoles, getTemplateRole, updateTemplateRole, deleteTemplateRole, getTemplateRoleFields, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, IGetTemplatesParams, getTemplates, getTemplate, getTemplateOwnerInfo, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, createTemplatev2, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, searchTemplates, ISearchTimeRange, IGetTemplateSummarySortBy, IGetTemplateSummaryParams, getTemplatesSummary, throttledGetTemplate, ITemplateListParams, listTemplates, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateSummary, ITemplateSearchParams, ITemplateSummaries, ITemplateTag, ITag, IStar, ITemplateOwnerInfo, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, verifyEmail, resendVerification, getNotifications, getProfiles, getCurrentProfile, getProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, IUpdateProfileRequest, IAuthenticateResponse, IUpdatePasswordRequest, IUpdatePasswordResponse, ICreateAccountRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, timePeriod, 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, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry, ITimePeriod };