@verdocs/js-sdk 1.1.8 → 1.1.9
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/Documents/Documents.d.ts +26 -0
- package/Templates/Documents.d.ts +3 -3
- package/Templates/Fields.d.ts +3 -3
- package/Templates/Roles.d.ts +2 -2
- package/Templates/Types.d.ts +7 -7
- package/Templates/Types.js +1 -1
- package/Utils/Fields.d.ts +5 -5
- package/Utils/Fields.js +17 -17
- package/package.json +1 -1
package/Documents/Documents.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ISigningSession, ISigningSessionRequest } from './Types';
|
|
2
|
+
import { ISetting } from '../Templates/Types';
|
|
2
3
|
export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
|
|
3
4
|
export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
|
|
4
5
|
export declare type TRecipientType = 'signer' | 'cc' | 'approver';
|
|
@@ -63,6 +64,28 @@ export interface IRecipient {
|
|
|
63
64
|
type: TRecipientType;
|
|
64
65
|
updated_at: string;
|
|
65
66
|
}
|
|
67
|
+
export interface IDocumentAsset {
|
|
68
|
+
created_at: string;
|
|
69
|
+
id: string;
|
|
70
|
+
mime: string;
|
|
71
|
+
name: string;
|
|
72
|
+
page_numbers: number;
|
|
73
|
+
updated_at: string;
|
|
74
|
+
url: string;
|
|
75
|
+
}
|
|
76
|
+
export interface IDocumentField {
|
|
77
|
+
envelope_id: string;
|
|
78
|
+
label: string | null;
|
|
79
|
+
name: string;
|
|
80
|
+
page: number;
|
|
81
|
+
recipient_role: string;
|
|
82
|
+
type: string;
|
|
83
|
+
required: boolean;
|
|
84
|
+
settings?: ISetting;
|
|
85
|
+
setting?: ISetting;
|
|
86
|
+
validator: string | null;
|
|
87
|
+
prepared?: boolean;
|
|
88
|
+
}
|
|
66
89
|
export interface IDocument {
|
|
67
90
|
id: string;
|
|
68
91
|
created_at: string;
|
|
@@ -79,6 +102,9 @@ export interface IDocument {
|
|
|
79
102
|
template_id: string;
|
|
80
103
|
updated_at: string;
|
|
81
104
|
organization_id: string | null;
|
|
105
|
+
certificate?: IDocumentAsset | null;
|
|
106
|
+
document?: IDocumentAsset | null;
|
|
107
|
+
fields?: IDocumentField[];
|
|
82
108
|
}
|
|
83
109
|
export interface IActivityEntry {
|
|
84
110
|
id: string;
|
package/Templates/Documents.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITemplateAsset } from './Types';
|
|
2
2
|
/**
|
|
3
3
|
* Get all the Documents associated to a particular Template.
|
|
4
4
|
*
|
|
@@ -18,7 +18,7 @@ export declare const getDocuments: (templateId: string) => Promise<any>;
|
|
|
18
18
|
* await Documents.createDocument(templateID, params);
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
export declare const createDocument: (templateId: string, params: any) => Promise<
|
|
21
|
+
export declare const createDocument: (templateId: string, params: any) => Promise<ITemplateAsset>;
|
|
22
22
|
/**
|
|
23
23
|
* Get a specific Document.
|
|
24
24
|
*
|
|
@@ -28,7 +28,7 @@ export declare const createDocument: (templateId: string, params: any) => Promis
|
|
|
28
28
|
* await Documents.getDocument(templateID, documentID);
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare const getDocument: (templateId: string, documentId: string) => Promise<
|
|
31
|
+
export declare const getDocument: (templateId: string, documentId: string) => Promise<ITemplateAsset>;
|
|
32
32
|
/**
|
|
33
33
|
* Delete a specific Document.
|
|
34
34
|
*
|
package/Templates/Fields.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createField: (templateId: string, params:
|
|
3
|
-
export declare const editField: (templateId: string, fieldName: string, params:
|
|
1
|
+
import { ITemplateField } from './Types';
|
|
2
|
+
export declare const createField: (templateId: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
3
|
+
export declare const editField: (templateId: string, fieldName: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
4
4
|
export declare const deleteField: (templateId: string, fieldName: string) => Promise<any>;
|
package/Templates/Roles.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITemplateField, IRole } from './Types';
|
|
2
2
|
export declare const createRole: (templateId: string, params: IRole) => Promise<IRole>;
|
|
3
3
|
export declare const getRoles: (templateId: string) => Promise<IRole[]>;
|
|
4
4
|
export declare const getRole: (templateId: string, roleName: string) => Promise<IRole>;
|
|
5
5
|
export declare const editRole: (templateId: string, roleName: string, params: IRole) => Promise<IRole>;
|
|
6
6
|
export declare const deleteRole: (templateId: string, roleName: string) => Promise<any>;
|
|
7
|
-
export declare const getRoleFields: (templateId: string, roleName: string) => Promise<
|
|
7
|
+
export declare const getRoleFields: (templateId: string, roleName: string) => Promise<ITemplateField[]>;
|
|
8
8
|
export declare const deleteSequence: (templateId: string) => Promise<IRole[]>;
|
package/Templates/Types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface ITemplate {
|
|
2
|
-
template_document?:
|
|
2
|
+
template_document?: ITemplateAsset;
|
|
3
3
|
pages?: IPage[];
|
|
4
4
|
roles?: IRole[];
|
|
5
5
|
counter?: number;
|
|
@@ -128,13 +128,13 @@ export interface IRole {
|
|
|
128
128
|
email?: string;
|
|
129
129
|
type: string;
|
|
130
130
|
sequence: number;
|
|
131
|
-
fields?:
|
|
131
|
+
fields?: ITemplateField[];
|
|
132
132
|
delegator?: boolean;
|
|
133
133
|
message?: string;
|
|
134
134
|
phone?: string;
|
|
135
135
|
rgba?: string;
|
|
136
136
|
}
|
|
137
|
-
export interface
|
|
137
|
+
export interface ITemplateAsset {
|
|
138
138
|
url: string;
|
|
139
139
|
name: string;
|
|
140
140
|
page_numbers: number;
|
|
@@ -145,7 +145,7 @@ export interface IDocument {
|
|
|
145
145
|
mime: string;
|
|
146
146
|
thumbnail_url: string;
|
|
147
147
|
}
|
|
148
|
-
export interface
|
|
148
|
+
export interface ITemplateField {
|
|
149
149
|
name: string;
|
|
150
150
|
role_name: string;
|
|
151
151
|
template_id: string;
|
|
@@ -155,7 +155,6 @@ export interface IField {
|
|
|
155
155
|
page_sequence: number;
|
|
156
156
|
validator?: string;
|
|
157
157
|
label?: string;
|
|
158
|
-
prepared?: boolean;
|
|
159
158
|
}
|
|
160
159
|
export interface ISetting {
|
|
161
160
|
x?: number;
|
|
@@ -166,15 +165,16 @@ export interface ISetting {
|
|
|
166
165
|
type?: string;
|
|
167
166
|
options?: any[];
|
|
168
167
|
value?: string;
|
|
168
|
+
[key: string]: any;
|
|
169
169
|
}
|
|
170
170
|
export interface IPage {
|
|
171
171
|
template_id: string;
|
|
172
172
|
document_id: string;
|
|
173
|
-
template_document?:
|
|
173
|
+
template_document?: ITemplateAsset;
|
|
174
174
|
sequence: number;
|
|
175
175
|
page_number: number;
|
|
176
176
|
thumbnail_url: string;
|
|
177
|
-
fields?:
|
|
177
|
+
fields?: ITemplateField[];
|
|
178
178
|
}
|
|
179
179
|
export interface IReminder {
|
|
180
180
|
id?: string;
|
package/Templates/Types.js
CHANGED
|
@@ -16,7 +16,7 @@ export var TemplateSenderTypes;
|
|
|
16
16
|
TemplateSenderTypes["ORGANIZATION_MEMBER"] = "organization_member";
|
|
17
17
|
TemplateSenderTypes["ORGANIZATION_MEMBER_AS_CREATOR"] = "organization_member_as_creator";
|
|
18
18
|
TemplateSenderTypes["EVERYONE"] = "everyone";
|
|
19
|
-
TemplateSenderTypes["EVERYONE_AS_CREATOR"] = "everyone_as_creator";
|
|
19
|
+
TemplateSenderTypes["EVERYONE_AS_CREATOR"] = "everyone_as_creator";
|
|
20
20
|
})(TemplateSenderTypes || (TemplateSenderTypes = {}));
|
|
21
21
|
export var TemplateActions;
|
|
22
22
|
(function (TemplateActions) {
|
package/Utils/Fields.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getHeight(field:
|
|
3
|
-
export declare function getWidth(field:
|
|
1
|
+
import { IDocumentField } from '../Documents/Documents';
|
|
2
|
+
export declare function getHeight(field: IDocumentField): number;
|
|
3
|
+
export declare function getWidth(field: IDocumentField): number;
|
|
4
4
|
export declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
5
5
|
export declare function getRLeft(x: number, ratio: number): number;
|
|
6
6
|
export declare function getRValue(y: number, ratio: number): number;
|
|
7
|
-
export declare function getStyle(field:
|
|
7
|
+
export declare function getStyle(field: IDocumentField): Record<string, string>;
|
|
8
8
|
export declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
9
|
-
export declare function getInputStyle(field:
|
|
9
|
+
export declare function getInputStyle(field: IDocumentField, mode: string, browserType: string): Record<string, string>;
|
|
10
10
|
export declare function getCheckboxLabelStyle(required: boolean): Record<string, any>;
|
|
11
11
|
export declare function getLetterSpacing(browserType: string): -0.0018 | -0.23594210526315787 | -0.0019;
|
|
12
12
|
export declare function rescale(r: number, n: number): number;
|
package/Utils/Fields.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function getHeight(field) {
|
|
2
|
-
var
|
|
2
|
+
var settings = field.settings || field.setting || {};
|
|
3
3
|
switch (field.type) {
|
|
4
4
|
case 'signature':
|
|
5
5
|
case 'initial':
|
|
@@ -12,10 +12,10 @@ export function getHeight(field) {
|
|
|
12
12
|
case 'payment':
|
|
13
13
|
return 24;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return settings.height || 0;
|
|
16
16
|
}
|
|
17
17
|
export function getWidth(field) {
|
|
18
|
-
var
|
|
18
|
+
var settings = field.settings || field.setting || {};
|
|
19
19
|
switch (field.type) {
|
|
20
20
|
case 'signature':
|
|
21
21
|
case 'initial':
|
|
@@ -30,9 +30,9 @@ export function getWidth(field) {
|
|
|
30
30
|
case 'date':
|
|
31
31
|
return 64;
|
|
32
32
|
case 'dropdown':
|
|
33
|
-
return (
|
|
33
|
+
return (settings === null || settings === void 0 ? void 0 : settings.width) || 64;
|
|
34
34
|
}
|
|
35
|
-
return (
|
|
35
|
+
return (settings === null || settings === void 0 ? void 0 : settings.width) || 0;
|
|
36
36
|
}
|
|
37
37
|
export function getRTop(y, fieldHeight, iTextHeight, yRatio) {
|
|
38
38
|
return iTextHeight - (y + fieldHeight) * yRatio;
|
|
@@ -44,11 +44,11 @@ export function getRValue(y, ratio) {
|
|
|
44
44
|
return y * ratio;
|
|
45
45
|
}
|
|
46
46
|
export function getStyle(field) {
|
|
47
|
-
var
|
|
47
|
+
var settings = field.settings || field.setting || {};
|
|
48
48
|
var height = getHeight(field);
|
|
49
49
|
var style = {
|
|
50
|
-
left: ((
|
|
51
|
-
bottom: ((
|
|
50
|
+
left: ((settings === null || settings === void 0 ? void 0 : settings.x) || 0) + 'px',
|
|
51
|
+
bottom: ((settings === null || settings === void 0 ? void 0 : settings.y) || 0) + 'px',
|
|
52
52
|
height: '100%',
|
|
53
53
|
width: '100%',
|
|
54
54
|
};
|
|
@@ -59,7 +59,7 @@ export function getStyle(field) {
|
|
|
59
59
|
case 'placeholder':
|
|
60
60
|
case 'dropdown':
|
|
61
61
|
style.maxHeight = height + 'px';
|
|
62
|
-
style.maxWidth = ((
|
|
62
|
+
style.maxWidth = ((settings === null || settings === void 0 ? void 0 : settings.width) || 0) + 'px';
|
|
63
63
|
break;
|
|
64
64
|
case 'checkbox':
|
|
65
65
|
case 'checkbox_group':
|
|
@@ -94,14 +94,14 @@ export function blobToBase64(image) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
export function getInputStyle(field, mode, browserType) {
|
|
97
|
-
var
|
|
98
|
-
var
|
|
97
|
+
var settings = field.settings || field.setting || {};
|
|
98
|
+
var fontSize = (settings === null || settings === void 0 ? void 0 : settings.font_size) || 11;
|
|
99
99
|
var style = {
|
|
100
100
|
height: '100%',
|
|
101
101
|
width: '100%',
|
|
102
102
|
background: 'none',
|
|
103
103
|
};
|
|
104
|
-
if (
|
|
104
|
+
if (settings.font_size ||
|
|
105
105
|
field.type === 'date' ||
|
|
106
106
|
field.type === 'signature' ||
|
|
107
107
|
field.type === 'initial' ||
|
|
@@ -123,14 +123,14 @@ export function getInputStyle(field, mode, browserType) {
|
|
|
123
123
|
if ((field === null || field === void 0 ? void 0 : field.prepared) === true && mode !== 'prepareview') {
|
|
124
124
|
style.visibility = 'hidden';
|
|
125
125
|
}
|
|
126
|
-
if (
|
|
127
|
-
style.color =
|
|
126
|
+
if (settings.color) {
|
|
127
|
+
style.color = settings.color;
|
|
128
128
|
}
|
|
129
|
-
if (
|
|
129
|
+
if (settings.upperCase) {
|
|
130
130
|
style.textTransform = 'uppercase';
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
133
|
-
style.lineHeight = "".concat(rescale(1,
|
|
132
|
+
if (settings.leading) {
|
|
133
|
+
style.lineHeight = "".concat(rescale(1, settings.leading + 0.5), "px");
|
|
134
134
|
}
|
|
135
135
|
return style;
|
|
136
136
|
}
|