@verdocs/js-sdk 2.1.2 → 3.0.1

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.
@@ -0,0 +1,113 @@
1
+ import { IEnvelope, IEnvelopesSummary, IRecipient, ISigningSession, TEnvelopeUpdateResult, IDocumentFieldSettings } from './Types';
2
+ import { ICreateEnvelopeRole, IEnvelopesSearchResult, ISigningSessionRequest } from './Types';
3
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
4
+ export interface ICreateEnvelopeRequest {
5
+ template_id: string;
6
+ roles: ICreateEnvelopeRole[];
7
+ name: string;
8
+ }
9
+ /**
10
+ * Create an envelope
11
+ *
12
+ * ```typescript
13
+ * import {Envelopes, ICreateEnvelopeRole, ICreateEnvelopeRequest} from '@verdocs/js-sdk/Envelopes';
14
+ *
15
+ * const role1: ICreateEnvelopeRole = {
16
+ * type: 'signer',
17
+ * name: 'Seller',
18
+ * full_name: 'Paige Turner',
19
+ * email: 'paige.turner@nomail.com',
20
+ * phone: '',
21
+ * sequence: 1,
22
+ * delegator: false,
23
+ * message: '',
24
+ * };
25
+ *
26
+ * const role2: ICreateEnvelopeRole = {
27
+ * type: 'signer',
28
+ * name: 'Buyer',
29
+ * full_name: 'Will Power',
30
+ * email: 'will.power@nomail.com',
31
+ * phone: '',
32
+ * sequence: 2,
33
+ * delegator: false,
34
+ * message: '',
35
+ * };
36
+ *
37
+ * const request: ICreateEnvelopeRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};
38
+ * const {id, recipients} = await Envelopes.createEnvelope(VerdocsEndpoint.getDefault(), request);
39
+ * ```
40
+ */
41
+ export declare const createEnvelope: (endpoint: VerdocsEndpoint, request: ICreateEnvelopeRequest) => Promise<IEnvelope>;
42
+ /**
43
+ * Get a summary of currently active envelopes.
44
+ *
45
+ * ```typescript
46
+ * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
47
+ *
48
+ * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());
49
+ * ```
50
+ */
51
+ export declare const getSummary: (endpoint: VerdocsEndpoint, page: number) => Promise<IEnvelopesSummary>;
52
+ /**
53
+ * Search for envelopes matching various criteria.
54
+ *
55
+ * ```typescript
56
+ * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
57
+ *
58
+ * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });
59
+ * ```
60
+ */
61
+ export declare const searchEnvelopes: (endpoint: VerdocsEndpoint, params: any) => Promise<IEnvelopesSearchResult>;
62
+ export interface ISigningSessionResult {
63
+ recipient: IRecipient;
64
+ session: ISigningSession;
65
+ signerToken: string;
66
+ }
67
+ /**
68
+ * Get a signing session for an Envelope.
69
+ */
70
+ export declare const getSigningSession: (endpoint: VerdocsEndpoint, params: ISigningSessionRequest) => Promise<ISigningSessionResult>;
71
+ /**
72
+ * Get the list of recipients for an Envelope.
73
+ */
74
+ export declare const getEnvelopeRecipients: (endpoint: VerdocsEndpoint, envelopeId: string) => Promise<IRecipient[]>;
75
+ /**
76
+ * Get all metadata for an Envelope.
77
+ */
78
+ export declare const getEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Promise<IEnvelope>;
79
+ /**
80
+ * Cancel an Envelope.
81
+ */
82
+ export declare const cancelEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Promise<TEnvelopeUpdateResult>;
83
+ /**
84
+ * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
85
+ */
86
+ export declare const recipientHasAction: (recipient: IRecipient) => boolean;
87
+ /**
88
+ * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
89
+ */
90
+ export declare const getRecipientsWithActions: (envelope: IEnvelope) => IRecipient[];
91
+ /**
92
+ * Returns true if the recipient can act.
93
+ */
94
+ export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
95
+ /**
96
+ * Returns true if the user can act.
97
+ */
98
+ export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
99
+ /**
100
+ * Get (binary download) a file attached to an Envelope. It is important to use this method
101
+ * rather than a direct A HREF or similar link to set the authorization headers for the
102
+ * request.
103
+ */
104
+ export declare const getEnvelopeFile: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string) => Promise<string>;
105
+ /**
106
+ * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
107
+ */
108
+ export declare const updateEnvelopeField: (endpoint: VerdocsEndpoint, envelopeId: string, fieldName: string, value: any) => Promise<IDocumentFieldSettings>;
109
+ /**
110
+ * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
111
+ * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
112
+ */
113
+ export declare const updateEnvelopeFieldSignature: (endpoint: VerdocsEndpoint, envelopeId: string, fieldName: string, signatureId: string) => Promise<IDocumentFieldSettings>;
@@ -36,12 +36,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { decodeAccessTokenBody } from '../Utils/Token';
38
38
  /**
39
- * Create a document
39
+ * Create an envelope
40
40
  *
41
41
  * ```typescript
42
- * import {Documents, ICreateDocumentRole, ICreateDocumentRequest} from '@verdocs/js-sdk/Documents';
42
+ * import {Envelopes, ICreateEnvelopeRole, ICreateEnvelopeRequest} from '@verdocs/js-sdk/Envelopes';
43
43
  *
44
- * const role1: ICreateDocumentRole = {
44
+ * const role1: ICreateEnvelopeRole = {
45
45
  * type: 'signer',
46
46
  * name: 'Seller',
47
47
  * full_name: 'Paige Turner',
@@ -52,7 +52,7 @@ import { decodeAccessTokenBody } from '../Utils/Token';
52
52
  * message: '',
53
53
  * };
54
54
  *
55
- * const role2: ICreateDocumentRole = {
55
+ * const role2: ICreateEnvelopeRole = {
56
56
  * type: 'signer',
57
57
  * name: 'Buyer',
58
58
  * full_name: 'Will Power',
@@ -63,56 +63,56 @@ import { decodeAccessTokenBody } from '../Utils/Token';
63
63
  * message: '',
64
64
  * };
65
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);
66
+ * const request: ICreateEnvelopeRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};
67
+ * const {id, recipients} = await Envelopes.createEnvelope(VerdocsEndpoint.getDefault(), request);
68
68
  * ```
69
69
  */
