@verdocs/js-sdk 2.0.14 → 2.0.16
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 +40 -7
- package/Documents/Documents.js +41 -2
- package/Documents/Types.d.ts +50 -6
- package/Templates/Types.d.ts +3 -10
- package/package.json +1 -1
package/Documents/Documents.d.ts
CHANGED
|
@@ -1,14 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICreateDocumentRequest, IDocumentsSearchResult, ISigningSessionRequest } from './Types';
|
|
2
|
+
import { IDocument, IDocumentsSummary, IRecipient, ISigningSession } from './Types';
|
|
3
|
+
import { TDocumentUpdateResult, IDocumentFieldSettings } from './Types';
|
|
2
4
|
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Create a document
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {Documents, ICreateDocumentRole, ICreateDocumentRequest} from '@verdocs/js-sdk/Documents';
|
|
10
|
+
*
|
|
11
|
+
* const role1: ICreateDocumentRole = {
|
|
12
|
+
* type: 'signer',
|
|
13
|
+
* name: 'Seller',
|
|
14
|
+
* full_name: 'Paige Turner',
|
|
15
|
+
* email: 'paige.turner@nomail.com',
|
|
16
|
+
* phone: '',
|
|
17
|
+
* sequence: 1,
|
|
18
|
+
* delegator: false,
|
|
19
|
+
* message: '',
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* const role2: ICreateDocumentRole = {
|
|
23
|
+
* type: 'signer',
|
|
24
|
+
* name: 'Buyer',
|
|
25
|
+
* full_name: 'Will Power',
|
|
26
|
+
* email: 'will.power@nomail.com',
|
|
27
|
+
* phone: '',
|
|
28
|
+
* sequence: 2,
|
|
29
|
+
* delegator: false,
|
|
30
|
+
* message: '',
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* const request: ICreateDocumentRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};
|
|
34
|
+
* const {id, recipients} = await Documents.createDocument(VerdocsEndpoint.getDefault(), request);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const createDocument: (endpoint: VerdocsEndpoint, request: ICreateDocumentRequest) => Promise<IDocument>;
|
|
5
38
|
/**
|
|
6
39
|
* Get a summary of currently active documents.
|
|
7
40
|
*
|
|
8
41
|
* ```typescript
|
|
9
42
|
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
10
43
|
*
|
|
11
|
-
* const {action_required, completed, waiting_on_others} = await Documents.getSummary();
|
|
44
|
+
* const {action_required, completed, waiting_on_others} = await Documents.getSummary(VerdocsEndpoint.getDefault());
|
|
12
45
|
* ```
|
|
13
46
|
*/
|
|
14
47
|
export declare const getSummary: (endpoint: VerdocsEndpoint, page: number) => Promise<IDocumentsSummary>;
|
|
@@ -18,7 +51,7 @@ export declare const getSummary: (endpoint: VerdocsEndpoint, page: number) => Pr
|
|
|
18
51
|
* ```typescript
|
|
19
52
|
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
20
53
|
*
|
|
21
|
-
* const {result, page, total} = await Documents.search({ ... });
|
|
54
|
+
* const {result, page, total} = await Documents.search(VerdocsEndpoint.getDefault(), { ... });
|
|
22
55
|
* ```
|
|
23
56
|
*/
|
|
24
57
|
export declare const searchDocuments: (endpoint: VerdocsEndpoint, params: any) => Promise<IDocumentsSearchResult>;
|
|
@@ -66,9 +99,9 @@ export declare const getDocumentFile: (endpoint: VerdocsEndpoint, documentId: st
|
|
|
66
99
|
/**
|
|
67
100
|
* Update a Document field. Typically called during the signing process as a Recipient fills in fields.
|
|
68
101
|
*/
|
|
69
|
-
export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<
|
|
102
|
+
export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<IDocumentFieldSettings>;
|
|
70
103
|
/**
|
|
71
104
|
* Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
|
|
72
105
|
* signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
|
|
73
106
|
*/
|
|
74
|
-
export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<
|
|
107
|
+
export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<IDocumentFieldSettings>;
|
package/Documents/Documents.js
CHANGED
|
@@ -35,13 +35,52 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { decodeAccessTokenBody } from '../Utils/Token';
|
|
38
|
+
/**
|
|
39
|
+
* Create a document
|
|
40
|
+
*
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import {Documents, ICreateDocumentRole, ICreateDocumentRequest} from '@verdocs/js-sdk/Documents';
|
|
43
|
+
*
|
|
44
|
+
* const role1: ICreateDocumentRole = {
|
|
45
|
+
* type: 'signer',
|
|
46
|
+
* name: 'Seller',
|
|
47
|
+
* full_name: 'Paige Turner',
|
|
48
|
+
* email: 'paige.turner@nomail.com',
|
|
49
|
+
* phone: '',
|
|
50
|
+
* sequence: 1,
|
|
51
|
+
* delegator: false,
|
|
52
|
+
* message: '',
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* const role2: ICreateDocumentRole = {
|
|
56
|
+
* type: 'signer',
|
|
57
|
+
* name: 'Buyer',
|
|
58
|
+
* full_name: 'Will Power',
|
|
59
|
+
* email: 'will.power@nomail.com',
|
|
60
|
+
* phone: '',
|
|
61
|
+
* sequence: 2,
|
|
62
|
+
* delegator: false,
|
|
63
|
+
* message: '',
|
|
64
|
+
* };
|
|
65
|
+
*
|
|
66
|
+
* const request: ICreateDocumentRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};
|
|
67
|
+
* const {id, recipients} = await Documents.createDocument(VerdocsEndpoint.getDefault(), request);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export var createDocument = function (endpoint, request) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
return [2 /*return*/, endpoint.api //
|
|
73
|
+
.post('/documents', request)
|
|
74
|
+
.then(function (r) { return r.data; })];
|
|
75
|
+
});
|
|
76
|
+
}); };
|
|
38
77
|
/**
|
|
39
78
|
* Get a summary of currently active documents.
|
|
40
79
|
*
|
|
41
80
|
* ```typescript
|
|
42
81
|
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
43
82
|
*
|
|
44
|
-
* const {action_required, completed, waiting_on_others} = await Documents.getSummary();
|
|
83
|
+
* const {action_required, completed, waiting_on_others} = await Documents.getSummary(VerdocsEndpoint.getDefault());
|
|
45
84
|
* ```
|
|
46
85
|
*/
|
|
47
86
|
export var getSummary = function (endpoint, page) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -57,7 +96,7 @@ export var getSummary = function (endpoint, page) { return __awaiter(void 0, voi
|
|
|
57
96
|
* ```typescript
|
|
58
97
|
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
59
98
|
*
|
|
60
|
-
* const {result, page, total} = await Documents.search({ ... });
|
|
99
|
+
* const {result, page, total} = await Documents.search(VerdocsEndpoint.getDefault(), { ... });
|
|
61
100
|
* ```
|
|
62
101
|
*/
|
|
63
102
|
export var searchDocuments = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
|
package/Documents/Types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IFieldSetting } from '../Templates/Types';
|
|
2
1
|
import { IProfile } from '../Users/Types';
|
|
3
2
|
export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
|
|
4
3
|
export interface ITemplateSummaryEntry {
|
|
@@ -126,6 +125,7 @@ export interface IRecipient {
|
|
|
126
125
|
status: TRecipientStatus;
|
|
127
126
|
type: TRecipientType;
|
|
128
127
|
updated_at: string;
|
|
128
|
+
fields?: IDocumentField[];
|
|
129
129
|
}
|
|
130
130
|
export interface IDocumentAsset {
|
|
131
131
|
created_at: string;
|
|
@@ -136,16 +136,45 @@ export interface IDocumentAsset {
|
|
|
136
136
|
updated_at: string;
|
|
137
137
|
url: string;
|
|
138
138
|
}
|
|
139
|
+
export interface IDocumentFieldOptions {
|
|
140
|
+
id: string;
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
checked?: boolean;
|
|
144
|
+
selected?: boolean;
|
|
145
|
+
value: string;
|
|
146
|
+
}
|
|
147
|
+
export interface IDocumentFieldSettings {
|
|
148
|
+
type?: string;
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
width?: number;
|
|
152
|
+
height?: number;
|
|
153
|
+
value?: number | string;
|
|
154
|
+
result?: any;
|
|
155
|
+
leading?: number;
|
|
156
|
+
alignment?: number;
|
|
157
|
+
upperCase?: boolean;
|
|
158
|
+
options?: IDocumentFieldOptions[];
|
|
159
|
+
base64?: string;
|
|
160
|
+
hash?: string;
|
|
161
|
+
ip_address?: string;
|
|
162
|
+
signature_id?: string;
|
|
163
|
+
signed_at?: string;
|
|
164
|
+
minimum_checked?: number;
|
|
165
|
+
maximum_checked?: number;
|
|
166
|
+
[key: string]: any;
|
|
167
|
+
}
|
|
168
|
+
export declare type TDocumentFieldType = 'signature' | 'initial' | 'checkbox_group' | 'radio_button_group' | 'textbox' | 'timestamp' | 'date' | 'dropdown' | 'textarea' | 'attachment' | 'payment';
|
|
139
169
|
export interface IDocumentField {
|
|
140
170
|
envelope_id: string;
|
|
141
|
-
label: string | null;
|
|
142
171
|
name: string;
|
|
172
|
+
label: string | null;
|
|
143
173
|
page: number;
|
|
144
174
|
recipient_role: string;
|
|
145
|
-
type:
|
|
175
|
+
type: TDocumentFieldType;
|
|
146
176
|
required: boolean;
|
|
147
|
-
settings?:
|
|
148
|
-
setting?: IFieldSetting;
|
|
177
|
+
settings?: IDocumentFieldSettings;
|
|
149
178
|
validator: string | null;
|
|
150
179
|
prepared?: boolean;
|
|
151
180
|
}
|
|
@@ -168,7 +197,7 @@ export interface IDocument {
|
|
|
168
197
|
certificate?: IDocumentAsset | null;
|
|
169
198
|
document?: IDocumentAsset | null;
|
|
170
199
|
fields?: IDocumentField[];
|
|
171
|
-
profile?: IProfile;
|
|
200
|
+
profile?: IProfile | null;
|
|
172
201
|
}
|
|
173
202
|
export declare type TDocumentUpdateResult = Omit<IDocument, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
|
|
174
203
|
export interface IActivityEntry {
|
|
@@ -209,3 +238,18 @@ export interface IDocumentSearchOptions {
|
|
|
209
238
|
}
|
|
210
239
|
export declare type THistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
|
|
211
240
|
export declare type TEventDetail = 'in_app' | 'mail' | 'signer' | '';
|
|
241
|
+
export interface ICreateDocumentRole {
|
|
242
|
+
type: TRecipientType;
|
|
243
|
+
name: string;
|
|
244
|
+
full_name: string;
|
|
245
|
+
email?: string;
|
|
246
|
+
phone?: string;
|
|
247
|
+
sequence: number;
|
|
248
|
+
delegator: boolean;
|
|
249
|
+
message: string;
|
|
250
|
+
}
|
|
251
|
+
export interface ICreateDocumentRequest {
|
|
252
|
+
template_id: string;
|
|
253
|
+
roles: ICreateDocumentRole[];
|
|
254
|
+
name: string;
|
|
255
|
+
}
|
package/Templates/Types.d.ts
CHANGED
|
@@ -154,28 +154,21 @@ export interface ITemplateField {
|
|
|
154
154
|
template_id: string;
|
|
155
155
|
type: string;
|
|
156
156
|
required: boolean;
|
|
157
|
-
setting
|
|
157
|
+
setting: ITemplateFieldSetting;
|
|
158
158
|
page_sequence: number;
|
|
159
159
|
validator?: string;
|
|
160
160
|
label?: string;
|
|
161
161
|
}
|
|
162
|
-
export interface
|
|
162
|
+
export interface ITemplateFieldSetting {
|
|
163
163
|
x: number;
|
|
164
164
|
y: number;
|
|
165
|
+
result?: string;
|
|
165
166
|
width?: number;
|
|
166
167
|
height?: number;
|
|
167
|
-
result?: any;
|
|
168
|
-
type?: string;
|
|
169
|
-
value?: string;
|
|
170
168
|
leading?: number;
|
|
171
169
|
alignment?: number;
|
|
172
170
|
upperCase?: boolean;
|
|
173
171
|
options?: any[];
|
|
174
|
-
base64?: string;
|
|
175
|
-
hash?: string;
|
|
176
|
-
ip_address?: string;
|
|
177
|
-
signature_id?: string;
|
|
178
|
-
signed_at?: string;
|
|
179
172
|
[key: string]: any;
|
|
180
173
|
}
|
|
181
174
|
export interface IPage {
|