@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.mjs
CHANGED
|
@@ -2493,11 +2493,10 @@ const authenticate = (endpoint, params) => endpoint.api //
|
|
|
2493
2493
|
* If called before the session expires, this will refresh the caller's session and tokens.
|
|
2494
2494
|
*
|
|
2495
2495
|
* ```typescript
|
|
2496
|
-
* import {Auth} from '@verdocs/js-sdk
|
|
2497
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2496
|
+
* import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
|
|
2498
2497
|
*
|
|
2499
2498
|
* const {accessToken} = await Auth.refreshTokens();
|
|
2500
|
-
*
|
|
2499
|
+
* VerdocsEndpoint.setAuthToken(accessToken);
|
|
2501
2500
|
* ```
|
|
2502
2501
|
*/
|
|
2503
2502
|
const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_type: 'refresh_token', refresh_token: refreshToken });
|
|
@@ -2505,7 +2504,7 @@ const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_
|
|
|
2505
2504
|
* Update the caller's password when the old password is known (typically for logged-in users).
|
|
2506
2505
|
*
|
|
2507
2506
|
* ```typescript
|
|
2508
|
-
* import {changePassword} from '@verdocs/js-sdk
|
|
2507
|
+
* import {changePassword} from '@verdocs/js-sdk';
|
|
2509
2508
|
*
|
|
2510
2509
|
* const {status, message} = await changePassword({ email, oldPassword, newPassword });
|
|
2511
2510
|
* if (status !== 'OK') {
|
|
@@ -2520,7 +2519,7 @@ const changePassword = (endpoint, params) => endpoint.api //
|
|
|
2520
2519
|
* Request a password reset, when the old password is not known (typically in login forms).
|
|
2521
2520
|
*
|
|
2522
2521
|
* ```typescript
|
|
2523
|
-
* import {resetPassword} from '@verdocs/js-sdk
|
|
2522
|
+
* import {resetPassword} from '@verdocs/js-sdk';
|
|
2524
2523
|
*
|
|
2525
2524
|
* const {success} = await resetPassword({ email });
|
|
2526
2525
|
* if (status !== 'OK') {
|
|
@@ -2539,9 +2538,25 @@ const resetPassword = (endpoint, params) => endpoint.api //
|
|
|
2539
2538
|
* "anonymous" mode while verification is being performed.
|
|
2540
2539
|
*
|
|
2541
2540
|
* ```typescript
|
|
2542
|
-
* import {
|
|
2541
|
+
* import {resendVerification} from '@verdocs/js-sdk';
|
|
2543
2542
|
*
|
|
2544
|
-
* const result = await
|
|
2543
|
+
* const result = await resendVerification();
|
|
2544
|
+
* ```
|
|
2545
|
+
*/
|
|
2546
|
+
const verifyEmail = (endpoint, email, code) => endpoint.api //
|
|
2547
|
+
.post('/v2/users/verify-email', { email, code })
|
|
2548
|
+
.then((r) => r.data);
|
|
2549
|
+
/**
|
|
2550
|
+
* Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
|
|
2551
|
+
* a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
|
|
2552
|
+
* the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
|
|
2553
|
+
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
2554
|
+
* "anonymous" mode while verification is being performed.
|
|
2555
|
+
*
|
|
2556
|
+
* ```typescript
|
|
2557
|
+
* import {resendVerification} from '@verdocs/js-sdk';
|
|
2558
|
+
*
|
|
2559
|
+
* const result = await resendVerification();
|
|
2545
2560
|
* ```
|
|
2546
2561
|
*/
|
|
2547
2562
|
const resendVerification = (endpoint, accessToken) => endpoint.api //
|
|
@@ -2556,9 +2571,9 @@ const getNotifications = async (endpoint) => endpoint.api //
|
|
|
2556
2571
|
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
2557
2572
|
*
|
|
2558
2573
|
* ```typescript
|
|
2559
|
-
* import {
|
|
2574
|
+
* import {getProfiles} from '@verdocs/js-sdk';
|
|
2560
2575
|
*
|
|
2561
|
-
* const profiles = await
|
|
2576
|
+
* const profiles = await getProfiles();
|
|
2562
2577
|
* ```
|
|
2563
2578
|
*/
|
|
2564
2579
|
const getProfiles = (endpoint) => endpoint.api //
|
|
@@ -2568,95 +2583,93 @@ const getProfiles = (endpoint) => endpoint.api //
|
|
|
2568
2583
|
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
2569
2584
|
*
|
|
2570
2585
|
* ```typescript
|
|
2571
|
-
* import {
|
|
2586
|
+
* import {getCurrentProfile} from '@verdocs/js-sdk';
|
|
2572
2587
|
*
|
|
2573
|
-
* const profiles = await
|
|
2588
|
+
* const profiles = await getCurrentProfile();
|
|
2574
2589
|
* ```
|
|
2575
2590
|
*/
|
|
2576
2591
|
const getCurrentProfile = (endpoint) => endpoint.api //
|
|
2577
2592
|
.get('/v2/profiles')
|
|
2578
2593
|
.then((r) => (r.data || []).find((profile) => profile.current));
|
|
2579
|
-
/**
|
|
2580
|
-
* Create a profile. If the caller does not have a "current" profile set, the new profile will be made current.
|
|
2581
|
-
*
|
|
2582
|
-
* ```typescript
|
|
2583
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
2584
|
-
*
|
|
2585
|
-
* const newProfile = await Profiles.createProfile({ first_name: 'FIRST', last_name: 'LAST', email: 'EMAIL' });
|
|
2586
|
-
* ```
|
|
2587
|
-
*/
|
|
2588
|
-
const createProfile = (endpoint, params) => endpoint.api //
|
|
2589
|
-
.post('/v2/profiles', params)
|
|
2590
|
-
.then((r) => r.data);
|
|
2591
2594
|
/**
|
|
2592
2595
|
* Get a profile. The caller must have admin access to the given profile.
|
|
2593
2596
|
* TODO: Add a "public" profile endpoint for public pages
|
|
2594
2597
|
*
|
|
2595
2598
|
* ```typescript
|
|
2596
|
-
* import {
|
|
2599
|
+
* import {getProfile} from '@verdocs/js-sdk';
|
|
2597
2600
|
*
|
|
2598
|
-
* const profile = await
|
|
2601
|
+
* const profile = await getProfile('PROFILEID');
|
|
2599
2602
|
* ```
|
|
2600
2603
|
*/
|
|
2601
2604
|
const getProfile = (endpoint, profileId) => endpoint.api //
|
|
2602
2605
|
.get(`/v2/profiles/${profileId}`)
|
|
2603
2606
|
.then((r) => r.data);
|
|
2604
2607
|
/**
|
|
2605
|
-
* Switch the caller's "current" profile. The current profile is used for permissions checking
|
|
2606
|
-
* for most operations in Verdocs. It is important to select the
|
|
2608
|
+
* Switch the caller's "current" profile. The current profile is used for permissions checking
|
|
2609
|
+
* and profile_id field settings for most operations in Verdocs. It is important to select the
|
|
2610
|
+
* appropropriate profile before calling other API functions.
|
|
2607
2611
|
*
|
|
2608
2612
|
* ```typescript
|
|
2609
|
-
* import {
|
|
2613
|
+
* import {switchProfile} from '@verdocs/js-sdk';
|
|
2610
2614
|
*
|
|
2611
|
-
* const newProfile = await
|
|
2615
|
+
* const newProfile = await switchProfile('PROFILEID');
|
|
2612
2616
|
* ```
|
|
2613
2617
|
*/
|
|
2614
2618
|
const switchProfile = (endpoint, profileId) => endpoint.api //
|
|
2615
2619
|
.post(`/v2/profiles/${profileId}/switch`)
|
|
2616
2620
|
.then((r) => r.data);
|
|
2617
2621
|
/**
|
|
2618
|
-
* Update a profile. For future expansion, the profile ID to update is required, but currently
|
|
2619
|
-
* "current" profile for the caller.
|
|
2622
|
+
* Update a profile. For future expansion, the profile ID to update is required, but currently
|
|
2623
|
+
* this must also be the "current" profile for the caller.
|
|
2620
2624
|
*
|
|
2621
2625
|
* ```typescript
|
|
2622
|
-
* import {
|
|
2626
|
+
* import {updateProfile} from '@verdocs/js-sdk/Users';
|
|
2623
2627
|
*
|
|
2624
|
-
* const newProfile = await
|
|
2628
|
+
* const newProfile = await updateProfile('PROFILEID');
|
|
2625
2629
|
* ```
|
|
2626
2630
|
*/
|
|
2627
2631
|
const updateProfile = (endpoint, profileId, params) => endpoint.api //
|
|
2628
2632
|
.patch(`/v2/profiles/${profileId}`, params)
|
|
2629
2633
|
.then((r) => r.data);
|
|
2630
2634
|
/**
|
|
2631
|
-
* Delete a profile. If the requested profile is the caller's curent profile, the next
|
|
2635
|
+
* Delete a profile. If the requested profile is the caller's curent profile, the next
|
|
2636
|
+
* available profile will be selected.
|
|
2632
2637
|
*
|
|
2633
2638
|
* ```typescript
|
|
2634
|
-
* import {
|
|
2639
|
+
* import {deleteProfile} from '@verdocs/js-sdk';
|
|
2635
2640
|
*
|
|
2636
|
-
* await
|
|
2641
|
+
* await deleteProfile('PROFILEID');
|
|
2637
2642
|
* ```
|
|
2638
2643
|
*/
|
|
2639
2644
|
const deleteProfile = (endpoint, profileId) => endpoint.api //
|
|
2640
2645
|
.delete(`/v2/profiles/${profileId}`)
|
|
2641
2646
|
.then((r) => r.data);
|
|
2642
2647
|
/**
|
|
2643
|
-
* Create a user account
|
|
2644
|
-
*
|
|
2648
|
+
* Create a new user account. Note that there are two registration paths for creation:
|
|
2649
|
+
* - Get invited to an organization, by an admin or owner of that org.
|
|
2650
|
+
* - Created a new organization. The caller will become the first owner of the new org.
|
|
2651
|
+
*
|
|
2652
|
+
* This endpoint is for the second path, so an organization name is required. It is NOT
|
|
2653
|
+
* required to be unique because it is very common for businesses to have the same names,
|
|
2654
|
+
* without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
|
|
2655
|
+
*
|
|
2656
|
+
* The new profile will automatically be set as the user's "current" profile, and new
|
|
2657
|
+
* session tokens will be returned to the caller. However, the caller's email may not yet
|
|
2658
|
+
* be verified. In that case, the caller will not yet be able to call other endpoints in
|
|
2659
|
+
* the Verdocs API. The caller will need to check their email for a verification code,
|
|
2660
|
+
* which should be submitted via the `verifyEmail` endpoint.
|
|
2645
2661
|
*
|
|
2646
2662
|
* ```typescript
|
|
2647
|
-
* import {
|
|
2663
|
+
* import {createProfile} from '@verdocs/js-sdk';
|
|
2648
2664
|
*
|
|
2649
|
-
* const
|
|
2650
|
-
* orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
2665
|
+
* const newSession = await createProfile({
|
|
2666
|
+
* orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
2651
2667
|
* });
|
|
2652
2668
|
* ```
|
|
2653
2669
|
*/
|
|
2654
|
-
const
|
|
2655
|
-
.post('/
|
|
2656
|
-
.then((r) => r.data);
|
|
2657
|
-
const recordSignupSurvey = (endpoint, params) => endpoint.api //
|
|
2658
|
-
.post('/user/signup', params)
|
|
2670
|
+
const createProfile = (endpoint, params) => endpoint.api //
|
|
2671
|
+
.post('/v2/profiles', params)
|
|
2659
2672
|
.then((r) => r.data);
|
|
2660
2673
|
|
|
2661
|
-
export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164,
|
|
2674
|
+
export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganization, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganization, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopesByTemplateId, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizations, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateOwnerInfo, getTemplateReminder, getTemplateRole, getTemplateRoleFields, getTemplateRoles, getTemplateTags, getTemplates, getTemplatesSummary, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listEnvelopes, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchEnvelopes, searchTemplates, sendDelegate, setWebhooks, switchProfile, throttledGetEnvelope, throttledGetTemplate, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationMember, updateProfile, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
|
|
2662
2675
|
//# sourceMappingURL=index.mjs.map
|