@verdocs/js-sdk 3.10.29 → 4.0.0
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/README.md +75 -0
- package/dist/index.d.mts +41294 -0
- package/dist/index.d.ts +41294 -0
- package/dist/index.js +3045 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3036 -0
- package/dist/index.mjs.map +1 -0
- package/dist/package.json +85 -0
- package/dist/tsconfig.json +16 -0
- package/package.json +31 -14
- package/.github/workflows/generate-docs.yml +0 -41
- package/Envelopes/Envelopes.d.ts +0 -242
- package/Envelopes/Envelopes.js +0 -339
- package/Envelopes/Initials.d.ts +0 -15
- package/Envelopes/Initials.js +0 -13
- package/Envelopes/Permissions.d.ts +0 -52
- package/Envelopes/Permissions.js +0 -84
- package/Envelopes/Recipients.d.ts +0 -89
- package/Envelopes/Recipients.js +0 -112
- package/Envelopes/Reminders.d.ts +0 -23
- package/Envelopes/Reminders.js +0 -33
- package/Envelopes/Signatures.d.ts +0 -28
- package/Envelopes/Signatures.js +0 -37
- package/Envelopes/Types.d.ts +0 -390
- package/Envelopes/Types.js +0 -45
- package/Envelopes/index.d.ts +0 -7
- package/Envelopes/index.js +0 -7
- package/Organizations/ApiKeys.d.ts +0 -64
- package/Organizations/ApiKeys.js +0 -82
- package/Organizations/Groups.d.ts +0 -47
- package/Organizations/Groups.js +0 -76
- package/Organizations/Invitations.d.ts +0 -24
- package/Organizations/Invitations.js +0 -45
- package/Organizations/Members.d.ts +0 -12
- package/Organizations/Members.js +0 -30
- package/Organizations/Organizations.d.ts +0 -27
- package/Organizations/Organizations.js +0 -45
- package/Organizations/Types.d.ts +0 -104
- package/Organizations/Types.js +0 -1
- package/Organizations/Webhooks.d.ts +0 -34
- package/Organizations/Webhooks.js +0 -10
- package/Organizations/Whitelabel.d.ts +0 -31
- package/Organizations/Whitelabel.js +0 -38
- package/Organizations/index.d.ts +0 -16
- package/Organizations/index.js +0 -16
- package/Sessions/Types.d.ts +0 -54
- package/Sessions/Types.js +0 -1
- package/Sessions/index.d.ts +0 -6
- package/Sessions/index.js +0 -7
- package/Templates/Actions.d.ts +0 -26
- package/Templates/Actions.js +0 -104
- package/Templates/Fields.d.ts +0 -14
- package/Templates/Fields.js +0 -24
- package/Templates/Pages.d.ts +0 -30
- package/Templates/Pages.js +0 -41
- package/Templates/Permissions.d.ts +0 -73
- package/Templates/Permissions.js +0 -124
- package/Templates/Reminders.d.ts +0 -23
- package/Templates/Reminders.js +0 -33
- package/Templates/Roles.d.ts +0 -16
- package/Templates/Roles.js +0 -42
- package/Templates/Stars.d.ts +0 -10
- package/Templates/Stars.js +0 -16
- package/Templates/Tags.d.ts +0 -33
- package/Templates/Tags.js +0 -55
- package/Templates/TemplateDocuments.d.ts +0 -66
- package/Templates/TemplateDocuments.js +0 -139
- package/Templates/Templates.d.ts +0 -284
- package/Templates/Templates.js +0 -309
- package/Templates/Types.d.ts +0 -346
- package/Templates/Types.js +0 -29
- package/Templates/Validators.d.ts +0 -21
- package/Templates/Validators.js +0 -27
- package/Templates/index.d.ts +0 -11
- package/Templates/index.js +0 -11
- package/Users/Auth.d.ts +0 -123
- package/Users/Auth.js +0 -142
- package/Users/Billing.d.ts +0 -1
- package/Users/Billing.js +0 -2
- package/Users/Notifications.d.ts +0 -2
- package/Users/Notifications.js +0 -43
- package/Users/Profiles.d.ts +0 -151
- package/Users/Profiles.js +0 -179
- package/Users/Types.d.ts +0 -146
- package/Users/Types.js +0 -47
- package/Users/index.d.ts +0 -5
- package/Users/index.js +0 -5
- package/Utils/Colors.d.ts +0 -18
- package/Utils/Colors.js +0 -102
- package/Utils/DateTime.d.ts +0 -6
- package/Utils/DateTime.js +0 -79
- package/Utils/Fields.d.ts +0 -5
- package/Utils/Fields.js +0 -24
- package/Utils/Files.d.ts +0 -16
- package/Utils/Files.js +0 -42
- package/Utils/Locales.d.ts +0 -17
- package/Utils/Locales.js +0 -1358
- package/Utils/Primitives.d.ts +0 -18
- package/Utils/Primitives.js +0 -31
- package/Utils/Strings.d.ts +0 -9
- package/Utils/Strings.js +0 -28
- package/Utils/Token.d.ts +0 -19
- package/Utils/Token.js +0 -67
- package/Utils/globalThis.d.ts +0 -2
- package/Utils/globalThis.js +0 -52
- package/Utils/index.d.ts +0 -8
- package/Utils/index.js +0 -8
- package/VerdocsEndpoint.d.ts +0 -199
- package/VerdocsEndpoint.js +0 -319
- package/index.d.ts +0 -18
- package/index.js +0 -18
- package/tsconfig-typedoc.json +0 -26
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IRole, ITag } from './Types';
|
|
2
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
3
|
-
export interface IValidator {
|
|
4
|
-
name: string;
|
|
5
|
-
regex: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Get all defined validators
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import {Documents} from '@verdocs/js-sdk/Templates';
|
|
12
|
-
*
|
|
13
|
-
* await Documents.getDocuments(templateID);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare const getValidators: (endpoint: VerdocsEndpoint) => Promise<IValidator[]>;
|
|
17
|
-
export declare const getValidator: (endpoint: VerdocsEndpoint, validatorName: string) => Promise<IValidator>;
|
|
18
|
-
export declare const isValidEmail: (email: string | undefined) => boolean;
|
|
19
|
-
export declare const isValidPhone: (phone: string | undefined) => boolean;
|
|
20
|
-
export declare const isValidRoleName: (value: string, roles: IRole[]) => boolean;
|
|
21
|
-
export declare const isValidTag: (value: string, tags: ITag[]) => boolean;
|
package/Templates/Validators.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get all defined validators
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* import {Documents} from '@verdocs/js-sdk/Templates';
|
|
6
|
-
*
|
|
7
|
-
* await Documents.getDocuments(templateID);
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export var getValidators = function (endpoint) {
|
|
11
|
-
return endpoint.api //
|
|
12
|
-
.get('/validators')
|
|
13
|
-
.then(function (r) { return r.data; });
|
|
14
|
-
};
|
|
15
|
-
export var getValidator = function (endpoint, validatorName) {
|
|
16
|
-
return endpoint.api //
|
|
17
|
-
.get("/validators/".concat(validatorName))
|
|
18
|
-
.then(function (r) { return r.data; });
|
|
19
|
-
};
|
|
20
|
-
var EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
21
|
-
export var isValidEmail = function (email) { return !!email && EMAIL_REGEX.test(email); };
|
|
22
|
-
// @see https://www.regextester.com/1978
|
|
23
|
-
var PHONE_REGEX = /((?:\+|00)[17](?: |\-)?|(?:\+|00)[1-9]\d{0,2}(?: |\-)?|(?:\+|00)1\-\d{3}(?: |\-)?)?(0\d|\([0-9]{3}\)|[1-9]{0,3})(?:((?: |\-)[0-9]{2}){4}|((?:[0-9]{2}){4})|((?: |\-)[0-9]{3}(?: |\-)[0-9]{4})|([0-9]{7}))/;
|
|
24
|
-
export var isValidPhone = function (phone) { return !!phone && PHONE_REGEX.test(phone); };
|
|
25
|
-
export var isValidRoleName = function (value, roles) { return roles.findIndex(function (role) { return role.name === value; }) !== -1; };
|
|
26
|
-
var TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
|
|
27
|
-
export var isValidTag = function (value, tags) { return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.name === value; }) !== -1; };
|
package/Templates/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * as Actions from './Actions';
|
|
2
|
-
export * as Fields from './Fields';
|
|
3
|
-
export * as Pages from './Pages';
|
|
4
|
-
export * as Reminders from './Reminders';
|
|
5
|
-
export * as Roles from './Roles';
|
|
6
|
-
export * as Stars from './Stars';
|
|
7
|
-
export * as Tags from './Tags';
|
|
8
|
-
export * as Templates from './Templates';
|
|
9
|
-
export * as TemplateDocuments from './TemplateDocuments';
|
|
10
|
-
export * as Types from './Types';
|
|
11
|
-
export * as Validators from './Validators';
|
package/Templates/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * as Actions from './Actions';
|
|
2
|
-
export * as Fields from './Fields';
|
|
3
|
-
export * as Pages from './Pages';
|
|
4
|
-
export * as Reminders from './Reminders';
|
|
5
|
-
export * as Roles from './Roles';
|
|
6
|
-
export * as Stars from './Stars';
|
|
7
|
-
export * as Tags from './Tags';
|
|
8
|
-
export * as Templates from './Templates';
|
|
9
|
-
export * as TemplateDocuments from './TemplateDocuments';
|
|
10
|
-
export * as Types from './Types';
|
|
11
|
-
export * as Validators from './Validators';
|
package/Users/Auth.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { IAuthenticateAppRequest, IAuthenticateUserRequest, IProfile } from './Types';
|
|
2
|
-
import { TokenValidationRequest, UpdateEmailRequest, IUpdatePasswordRequest } from './Types';
|
|
3
|
-
import { IAuthenticateResponse, TokenValidationResponse, UpdateEmailResponse, UpdatePasswordResponse } from './Types';
|
|
4
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
5
|
-
/**
|
|
6
|
-
* Authenticate to Verdocs via user/password authentication
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
10
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
11
|
-
*
|
|
12
|
-
* const {accessToken} = await Auth.authenticateUser({ username: 'test@test.com', password: 'PASSWORD' });
|
|
13
|
-
* Transport.setAuthToken(accessToken);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare const authenticateUser: (endpoint: VerdocsEndpoint, params: IAuthenticateUserRequest) => Promise<IAuthenticateResponse>;
|
|
17
|
-
/**
|
|
18
|
-
* Authenticate to Verdocs via client ID / Secret authentication. **NOTE: This is only suitable for
|
|
19
|
-
* NodeJS server-side applications. Never expose your Client Secret in a Web or Mobile app!** Also note
|
|
20
|
-
* that access tokens may be cached by server-side apps (and this is recommended) but do expire after 2
|
|
21
|
-
* hours. This expiration may change based on future security needs. Application developers are encouraged
|
|
22
|
-
* to check the `exp` expiration field in the response accessToken and renew tokens after they expire.
|
|
23
|
-
*
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
26
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
27
|
-
*
|
|
28
|
-
* const {accessToken} = await Auth.authenticateApp({ client_id: 'CLIENTID', client_secret: 'SECRET' });
|
|
29
|
-
* Transport.setAuthToken(accessToken);
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare const authenticateApp: (endpoint: VerdocsEndpoint, params: IAuthenticateAppRequest) => Promise<IAuthenticateResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* Validate a token. Only Verdocs tokens will be accepted. Most applications can decode tokens locally,
|
|
35
|
-
* because tokens will be validated when API calls are made anyway. However, high-security applications
|
|
36
|
-
* may use this endpoint to check if a token has been revoked.
|
|
37
|
-
*
|
|
38
|
-
* ```typescript
|
|
39
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
40
|
-
*
|
|
41
|
-
* const {valid} = await Auth.validateToken({ token });
|
|
42
|
-
* if (!valid) {
|
|
43
|
-
* window.alert('Session invalid or expired. Please re-authenticate.');
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare const validateToken: (endpoint: VerdocsEndpoint, params: TokenValidationRequest) => Promise<TokenValidationResponse>;
|
|
48
|
-
/**
|
|
49
|
-
* If called before the session expires, this will refresh the caller's session and tokens.
|
|
50
|
-
*
|
|
51
|
-
* ```typescript
|
|
52
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
53
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
54
|
-
*
|
|
55
|
-
* const {accessToken} = await Auth.refreshTokens();
|
|
56
|
-
* Transport.setAuthToken(accessToken);
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare const refreshTokens: (endpoint: VerdocsEndpoint) => Promise<IAuthenticateResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* Update the caller's password. To help prevent CSRF attack vectors, the user's old password and email address are required.
|
|
62
|
-
*
|
|
63
|
-
* ```typescript
|
|
64
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
65
|
-
*
|
|
66
|
-
* const {status, message} = await Auth.updatePassword({ email, oldPassword, newPassword });
|
|
67
|
-
* if (status !== 'OK') {
|
|
68
|
-
* window.alert(`Password reset error: ${message}`);
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare const updatePassword: (endpoint: VerdocsEndpoint, params: IUpdatePasswordRequest) => Promise<UpdatePasswordResponse>;
|
|
73
|
-
/**
|
|
74
|
-
* Reset the caller's password.
|
|
75
|
-
*
|
|
76
|
-
* ```typescript
|
|
77
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
78
|
-
*
|
|
79
|
-
* const {success} = await Auth.resetPassword({ email });
|
|
80
|
-
* if (status !== 'OK') {
|
|
81
|
-
* window.alert(`Please check your email for instructions on how to reset your password.`);
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare const resetPassword: (endpoint: VerdocsEndpoint, params: {
|
|
86
|
-
email: string;
|
|
87
|
-
}) => Promise<{
|
|
88
|
-
success: boolean;
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* Update the caller's email address.
|
|
92
|
-
*
|
|
93
|
-
* ```typescript
|
|
94
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
95
|
-
*
|
|
96
|
-
* const {profiles} = await Auth.updateEmail({ email: newEmail });
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export declare const updateEmail: (endpoint: VerdocsEndpoint, params: UpdateEmailRequest) => Promise<UpdateEmailResponse>;
|
|
100
|
-
/**
|
|
101
|
-
* Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
|
|
102
|
-
* a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
|
|
103
|
-
* the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
|
|
104
|
-
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
105
|
-
* "anonymous" mode while verification is being performed.
|
|
106
|
-
*
|
|
107
|
-
* ```typescript
|
|
108
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
109
|
-
*
|
|
110
|
-
* const result = await Auth.resendVerification();
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare const resendVerification: (endpoint: VerdocsEndpoint, accessToken?: string) => Promise<{
|
|
114
|
-
result: 'done';
|
|
115
|
-
}>;
|
|
116
|
-
export interface ICreateUserRequest {
|
|
117
|
-
firstName: string;
|
|
118
|
-
lastName: string;
|
|
119
|
-
email: string;
|
|
120
|
-
password: string;
|
|
121
|
-
fromInviteCode: string;
|
|
122
|
-
}
|
|
123
|
-
export declare const createUser: (endpoint: VerdocsEndpoint, params: ICreateUserRequest) => Promise<IProfile>;
|
package/Users/Auth.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authenticate to Verdocs via user/password authentication
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
6
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
7
|
-
*
|
|
8
|
-
* const {accessToken} = await Auth.authenticateUser({ username: 'test@test.com', password: 'PASSWORD' });
|
|
9
|
-
* Transport.setAuthToken(accessToken);
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export var authenticateUser = function (endpoint, params) {
|
|
13
|
-
return endpoint.api //
|
|
14
|
-
.post('/authentication/login', params)
|
|
15
|
-
.then(function (r) { return r.data; });
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Authenticate to Verdocs via client ID / Secret authentication. **NOTE: This is only suitable for
|
|
19
|
-
* NodeJS server-side applications. Never expose your Client Secret in a Web or Mobile app!** Also note
|
|
20
|
-
* that access tokens may be cached by server-side apps (and this is recommended) but do expire after 2
|
|
21
|
-
* hours. This expiration may change based on future security needs. Application developers are encouraged
|
|
22
|
-
* to check the `exp` expiration field in the response accessToken and renew tokens after they expire.
|
|
23
|
-
*
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
26
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
27
|
-
*
|
|
28
|
-
* const {accessToken} = await Auth.authenticateApp({ client_id: 'CLIENTID', client_secret: 'SECRET' });
|
|
29
|
-
* Transport.setAuthToken(accessToken);
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export var authenticateApp = function (endpoint, params) {
|
|
33
|
-
return endpoint.api //
|
|
34
|
-
.post('/authentication/login_client', {}, { headers: params })
|
|
35
|
-
.then(function (r) { return r.data; });
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Validate a token. Only Verdocs tokens will be accepted. Most applications can decode tokens locally,
|
|
39
|
-
* because tokens will be validated when API calls are made anyway. However, high-security applications
|
|
40
|
-
* may use this endpoint to check if a token has been revoked.
|
|
41
|
-
*
|
|
42
|
-
* ```typescript
|
|
43
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
44
|
-
*
|
|
45
|
-
* const {valid} = await Auth.validateToken({ token });
|
|
46
|
-
* if (!valid) {
|
|
47
|
-
* window.alert('Session invalid or expired. Please re-authenticate.');
|
|
48
|
-
* }
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export var validateToken = function (endpoint, params) {
|
|
52
|
-
return endpoint.api //
|
|
53
|
-
.post('/token/isValid', params)
|
|
54
|
-
.then(function (r) { return r.data; });
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* If called before the session expires, this will refresh the caller's session and tokens.
|
|
58
|
-
*
|
|
59
|
-
* ```typescript
|
|
60
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
61
|
-
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
62
|
-
*
|
|
63
|
-
* const {accessToken} = await Auth.refreshTokens();
|
|
64
|
-
* Transport.setAuthToken(accessToken);
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export var refreshTokens = function (endpoint) {
|
|
68
|
-
return endpoint.api //
|
|
69
|
-
.get('/token')
|
|
70
|
-
.then(function (r) { return r.data; });
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Update the caller's password. To help prevent CSRF attack vectors, the user's old password and email address are required.
|
|
74
|
-
*
|
|
75
|
-
* ```typescript
|
|
76
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
77
|
-
*
|
|
78
|
-
* const {status, message} = await Auth.updatePassword({ email, oldPassword, newPassword });
|
|
79
|
-
* if (status !== 'OK') {
|
|
80
|
-
* window.alert(`Password reset error: ${message}`);
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export var updatePassword = function (endpoint, params) {
|
|
85
|
-
return endpoint.api //
|
|
86
|
-
.put('/user/update_password', params)
|
|
87
|
-
.then(function (r) { return r.data; });
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Reset the caller's password.
|
|
91
|
-
*
|
|
92
|
-
* ```typescript
|
|
93
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
94
|
-
*
|
|
95
|
-
* const {success} = await Auth.resetPassword({ email });
|
|
96
|
-
* if (status !== 'OK') {
|
|
97
|
-
* window.alert(`Please check your email for instructions on how to reset your password.`);
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export var resetPassword = function (endpoint, params) {
|
|
102
|
-
return endpoint.api //
|
|
103
|
-
.post('/user/reset_password', params)
|
|
104
|
-
.then(function (r) { return r.data; });
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Update the caller's email address.
|
|
108
|
-
*
|
|
109
|
-
* ```typescript
|
|
110
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
111
|
-
*
|
|
112
|
-
* const {profiles} = await Auth.updateEmail({ email: newEmail });
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
export var updateEmail = function (endpoint, params) {
|
|
116
|
-
return endpoint.api //
|
|
117
|
-
.put('/user/update_email', params)
|
|
118
|
-
.then(function (r) { return r.data; });
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
|
|
122
|
-
* a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
|
|
123
|
-
* the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
|
|
124
|
-
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
125
|
-
* "anonymous" mode while verification is being performed.
|
|
126
|
-
*
|
|
127
|
-
* ```typescript
|
|
128
|
-
* import {Auth} from '@verdocs/js-sdk/Auth';
|
|
129
|
-
*
|
|
130
|
-
* const result = await Auth.resendVerification();
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export var resendVerification = function (endpoint, accessToken) {
|
|
134
|
-
return endpoint.api //
|
|
135
|
-
.post('/user/email_verification', {}, accessToken ? { headers: { Authorization: "Bearer ".concat(accessToken) } } : {})
|
|
136
|
-
.then(function (r) { return r.data; });
|
|
137
|
-
};
|
|
138
|
-
export var createUser = function (endpoint, params) {
|
|
139
|
-
return endpoint.api //
|
|
140
|
-
.post('/user', params)
|
|
141
|
-
.then(function (r) { return r.data; });
|
|
142
|
-
};
|
package/Users/Billing.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const billingPlaceholder: {};
|
package/Users/Billing.js
DELETED
package/Users/Notifications.d.ts
DELETED
package/Users/Notifications.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export var getNotifications = function (endpoint) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38
|
-
return __generator(this, function (_a) {
|
|
39
|
-
return [2 /*return*/, endpoint.api //
|
|
40
|
-
.get('/notifications')
|
|
41
|
-
.then(function (r) { return r.data; })];
|
|
42
|
-
});
|
|
43
|
-
}); };
|
package/Users/Profiles.d.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { ICreateProfileRequest, IPermission, IProfile, IRole, ISwitchProfileResponse, IUpdateProfileRequest } from './Types';
|
|
2
|
-
import { IGroup, IOrganization } from '../Organizations/Types';
|
|
3
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
4
|
-
/**
|
|
5
|
-
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
6
|
-
*
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
9
|
-
*
|
|
10
|
-
* const profiles = await Profiles.getProfiles()
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare const getProfiles: (endpoint: VerdocsEndpoint) => Promise<IProfile[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
16
|
-
*
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
19
|
-
*
|
|
20
|
-
* const profiles = await Profiles.getCurrentProfile()
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare const getCurrentProfile: (endpoint: VerdocsEndpoint) => Promise<IProfile | undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* Get a list of system roles.
|
|
26
|
-
*
|
|
27
|
-
* ```typescript
|
|
28
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
29
|
-
*
|
|
30
|
-
* const roles = await Profiles.getRoles();
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare const getRoles: (endpoint: VerdocsEndpoint) => Promise<IRole[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Get a list of system roles.
|
|
36
|
-
*
|
|
37
|
-
* ```typescript
|
|
38
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
39
|
-
*
|
|
40
|
-
* const permissions = await Profiles.getPermissions();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare const getPermissions: (endpoint: VerdocsEndpoint) => Promise<any>;
|
|
44
|
-
/**
|
|
45
|
-
* Create a profile. If the caller does not have a "current" profile set, the new profile will be made current.
|
|
46
|
-
*
|
|
47
|
-
* ```typescript
|
|
48
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
49
|
-
*
|
|
50
|
-
* const newProfile = await Profiles.createProfile({ first_name: 'FIRST', last_name: 'LAST', email: 'EMAIL' });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare const createProfile: (endpoint: VerdocsEndpoint, params: ICreateProfileRequest) => Promise<IProfile>;
|
|
54
|
-
/**
|
|
55
|
-
* Get a profile. The caller must have admin access to the given profile.
|
|
56
|
-
* TODO: Add a "public" profile endpoint for public pages
|
|
57
|
-
*
|
|
58
|
-
* ```typescript
|
|
59
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
60
|
-
*
|
|
61
|
-
* const profile = await Profiles.getProfile('PROFILEID');
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare const getProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IProfile>;
|
|
65
|
-
/**
|
|
66
|
-
* Get a profile's permissions. The caller must have admin access to the given profile.
|
|
67
|
-
*
|
|
68
|
-
* ```typescript
|
|
69
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
70
|
-
*
|
|
71
|
-
* const permissions = await Profiles.getProfilePermissions('PROFILEID');
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare const getProfilePermissions: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IPermission[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Get a profile's groups.
|
|
77
|
-
*
|
|
78
|
-
* ```typescript
|
|
79
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
80
|
-
*
|
|
81
|
-
* const groups = await Profiles.getProfileGroups('PROFILEID');
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export declare const getProfileGroups: (endpoint: VerdocsEndpoint, profileId: string) => Promise<IGroup[]>;
|
|
85
|
-
/**
|
|
86
|
-
* Switch the caller's "current" profile. The current profile is used for permissions checking and profile_id field settings
|
|
87
|
-
* for most operations in Verdocs. It is important to select the appropropriate profile before calling other API functions.
|
|
88
|
-
*
|
|
89
|
-
* ```typescript
|
|
90
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
91
|
-
*
|
|
92
|
-
* const newProfile = await Profiles.switchProfile('PROFILEID');
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare const switchProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<ISwitchProfileResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* Update a profile. For future expansion, the profile ID to update is required, but currently this must also be the
|
|
98
|
-
* "current" profile for the caller.
|
|
99
|
-
*
|
|
100
|
-
* ```typescript
|
|
101
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
102
|
-
*
|
|
103
|
-
* const newProfile = await Profiles.updateProfile('PROFILEID');
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export declare const updateProfile: (endpoint: VerdocsEndpoint, profileId: string, params: IUpdateProfileRequest) => Promise<IProfile>;
|
|
107
|
-
/**
|
|
108
|
-
* Delete a profile. If the requested profile is the caller's curent profile, the next available profile will be selected.
|
|
109
|
-
*
|
|
110
|
-
* ```typescript
|
|
111
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
112
|
-
*
|
|
113
|
-
* await Profiles.deleteProfile('PROFILEID');
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
export declare const deleteProfile: (endpoint: VerdocsEndpoint, profileId: string) => Promise<any>;
|
|
117
|
-
export interface ICreateBusinessAccountRequest {
|
|
118
|
-
email: string;
|
|
119
|
-
password: string;
|
|
120
|
-
firstName: string;
|
|
121
|
-
lastName: string;
|
|
122
|
-
orgName: string;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
|
|
126
|
-
* existing organization should be invited, and follow their invitation links/instructions to create their accounts.
|
|
127
|
-
*
|
|
128
|
-
* ```typescript
|
|
129
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
130
|
-
*
|
|
131
|
-
* const newAccount = await Profiles.createBusinessAccount({
|
|
132
|
-
* orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
133
|
-
* });
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export declare const createBusinessAccount: (endpoint: VerdocsEndpoint, params: ICreateBusinessAccountRequest) => Promise<{
|
|
137
|
-
profile: IProfile;
|
|
138
|
-
organization: IOrganization;
|
|
139
|
-
}>;
|
|
140
|
-
export interface ISignupSurvey {
|
|
141
|
-
industry?: string;
|
|
142
|
-
size?: string;
|
|
143
|
-
source?: string;
|
|
144
|
-
referral?: string;
|
|
145
|
-
coupon?: string;
|
|
146
|
-
reason?: string;
|
|
147
|
-
hearabout?: string;
|
|
148
|
-
}
|
|
149
|
-
export declare const recordSignupSurvey: (endpoint: VerdocsEndpoint, params: ISignupSurvey) => Promise<{
|
|
150
|
-
status: 'OK';
|
|
151
|
-
}>;
|