@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
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* White-labeling allows applications to store visual-styling configuration data on the Verdocs servers. This data is not used by
|
|
3
|
-
* Verdocs itself, but may be retrieved later by the application to support changing styles in user interfaces.
|
|
4
|
-
*
|
|
5
|
-
* The advantage to this approach is white-label data is stored at an organization-wide level. If you are building just one
|
|
6
|
-
* application, you may not need this feature. But if you are building an application that may have many different "looks"
|
|
7
|
-
* depending on who the user is (what organization the user is in) this endpoint can be very helpful.
|
|
8
|
-
*
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Create or update white-label data. The caller's organization ID will be used as the key for the operation.
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import {Whitelabel} from '@verdocs/js-sdk/Organizations';
|
|
16
|
-
*
|
|
17
|
-
* await Whitelabel.setWhitelabel({ logo: '/path/to/logo.png' });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export var setWhitelabel = function (endpoint) {
|
|
21
|
-
return endpoint.api //
|
|
22
|
-
.post('/whitelabel')
|
|
23
|
-
.then(function (r) { return r.data; });
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Retrieve white-label data.
|
|
27
|
-
*
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import {Whitelabel} from '@verdocs/js-sdk/Organizations';
|
|
30
|
-
*
|
|
31
|
-
* const {logo} = await Whitelabel.getWhitelabel();
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export var getWhitelabel = function (endpoint) {
|
|
35
|
-
return endpoint.api //
|
|
36
|
-
.get('/whitelabel')
|
|
37
|
-
.then(function (r) { return r.data; });
|
|
38
|
-
};
|
package/Organizations/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An Organization is a high-level container within Verdocs that groups together Templates, Documents, Profiles, Billing, and
|
|
3
|
-
* other settings. A User may be a member of more than one Organization. Each membership is tracked by a Profile representing
|
|
4
|
-
* that user's settings within that organization. It is important to select the correct Profile before performing operations
|
|
5
|
-
* against the Verdocs API, as this also sets the Organization that will be operated on, and the user's permissions within it.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
export * as ApiKeys from './ApiKeys';
|
|
10
|
-
export * as Groups from './Groups';
|
|
11
|
-
export * as Invitations from './Invitations';
|
|
12
|
-
export * as Members from './Members';
|
|
13
|
-
export * as Organizations from './Organizations';
|
|
14
|
-
export * as Types from './Types';
|
|
15
|
-
export * as Webhooks from './Webhooks';
|
|
16
|
-
export * as Whitelabel from './Whitelabel';
|
package/Organizations/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An Organization is a high-level container within Verdocs that groups together Templates, Documents, Profiles, Billing, and
|
|
3
|
-
* other settings. A User may be a member of more than one Organization. Each membership is tracked by a Profile representing
|
|
4
|
-
* that user's settings within that organization. It is important to select the correct Profile before performing operations
|
|
5
|
-
* against the Verdocs API, as this also sets the Organization that will be operated on, and the user's permissions within it.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
export * as ApiKeys from './ApiKeys';
|
|
10
|
-
export * as Groups from './Groups';
|
|
11
|
-
export * as Invitations from './Invitations';
|
|
12
|
-
export * as Members from './Members';
|
|
13
|
-
export * as Organizations from './Organizations';
|
|
14
|
-
export * as Types from './Types';
|
|
15
|
-
export * as Webhooks from './Webhooks';
|
|
16
|
-
export * as Whitelabel from './Whitelabel';
|
package/Sessions/Types.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { IProfile, TPermission, TPlan, TRole } from '../Users/Types';
|
|
2
|
-
export interface ISigningSessionRequest {
|
|
3
|
-
envelopeId: string;
|
|
4
|
-
roleId: string;
|
|
5
|
-
inviteCode: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A Signing Session connects a caller to a role within an envelope, and can be used only for calls related to signing that envelope.
|
|
9
|
-
*/
|
|
10
|
-
export interface ISigningSession {
|
|
11
|
-
profile_id: string;
|
|
12
|
-
envelope_id: string;
|
|
13
|
-
role: string;
|
|
14
|
-
email: string;
|
|
15
|
-
access_key: {
|
|
16
|
-
id: string;
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
iss: string;
|
|
20
|
-
aud: string;
|
|
21
|
-
exp: number;
|
|
22
|
-
iat: number;
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform.
|
|
27
|
-
*/
|
|
28
|
-
export interface IUserSession {
|
|
29
|
-
sub: string;
|
|
30
|
-
email: string;
|
|
31
|
-
email_verified: boolean;
|
|
32
|
-
iat: number;
|
|
33
|
-
exp: number;
|
|
34
|
-
permissions: TPermission[];
|
|
35
|
-
roles: TRole[];
|
|
36
|
-
profile: IProfile;
|
|
37
|
-
profile_id: string;
|
|
38
|
-
organization_id: string;
|
|
39
|
-
plans?: TPlan[];
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Verdocs supports two types of authenticated sessions: User and Signing. Both behave similarly and have similar
|
|
44
|
-
* properties, but signing sessions only have access to a small set of signing-related functions.
|
|
45
|
-
*/
|
|
46
|
-
export type TSessionType = 'user' | 'signing';
|
|
47
|
-
/**
|
|
48
|
-
* Represents a possibly-authenticated session within Verdocs, either for signing or regular user-based operations.
|
|
49
|
-
*/
|
|
50
|
-
export type TSession = IUserSession | ISigningSession | null;
|
|
51
|
-
/**
|
|
52
|
-
* An active authenticated session within Verdocs, either for signing or regular user-based operations.
|
|
53
|
-
*/
|
|
54
|
-
export type TActiveSession = IUserSession | ISigningSession;
|
package/Sessions/Types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/Sessions/index.d.ts
DELETED
package/Sessions/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * as Types from './Types';
|
|
2
|
-
/**
|
|
3
|
-
* Confirm whether the user has all of the specified permissions.
|
|
4
|
-
*/
|
|
5
|
-
export var userHasPermissions = function (session, permissions) {
|
|
6
|
-
return permissions.every(function (perm) { return ((session === null || session === void 0 ? void 0 : session.permissions) || []).includes(perm); });
|
|
7
|
-
};
|
package/Templates/Actions.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ITemplate, ITemplateSummary } from './Types';
|
|
2
|
-
import { TSession } from '../Sessions/Types';
|
|
3
|
-
export declare enum TemplateSenderTypes {
|
|
4
|
-
CREATOR = "creator",// same as legacy
|
|
5
|
-
ORGANIZATION_MEMBER = "organization_member",
|
|
6
|
-
ORGANIZATION_MEMBER_AS_CREATOR = "organization_member_as_creator",
|
|
7
|
-
EVERYONE = "everyone",
|
|
8
|
-
EVERYONE_AS_CREATOR = "everyone_as_creator"
|
|
9
|
-
}
|
|
10
|
-
export declare enum TemplatePermissions {
|
|
11
|
-
TEMPLATE_CREATOR_CREATE_PUBLIC = "template:creator:create:public",
|
|
12
|
-
TEMPLATE_CREATOR_CREATE_ORG = "template:creator:create:org",
|
|
13
|
-
TEMPLATE_CREATOR_CREATE_PERSONAL = "template:creator:create:personal",
|
|
14
|
-
TEMPLATE_CREATOR_DELETE = "template:creator:delete",
|
|
15
|
-
TEMPLATE_CREATOR_VISIBILITY = "template:creator:visibility",
|
|
16
|
-
TEMPLATE_MEMBER_READ = "template:member:read",
|
|
17
|
-
TEMPLATE_MEMBER_WRITE = "template:member:write",
|
|
18
|
-
TEMPLATE_MEMBER_DELETE = "template:member:delete",
|
|
19
|
-
TEMPLATE_MEMBER_VISIBILITY = "template:member:visibility"
|
|
20
|
-
}
|
|
21
|
-
export type TTemplateActions = 'create_personal' | 'create_org' | 'create_public' | 'read' | 'write' | 'delete' | 'change_visibility_personal' | 'change_visibility_org' | 'change_visibility_public';
|
|
22
|
-
export declare const canPerformTemplateAction: (session: TSession, action: TTemplateActions, template?: ITemplate | ITemplateSummary) => {
|
|
23
|
-
canPerform: boolean;
|
|
24
|
-
message: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const hasRequiredPermissions: (session: TSession, permissions: string[]) => boolean;
|
package/Templates/Actions.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export var TemplateSenderTypes;
|
|
2
|
-
(function (TemplateSenderTypes) {
|
|
3
|
-
TemplateSenderTypes["CREATOR"] = "creator";
|
|
4
|
-
TemplateSenderTypes["ORGANIZATION_MEMBER"] = "organization_member";
|
|
5
|
-
TemplateSenderTypes["ORGANIZATION_MEMBER_AS_CREATOR"] = "organization_member_as_creator";
|
|
6
|
-
TemplateSenderTypes["EVERYONE"] = "everyone";
|
|
7
|
-
TemplateSenderTypes["EVERYONE_AS_CREATOR"] = "everyone_as_creator";
|
|
8
|
-
})(TemplateSenderTypes || (TemplateSenderTypes = {}));
|
|
9
|
-
export var TemplatePermissions;
|
|
10
|
-
(function (TemplatePermissions) {
|
|
11
|
-
TemplatePermissions["TEMPLATE_CREATOR_CREATE_PUBLIC"] = "template:creator:create:public";
|
|
12
|
-
TemplatePermissions["TEMPLATE_CREATOR_CREATE_ORG"] = "template:creator:create:org";
|
|
13
|
-
TemplatePermissions["TEMPLATE_CREATOR_CREATE_PERSONAL"] = "template:creator:create:personal";
|
|
14
|
-
TemplatePermissions["TEMPLATE_CREATOR_DELETE"] = "template:creator:delete";
|
|
15
|
-
TemplatePermissions["TEMPLATE_CREATOR_VISIBILITY"] = "template:creator:visibility";
|
|
16
|
-
TemplatePermissions["TEMPLATE_MEMBER_READ"] = "template:member:read";
|
|
17
|
-
TemplatePermissions["TEMPLATE_MEMBER_WRITE"] = "template:member:write";
|
|
18
|
-
TemplatePermissions["TEMPLATE_MEMBER_DELETE"] = "template:member:delete";
|
|
19
|
-
TemplatePermissions["TEMPLATE_MEMBER_VISIBILITY"] = "template:member:visibility";
|
|
20
|
-
})(TemplatePermissions || (TemplatePermissions = {}));
|
|
21
|
-
export var canPerformTemplateAction = function (session, action, template) {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
if (!template && !action.includes('create')) {
|
|
24
|
-
return { canPerform: false, message: 'Missing required template object' };
|
|
25
|
-
}
|
|
26
|
-
// We use BOGUS here to force the option-chain in things like template?.profile_id to NOT match profile?.profile_id because if both
|
|
27
|
-
// were undefined, they would actually match.
|
|
28
|
-
var profile_id = (session === null || session === void 0 ? void 0 : session.profile_id) || 'BOGUS';
|
|
29
|
-
var organization_id = (session === null || session === void 0 ? void 0 : session.organization_id) || 'BOGUS';
|
|
30
|
-
if (!profile_id) {
|
|
31
|
-
return { canPerform: false, message: 'Active session required' };
|
|
32
|
-
}
|
|
33
|
-
var isCreator = (template === null || template === void 0 ? void 0 : template.profile_id) === profile_id;
|
|
34
|
-
var isSameOrg = (template === null || template === void 0 ? void 0 : template.organization_id) === organization_id;
|
|
35
|
-
var isPersonal = (_a = template === null || template === void 0 ? void 0 : template.is_personal) !== null && _a !== void 0 ? _a : false;
|
|
36
|
-
var isPublic = (_b = template === null || template === void 0 ? void 0 : template.is_public) !== null && _b !== void 0 ? _b : false;
|
|
37
|
-
var permissionsRequired = [];
|
|
38
|
-
switch (action) {
|
|
39
|
-
case 'create_personal':
|
|
40
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_PERSONAL);
|
|
41
|
-
break;
|
|
42
|
-
case 'create_org':
|
|
43
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_ORG);
|
|
44
|
-
break;
|
|
45
|
-
case 'create_public':
|
|
46
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_PUBLIC);
|
|
47
|
-
break;
|
|
48
|
-
case 'read':
|
|
49
|
-
if (!isCreator) {
|
|
50
|
-
if ((!isPersonal && isSameOrg) || !isPublic) {
|
|
51
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_READ);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
case 'write':
|
|
56
|
-
if (!isCreator) {
|
|
57
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_READ);
|
|
58
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_WRITE);
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
case 'change_visibility_personal':
|
|
62
|
-
if (isCreator) {
|
|
63
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_PERSONAL);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_VISIBILITY);
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
case 'change_visibility_org':
|
|
70
|
-
if (isCreator) {
|
|
71
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_ORG);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_VISIBILITY);
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
case 'change_visibility_public':
|
|
78
|
-
if (isCreator) {
|
|
79
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_CREATE_PUBLIC);
|
|
80
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_VISIBILITY);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_VISIBILITY);
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
case 'delete':
|
|
87
|
-
if (isCreator) {
|
|
88
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_CREATOR_DELETE);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
permissionsRequired.push(TemplatePermissions.TEMPLATE_MEMBER_DELETE);
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
default:
|
|
95
|
-
return { canPerform: false, message: 'Action is not defined' };
|
|
96
|
-
}
|
|
97
|
-
if (hasRequiredPermissions(session, permissionsRequired)) {
|
|
98
|
-
return { canPerform: true, message: '' };
|
|
99
|
-
}
|
|
100
|
-
return { canPerform: false, message: "Insufficient access to perform '".concat(action, "'. Needed permissions: ").concat(permissionsRequired.toString()) };
|
|
101
|
-
};
|
|
102
|
-
export var hasRequiredPermissions = function (session, permissions) {
|
|
103
|
-
return permissions.every(function (perm) { return ((session === null || session === void 0 ? void 0 : session.permissions) || []).includes(perm); });
|
|
104
|
-
};
|
package/Templates/Fields.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
2
|
-
import { ITemplateField } from './Types';
|
|
3
|
-
/**
|
|
4
|
-
* Add a field to a template.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createField: (endpoint: VerdocsEndpoint, templateId: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
7
|
-
/**
|
|
8
|
-
* Update a template field.
|
|
9
|
-
*/
|
|
10
|
-
export declare const updateField: (endpoint: VerdocsEndpoint, templateId: string, fieldName: string, params: Partial<ITemplateField>) => Promise<ITemplateField>;
|
|
11
|
-
/**
|
|
12
|
-
* REmove a field from a template.
|
|
13
|
-
*/
|
|
14
|
-
export declare const deleteField: (endpoint: VerdocsEndpoint, templateId: string, fieldName: string) => Promise<any>;
|
package/Templates/Fields.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Add a field to a template.
|
|
3
|
-
*/
|
|
4
|
-
export var createField = function (endpoint, templateId, params) {
|
|
5
|
-
return endpoint.api //
|
|
6
|
-
.post("/templates/".concat(templateId, "/fields"), params)
|
|
7
|
-
.then(function (r) { return r.data; });
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Update a template field.
|
|
11
|
-
*/
|
|
12
|
-
export var updateField = function (endpoint, templateId, fieldName, params) {
|
|
13
|
-
return endpoint.api //
|
|
14
|
-
.put("/templates/".concat(templateId, "/fields/").concat(fieldName), params)
|
|
15
|
-
.then(function (r) { return r.data; });
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* REmove a field from a template.
|
|
19
|
-
*/
|
|
20
|
-
export var deleteField = function (endpoint, templateId, fieldName) {
|
|
21
|
-
return endpoint.api //
|
|
22
|
-
.delete("/templates/".concat(templateId, "/fields/").concat(fieldName))
|
|
23
|
-
.then(function (r) { return r.data; });
|
|
24
|
-
};
|
package/Templates/Pages.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { IPage } from './Types';
|
|
2
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
3
|
-
export interface ICreatePageParams {
|
|
4
|
-
document_id: string;
|
|
5
|
-
page_number: number;
|
|
6
|
-
sequence: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Add a page to a template.
|
|
10
|
-
*/
|
|
11
|
-
export declare const createPage: (endpoint: VerdocsEndpoint, templateId: string, params: ICreatePageParams) => Promise<IPage>;
|
|
12
|
-
/**
|
|
13
|
-
* Update a template page.
|
|
14
|
-
*/
|
|
15
|
-
export declare const editPage: (endpoint: VerdocsEndpoint, templateId: string, sequence: string) => Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Get a page from a template.
|
|
18
|
-
*/
|
|
19
|
-
export declare const getPage: (endpoint: VerdocsEndpoint, templateId: string, sequence: number, thumbnail?: boolean) => Promise<any>;
|
|
20
|
-
export interface IPageImageResponse {
|
|
21
|
-
url: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get a page image (PNG format) from a template.
|
|
25
|
-
*/
|
|
26
|
-
export declare const getPageImage: (endpoint: VerdocsEndpoint, templateId: string, sequence: number) => Promise<IPageImageResponse>;
|
|
27
|
-
/**
|
|
28
|
-
* Delete a page from a template
|
|
29
|
-
*/
|
|
30
|
-
export declare const deletePage: (endpoint: VerdocsEndpoint, templateId: string, sequence: string) => Promise<any>;
|
package/Templates/Pages.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Add a page to a template.
|
|
3
|
-
*/
|
|
4
|
-
export var createPage = function (endpoint, templateId, params) {
|
|
5
|
-
return endpoint.api //
|
|
6
|
-
.post("/templates/".concat(templateId, "/pages"), params)
|
|
7
|
-
.then(function (r) { return r.data; });
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Update a template page.
|
|
11
|
-
*/
|
|
12
|
-
export var editPage = function (endpoint, templateId, sequence) {
|
|
13
|
-
return endpoint.api //
|
|
14
|
-
.put("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
15
|
-
.then(function (r) { return r.data; });
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Get a page from a template.
|
|
19
|
-
*/
|
|
20
|
-
export var getPage = function (endpoint, templateId, sequence, thumbnail) {
|
|
21
|
-
if (thumbnail === void 0) { thumbnail = false; }
|
|
22
|
-
return endpoint.api //
|
|
23
|
-
.get("/templates/".concat(templateId, "/pages/").concat(sequence).concat(thumbnail ? '?thumbnail=true' : ''))
|
|
24
|
-
.then(function (r) { return r.data; });
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Get a page image (PNG format) from a template.
|
|
28
|
-
*/
|
|
29
|
-
export var getPageImage = function (endpoint, templateId, sequence) {
|
|
30
|
-
return endpoint.api //
|
|
31
|
-
.get("/templates/".concat(templateId, "/pages/").concat(sequence, "/image"))
|
|
32
|
-
.then(function (r) { return r.data; });
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Delete a page from a template
|
|
36
|
-
*/
|
|
37
|
-
export var deletePage = function (endpoint, templateId, sequence) {
|
|
38
|
-
return endpoint.api //
|
|
39
|
-
.delete("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
40
|
-
.then(function (r) { return r.data; });
|
|
41
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Various helpers to identify available operations for a template by a user.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { ITemplate, ITemplateSummary } from './Types';
|
|
7
|
-
import { TSession } from '../Sessions/Types';
|
|
8
|
-
/**
|
|
9
|
-
* Check to see if the user created the template.
|
|
10
|
-
*/
|
|
11
|
-
export declare const userIsTemplateCreator: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
12
|
-
/**
|
|
13
|
-
* Check to see if a template is "shared" with the user.
|
|
14
|
-
*/
|
|
15
|
-
export declare const userHasSharedTemplate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
16
|
-
/**
|
|
17
|
-
* Check to see if the user can create a personal/private template.
|
|
18
|
-
*/
|
|
19
|
-
export declare const userCanCreatePersonalTemplate: (session: TSession) => boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Check to see if the user can create an org-shared template.
|
|
22
|
-
*/
|
|
23
|
-
export declare const userCanCreateOrgTemplate: (session: TSession) => boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Check to see if the user can create a public template.
|
|
26
|
-
*/
|
|
27
|
-
export declare const userCanCreatePublicTemplate: (session: TSession) => boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Check to see if the user can read/view a template.
|
|
30
|
-
*/
|
|
31
|
-
export declare const userCanReadTemplate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
32
|
-
/**
|
|
33
|
-
* Check to see if the user can update a tempate.
|
|
34
|
-
*/
|
|
35
|
-
export declare const userCanUpdateTemplate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
36
|
-
/**
|
|
37
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
38
|
-
*/
|
|
39
|
-
export declare const userCanMakeTemplatePrivate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
42
|
-
*/
|
|
43
|
-
export declare const userCanMakeTemplateShared: (session: TSession, template: ITemplate | ITemplateSummary) => boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
46
|
-
*/
|
|
47
|
-
export declare const userCanMakeTemplatePublic: (session: TSession, template: ITemplate | ITemplateSummary) => boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
50
|
-
*/
|
|
51
|
-
export declare const userCanChangeOrgVisibility: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
52
|
-
/**
|
|
53
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
54
|
-
*/
|
|
55
|
-
export declare const userCanDeleteTemplate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Confirm whether the user can create an envelope using the specified template.
|
|
58
|
-
*/
|
|
59
|
-
export declare const userCanSendTemplate: (session: TSession, template: ITemplate | ITemplateSummary) => boolean | null;
|
|
60
|
-
/**
|
|
61
|
-
* Confirm whether the user can create a new template.
|
|
62
|
-
*/
|
|
63
|
-
export declare const userCanCreateTemplate: (session: TSession) => boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Check to see if the user can "build" the template (use the field builder). The user must have write access to the
|
|
66
|
-
* template, and the template must have at least one signer role.
|
|
67
|
-
*/
|
|
68
|
-
export declare const userCanBuildTemplate: (session: TSession, template: ITemplate) => boolean | null;
|
|
69
|
-
/**
|
|
70
|
-
* Check to see if the user can preview the template. The user must have read access to the template, the template must
|
|
71
|
-
* have at least one signer, and every signer must have at least one field.
|
|
72
|
-
*/
|
|
73
|
-
export declare const userCanPreviewTemplate: (session: TSession, template: ITemplate) => boolean | null;
|
package/Templates/Permissions.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Various helpers to identify available operations for a template by a user.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { TemplateSenderTypes } from './Types';
|
|
7
|
-
import { userHasPermissions } from '../Sessions';
|
|
8
|
-
import { Permissions } from '../Users/Types';
|
|
9
|
-
/**
|
|
10
|
-
* Check to see if the user created the template.
|
|
11
|
-
*/
|
|
12
|
-
export var userIsTemplateCreator = function (session, template) {
|
|
13
|
-
return session && template && session.profile_id === template.profile_id;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Check to see if a template is "shared" with the user.
|
|
17
|
-
*/
|
|
18
|
-
export var userHasSharedTemplate = function (session, template) {
|
|
19
|
-
return session && template && !template.is_personal && session.organization_id === template.organization_id;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Check to see if the user can create a personal/private template.
|
|
23
|
-
*/
|
|
24
|
-
export var userCanCreatePersonalTemplate = function (session) {
|
|
25
|
-
return userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_PERSONAL]);
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Check to see if the user can create an org-shared template.
|
|
29
|
-
*/
|
|
30
|
-
export var userCanCreateOrgTemplate = function (session) { return userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_ORG]); };
|
|
31
|
-
/**
|
|
32
|
-
* Check to see if the user can create a public template.
|
|
33
|
-
*/
|
|
34
|
-
export var userCanCreatePublicTemplate = function (session) { return userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_PUBLIC]); };
|
|
35
|
-
/**
|
|
36
|
-
* Check to see if the user can read/view a template.
|
|
37
|
-
*/
|
|
38
|
-
export var userCanReadTemplate = function (session, template) {
|
|
39
|
-
return template.is_public ||
|
|
40
|
-
userIsTemplateCreator(session, template) ||
|
|
41
|
-
(userHasSharedTemplate(session, template) && userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_READ]));
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Check to see if the user can update a tempate.
|
|
45
|
-
*/
|
|
46
|
-
export var userCanUpdateTemplate = function (session, template) {
|
|
47
|
-
return userIsTemplateCreator(session, template) ||
|
|
48
|
-
(userHasSharedTemplate(session, template) &&
|
|
49
|
-
userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_READ, Permissions.TEMPLATE_MEMBER_WRITE]));
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
53
|
-
*/
|
|
54
|
-
export var userCanMakeTemplatePrivate = function (session, template) {
|
|
55
|
-
return userIsTemplateCreator(session, template)
|
|
56
|
-
? userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_PERSONAL])
|
|
57
|
-
: userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_VISIBILITY]);
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
61
|
-
*/
|
|
62
|
-
export var userCanMakeTemplateShared = function (session, template) {
|
|
63
|
-
return userIsTemplateCreator(session, template)
|
|
64
|
-
? userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_ORG])
|
|
65
|
-
: userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_VISIBILITY]);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
69
|
-
*/
|
|
70
|
-
export var userCanMakeTemplatePublic = function (session, template) {
|
|
71
|
-
return userIsTemplateCreator(session, template)
|
|
72
|
-
? userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_PUBLIC])
|
|
73
|
-
: userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_VISIBILITY]);
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
77
|
-
*/
|
|
78
|
-
export var userCanChangeOrgVisibility = function (session, template) {
|
|
79
|
-
return userIsTemplateCreator(session, template) && userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_CREATE_PERSONAL]);
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Check to see if the user can change whether a template is personal vs org-shared.
|
|
83
|
-
*/
|
|
84
|
-
export var userCanDeleteTemplate = function (session, template) {
|
|
85
|
-
return userIsTemplateCreator(session, template)
|
|
86
|
-
? userHasPermissions(session, [Permissions.TEMPLATE_CREATOR_DELETE])
|
|
87
|
-
: userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_DELETE]);
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Confirm whether the user can create an envelope using the specified template.
|
|
91
|
-
*/
|
|
92
|
-
export var userCanSendTemplate = function (session, template) {
|
|
93
|
-
switch (template.sender) {
|
|
94
|
-
case TemplateSenderTypes.CREATOR:
|
|
95
|
-
return userIsTemplateCreator(session, template);
|
|
96
|
-
case TemplateSenderTypes.ORGANIZATION_MEMBER:
|
|
97
|
-
case TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR:
|
|
98
|
-
return userIsTemplateCreator(session, template) || template.organization_id === (session === null || session === void 0 ? void 0 : session.organization_id);
|
|
99
|
-
default:
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Confirm whether the user can create a new template.
|
|
105
|
-
*/
|
|
106
|
-
export var userCanCreateTemplate = function (session) {
|
|
107
|
-
return userCanCreatePersonalTemplate(session) || userCanCreateOrgTemplate(session) || userCanCreatePublicTemplate(session);
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Check to see if the user can "build" the template (use the field builder). The user must have write access to the
|
|
111
|
-
* template, and the template must have at least one signer role.
|
|
112
|
-
*/
|
|
113
|
-
export var userCanBuildTemplate = function (session, template) {
|
|
114
|
-
return userCanUpdateTemplate(session, template) && (template.roles || []).filter(function (role) { return role.type === 'signer'; }).length > 0;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Check to see if the user can preview the template. The user must have read access to the template, the template must
|
|
118
|
-
* have at least one signer, and every signer must have at least one field.
|
|
119
|
-
*/
|
|
120
|
-
export var userCanPreviewTemplate = function (session, template) {
|
|
121
|
-
var hasPermission = userCanReadTemplate(session, template);
|
|
122
|
-
var signers = (template.roles || []).filter(function (role) { return role.type === 'signer'; });
|
|
123
|
-
return hasPermission && signers.length > 0 && signers.every(function (signer) { return (signer.fields || []).length > 0; });
|
|
124
|
-
};
|
package/Templates/Reminders.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
2
|
-
import { IReminder, ITemplate } from './Types';
|
|
3
|
-
export interface ICreateTemplateReminderRequest {
|
|
4
|
-
setup_time: number;
|
|
5
|
-
interval_time: number;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Enable automatic reminders. setup_time is the number of days after the envelope is sent that the first reminder
|
|
9
|
-
* should be sent. interval_time is the number of days between reminders.
|
|
10
|
-
*/
|
|
11
|
-
export declare const createReminder: (endpoint: VerdocsEndpoint, templateId: string, params: ICreateTemplateReminderRequest) => Promise<ITemplate>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the reminder configuration for a template.
|
|
14
|
-
*/
|
|
15
|
-
export declare const getReminder: (endpoint: VerdocsEndpoint, templateId: string, reminderId: string) => Promise<IReminder>;
|
|
16
|
-
/**
|
|
17
|
-
* Update the reminder configuration for a template.
|
|
18
|
-
*/
|
|
19
|
-
export declare const updateReminder: (endpoint: VerdocsEndpoint, templateId: string, reminderId: string, params: ICreateTemplateReminderRequest) => Promise<IReminder>;
|
|
20
|
-
/**
|
|
21
|
-
* Delete the reminder configuration for a template.
|
|
22
|
-
*/
|
|
23
|
-
export declare const deleteReminder: (endpoint: VerdocsEndpoint, templateId: string, reminderId: string) => Promise<any>;
|
package/Templates/Reminders.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enable automatic reminders. setup_time is the number of days after the envelope is sent that the first reminder
|
|
3
|
-
* should be sent. interval_time is the number of days between reminders.
|
|
4
|
-
*/
|
|
5
|
-
export var createReminder = function (endpoint, templateId, params) {
|
|
6
|
-
return endpoint.api //
|
|
7
|
-
.post("/templates/".concat(templateId, "/reminder/"), params)
|
|
8
|
-
.then(function (r) { return r.data; });
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Get the reminder configuration for a template.
|
|
12
|
-
*/
|
|
13
|
-
export var getReminder = function (endpoint, templateId, reminderId) {
|
|
14
|
-
return endpoint.api //
|
|
15
|
-
.get("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
16
|
-
.then(function (r) { return r.data; });
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Update the reminder configuration for a template.
|
|
20
|
-
*/
|
|
21
|
-
export var updateReminder = function (endpoint, templateId, reminderId, params) {
|
|
22
|
-
return endpoint.api //
|
|
23
|
-
.put("/templates/".concat(templateId, "/reminder/").concat(reminderId), params)
|
|
24
|
-
.then(function (r) { return r.data; });
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Delete the reminder configuration for a template.
|
|
28
|
-
*/
|
|
29
|
-
export var deleteReminder = function (endpoint, templateId, reminderId) {
|
|
30
|
-
return endpoint.api //
|
|
31
|
-
.delete("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
32
|
-
.then(function (r) { return r.data; });
|
|
33
|
-
};
|