@verdocs/js-sdk 3.10.30 → 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 +29 -12
- 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
package/Users/Profiles.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
6
|
-
*
|
|
7
|
-
* const profiles = await Profiles.getProfiles()
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export var getProfiles = function (endpoint) {
|
|
11
|
-
return endpoint.api //
|
|
12
|
-
.get('/profiles')
|
|
13
|
-
.then(function (r) { return r.data; });
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
20
|
-
*
|
|
21
|
-
* const profiles = await Profiles.getCurrentProfile()
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export var getCurrentProfile = function (endpoint) {
|
|
25
|
-
return endpoint.api //
|
|
26
|
-
.get('/profiles')
|
|
27
|
-
.then(function (r) { return (r.data || []).find(function (profile) { return profile.current; }); });
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Get a list of system roles.
|
|
31
|
-
*
|
|
32
|
-
* ```typescript
|
|
33
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
34
|
-
*
|
|
35
|
-
* const roles = await Profiles.getRoles();
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export var getRoles = function (endpoint) {
|
|
39
|
-
return endpoint.api //
|
|
40
|
-
.get('/roles')
|
|
41
|
-
.then(function (r) { return r.data; });
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Get a list of system roles.
|
|
45
|
-
*
|
|
46
|
-
* ```typescript
|
|
47
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
48
|
-
*
|
|
49
|
-
* const permissions = await Profiles.getPermissions();
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export var getPermissions = function (endpoint) {
|
|
53
|
-
return endpoint.api //
|
|
54
|
-
.get('/permissions')
|
|
55
|
-
.then(function (r) { return r.data; });
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Create a profile. If the caller does not have a "current" profile set, the new profile will be made current.
|
|
59
|
-
*
|
|
60
|
-
* ```typescript
|
|
61
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
62
|
-
*
|
|
63
|
-
* const newProfile = await Profiles.createProfile({ first_name: 'FIRST', last_name: 'LAST', email: 'EMAIL' });
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export var createProfile = function (endpoint, params) {
|
|
67
|
-
return endpoint.api //
|
|
68
|
-
.post('/profiles', params)
|
|
69
|
-
.then(function (r) { return r.data; });
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Get a profile. The caller must have admin access to the given profile.
|
|
73
|
-
* TODO: Add a "public" profile endpoint for public pages
|
|
74
|
-
*
|
|
75
|
-
* ```typescript
|
|
76
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
77
|
-
*
|
|
78
|
-
* const profile = await Profiles.getProfile('PROFILEID');
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export var getProfile = function (endpoint, profileId) {
|
|
82
|
-
return endpoint.api //
|
|
83
|
-
.get("/profiles/".concat(profileId))
|
|
84
|
-
.then(function (r) { return r.data; });
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Get a profile's permissions. The caller must have admin access to the given profile.
|
|
88
|
-
*
|
|
89
|
-
* ```typescript
|
|
90
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
91
|
-
*
|
|
92
|
-
* const permissions = await Profiles.getProfilePermissions('PROFILEID');
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export var getProfilePermissions = function (endpoint, profileId) {
|
|
96
|
-
return endpoint.api //
|
|
97
|
-
.get("/profiles/".concat(profileId, "/permissions"))
|
|
98
|
-
.then(function (r) { return r.data; });
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Get a profile's groups.
|
|
102
|
-
*
|
|
103
|
-
* ```typescript
|
|
104
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
105
|
-
*
|
|
106
|
-
* const groups = await Profiles.getProfileGroups('PROFILEID');
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
export var getProfileGroups = function (endpoint, profileId) {
|
|
110
|
-
return endpoint.api //
|
|
111
|
-
.get("/profiles/".concat(profileId, "/groups"))
|
|
112
|
-
.then(function (r) { return r.data; });
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Switch the caller's "current" profile. The current profile is used for permissions checking and profile_id field settings
|
|
116
|
-
* for most operations in Verdocs. It is important to select the appropropriate profile before calling other API functions.
|
|
117
|
-
*
|
|
118
|
-
* ```typescript
|
|
119
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
120
|
-
*
|
|
121
|
-
* const newProfile = await Profiles.switchProfile('PROFILEID');
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export var switchProfile = function (endpoint, profileId) {
|
|
125
|
-
return endpoint.api //
|
|
126
|
-
.post("/profiles/".concat(profileId, "/switch"))
|
|
127
|
-
.then(function (r) { return r.data; });
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Update a profile. For future expansion, the profile ID to update is required, but currently this must also be the
|
|
131
|
-
* "current" profile for the caller.
|
|
132
|
-
*
|
|
133
|
-
* ```typescript
|
|
134
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
135
|
-
*
|
|
136
|
-
* const newProfile = await Profiles.updateProfile('PROFILEID');
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
export var updateProfile = function (endpoint, profileId, params) {
|
|
140
|
-
return endpoint.api //
|
|
141
|
-
.put("/profiles/".concat(profileId), params)
|
|
142
|
-
.then(function (r) { return r.data; });
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Delete a profile. If the requested profile is the caller's curent profile, the next available profile will be selected.
|
|
146
|
-
*
|
|
147
|
-
* ```typescript
|
|
148
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
149
|
-
*
|
|
150
|
-
* await Profiles.deleteProfile('PROFILEID');
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
export var deleteProfile = function (endpoint, profileId) {
|
|
154
|
-
return endpoint.api //
|
|
155
|
-
.delete("/profiles/".concat(profileId))
|
|
156
|
-
.then(function (r) { return r.data; });
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
|
|
160
|
-
* existing organization should be invited, and follow their invitation links/instructions to create their accounts.
|
|
161
|
-
*
|
|
162
|
-
* ```typescript
|
|
163
|
-
* import {Profiles} from '@verdocs/js-sdk/Users';
|
|
164
|
-
*
|
|
165
|
-
* const newAccount = await Profiles.createBusinessAccount({
|
|
166
|
-
* orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
|
167
|
-
* });
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
export var createBusinessAccount = function (endpoint, params) {
|
|
171
|
-
return endpoint.api //
|
|
172
|
-
.post('/user/business', params)
|
|
173
|
-
.then(function (r) { return r.data; });
|
|
174
|
-
};
|
|
175
|
-
export var recordSignupSurvey = function (endpoint, params) {
|
|
176
|
-
return endpoint.api //
|
|
177
|
-
.post('/user/signup', params)
|
|
178
|
-
.then(function (r) { return r.data; });
|
|
179
|
-
};
|
package/Users/Types.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { IGroup, IOrganization } from '../Organizations/Types';
|
|
2
|
-
export type TRequestStatus = 'OK' | 'ERROR';
|
|
3
|
-
/**
|
|
4
|
-
* Operation within Verdocs that users may perform.
|
|
5
|
-
*/
|
|
6
|
-
export declare enum Permissions {
|
|
7
|
-
RCOMMON = "rcommon:access",
|
|
8
|
-
RFORM_ACCESS = "rform:access",
|
|
9
|
-
ORG_CREATE = "org:create",
|
|
10
|
-
ORG_VIEW = "org:view",
|
|
11
|
-
ORG_UPDATE = "org:update",
|
|
12
|
-
ORG_DELETE = "org:delete",
|
|
13
|
-
ORG_TRANSFER = "org:transfer",
|
|
14
|
-
ORG_LIST = "org:list",
|
|
15
|
-
OWNER_ADD = "owner:add",
|
|
16
|
-
OWNER_REMOVE = "owner:remove",
|
|
17
|
-
ADMIN_ADD = "admin:add",
|
|
18
|
-
ADMIN_REMOVE = "admin:remove",
|
|
19
|
-
MEMBER_VIEW = "member:view",
|
|
20
|
-
MEMBER_ADD = "member:add",
|
|
21
|
-
MEMBER_REMOVE = "member:remove",
|
|
22
|
-
TEMPLATE_CREATOR_DELETE = "template:creator:delete",
|
|
23
|
-
TEMPLATE_CREATOR_VISIBILITY = "template:creator:visibility",
|
|
24
|
-
TEMPLATE_CREATOR_CREATE_ORG = "template:creator:create:org",
|
|
25
|
-
TEMPLATE_CREATOR_CREATE_PUBLIC = "template:creator:create:public",
|
|
26
|
-
TEMPLATE_CREATOR_CREATE_PERSONAL = "template:creator:create:personal",
|
|
27
|
-
TEMPLATE_MEMBER_READ = "template:member:read",
|
|
28
|
-
TEMPLATE_MEMBER_WRITE = "template:member:write",
|
|
29
|
-
TEMPLATE_MEMBER_DELETE = "template:member:delete",
|
|
30
|
-
TEMPLATE_MEMBER_VISIBILITY = "template:member:visibility"
|
|
31
|
-
}
|
|
32
|
-
export type TPermission = `${Permissions}`;
|
|
33
|
-
/**
|
|
34
|
-
* Plans provide access to Verdocs product features.
|
|
35
|
-
*/
|
|
36
|
-
export declare enum Plans {
|
|
37
|
-
ENV_ESSENTIAL = "env:essential",
|
|
38
|
-
ORG_STANDARD = "org:standard"
|
|
39
|
-
}
|
|
40
|
-
export type TPlan = `${Plans}`;
|
|
41
|
-
/**
|
|
42
|
-
* Roles provide access to groups of permissions.
|
|
43
|
-
*/
|
|
44
|
-
export declare enum Roles {
|
|
45
|
-
OWNER = "owner",
|
|
46
|
-
BASIC_USER = "basic_user",
|
|
47
|
-
MEMBER = "member"
|
|
48
|
-
}
|
|
49
|
-
export type TRole = `${Roles}`;
|
|
50
|
-
export interface IProfile {
|
|
51
|
-
/** The unique ID of the profile */
|
|
52
|
-
id: string;
|
|
53
|
-
/**
|
|
54
|
-
* The Verdocs back-end currently uses Auth0 for authentication. This value is a unique ID assigned by Auth0 to the
|
|
55
|
-
* user. This is typically used to identify multiple profiles owned by a single user, but its implementation may
|
|
56
|
-
* change in the future and developers should not develop code based on this field at this time.
|
|
57
|
-
*/
|
|
58
|
-
user_id: string;
|
|
59
|
-
/** The profile's organization ID, or a global "Realster" organization that all personal profiles are members of. */
|
|
60
|
-
organization_id: string;
|
|
61
|
-
first_name: string;
|
|
62
|
-
last_name: string;
|
|
63
|
-
email: string;
|
|
64
|
-
phone: string | null;
|
|
65
|
-
/** If true, this is the caller's "currently selected" profile. All operations will performed "as" this profile. */
|
|
66
|
-
current: boolean;
|
|
67
|
-
created_at: string;
|
|
68
|
-
updated_at: string;
|
|
69
|
-
/** The organization */
|
|
70
|
-
organization?: IOrganization;
|
|
71
|
-
/** The permissions assigned to the profilel _NOTE: Only present in the "current" profile._ */
|
|
72
|
-
permissions?: TPermission[];
|
|
73
|
-
/** The roles assigned to the profilel _NOTE: Only present in the "current" profile._ */
|
|
74
|
-
roles?: TRole[];
|
|
75
|
-
/** The plans assigned to the profilel _NOTE: Only present in the "current" profile._ */
|
|
76
|
-
plans?: TPlan[];
|
|
77
|
-
/** The plans assigned to the profilel _NOTE: Only present in the "current" profile._ */
|
|
78
|
-
groups?: IGroup[];
|
|
79
|
-
}
|
|
80
|
-
export interface IRole {
|
|
81
|
-
/** Unique identifier for the role. */
|
|
82
|
-
id: string;
|
|
83
|
-
/** Display name for the role. */
|
|
84
|
-
name: string;
|
|
85
|
-
}
|
|
86
|
-
export interface IPermission {
|
|
87
|
-
/** Unique identifier for the permission. */
|
|
88
|
-
id: string;
|
|
89
|
-
/** Display name for the permission. */
|
|
90
|
-
name: string;
|
|
91
|
-
}
|
|
92
|
-
export interface ICreateProfileRequest {
|
|
93
|
-
first_name: string;
|
|
94
|
-
last_name: string;
|
|
95
|
-
email: string;
|
|
96
|
-
phone?: string;
|
|
97
|
-
}
|
|
98
|
-
export interface ISwitchProfileResponse {
|
|
99
|
-
profile: IProfile;
|
|
100
|
-
idToken: string;
|
|
101
|
-
accessToken: string;
|
|
102
|
-
refreshToken: string;
|
|
103
|
-
}
|
|
104
|
-
export interface IUpdateProfileRequest {
|
|
105
|
-
first_name?: string;
|
|
106
|
-
last_name?: string;
|
|
107
|
-
phone?: string;
|
|
108
|
-
}
|
|
109
|
-
export interface IAuthenticateUserRequest {
|
|
110
|
-
username: string;
|
|
111
|
-
password: string;
|
|
112
|
-
}
|
|
113
|
-
export interface IAuthenticateAppRequest {
|
|
114
|
-
client_id: string;
|
|
115
|
-
client_secret: string;
|
|
116
|
-
}
|
|
117
|
-
export interface IAuthenticateResponse {
|
|
118
|
-
idToken: string;
|
|
119
|
-
accessToken: string;
|
|
120
|
-
refreshToken: string;
|
|
121
|
-
}
|
|
122
|
-
export interface TokenValidationRequest {
|
|
123
|
-
token: string;
|
|
124
|
-
}
|
|
125
|
-
export interface TokenValidationResponse {
|
|
126
|
-
/** True if the token is valid */
|
|
127
|
-
valid: boolean;
|
|
128
|
-
/** The decoded and validated body of the JWT */
|
|
129
|
-
payload: any;
|
|
130
|
-
}
|
|
131
|
-
export interface IUpdatePasswordRequest {
|
|
132
|
-
email: string;
|
|
133
|
-
oldPassword: string;
|
|
134
|
-
newPassword: string;
|
|
135
|
-
}
|
|
136
|
-
export interface UpdatePasswordResponse {
|
|
137
|
-
status: TRequestStatus;
|
|
138
|
-
/** Success or failure message */
|
|
139
|
-
message: string;
|
|
140
|
-
}
|
|
141
|
-
export interface UpdateEmailRequest {
|
|
142
|
-
email: string;
|
|
143
|
-
}
|
|
144
|
-
export interface UpdateEmailResponse {
|
|
145
|
-
profiles: IProfile[];
|
|
146
|
-
}
|
package/Users/Types.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operation within Verdocs that users may perform.
|
|
3
|
-
*/
|
|
4
|
-
export var Permissions;
|
|
5
|
-
(function (Permissions) {
|
|
6
|
-
Permissions["RCOMMON"] = "rcommon:access";
|
|
7
|
-
Permissions["RFORM_ACCESS"] = "rform:access";
|
|
8
|
-
Permissions["ORG_CREATE"] = "org:create";
|
|
9
|
-
Permissions["ORG_VIEW"] = "org:view";
|
|
10
|
-
Permissions["ORG_UPDATE"] = "org:update";
|
|
11
|
-
Permissions["ORG_DELETE"] = "org:delete";
|
|
12
|
-
Permissions["ORG_TRANSFER"] = "org:transfer";
|
|
13
|
-
Permissions["ORG_LIST"] = "org:list";
|
|
14
|
-
Permissions["OWNER_ADD"] = "owner:add";
|
|
15
|
-
Permissions["OWNER_REMOVE"] = "owner:remove";
|
|
16
|
-
Permissions["ADMIN_ADD"] = "admin:add";
|
|
17
|
-
Permissions["ADMIN_REMOVE"] = "admin:remove";
|
|
18
|
-
Permissions["MEMBER_VIEW"] = "member:view";
|
|
19
|
-
Permissions["MEMBER_ADD"] = "member:add";
|
|
20
|
-
Permissions["MEMBER_REMOVE"] = "member:remove";
|
|
21
|
-
Permissions["TEMPLATE_CREATOR_DELETE"] = "template:creator:delete";
|
|
22
|
-
Permissions["TEMPLATE_CREATOR_VISIBILITY"] = "template:creator:visibility";
|
|
23
|
-
Permissions["TEMPLATE_CREATOR_CREATE_ORG"] = "template:creator:create:org";
|
|
24
|
-
Permissions["TEMPLATE_CREATOR_CREATE_PUBLIC"] = "template:creator:create:public";
|
|
25
|
-
Permissions["TEMPLATE_CREATOR_CREATE_PERSONAL"] = "template:creator:create:personal";
|
|
26
|
-
Permissions["TEMPLATE_MEMBER_READ"] = "template:member:read";
|
|
27
|
-
Permissions["TEMPLATE_MEMBER_WRITE"] = "template:member:write";
|
|
28
|
-
Permissions["TEMPLATE_MEMBER_DELETE"] = "template:member:delete";
|
|
29
|
-
Permissions["TEMPLATE_MEMBER_VISIBILITY"] = "template:member:visibility";
|
|
30
|
-
})(Permissions || (Permissions = {}));
|
|
31
|
-
/**
|
|
32
|
-
* Plans provide access to Verdocs product features.
|
|
33
|
-
*/
|
|
34
|
-
export var Plans;
|
|
35
|
-
(function (Plans) {
|
|
36
|
-
Plans["ENV_ESSENTIAL"] = "env:essential";
|
|
37
|
-
Plans["ORG_STANDARD"] = "org:standard";
|
|
38
|
-
})(Plans || (Plans = {}));
|
|
39
|
-
/**
|
|
40
|
-
* Roles provide access to groups of permissions.
|
|
41
|
-
*/
|
|
42
|
-
export var Roles;
|
|
43
|
-
(function (Roles) {
|
|
44
|
-
Roles["OWNER"] = "owner";
|
|
45
|
-
Roles["BASIC_USER"] = "basic_user";
|
|
46
|
-
Roles["MEMBER"] = "member";
|
|
47
|
-
})(Roles || (Roles = {}));
|
package/Users/index.d.ts
DELETED
package/Users/index.js
DELETED
package/Utils/Colors.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IRole } from '../Templates/Types';
|
|
2
|
-
/**
|
|
3
|
-
* Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getRGB(rgba: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Given a signer role index, return the color code for that signer.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getRGBA(roleIndex: number): "rgba(255, 193, 7, 0.4)" | "rgba(134, 134, 134, 0.3)" | "rgba(156, 39, 176, .4)" | "rgba(33, 150, 243, .4)" | "rgba(220, 231, 117, 0.3)" | "rgba(121, 134, 203, 0.3)" | "rgba(77, 182, 172, 0.3)" | "rgba(255, 202, 165, 0.3)" | "rgba(2, 247, 190, 0.3)" | "rgba(255, 138, 101, 0.3)" | "rgba(82, 255, 79, 0.3)" | "rgba(229, 115, 155, 0.3)";
|
|
10
|
-
/**
|
|
11
|
-
* Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
|
|
12
|
-
* is not specified explicitly, but will be the same for every call with the same input value.
|
|
13
|
-
*/
|
|
14
|
-
export declare function nameToRGBA(str: string): string | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Helper function to obtain a color code given a role name given various possible inputs.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getRoleColor(name: string, roles: IRole[], index?: number): string | undefined;
|
package/Utils/Colors.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
|
|
3
|
-
*/
|
|
4
|
-
export function getRGB(rgba) {
|
|
5
|
-
var rgbNumbers = rgba.replace('rgba(', '').replace(')', '').split(',');
|
|
6
|
-
var rgbObject = {
|
|
7
|
-
red: +rgbNumbers[0],
|
|
8
|
-
green: +rgbNumbers[1],
|
|
9
|
-
blue: +rgbNumbers[2],
|
|
10
|
-
alpha: +rgbNumbers[3],
|
|
11
|
-
};
|
|
12
|
-
var alpha = 1 - rgbObject.alpha;
|
|
13
|
-
var red = Math.round((rgbObject.alpha * (rgbObject.red / 255) + alpha) * 255);
|
|
14
|
-
var green = Math.round((rgbObject.alpha * (rgbObject.green / 255) + alpha) * 255);
|
|
15
|
-
var blue = Math.round((rgbObject.alpha * (rgbObject.blue / 255) + alpha) * 255);
|
|
16
|
-
return '#' + rgbToHex(red) + rgbToHex(green) + rgbToHex(blue);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Given an RGB string value, returns the hex equivalent.
|
|
20
|
-
*/
|
|
21
|
-
function rgbToHex(rgb) {
|
|
22
|
-
var hex = rgb.toString(16);
|
|
23
|
-
if (hex.length < 2) {
|
|
24
|
-
return '0' + hex;
|
|
25
|
-
}
|
|
26
|
-
return hex;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Given a signer role index, return the color code for that signer.
|
|
30
|
-
*/
|
|
31
|
-
export function getRGBA(roleIndex) {
|
|
32
|
-
switch (roleIndex % 10) {
|
|
33
|
-
case 0:
|
|
34
|
-
return roleIndex === 0 ? 'rgba(255, 193, 7, 0.4)' : 'rgba(134, 134, 134, 0.3)'; // #FFE69C
|
|
35
|
-
case 1:
|
|
36
|
-
return 'rgba(156, 39, 176, .4)'; // '#E3C3E9'
|
|
37
|
-
case 2:
|
|
38
|
-
return 'rgba(33, 150, 243, .4)'; // '#C1E1FB'
|
|
39
|
-
case 3:
|
|
40
|
-
return 'rgba(220, 231, 117, 0.3)';
|
|
41
|
-
case 4:
|
|
42
|
-
return 'rgba(121, 134, 203, 0.3)';
|
|
43
|
-
case 5:
|
|
44
|
-
return 'rgba(77, 182, 172, 0.3)';
|
|
45
|
-
case 6:
|
|
46
|
-
return 'rgba(255, 202, 165, 0.3)';
|
|
47
|
-
case 7:
|
|
48
|
-
return 'rgba(2, 247, 190, 0.3)';
|
|
49
|
-
case 8:
|
|
50
|
-
return 'rgba(255, 138, 101, 0.3)';
|
|
51
|
-
case 9:
|
|
52
|
-
return 'rgba(82, 255, 79, 0.3)';
|
|
53
|
-
default:
|
|
54
|
-
return 'rgba(229, 115, 155, 0.3)';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
|
|
59
|
-
* is not specified explicitly, but will be the same for every call with the same input value.
|
|
60
|
-
*/
|
|
61
|
-
export function nameToRGBA(str) {
|
|
62
|
-
if (!!str) {
|
|
63
|
-
var validNum = parseInt(str.slice(-1), 10);
|
|
64
|
-
if (!isNaN(validNum)) {
|
|
65
|
-
str += (validNum * 99).toString();
|
|
66
|
-
}
|
|
67
|
-
var hash = 0;
|
|
68
|
-
for (var i = 0; i < str.length; i++) {
|
|
69
|
-
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
70
|
-
}
|
|
71
|
-
hash = Math.round(hash / 1.3);
|
|
72
|
-
var c = (hash & 0x00ffff08).toString(16).toUpperCase();
|
|
73
|
-
var hex = '#' + '00000'.substring(0, 6 - c.length) + c;
|
|
74
|
-
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
75
|
-
var color = {
|
|
76
|
-
r: parseInt(result[1], 16),
|
|
77
|
-
g: parseInt(result[2], 16),
|
|
78
|
-
b: parseInt(result[3], 16),
|
|
79
|
-
};
|
|
80
|
-
return "rgba(".concat(color.r, ", ").concat(color.g, ", ").concat(color.b, ", 0.2)");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Helper function to obtain a color code given a role name given various possible inputs.
|
|
85
|
-
*/
|
|
86
|
-
export function getRoleColor(name, roles, index) {
|
|
87
|
-
if (index) {
|
|
88
|
-
return getRGBA(index);
|
|
89
|
-
}
|
|
90
|
-
else if (roles && roles.length > 0) {
|
|
91
|
-
var roleIndex = roles.findIndex(function (role) { return role.name === name; });
|
|
92
|
-
if (roleIndex > -1) {
|
|
93
|
-
return roles[roleIndex].rgba || getRGBA(roleIndex);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return nameToRGBA(name);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return nameToRGBA(name);
|
|
101
|
-
}
|
|
102
|
-
}
|
package/Utils/DateTime.d.ts
DELETED
package/Utils/DateTime.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var YEAR = 365 * 24 * 60 * 60;
|
|
2
|
-
var MONTH = 30 * 24 * 60 * 60;
|
|
3
|
-
var WEEK = 7 * 24 * 60 * 60;
|
|
4
|
-
var DAY = 24 * 60 * 60;
|
|
5
|
-
var HOUR = 60 * 60;
|
|
6
|
-
var MINUTE = 60;
|
|
7
|
-
export var formatShortTimeAgo = function (val) {
|
|
8
|
-
if (val === undefined || val === null) {
|
|
9
|
-
return '';
|
|
10
|
-
}
|
|
11
|
-
var dateInput;
|
|
12
|
-
if (typeof val === 'string' || typeof val === 'number') {
|
|
13
|
-
dateInput = new Date(val);
|
|
14
|
-
}
|
|
15
|
-
else if (typeof val === 'object') {
|
|
16
|
-
dateInput = val;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
var timeDiff = Math.floor((new Date().getTime() - dateInput.getTime()) / 1000);
|
|
22
|
-
if (timeDiff >= YEAR) {
|
|
23
|
-
return Math.floor(timeDiff / YEAR) + 'Y';
|
|
24
|
-
}
|
|
25
|
-
// if (timeDiff >= MONTH) {
|
|
26
|
-
// return Math.floor(timeDiff / MONTH) + 'M';
|
|
27
|
-
// }
|
|
28
|
-
if (timeDiff >= WEEK) {
|
|
29
|
-
return Math.floor(timeDiff / WEEK) + 'W';
|
|
30
|
-
}
|
|
31
|
-
if (timeDiff >= DAY) {
|
|
32
|
-
return Math.floor(timeDiff / DAY) + 'D';
|
|
33
|
-
}
|
|
34
|
-
if (timeDiff >= HOUR) {
|
|
35
|
-
return Math.floor(timeDiff / HOUR) + 'H';
|
|
36
|
-
}
|
|
37
|
-
if (timeDiff >= MINUTE) {
|
|
38
|
-
return Math.floor(timeDiff / MINUTE) + 'M';
|
|
39
|
-
}
|
|
40
|
-
return "".concat(timeDiff, "S");
|
|
41
|
-
};
|
|
42
|
-
export function timePeriod(type) {
|
|
43
|
-
var endDate = new Date().getTime();
|
|
44
|
-
var today = new Date();
|
|
45
|
-
var month = today.getMonth();
|
|
46
|
-
var year = today.getFullYear();
|
|
47
|
-
var startDate = null;
|
|
48
|
-
switch (type) {
|
|
49
|
-
case '30d':
|
|
50
|
-
startDate = endDate - 60 * 60 * 24 * 30 * 1000;
|
|
51
|
-
break;
|
|
52
|
-
case '60d':
|
|
53
|
-
startDate = endDate - 60 * 60 * 24 * 60 * 1000;
|
|
54
|
-
break;
|
|
55
|
-
case '6m':
|
|
56
|
-
startDate = endDate - 60 * 60 * 24 * 30 * 6 * 1000;
|
|
57
|
-
break;
|
|
58
|
-
case 'this_month':
|
|
59
|
-
startDate = new Date(year, month, 1).getTime();
|
|
60
|
-
break;
|
|
61
|
-
case 'last_month':
|
|
62
|
-
startDate = new Date(year, month - 1, 1).getTime();
|
|
63
|
-
endDate = new Date(year, month, 0).getTime();
|
|
64
|
-
break;
|
|
65
|
-
case 'this_year':
|
|
66
|
-
startDate = new Date(year, 0, 1);
|
|
67
|
-
break;
|
|
68
|
-
case 'all_time':
|
|
69
|
-
default:
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
if (startDate === null && endDate === null) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
start_time: new Date(startDate).toISOString(),
|
|
77
|
-
end_time: new Date(endDate).toISOString(),
|
|
78
|
-
};
|
|
79
|
-
}
|
package/Utils/Fields.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
2
|
-
export declare function getRLeft(x: number, ratio: number): number;
|
|
3
|
-
export declare function getRValue(y: number, ratio: number): number;
|
|
4
|
-
export declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
5
|
-
export declare function rescale(r: number, n: number): number;
|
package/Utils/Fields.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function getRTop(y, fieldHeight, iTextHeight, yRatio) {
|
|
2
|
-
return iTextHeight - (y + fieldHeight) * yRatio;
|
|
3
|
-
}
|
|
4
|
-
export function getRLeft(x, ratio) {
|
|
5
|
-
return x * ratio;
|
|
6
|
-
}
|
|
7
|
-
export function getRValue(y, ratio) {
|
|
8
|
-
return y * ratio;
|
|
9
|
-
}
|
|
10
|
-
export function blobToBase64(image) {
|
|
11
|
-
var fileReader = new FileReader();
|
|
12
|
-
return new Promise(function (resolve, reject) {
|
|
13
|
-
fileReader.onerror = function () {
|
|
14
|
-
reject(new DOMException('Problem reading blob.'));
|
|
15
|
-
};
|
|
16
|
-
fileReader.onload = function () {
|
|
17
|
-
resolve(fileReader.result);
|
|
18
|
-
};
|
|
19
|
-
fileReader.readAsDataURL(image);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function rescale(r, n) {
|
|
23
|
-
return r * n;
|
|
24
|
-
}
|
package/Utils/Files.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface FileWithData {
|
|
2
|
-
lastModified: number;
|
|
3
|
-
size: number;
|
|
4
|
-
type: string;
|
|
5
|
-
name: string;
|
|
6
|
-
data: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
10
|
-
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
11
|
-
*/
|
|
12
|
-
export declare const fileToDataUrl: (file: File) => Promise<FileWithData>;
|
|
13
|
-
/**
|
|
14
|
-
* Trigger a download dialog to save a blob as a file on disk.
|
|
15
|
-
*/
|
|
16
|
-
export declare const downloadBlob: (blob: Blob, name?: string) => void;
|
package/Utils/Files.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
3
|
-
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
4
|
-
*/
|
|
5
|
-
export var fileToDataUrl = function (file) {
|
|
6
|
-
return new Promise(function (resolve, reject) {
|
|
7
|
-
var reader = new FileReader();
|
|
8
|
-
reader.onload = function () {
|
|
9
|
-
return resolve({
|
|
10
|
-
lastModified: file.lastModified,
|
|
11
|
-
size: file.size,
|
|
12
|
-
type: file.type,
|
|
13
|
-
name: file.name,
|
|
14
|
-
data: reader.result,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
reader.onerror = reject;
|
|
18
|
-
if (file) {
|
|
19
|
-
reader.readAsDataURL(file);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
reject(new Error('Invalid file'));
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Trigger a download dialog to save a blob as a file on disk.
|
|
28
|
-
*/
|
|
29
|
-
export var downloadBlob = function (blob, name) {
|
|
30
|
-
if (name === void 0) { name = 'file.pdf'; }
|
|
31
|
-
var blobUrl = URL.createObjectURL(blob);
|
|
32
|
-
var link = document.createElement('a');
|
|
33
|
-
link.href = blobUrl;
|
|
34
|
-
link.download = name;
|
|
35
|
-
document.body.appendChild(link);
|
|
36
|
-
link.dispatchEvent(new MouseEvent('click', {
|
|
37
|
-
bubbles: true,
|
|
38
|
-
cancelable: true,
|
|
39
|
-
view: window,
|
|
40
|
-
}));
|
|
41
|
-
document.body.removeChild(link);
|
|
42
|
-
};
|