70
- export var createDocument = function (endpoint, request) { return __awaiter(void 0, void 0, void 0, function () {
70
+ export var createEnvelope = function (endpoint, request) { return __awaiter(void 0, void 0, void 0, function () {
71
71
  return __generator(this, function (_a) {
72
72
  return [2 /*return*/, endpoint.api //
73
- .post('/documents', request)
73
+ .post('/envelopes', request)
74
74
  .then(function (r) { return r.data; })];
75
75
  });
76
76
  }); };
77
77
  /**
78
- * Get a summary of currently active documents.
78
+ * Get a summary of currently active envelopes.
79
79
  *
80
80
  * ```typescript
81
- * import {Documents} from '@verdocs/js-sdk/Documents';
81
+ * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
82
82
  *
83
- * const {action_required, completed, waiting_on_others} = await Documents.getSummary(VerdocsEndpoint.getDefault());
83
+ * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());
84
84
  * ```
85
85
  */
86
86
  export var getSummary = function (endpoint, page) { return __awaiter(void 0, void 0, void 0, function () {
87
87
  return __generator(this, function (_a) {
88
88
  return [2 /*return*/, endpoint.api //
89
- .post('/documents/summary', { page: page })
89
+ .post('/envelopes/summary', { page: page })
90
90
  .then(function (r) { return r.data; })];
91
91
  });
92
92
  }); };
93
93
  /**
94
- * Search for documents matching various criteria.
94
+ * Search for envelopes matching various criteria.
95
95
  *
96
96
  * ```typescript
97
- * import {Documents} from '@verdocs/js-sdk/Documents';
97
+ * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
98
98
  *
99
- * const {result, page, total} = await Documents.search(VerdocsEndpoint.getDefault(), { ... });
99
+ * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });
100
100
  * ```
101
101
  */
102
- export var searchDocuments = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
102
+ export var searchEnvelopes = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
103
103
  return __generator(this, function (_a) {
104
104
  return [2 /*return*/, endpoint.api //
105
- .post('/documents/search', params)
105
+ .post('/envelopes/search', params)
106
106
  .then(function (r) { return r.data; })];
107
107
  });
108
108
  }); };
109
109
  /**
110
- * Get a signing session for a Document.
110
+ * Get a signing session for an Envelope.
111
111
  */
112
112
  export var getSigningSession = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
113
113
  return __generator(this, function (_a) {
114
114
  return [2 /*return*/, endpoint.api //
115
- .get("/documents/".concat(params.documentId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
115
+ .get("/envelopes/".concat(params.envelopeId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
116
116
  .then(function (r) {
117
117
  var _a, _b;
118
118
  // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
@@ -124,32 +124,32 @@ export var getSigningSession = function (endpoint, params) { return __awaiter(vo
124
124
  });
125
125
  }); };
126
126
  /**
127
- * Get the list of recipients for a Document.
127
+ * Get the list of recipients for an Envelope.
128
128
  */
129
- export var getDocumentRecipients = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
129
+ export var getEnvelopeRecipients = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
130
130
  return __generator(this, function (_a) {
131
131
  return [2 /*return*/, endpoint.api //
132
- .get("/documents/".concat(documentId, "/recipients"))
132
+ .get("/envelopes/".concat(envelopeId, "/recipients"))
133
133
  .then(function (r) { return r.data; })];
134
134
  });
135
135
  }); };
136
136
  /**
137
- * Get all metadata for a Document.
137
+ * Get all metadata for an Envelope.
138
138
  */
139
- export var getDocument = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
139
+ export var getEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
140
140
  return __generator(this, function (_a) {
141
141
  return [2 /*return*/, endpoint.api //
142
- .get("/documents/".concat(documentId))
142
+ .get("/envelopes/".concat(envelopeId))
143
143
  .then(function (r) { return r.data; })];
144
144
  });
145
145
  }); };
146
146
  /**
147
- * Cancel a Document.
147
+ * Cancel an Envelope.
148
148
  */
149
- export var cancelDocument = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
149
+ export var cancelEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
150
150
  return __generator(this, function (_a) {
151
151
  return [2 /*return*/, endpoint.api //
152
- .put("/documents/".concat(documentId), { action: 'cancel' })
152
+ .put("/envelopes/".concat(envelopeId), { action: 'cancel' })
153
153
  .then(function (r) { return r.data; })];
154
154
  });
