@verdocs/js-sdk 4.1.5 → 4.1.6
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 +61 -60
- package/dist/index.d.ts +61 -60
- package/dist/index.js +60 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -47
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2495,11 +2495,10 @@ const authenticate = (endpoint, params) => endpoint.api //
|
|
|
2495
2495
|
* If called before the session expires, this will refresh the caller's session and tokens.
|
|
2496
2496
|
*
|
|
2497
2497
|
* ```typescript
|
|
2498
|
-
* import {Auth} from '@verdocs/js-sdk
|
|
2499
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2498
|
+
* import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
|
|
2500
2499
|
*
|
|
2501
2500
|
* const {accessToken} = await Auth.refreshTokens();
|
|
2502
|
-
*
|
|
2501
|
+
* VerdocsEndpoint.setAuthToken(accessToken);
|
|
2503
2502
|
* ```
|
|
2504
2503
|
*/
|
|
2505
2504
|
const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_type: 'refresh_token', refresh_token: refreshToken });
|
|
@@ -2507,7 +2506,7 @@ const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_
|
|
|
2507
2506
|
* Update the caller's password when the old password is known (typically for logged-in users).
|
|
2508
2507
|
*
|
|
2509
2508
|
* ```typescript
|
|
2510
|
-
* import {changePassword} from '@verdocs/js-sdk
|
|
2509
|
+
* import {changePassword} from '@verdocs/js-sdk';
|
|
2511
2510
|
*
|
|
2512
2511
|
* const {status, message} = await changePassword({ email, oldPassword, newPassword });
|
|
2513
2512
|
* if (status !== 'OK') {
|
|
@@ -2522,7 +2521,7 @@ const changePassword = (endpoint, params) => endpoint.api //
|
|
|
2522
2521
|
* Request a password reset, when the old password is not known (typically in login forms).
|
|
2523
2522
|
*
|
|
2524
2523
|
* ```typescript
|
|
2525
|
-
* import {resetPassword} from '@verdocs/js-sdk
|
|
2524
|
+
* import {resetPassword} from '@verdocs/js-sdk';
|
|
2526
2525
|
*
|
|
2527
2526
|
* const {success} = await resetPassword({ email });
|
|
2528
2527
|
* if (status !== 'OK') {
|
|
@@ -2541,9 +2540,25 @@ const resetPassword = (endpoint, params) => endpoint.api //
|
|
|
2541
2540
|
* "anonymous" mode while verification is being performed.
|
|
2542
2541
|
*
|
|
2543
2542
|
* ```typescript
|
|
2544
|
-
* import {
|
|
2543
|
+
* import {resendVerification} from '@verdocs/js-sdk';
|
|
2545
2544
|
*
|
|
2546
|
-
* const result = await
|
|
2545
|
+
* const result = await resendVerification();
|
|
2546
|
+
* ```
|
|
2547
|
+
*/
|
|
2548
|
+
const verifyEmail = (endpoint, email, code) => endpoint.api //
|
|
2549
|
+
.post('/v2/users/verify-email', { email, code })
|
|
2550
|
+
.then((r) => r.data);
|
|
2551
|
+
/**
|
|
2552
|
+
* Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
|
|
2553
|
+
* a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
|
|
2554
|
+
* the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
|
|
2555
|
+
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
2556
|
+
* "anonymous" mode while verification is being performed.
|
|
2557
|
+
*
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* import {resendVerification} from '@verdocs/js-sdk';
|
|
2560
|
+
*
|
|
2561
|
+
* const result = await resendVerification();
|
|
2547
2562
|
* ```
|
|
2548
2563
|
*/
|
|
2549
2564
|
const resendVerification = (endpoint, accessToken) => endpoint.api //
|
|
@@ -2558,9 +2573,9 @@ const getNotifications = async (endpoint) => endpoint.api //
|
|
|
2558
2573
|
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
2559
2574
|
*
|
|
2560
2575
|
* ```typescript
|
|
2561
|
-
* import {
|
|
2576
|
+
* import {getProfiles} from '@verdocs/js-sdk';
|
|
2562
2577
|
*
|
|
2563
|
-
* const profiles = await
|
|
2578
|
+
* const profiles = await getProfiles();
|
|
2564
2579
|
* ```
|
|
2565
2580
|
*/
|
|
2566
2581
|
const getProfiles = (endpoint) => endpoint.api //
|
|
@@ -2570,94 +2585,92 @@ const getProfiles = (endpoint) => endpoint.api //
|
|
|
2570
2585
|
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
2571
2586
|
*
|
|
2572
2587
|
* ```typescript
|
|
2573
|
-
* import {
|
|
2588
|
+
* import {getCurrentProfile} from '@verdocs/js-sdk';
|
|
2574
2589
|
*
|
|
2575
|
-
* const profiles = await
|
|
2590
|
+
* const profiles = await getCurrentProfile();
|
|
2576
2591
|
* ```
|
|
2577
2592
|
*/
|
|
2578
2593
|
const getCurrentProfile = (endpoint) => endpoint.api //
|
|
2579
2594
|
.get('/v2/profiles')
|
|
2580
2595
|
.then((r) => (r.data || []).find((profile) => profile.current));
|
|
2581
|
-
/**
|
|
2582
|
-
* Create a profile. If the caller does not have a "current" profile set, the new profile will be made current.
|
|
2583
|
-
*
|
|
2584
|
-
* ```typescript
|
|
2585
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
2586
|
-
*
|
|
2587
|
-
* const newProfile = await Profiles.createProfile({ first_name: 'FIRST', last_name: 'LAST', email: 'EMAIL' });
|
|
2588
|
-
* ```
|
|
2589
|
-
*/
|
|
2590
|
-
const createProfile = (endpoint, params) => endpoint.api //
|
|
2591
|
-
.post('/v2/profiles', params)
|
|
2592
|
-
.then((r) => r.data);
|
|
2593
2596
|
/**
|
|
2594
2597
|
* Get a profile. The caller must have admin access to the given profile.
|
|
2595
2598
|
* TODO: Add a "public" profile endpoint for public pages
|
|
2596
2599
|
*
|
|
2597
2600
|
* ```typescript
|
|
2598
|
-
* import {
|
|
2601
|
+
* import {getProfile} from '@verdocs/js-sdk';
|
|
2599
2602
|
*
|
|
2600
|
-
* const profile = await
|
|
2603
|
+
* const profile = await getProfile('PROFILEID');
|
|
2601
2604
|
* ```
|
|
2602
2605
|
*/
|
|
2603
2606
|
const getProfile = (endpoint, profileId) => endpoint.api //
|
|
2604
2607
|
.get(`/v2/profiles/${profileId}`)
|
|
2605
2608
|
.then((r) => r.data);
|
|
2606
2609
|
/**
|
|
2607
|
-
* Switch the caller's "current" profile. The current profile is used for permissions checking
|
|
2608
|
-
* for most operations in Verdocs. It is important to select the
|
|
2610
|
+
* Switch the caller's "current" profile. The current profile is used for permissions checking
|
|
2611
|
+
* and profile_id field settings for most operations in Verdocs. It is important to select the
|
|
2612
|
+
* appropropriate profile before calling other API functions.
|
|
2609
2613
|
*
|
|
2610
2614
|
* ```typescript
|
|
2611
|
-
* import {
|
|
2615
|
+
* import {switchProfile} from '@verdocs/js-sdk';
|
|
2612
2616
|
*
|
|
2613
|
-
* const newProfile = await
|
|
2617
|
+
* const newProfile = await switchProfile('PROFILEID');
|
|
2614
2618
|
* ```
|
|
2615
2619
|
*/
|
|
2616
2620
|
const switchProfile = (endpoint, profileId) => endpoint.api //
|
|
2617
2621
|
.post(`/v2/profiles/${profileId}/switch`)
|
|
2618
2622
|
.then((r) => r.data);
|
|
2619
2623
|
/**
|
|
2620
|
-
* Update a profile. For future expansion, the profile ID to update is required, but currently
|
|
2621
|
-
* "current" profile for the caller.
|
|
2624
|
+
* Update a profile. For future expansion, the profile ID to update is required, but currently
|
|
2625
|
+
* this must also be the "current" profile for the caller.
|
|
2622
2626
|
*
|
|
2623
2627
|
* ```typescript
|
|
2624
|
-
* import {
|
|
2628
|
+
* import {updateProfile} from '@verdocs/js-sdk/Users';
|
|
2625
2629
|
*
|
|
2626
|
-
* const newProfile = await
|
|
2630
|
+
* const newProfile = await updateProfile('PROFILEID');
|
|
2627
2631
|
* ```
|
|
2628
2632
|
*/
|
|
2629
2633
|
const updateProfile = (endpoint, profileId, params) => endpoint.api //
|
|
2630
2634
|
.patch(`/v2/profiles/${profileId}`, params)
|
|
2631
2635
|
.then((r) => r.data);
|
|
2632
2636
|
/**
|
|
2633
|
-
* Delete a profile. If the requested profile is the caller's curent profile, the next
|
|
2637
|
+
* Delete a profile. If the requested profile is the caller's curent profile, the next
|
|
2638
|
+
* available profile will be selected.
|
|
2634
2639
|
*
|
|
2635
2640
|
* ```typescript
|
|
2636
|
-
* import {
|
|
2641
|
+
* import {deleteProfile} from '@verdocs/js-sdk';
|
|
2637
2642
|
*
|
|
2638
|
-
* await
|
|
2643
|
+
* await deleteProfile('PROFILEID');
|
|
2639
2644
|
* ```
|
|
2640
2645
|
*/
|
|
2641
2646
|
const deleteProfile = (endpoint, profileId) => endpoint.api //
|
|
2642
2647
|
.delete(`/v2/profiles/${profileId}`)
|
|
2643
2648
|
.then((r) => r.data);
|
|
2644
2649
|
/**
|
|
2645
|
-
* Create a user account
|
|
2646
|
-
*
|
|
2650
|
+
* Create a new user account. Note that there are two registration paths for creation:
|
|
2651
|
+
* - Get invited to an organization, by an admin or owner of that org.
|
|
2652
|
+
* - Created a new organization. The caller will become the first owner of the new org.
|
|
2653
|
+
*
|
|
2654
|
+
* This endpoint is for the second path, so an organization name is required. It is NOT
|
|
2655
|
+
* required to be unique because it is very common for businesses to have the same names,
|
|
2656
|
+
* without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
|
|
2657
|
+
*
|
|
2658
|
+
* The new profile will automatically be set as the user's "current" profile, and new
|
|
2659
|
+
* session tokens will be returned to the caller. However, the caller's email may not yet
|
|
2660
|
+
* be verified. In that case, the caller will not yet be able to call other endpoints in
|
|
2661
|
+
* the Verdocs API. The caller will need to check their email for a verification code,
|
|
2662
|
+
* which should be submitted via the `verifyEmail` endpoint.
|
|
2647
2663
|
*
|
|
2648
2664
|
* ```typescript
|
|
2649
|
-
* import {
|
|
2665
|
+
* import {createProfile} from '@verdocs/js-sdk';
|
|
2650
2666
|
*
|
|
2651
|
-
* const
|
|
2652
|
-
* orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
2667
|
+
* const newSession = await createProfile({
|
|
2668
|
+
* orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
2653
2669
|
* });
|
|
2654
2670
|
* ```
|
|
2655
2671
|
*/
|
|
2656
|
-
const
|
|
2657
|
-
.post('/
|
|
2658
|
-
.then((r) => r.data);
|
|
2659
|
-
const recordSignupSurvey = (endpoint, params) => endpoint.api //
|
|
2660
|
-
.post('/user/signup', params)
|
|
2672
|
+
const createProfile = (endpoint, params) => endpoint.api //
|
|
2673
|
+
.post('/v2/profiles', params)
|
|
2661
2674
|
.then((r) => r.data);
|
|
2662
2675
|
|
|
2663
2676
|
exports.AtoB = AtoB;
|
|
@@ -2673,7 +2686,6 @@ exports.cancelEnvelope = cancelEnvelope;
|
|
|
2673
2686
|
exports.capitalize = capitalize;
|
|
2674
2687
|
exports.changePassword = changePassword;
|
|
2675
2688
|
exports.convertToE164 = convertToE164;
|
|
2676
|
-
exports.createAccount = createAccount;
|
|
2677
2689
|
exports.createApiKey = createApiKey;
|
|
2678
2690
|
exports.createEnvelope = createEnvelope;
|
|
2679
2691
|
exports.createEnvelopeReminder = createEnvelopeReminder;
|
|
@@ -2802,7 +2814,6 @@ exports.listTemplates = listTemplates;
|
|
|
2802
2814
|
exports.nameToRGBA = nameToRGBA;
|
|
2803
2815
|
exports.recipientCanAct = recipientCanAct;
|
|
2804
2816
|
exports.recipientHasAction = recipientHasAction;
|
|
2805
|
-
exports.recordSignupSurvey = recordSignupSurvey;
|
|
2806
2817
|
exports.refreshToken = refreshToken;
|
|
2807
2818
|
exports.rescale = rescale;
|
|
2808
2819
|
exports.resendInvitation = resendInvitation;
|
|
@@ -2858,4 +2869,5 @@ exports.userHasSharedTemplate = userHasSharedTemplate;
|
|
|
2858
2869
|
exports.userIsEnvelopeOwner = userIsEnvelopeOwner;
|
|
2859
2870
|
exports.userIsEnvelopeRecipient = userIsEnvelopeRecipient;
|
|
2860
2871
|
exports.userIsTemplateCreator = userIsTemplateCreator;
|
|
2872
|
+
exports.verifyEmail = verifyEmail;
|
|
2861
2873
|
//# sourceMappingURL=index.js.map
|