155
155
  }); };
@@ -160,7 +160,7 @@ export var recipientHasAction = function (recipient) { return !['submitted', 'ca
160
160
  /**
161
161
  * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
162
162
  */
163
- export var getRecipientsWithActions = function (document) { return ((document === null || document === void 0 ? void 0 : document.recipients) || []).filter(recipientHasAction); };
163
+ export var getRecipientsWithActions = function (envelope) { return ((envelope === null || envelope === void 0 ? void 0 : envelope.recipients) || []).filter(recipientHasAction); };
164
164
  /**
165
165
  * Returns true if the recipient can act.
166
166
  */
@@ -174,14 +174,14 @@ export var userCanAct = function (email, recipientsWithActions) {
174
174
  return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
175
175
  };
176
176
  /**
177
- * Get (binary download) a file attached to a Document. It is important to use this method
177
+ * Get (binary download) a file attached to an Envelope. It is important to use this method
178
178
  * rather than a direct A HREF or similar link to set the authorization headers for the
179
179
  * request.
180
180
  */
181
- export var getDocumentFile = function (endpoint, documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
181
+ export var getEnvelopeFile = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
182
182
  return __generator(this, function (_a) {
183
183
  return [2 /*return*/, endpoint.api //
184
- .get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
184
+ .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?file=true"), {
185
185
  responseType: 'arraybuffer',
186
186
  })
187
187
  .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
@@ -190,10 +190,10 @@ export var getDocumentFile = function (endpoint, documentId, envelopeDocumentId)
190
190
  /**
191
191
  * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
192
192
  */
193
- export var updateDocumentField = function (endpoint, documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
193
+ export var updateEnvelopeField = function (endpoint, envelopeId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
194
194
  return __generator(this, function (_a) {
195
195
  return [2 /*return*/, endpoint.api //
196
- .put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
196
+ .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName), value)
197
197
  .then(function (r) { return r.data; })];
198
198
  });
199
199
  }); };
@@ -201,10 +201,10 @@ export var updateDocumentField = function (endpoint, documentId, fieldName, valu
201
201
  * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
202
202
  * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
203
203
  */
204
- export var updateDocumentFieldSignature = function (endpoint, documentId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
204
+ export var updateEnvelopeFieldSignature = function (endpoint, envelopeId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
205
205
  return __generator(this, function (_a) {
206
206
  return [2 /*return*/, endpoint.api //
207
- .put("/documents/".concat(documentId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
207
+ .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
208
208
  .then(function (r) { return r.data; })];
209
209
  });
210
210
  }); };
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import { IInPersonAccessKey, TRecipientAction } from './Types';
2
2
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
- import { IDocument, IRecipient } from './Types';
3
+ import { IEnvelope, IRecipient } from './Types';
4
4
  export interface IUpdateRecipientParams {
5
5
  new_full_name?: string;
6
6
  agreed?: boolean;
@@ -8,12 +8,12 @@ export interface IUpdateRecipientParams {
8
8
  /**
9
9
  * Update a recipient's status block
10
10
  */
11
- export declare const updateRecipientStatus: (endpoint: VerdocsEndpoint, documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
11
+ export declare const updateRecipientStatus: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
12
12
  export interface ISignerTokenResponse {
13
13
  recipient: IRecipient;
14
- envelope: IDocument;
14
+ envelope: IEnvelope;
15
15
  signerToken: string;
16
16
  inPersonAccessKey: IInPersonAccessKey;
17
17
  }
18
- export declare const getSignerToken: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
19
- export declare const getInPersonLink: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
18
+ export declare const getSignerToken: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<ISignerTokenResponse>;
19
+ export declare const getInPersonLink: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<ISignerTokenResponse>;
@@ -48,20 +48,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  /**
49
49
  * Update a recipient's status block
50
50
  */
51
- export var updateRecipientStatus = function (endpoint, documentId, roleName, action, params) { return __awaiter(void 0, void 0, void 0, function () {
51
+ export var updateRecipientStatus = function (endpoint, envelopeId, roleName, action, params) { return __awaiter(void 0, void 0, void 0, function () {
52
52
  return __generator(this, function (_a) {
53
53
  return [2 /*return*/, endpoint.api //
54
- .put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
54
+ .put("/envelopes/".concat(envelopeId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
55
55
  .then(function (r) { return r.data; })];
56
56
  });
57
57
  }); };
58
- export var getSignerToken = function (endpoint, documentId, roleName) {
58
+ export var getSignerToken = function (endpoint, envelopeId, roleName) {
59
59
  return endpoint.api //
60
- .get("/documents/".concat(documentId, "/recipients/").concat(encodeURIComponent(roleName), "/signer-token"))
60
+ .get("/envelopes/".concat(envelopeId, "/recipients/").concat(encodeURIComponent(roleName), "/signer-token"))
61
61
  .then(function (r) { return r.data; });
62
62
  };
63
- export var getInPersonLink = function (endpoint, documentId, roleName) {
63
+ export var getInPersonLink = function (endpoint, envelopeId, roleName) {
64
64
  return endpoint.api //
65
- .get("/documents/".concat(documentId, "/recipients/").concat(encodeURIComponent(roleName), "?in_person_link=true"))
65
+ .get("/envelopes/".concat(envelopeId, "/recipients/").concat(encodeURIComponent(roleName), "?in_person_link=true"))
66
66
  .then(function (r) { return r.data; });
67
67
  };
File without changes
File without changes
@@ -1,36 +1,13 @@
1
1
  import { IProfile } from '../Users/Types';
2
2
  export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
3
- export interface ITemplateSummaryEntry {
4
- id: string;
5
- name: string;
6
- sender: string;
7
- counter: number;
8
- description: string | null;
9
- created_at: string;
10
- updated_at: string;
11
- is_personal: boolean;
12
- is_public: boolean;
13
- profile_id: string;
14
- organization_id: string;
15
- last_used_at: string | null;
16
- document_name: string | null;
17
- star_counter: number;
18
- tag_name: string | null;
19
- is_starred: boolean;
20
- }
21
- export interface ITemplatesSummary {
22
- page: number;
23
- total: number;
24
- result: ITemplateSummaryEntry[];
25
- }
26
3
  export interface ISigningSessionRequest {
27
- documentId: string;
4
+ envelopeId: string;
28
5
  roleId: string;
29
6
  inviteCode: string;
30
7
  }
31
8
  export interface ISigningSession {
32
9
  profile_id: string;
33
- document_id: string;
10
+ envelope_id: string;
34
11
  role: string;
35
12
  email: string;
36
13
  access_key: {
@@ -54,15 +31,16 @@ export interface IInPersonAccessKey {
54
31
  first_used: string | null;
55
32
  last_used: string | null;
56
33
  }
57
- export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
34
+ export declare type TEnvelopeStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
58
35
  export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
59
36
  export declare type TRecipientType = 'signer' | 'cc' | 'approver';
60
- export interface IDocumentsSearchResultEntry {
37
+ export interface IEnvelopesSearchResultEntry {
61
38
  id: string;
62
39
  canceled_at: string;
63
40
  certificate_document_id: string;
64
- created_at: string;
41
+ /** @deprecated. New envelopes may have more than one document attached. */
65
42
  envelope_document_id: string;
43
+ created_at: string;
66
44
  histories: IHistory[];
67
45
  indexed_at: string;
68
46
  name: string;
@@ -71,7 +49,7 @@ export interface IDocumentsSearchResultEntry {
71
49
  profile_id: string;
72
50
  recipients: IRecipient[];
73
51
  reminder_id: string | null;
74
- status: TDocumentStatus;
52
+ status: TEnvelopeStatus;
75
53
  next_recipient: {
76
54
  claimed: boolean;
77
55
  email: string;
@@ -84,12 +62,12 @@ export interface IDocumentsSearchResultEntry {
84
62
  total_count: number;
85
63
  updated_at: string;
86
64
  }
87
- export interface IDocumentsSearchResult {
65
+ export interface IEnvelopesSearchResult {
88
66
  page: number;
89
67
  total: number;
90
- result: IDocumentsSearchResultEntry[];
68
+ result: IEnvelopesSearchResultEntry[];
91
69
  }
92
- export interface IDocumentsSummary {
70
+ export interface IEnvelopesSummary {
93
71
  action_required: {
94
72
  page: number;
95
73
  total: number;
@@ -121,13 +99,19 @@ export interface IRecipient {
121
99
  phone: string | null;
122
100
  profile_id: string;
123
101
  role_name: string;
102
+ /**
103
+ * The sequence number indicates the order in which recipients act. Note that it is the workflow "level" not the
104
+ * recipient's individual index in the list. There may be multiple recipients with the same sequence. Recipients
105
+ * with the same sequence number may act independently, in parallel to each other (co-signers), as long as all
106
+ * Recipients with an earlier sequence number have completed their tasks.
107
+ */
124
108
  sequence: number;
125
109
  status: TRecipientStatus;
126
110
  type: TRecipientType;
127
111
  updated_at: string;
128
112
  fields?: IDocumentField[];
129
113
  }
130
- export interface IDocumentAsset {
114
+ export interface IEnvelopeDocument {
131
115
  created_at: string;
132
116
  id: string;
133
117
  mime: string;
@@ -137,11 +121,17 @@ export interface IDocumentAsset {
137
121
  url: string;
138
122
  }
139
123
  export interface IDocumentFieldOptions {
124
+ /** The unique ID of the field */
140
125
  id: string;
126
+ /** The X position of the field on the page. Self-placed fields will have an X value of 0. */
141
127
  x: number;
128
+ /** The Y position of the field on the page. Self-placed fields will have an X value of 0. */
142
129
  y: number;
130
+ /** For checkboxes, whether it is currently checked */
143
131
  checked?: boolean;
132
+ /** For radio buttons, whether it is currently selected */
144
133
  selected?: boolean;
134
+ /** The visible label for the field e.g. 'Not Applicable' */
145
135
  value: string;
146
136
  }
147
137
  export interface IDocumentFieldSettings {
@@ -151,55 +141,79 @@ export interface IDocumentFieldSettings {
151
141
  width?: number;
152
142
  height?: number;
153
143
  value?: number | string;
144
+ /** If the field has been filled in, this contains the current value */
154
145
  result?: any;
146
+ /** Text field settings */
155
147
  leading?: number;
156
148
  alignment?: number;
157
149
  upperCase?: boolean;
150
+ /** Dropdowns, checkboxes, radio groups */
158
151
  options?: IDocumentFieldOptions[];
152
+ /** Signatures and Initials, result will be "signed" */
159
153
  base64?: string;
160
154
  hash?: string;
161
155
  ip_address?: string;
162
156
  signature_id?: string;
163
157
  signed_at?: string;
158
+ /** Checkbox settings */
164
159
  minimum_checked?: number;
165
160
  maximum_checked?: number;
166
161
  [key: string]: any;
167
162
  }
168
163
  export declare type TDocumentFieldType = 'signature' | 'initial' | 'checkbox_group' | 'radio_button_group' | 'textbox' | 'timestamp' | 'date' | 'dropdown' | 'textarea' | 'attachment' | 'payment';
169
164
  export interface IDocumentField {
165
+ /**
166
+ * The ID of the document the field is for. For historical reasons, this is called `envelope_id` because documents
167
+ * were previously called envelopes.
168
+ */
170
169
  envelope_id: string;
170
+ /** The machine name of the field, e.g. `checkbox_groupP1-18` */
171
171
  name: string;
172
+ /** If set, the placeholder/label for the field. */
172
173
  label: string | null;
174
+ /** The 1-based page number the field is displayed on. "Self-placed" fields that the user must apply will be on page 0. */
173
175
  page: number;
176
+ /** The ID of the role in the recipients list, e.g. `Recipient 2` */
174
177
  recipient_role: string;
178
+ /** The type of the field */
175
179
  type: TDocumentFieldType;
180
+ /** If true, the field will be required */
176
181
  required: boolean;
177
182
  settings?: IDocumentFieldSettings;
178
183
  validator: string | null;
184
+ /** Not sent by the server. Used in the UI to identify prepared fields. */
179
185
  prepared?: boolean;
180
186
  }
181
- export interface IDocument {
187
+ /**
188
+ * An Envelope is a workflow wrapper that shepherds one or more Documents through the various recipients in a signing
189
+ * process.
190
+ */
191
+ export interface IEnvelope {
182
192
  id: string;
193
+ template_id: string;
194
+ name: string;
195
+ status: TEnvelopeStatus;
196
+ profile_id: string;
197
+ organization_id: string | null;
198
+ no_contact: boolean;
183
199
  created_at: string;
200
+ updated_at: string;
184
201
  canceled_at: string;
202
+ reminder_id: string | null;
203
+ /** @deprecated. New envelopes will support more than one document attachment so new code should no longer refer to this field. */
185
204
  envelope_document_id: string;
186
205
  certificate_document_id: string | null;
187
206
  histories: IHistory[];
188
207
  recipients: IRecipient[];
189
- name: string;
190
- no_contact: boolean;
191
- profile_id: string;
192
- reminder_id: string | null;
193
- status: TDocumentStatus;
194
- template_id: string;
195
- updated_at: string;
196
- organization_id: string | null;
197
- certificate?: IDocumentAsset | null;
198
- document?: IDocumentAsset | null;
199
- fields?: IDocumentField[];
200
208
  profile?: IProfile | null;
209
+ certificate?: IEnvelopeDocument | null;
210
+ /** @deprecated. New code should use `documents[]`. */
211
+ document?: IEnvelopeDocument | null;
212
+ /** Documents attached to this envelope */
213
+ documents?: IEnvelopeDocument[] | null;
214
+ fields?: IDocumentField[];
201
215
  }
202
- export declare type TDocumentUpdateResult = Omit<IDocument, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
216
+ export declare type TEnvelopeUpdateResult = Omit<IEnvelope, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
203
217
  export interface IActivityEntry {
204
218
  id: string;
205
219
  name: string;
@@ -207,7 +221,7 @@ export interface IActivityEntry {
207
221
  created_at: string;
208
222
  updated_at: string;
209
223
  profile_id: string;
210
- status: TDocumentStatus;
224
+ status: TEnvelopeStatus;
211
225
  template_id: string;
212
226
  recipient: {
213
227
  claimed: boolean;
@@ -233,23 +247,37 @@ export interface IDocumentSearchOptions {
233
247
  ascending?: boolean;
234
248
  is_owner?: boolean;
235
249
  is_recipient?: boolean;
236
- envelope_status: TDocumentStatus[];
237
- recipient_status: TDocumentStatus[];
250
+ envelope_status?: TEnvelopeStatus[];
251
+ recipient_status?: TEnvelopeStatus[];
238
252
  }
239
253
  export declare type THistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
240
254
  export declare type TEventDetail = 'in_app' | 'mail' | 'signer' | '';
241
- export interface ICreateDocumentRole {
255
+ export interface ICreateEnvelopeRole {
256
+ /** The type of role to create. Most participants in standard flows will be "signer" recipients. */
242
257
  type: TRecipientType;
258
+ /**
259
+ * The Role name of the recipient. Please note this is not the person's name. It is the ID of the role, e.g.
260
+ * 'Recipient 1', 'Seller', etc. This must match one of the pre-defined roles in the template's Recipients list.
261
+ */
243
262
  name: string;
263
+ /** The full name of the recipient as it will be displayed in reports and queries, e.g. 'Paige Turner'. */
244
264
  full_name: string;
265
+ /** The email address of the recipient. One of `email` or `phone` must be provided. */
245
266
  email?: string;
267
+ /**
268
+ * The phone number of the recipient. One of `email` or `phone` must be provided. If `phone` is included, the
269
+ * recipient will receive an SMS notification for the document.
270
+ */
246
271
  phone?: string;
272
+ /**
273
+ * The 1-based sequence number for the recipient. This can be used to override the template's workflow. Recipients
274
+ * are processed in parallel for each matching sequence number (e.g. all recipients at level "1" may act in parallel)
275
+ * and in series between sequence numbers (e.g. all recipients at level "1" must complete their tasks before
276
+ * recipients at level "2" may act).
277
+ */
247
278
  sequence: number;
279
+ /** Whether the recipient may delegate their tasks to others. Should be false for most standard workflows. */
248
280
  delegator: boolean;
281
+ /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
249
282
  message: string;
250
283
  }
251
- export interface ICreateDocumentRequest {
252
- template_id: string;
253
- roles: ICreateDocumentRole[];
254
- name: string;
255
- }
File without changes
@@ -1,4 +1,4 @@
1
- export * as Documents from './Documents';
1
+ export * as Envelopes from './Envelopes';
2
2
  export * as Recipients from './Recipients';
3
3
  export * as Signatures from './Signatures';
4
4
  export * as Initials from './Initials';
@@ -1,4 +1,4 @@
1
- export * as Documents from './Documents';
1
+ export * as Envelopes from './Envelopes';
2
2
  export * as Recipients from './Recipients';
3
3
  export * as Signatures from './Signatures';
4
4
  export * as Initials from './Initials';
@@ -11,9 +11,28 @@ export interface IOrganization {
11
11
  is_business: boolean;
12
12
  /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
13
13
  business_name: string | null;
14
+ /** @deprecated. The organization primary contact email address. */
14
15
  contact_email: string | null;
16
+ /** @deprecated. The organization's primary time zone. */
15
17
  timezone: string | null;
18
+ /**
19
+ * If a Template published by the Organization is configured to be usable to create new Envelopes by users outside that
20
+ * Organization (`sender: 'everyone_as_creator'`), and that action would trigger a billing event, this field controls
21
+ * who is reponsible for that cost. If set to TRUE, the Organization that owns the template will be billed for its use.
22
+ * If set to FALSE, the requestor pays.
23
+ *
24
+ * This is deprecated in favor of a future per-template approach. Please contact support@verdocs.com to discuss your
25
+ * application requirements if you plan to use this functionality for an immediate integration.
26
+ *
27
+ * @deprecated
28
+ */
16
29
  envelope_responsible: boolean;
30
+ /** Web site URL */
31
+ url: string | null;
32
+ /** Creation date/time. */
33
+ created_at: string;
34
+ /** Last-update date/time. */
35
+ updated_at: string;
17
36
  }
18
37
  export interface ICreateApiKeyRequest {
19
38
  name: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended
3
3
  * to locate items across all content types. More specific retrievals may be performed using the various "list" endpoints within
4
- * each collection (e.g. {@link Documents.Documents.searchDocuments} or {@link Templates.Templates.searchTemplates}).
4
+ * each collection (e.g. {@link Envelopes.Envelopes.searchEnvelopes} or {@link Templates.Templates.searchTemplates}).
5
5
  *
6
6
  * @module
7
7
  */
package/Search/Content.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended
3
3
  * to locate items across all content types. More specific retrievals may be performed using the various "list" endpoints within
4
- * each collection (e.g. {@link Documents.Documents.searchDocuments} or {@link Templates.Templates.searchTemplates}).
4
+ * each collection (e.g. {@link Envelopes.Envelopes.searchEnvelopes} or {@link Templates.Templates.searchTemplates}).
5
5
  *
6
6
  * @module
7
7
  */
package/Search/Types.d.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { TTemplateSender } from '../Templates/Types';
2
- import { TDocumentStatus } from '../Documents/Types';
2
+ import { TEnvelopeStatus } from '../Envelopes/Types';
3
3
  export declare type TMimeType = 'application/pdf' | string;
4
4
  /**
5
5
  * An individual hit in a document search result. Note that this schema does not precisely match IDocument because fields
6
6
  * are optimized for search performance.
7
7
  */
8
- export interface IDocumentHit {
9
- type: 'document';
8
+ export interface IEnvelopeHit {
9
+ type: 'envelope';
10
10
  id: string;
11
11
  template_id: string;
12
12
  name: string;
13
13
  profile_id: string;
14
14
  organization_id: string;
15
15
  organization_name: string;
16
- status: TDocumentStatus;
16
+ status: TEnvelopeStatus;
17
17
  recipient_emails: string[];
18
18
  recipient_names: string[];
19
19
  updated_at: string;
@@ -93,7 +93,7 @@ export interface ISearchResultCollection<T> {
93
93
  search_time_ms: number;
94
94
  }
95
95
  export interface ISearchResult {
96
- documents: ISearchResultCollection<IDocumentHit>;
96
+ documents: ISearchResultCollection<IEnvelopeHit>;
97
97
  myTemplates: ISearchResultCollection<ITemplateHit>;
98
98
  publicTemplates: ISearchResultCollection<ITemplateHit>;
99
99
  organizations: ISearchResultCollection<IOrganizationHit>;
@@ -0,0 +1,39 @@
1
+ import { IProfile, TPermission, TPlan, TRole } from '../Users/Types';
2
+ export interface ISigningSessionRequest {
3
+ envelopeId: string;
4
+ roleId: string;
5
+ inviteCode: string;
6
+ }
7
+ /** A Signing Session connects a caller to a role within an envelope, and can be used only for calls related to signing that envelope. */
8
+ export interface ISigningSession {
9
+ profile_id: string;
10
+ envelope_id: string;
11
+ role: string;
12
+ email: string;
13
+ access_key: {
14
+ id: string;
15
+ type: string;
16
+ };
17
+ iss: string;
18
+ aud: string;
19
+ exp: number;
20
+ iat: number;
21
+ [key: string]: any;
22
+ }
23
+ /** A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform. */
24
+ export interface IUserSession {
25
+ sub: string;
26
+ email: string;
27
+ email_verified: boolean;
28
+ iat: number;
29
+ exp: number;
30
+ permissions: TPermission[];
31
+ roles: TRole[];
32
+ profile: IProfile;
33
+ profile_id: string;
34
+ organization_id: string;
35
+ plans?: TPlan[];
36
+ [key: string]: any;
37
+ }
38
+ export declare type TSessionType = 'user' | 'signing';
39
+ export declare type TSession = IUserSession | ISigningSession | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * as Types from './Types';
@@ -0,0 +1 @@
1
+ export * as Types from './Types';
package/Users/Types.d.ts CHANGED
@@ -29,6 +29,8 @@ export interface IProfile {
29
29
  phone: string | null;
30
30
  /** If true, this is the caller's "currently selected" profile. All operations will performed "as" this profile. */
31
31
  current: boolean;
32
+ created_at: string;
33
+ updated_at: string;
32
34
  /** The organization */
33
35
  organization?: IOrganization;
34
36
  /** The permissions assigned to the profilel _NOTE: Only present in the "current" profile._ */
@@ -40,20 +42,6 @@ export interface IProfile {
40
42
  /** The plans assigned to the profilel _NOTE: Only present in the "current" profile._ */
41
43
  groups?: IGroup[];
42
44
  }
43
- export interface IActiveSession {
44
- sub: string;
45
- email: string;
46
- email_verified: boolean;
47
- iat: number;
48
- exp: number;
49
- permissions: TPermission[];
50
- roles: TRole[];
51
- profile: IProfile;
52
- profile_id: string;
53
- organization_id: string;
54
- plans?: TPlan[];
55
- [key: string]: any;
56
- }
57
45
  export interface IRole {
58
46
  /** Unique identifier for the role. */
59
47
  id: string;
package/Utils/Token.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ISigningSession } from '../Documents/Types';
2
- import { IActiveSession } from '../Users/Types';
1
+ import { ISigningSession } from '../Envelopes/Types';
2
+ import { IUserSession } from '../Sessions/Types';
3
3
  /**
4
4
  * Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
5
5
  * Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
@@ -17,4 +17,4 @@ export declare const decodeJWTBody: (token: string) => any;
17
17
  * application should distinguish between the two based on the context of the authenticated session, or by
18
18
  * the presence of the `document_id` field, which will only be present for signing sessions.
19
19
  */
20
- export declare const decodeAccessTokenBody: (token: string) => IActiveSession | ISigningSession | null;
20
+ export declare const decodeAccessTokenBody: (token: string) => IUserSession | ISigningSession | null;
@@ -1,10 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ISigningSession } from './Documents/Types';
3
- import { IActiveSession } from './Users/Types';
4
- import * as Documents from './Documents';
2
+ import { TSession, TSessionType } from './Sessions/Types';
5
3
  export declare type TEnvironment = 'verdocs' | 'verdocs-stage';
6
- export declare type TSessionType = 'user' | 'signing';
7
- export declare type TSession = IActiveSession | ISigningSession | null;
8
4
  export declare type TSessionChangedListener = (endpoint: VerdocsEndpoint, session: TSession) => void;
9
5
  export interface VerdocsEndpointOptions {
10
6
  baseURL?: string;
@@ -51,7 +47,6 @@ export declare class VerdocsEndpoint {
51
47
  */
52
48
  session: TSession;
53
49
  api: AxiosInstance;
54
- Documents: typeof Documents;
55
50
  /**
56
51
  * Create a new VerdocsEndpoint to call Verdocs platform services.
57
52
  *
@@ -1,7 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import { decodeAccessTokenBody } from './Utils/Token';
3
3
  import globalThis from './Utils/globalThis';
4
- import * as Documents from './Documents';
5
4
  // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
6
5
  // Also see globalThis for comments about why we're doing this in the first place.
7
6
  var ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
@@ -56,7 +55,6 @@ var VerdocsEndpoint = /** @class */ (function () {
56
55
  * with Documents.
57
56
  */
58
57
  this.session = null;
59
- this.Documents = Documents;
60
58
  this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
61
59
  this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 3000;
62
60
  this.environment = (options === null || options === void 0 ? void 0 : options.environment) || 'verdocs';
package/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Verdocs functions are organized into high-level modules that represent the main objects within Verdocs:
3
3
  *
4
- * - Documents - An individual document to be signed. Documents are created from templates.
5
- * - HTTP - General support functionality for Verdocs' REST endpoints. Typically not used directly.
4
+ * - Envelopes - An individual document to be signed. Documents are created from templates.
6
5
  * - Organizations - An Organization is a container for user profiles, templates, documents, billing, and other related objects.
7
6
  * - Search - Various methods used to retrieve lists of documents and templtes.
8
7
  * - Templates - A template for a document containing a PDF file, metadata for signature fields, and other information.
@@ -11,10 +10,11 @@
11
10
  *
12
11
  * @module
13
12
  */
14
- export * as Documents from './Documents';
15
- export * as Templates from './Templates';
13
+ export * as Envelopes from './Envelopes';
16
14
  export * as Organizations from './Organizations';
17
15
  export * as Search from './Search';
16
+ export * as Sessions from './Sessions';
17
+ export * as Templates from './Templates';
18
18
  export * as Users from './Users';
19
19
  export * as Utils from './Utils';
20
20
  export * from './VerdocsEndpoint';
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Verdocs functions are organized into high-level modules that represent the main objects within Verdocs:
3
3
  *
4
- * - Documents - An individual document to be signed. Documents are created from templates.
5
- * - HTTP - General support functionality for Verdocs' REST endpoints. Typically not used directly.
4
+ * - Envelopes - An individual document to be signed. Documents are created from templates.
6
5
  * - Organizations - An Organization is a container for user profiles, templates, documents, billing, and other related objects.
7
6
  * - Search - Various methods used to retrieve lists of documents and templtes.
8
7
  * - Templates - A template for a document containing a PDF file, metadata for signature fields, and other information.
@@ -11,10 +10,11 @@
11
10
  *
12
11
  * @module
13
12
  */
14
- export * as Documents from './Documents';
15
- export * as Templates from './Templates';
13
+ export * as Envelopes from './Envelopes';
16
14
  export * as Organizations from './Organizations';
17
15
  export * as Search from './Search';
16
+ export * as Sessions from './Sessions';
17
+ export * as Templates from './Templates';
18
18
  export * as Users from './Users';
19
19
  export * as Utils from './Utils';
20
20
  export * from './VerdocsEndpoint';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "2.1.2",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",
@@ -1,109 +0,0 @@
1
- import { ICreateDocumentRequest, IDocumentsSearchResult, ISigningSessionRequest } from './Types';
2
- import { IDocument, IDocumentsSummary, IRecipient, ISigningSession } from './Types';
3
- import { TDocumentUpdateResult, IDocumentFieldSettings } from './Types';
4
- import { VerdocsEndpoint } from '../VerdocsEndpoint';
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>;
38
- /**
39
- * Get a summary of currently active documents.
40
- *
41
- * ```typescript
42
- * import {Documents} from '@verdocs/js-sdk/Documents';
43
- *
44
- * const {action_required, completed, waiting_on_others} = await Documents.getSummary(VerdocsEndpoint.getDefault());
45
- * ```
46
- */
47
- export declare const getSummary: (endpoint: VerdocsEndpoint, page: number) => Promise<IDocumentsSummary>;
48
- /**
49
- * Search for documents matching various criteria.
50
- *
51
- * ```typescript
52
- * import {Documents} from '@verdocs/js-sdk/Documents';
53
- *
54
- * const {result, page, total} = await Documents.search(VerdocsEndpoint.getDefault(), { ... });
55
- * ```
56
- */
57
- export declare const searchDocuments: (endpoint: VerdocsEndpoint, params: any) => Promise<IDocumentsSearchResult>;
58
- export interface ISigningSessionResult {
59
- recipient: IRecipient;
60
- session: ISigningSession;
61
- signerToken: string;
62
- }
63
- /**
64
- * Get a signing session for a Document.
65
- */
66
- export declare const getSigningSession: (endpoint: VerdocsEndpoint, params: ISigningSessionRequest) => Promise<ISigningSessionResult>;
67
- /**
68
- * Get the list of recipients for a Document.
69
- */
70
- export declare const getDocumentRecipients: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IRecipient[]>;
71
- /**
72
- * Get all metadata for a Document.
73
- */
74
- export declare const getDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IDocument>;
75
- /**
76
- * Cancel a Document.
77
- */
78
- export declare const cancelDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<TDocumentUpdateResult>;
79
- /**
80
- * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
81
- */
82
- export declare const recipientHasAction: (recipient: IRecipient) => boolean;
83
- /**
84
- * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
85
- */
86
- export declare const getRecipientsWithActions: (document: IDocument) => IRecipient[];
87
- /**
88
- * Returns true if the recipient can act.
89
- */
90
- export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
91
- /**
92
- * Returns true if the user can act.
93
- */
94
- export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
95
- /**
96
- * Get (binary download) a file attached to a Document. It is important to use this method
97
- * rather than a direct A HREF or similar link to set the authorization headers for the
98
- * request.
99
- */
100
- export declare const getDocumentFile: (endpoint: VerdocsEndpoint, documentId: string, envelopeDocumentId: string) => Promise<string>;
101
- /**
102
- * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
103
- */
104
- export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<IDocumentFieldSettings>;
105
- /**
106
- * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
107
- * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
108
- */
109
- export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<IDocumentFieldSettings>;