@verdocs/js-sdk 4.0.0 → 4.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.
package/dist/index.d.mts CHANGED
@@ -1,1164 +1,314 @@
1
1
  import { AxiosInstance } from "axios";
2
- declare namespace Models {
3
- type TTemplateSenderType = "creator" | "organization_member" | "organization_member_as_creator" | "everyone" | "everyone_as_creator";
4
- type TTemplatePermission = "template:creator:create:public" | "template:creator:create:org" | "template:creator:create:personal" | "template:creator:delete" | "template:creator:visibility" | "template:member:read" | "template:member:write" | "template:member:delete" | "template:member:visibility";
5
- type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
6
- /**
7
- * Some template search and list endpoints return only a partial set of fields for each entry via this structure.
8
- */
9
- interface ITemplateSummary {
10
- id: string;
2
+ type TEnvelopeStatus = "complete" | "pending" | "in progress" | "declined" | "canceled";
3
+ type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined";
4
+ type TRecipientType = "signer" | "cc" | "approver";
5
+ /**
6
+ * One entry in an envelope search result.
7
+ * NOTE: Many of the fields here are undefined unless "summary=true" is included in the search terms
8
+ */
9
+ interface IEnvelopesSearchResultEntry {
10
+ id: string;
11
+ canceled_at: string;
12
+ certificate_document_id: string;
13
+ created_at: string;
14
+ histories: IEnvelopeHistory[];
15
+ indexed_at: string;
16
+ name: string;
17
+ no_contact: boolean;
18
+ organization_id: string;
19
+ profile_id: string;
20
+ recipients: IRecipient[];
21
+ reminder_id: string | null;
22
+ status: TEnvelopeStatus;
23
+ /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
24
+ visibility: "private" | "shared";
25
+ next_recipient: {
26
+ claimed: boolean;
27
+ email: string;
11
28
  name: string;
12
- description: string | null;
13
- sender: TTemplateSenderType;
14
- counter: number;
15
- star_counter: number;
16
- created_at: string;
17
- updated_at: string;
18
- last_used_at: string | null;
19
- /**
20
- * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
21
- */
22
- is_sendable: boolean;
23
- is_personal: boolean;
24
- is_public: boolean;
25
29
  profile_id: string;
26
- organization_id: string;
27
- reminder_id: string;
28
- tags: string[];
29
- allowed_operations: TTemplateAction[];
30
- }
31
- interface ITemplateSearchParams {
32
- id?: string;
33
- name?: string;
34
- sender?: string;
35
- description?: string;
36
- profile_id?: string;
37
- organization_id?: string;
38
- updated_at?: ITimePeriod;
39
- created_at?: ITimePeriod;
40
- last_used_at?: ITimePeriod;
41
- is_personal?: boolean;
42
- is_public?: boolean;
43
- tags?: string[];
44
- document_name?: string;
45
- sort_by?: TSortTemplateBy;
46
- ascending?: boolean;
47
- row?: number;
48
- page?: number;
49
- }
50
- interface ITimePeriod {
51
- start_time: string; // Date
52
- end_time: string; // Date
53
- }
54
- interface ITemplateSummaries {
30
+ status: TRecipientStatus;
31
+ type: TRecipientType;
32
+ };
33
+ template_id: string;
34
+ total_count: number;
35
+ updated_at: string;
36
+ }
37
+ interface IEnvelopesSearchResult {
38
+ page: number;
39
+ total: number;
40
+ result: IEnvelopesSearchResultEntry[];
41
+ }
42
+ interface IEnvelopesSummary {
43
+ action_required: {
55
44
  page: number;
56
- count: number;
57
45
  total: number;
58
- records: ITemplateSummary[];
59
- }
60
- interface ITemplateTag {
61
- tag_name: string;
62
- template_id: string;
63
- }
64
- interface ITag {
65
- name: string;
66
- featured?: boolean;
67
- organization_id?: string;
68
- created_at?: string;
69
- }
70
- interface IStar {
71
- template_id: string;
72
- profile_id: string;
73
- }
74
- interface ITemplateOwnerInfo {
75
- email: string;
76
- name: string;
77
- profile_id: string;
78
- }
79
- type TSortTemplateBy = "created_at" | "updated_at" | "name" | "last_used_at" | "counter" | "star_counter";
80
- type TRequestStatus = "OK" | "ERROR";
81
- type TAccountPermission = "owner:add" | "owner:remove" | "admin:add" | "admin:remove" | "member:view" | "member:add" | "member:remove";
82
- /**
83
- * Operation within Verdocs that users may perform.
46
+ result: IActivityEntry[];
47
+ };
48
+ completed: {
49
+ page: number;
50
+ total: number;
51
+ result: IActivityEntry[];
52
+ };
53
+ waiting_others: {
54
+ page: number;
55
+ total: number;
56
+ result: IActivityEntry[];
57
+ };
58
+ }
59
+ type TDocumentFieldType = "signature" | "initial" | "checkbox_group" | "radio_button_group" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
60
+ type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certificate" | "document" | "fields" | "profile">;
61
+ type THistoryEvent = "recipient:signed" | "recipient:opened" | "recipient:submitted" | "recipient:prepared" | "recipient:claimed" | "recipient:agreed" | "recipient:invited" | "recipient:delegated" | "recipient:updated_info" | "recipient:declined" | "invitation:resent" | "envelope:cc" | "created" | "completed" | "canceled" | "owner:updated_recipient_info" | "owner:canceled" | "owner:get_in_person_link";
62
+ type TEventDetail = "in_app" | "mail" | "signer" | "sms" | "reminder" | "preparer" | "manual" | "in_person_link" | "guest" | "email" | "" | string; // Modification events have a string description
63
+ // Modification events have a string description
64
+ interface ICreateEnvelopeRole {
65
+ /** The type of role to create. Most participants in standard flows will be "signer" recipients. */
66
+ type: TRecipientType;
67
+ /**
68
+ * The Role name of the recipient. Please note this is not the person's name. It is the ID of the role, e.g.
69
+ * 'Recipient 1', 'Seller', etc. This must match one of the pre-defined roles in the template's Recipients list.
84
70
  */
85
- type TPermission = TTemplatePermission | TOrgPermission | TAccountPermission;
71
+ name: string;
72
+ /** The full name of the recipient as it will be displayed in reports and queries, e.g. 'Paige Turner'. */
73
+ full_name: string;
74
+ /** The email address of the recipient. One of `email` or `phone` must be provided. */
75
+ email?: string;
86
76
  /**
87
- * Plans provide access to Verdocs product features.
77
+ * The phone number of the recipient. One of `email` or `phone` must be provided. If `phone` is included, the
78
+ * recipient will receive an SMS notification for the document.
88
79
  */
89
- type TPlan = "env:essential" | "org:standard";
80
+ phone?: string;
90
81
  /**
91
- * Roles provide access to groups of permissions. Note that for historical reasons there is some overlap in the
92
- * use of the term "role". TRole refers to a user type. A "Role" (IRole) is a Template participant placeholder.
82
+ * The 1-based sequence number for the recipient. This can be used to override the template's workflow. Recipients
83
+ * are processed in parallel for each matching sequence number (e.g. all recipients at level "1" may act in parallel)
84
+ * and in series between sequence numbers (e.g. all recipients at level "1" must complete their tasks before
85
+ * recipients at level "2" may act).
93
86
  */
94
- type TRole = "contact" | "basic_user" | "member" | "admin" | "owner";
95
- interface ICreateProfileRequest {
96
- first_name: string;
97
- last_name: string;
98
- email: string;
99
- phone?: string;
100
- }
101
- interface ISwitchProfileResponse {
102
- profile: IProfile;
103
- idToken: string;
104
- accessToken: string;
105
- refreshToken: string;
106
- }
107
- interface IUpdateProfileRequest {
108
- first_name?: string;
109
- last_name?: string;
110
- phone?: string;
111
- }
112
- interface IAuthenticateUserRequest {
113
- username: string;
114
- password: string;
115
- }
116
- interface IAuthenticateAppRequest {
117
- client_id: string;
118
- client_secret: string;
119
- }
120
- interface IAuthenticateResponse {
121
- idToken: string;
122
- accessToken: string;
123
- refreshToken: string;
124
- }
125
- interface TokenValidationRequest {
126
- token: string;
127
- }
128
- interface TokenValidationResponse {
129
- /** True if the token is valid */
130
- valid: boolean;
131
- /** The decoded and validated body of the JWT */
132
- payload: any;
133
- }
134
- interface IUpdatePasswordRequest {
135
- email: string;
136
- oldPassword: string;
137
- newPassword: string;
138
- }
139
- interface UpdatePasswordResponse {
140
- status: TRequestStatus;
141
- /** Success or failure message */
142
- message: string;
143
- }
144
- interface UpdateEmailRequest {
145
- email: string;
146
- }
147
- interface UpdateEmailResponse {
148
- profiles: IProfile[];
149
- }
150
- interface ICreateBusinessAccountRequest {
151
- email: string;
152
- password: string;
153
- firstName: string;
154
- lastName: string;
155
- orgName: string;
156
- }
157
- interface ICreateUserRequest {
158
- firstName: string;
159
- lastName: string;
160
- email: string;
161
- password: string;
162
- fromInviteCode: string;
163
- }
164
- interface ICreateApiKeyRequest {
165
- name: string;
166
- permission: TApiKeyPermission;
167
- }
168
- interface IUpdateApiKeyRequest {
169
- name?: string;
170
- permission?: TApiKeyPermission;
171
- }
172
- type TApiKeyPermission = "personal" | "global_read" | "global_write";
173
- interface ICreateInvitationRequest {
174
- email: string;
175
- role: TRole;
176
- }
177
- type TOrgPermission = "org:create" | "org:view" | "org:update" | "org:delete" | "org:transfer" | "org:list";
178
- interface ISetWebhookRequest {
179
- url: string;
180
- active: boolean;
181
- events: {
182
- envelope_created: boolean;
183
- envelope_completed: boolean;
184
- envelope_canceled: boolean;
185
- template_created: boolean;
186
- template_updated: boolean;
187
- template_deleted: boolean;
188
- template_used: boolean;
189
- };
190
- }
191
- /////////////////////////////// NOTIFICATIONS /////////////////////////////
192
- interface IChannel {
193
- id: string;
194
- channel_type: string;
195
- event_name: string;
196
- disabled_channels?: IDisabledChannel[];
197
- }
198
- interface IDisabledChannel {
199
- channel_id: string;
200
- profile_id: string;
201
- profile?: IProfile;
202
- channel?: IChannel;
203
- }
204
- interface INotification {
205
- id: string;
206
- profile_id: string;
207
- event_name: string;
208
- data: any;
209
- read: boolean;
210
- deleted: boolean;
211
- message: string;
212
- time: string;
213
- profile?: IProfile;
214
- }
215
- //////////////////////////////////////// IAM //////////////////////////////
216
- interface IApiKey {
217
- client_id: string;
218
- name: string;
219
- organization_id: string;
220
- profile_id: string;
221
- client_secret?: string;
222
- permission: TApiKeyPermission;
223
- profile?: IProfile;
224
- organization?: IOrganization;
225
- }
226
- interface IGroup {
227
- id: string;
228
- name: string;
229
- organization_id: string;
230
- permissions: TPermission[];
231
- organization?: IOrganization;
232
- profiles?: IGroupProfile[];
233
- }
234
- interface IGroupProfile {
235
- group_id: string;
236
- profile_id: string;
237
- organization_id: string;
238
- group?: IGroup;
239
- profile?: IProfile;
240
- organization?: IOrganization;
241
- }
242
- interface IOAuth2App {
243
- id: string;
244
- profile_id: string;
245
- organization_id: string;
246
- name: string;
247
- client_id: string;
248
- client_secret?: string;
249
- redirect_uris: string;
250
- origins: string;
251
- friendly_name: string;
252
- logo_uri: string;
253
- public_key: string;
254
- private_key: string;
255
- created_at: string;
256
- updated_at: string;
257
- organization?: IOrganization;
258
- profile?: IProfile;
259
- }
260
- interface IOrganization {
261
- /** The unique ID of the organization */
262
- id: string;
263
- /** The organization's name. */
87
+ sequence: number;
88
+ /** Whether the recipient may delegate their tasks to others. Should be false for most standard workflows. */
89
+ delegator: boolean;
90
+ /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
91
+ message: string;
92
+ }
93
+ interface IEnvelopeSummary {
94
+ id: string;
95
+ profile_id: string;
96
+ organization_id: string | null;
97
+ name: string;
98
+ status: TEnvelopeStatus;
99
+ template_id: string;
100
+ created_at: string;
101
+ updated_at: string;
102
+ canceled_at: string;
103
+ envelope_document_id: string;
104
+ certificate_document_id: string | null;
105
+ reminder_id: string | null;
106
+ no_contact: boolean;
107
+ visibility: "private" | "shared";
108
+ documents: IEnvelopeDocument[];
109
+ recipients: IRecipient[];
110
+ fields: IEnvelopeField[];
111
+ }
112
+ interface IInPersonLinkResponse {
113
+ link: string;
114
+ envelope_id: string;
115
+ profile_id: string;
116
+ role_name: string;
117
+ access_key: string;
118
+ expiration_date: string;
119
+ type: TAccessKey;
120
+ }
121
+ interface IUpdateRecipientSubmitParams {
122
+ action: "submit";
123
+ }
124
+ interface IUpdateRecipientDeclineParams {
125
+ action: "decline";
126
+ }
127
+ interface IUpdateRecipientClaimEnvelope {
128
+ action: "owner_update";
129
+ full_name: string;
130
+ email: string;
131
+ }
132
+ interface IUpdateRecipientAgreedParams {
133
+ action: "update";
134
+ agreed: boolean;
135
+ }
136
+ interface IUpdateRecipientNameParams {
137
+ action: "update";
138
+ new_full_name: string;
139
+ }
140
+ interface IUpdateRecipientPrepareParams {
141
+ action: "prepare";
142
+ recipients: IRecipient[];
143
+ }
144
+ interface ICreateEnvelopeReminderRequest {
145
+ setup_time: number;
146
+ interval_time: number;
147
+ }
148
+ interface ICreateEnvelopeRequest {
149
+ template_id: string;
150
+ roles: ICreateEnvelopeRole[];
151
+ name: string;
152
+ environment?: string;
153
+ prepared_fields?: {
264
154
  name: string;
265
- address: string | null;
266
- address2: string | null;
267
- phone: string | null;
268
- /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
269
- business_name: string | null;
270
- /** If true, the organization is a business */
271
- is_business: boolean;
272
- /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
273
- contact_email: string | null;
274
- slug: string | null;
275
- /** Web site URL */
276
- url: string | null;
277
- full_logo_url: string | null;
278
- thumbnail_url: string | null;
279
- primary_color: string | null;
280
- secondary_color: string | null;
281
- data?: Record<string, any>;
282
- /** Creation date/time. */
283
- created_at: string;
284
- /** Last-update date/time. */
285
- updated_at: string;
286
- api_keys?: IApiKey[];
287
- groups?: IGroup[];
288
- oauth2_apps?: IOAuth2App[];
289
- organization_invitations?: IOrganizationInvitation[];
290
- profiles?: IProfile[];
291
- webhooks?: IWebhook[];
292
- envelopes?: IEnvelope[];
293
- templates?: ITemplate[];
294
- group_profiles?: IGroupProfile[];
295
- pending_webhooks?: IPendingWebhook[];
296
- }
297
- interface IOrganizationInvitation {
298
- organization_id: string;
299
- email: string;
300
- status: "pending";
301
- role: TRole;
302
- generated_at: string;
303
- token?: string;
304
- organization?: IOrganization;
305
- }
306
- interface IPendingWebhook {
307
- id: string;
308
- webhook_id: string;
309
- organization_id: string;
310
- url: string;
311
- body: any;
312
- created_at: string;
313
- delivered_at: string | null;
314
- last_attempt_at: string | null;
315
- last_status: number | null;
316
- last_result: string | null;
317
- webhook?: IWebhook;
318
- organization?: IOrganization;
319
- }
320
- interface IProfile {
321
- /** The unique ID of the profile */
322
- id: string;
323
- /**
324
- * The Verdocs back-end currently uses Auth0 for authentication. This value is a unique ID assigned by Auth0 to the
325
- * user. This is typically used to identify multiple profiles owned by a single user, but its implementation may
326
- * change in the future and developers should not develop code based on this field at this time.
327
- */
328
- user_id: string;
329
- /** The profile's organization ID, or a global "Realster" organization that all personal profiles are members of. */
330
- organization_id: string;
331
- first_name: string;
332
- last_name: string;
333
- email: string;
334
- phone: string | null;
335
- /** If true, this is the caller's "currently selected" profile. All operations will performed "as" this profile. */
336
- current: boolean;
337
- permissions: TPermission[];
338
- roles: TRole[];
339
- plans: TPlan[];
340
- // Creation date/time.
341
- created_at: string;
342
- // Last-update date/time.
343
- updated_at: string;
344
- /** The organization */
345
- organization?: IOrganization;
346
- api_keys?: IApiKey[];
347
- group_profiles?: IGroupProfile[];
348
- groups?: IGroup[];
349
- notifications?: INotification[];
350
- oauth2_apps?: IOAuth2App[];
351
- signatures?: ISignature[];
352
- initials?: IInitial[];
353
- }
354
- interface IWebhookEvents {
355
- envelope_created: boolean;
356
- envelope_completed: boolean;
357
- envelope_canceled: boolean;
358
- template_created: boolean;
359
- template_updated: boolean;
360
- template_deleted: boolean;
361
- template_used: boolean;
362
- }
363
- interface IWebhook {
364
- id: string;
365
- organization_id: string;
366
- url: string;
367
- active: boolean;
368
- events: IWebhookEvents;
369
- status: string | null;
370
- last_success: string | null;
371
- last_failure: string | null;
372
- organization?: IOrganization;
373
- pending_webhooks?: IPendingWebhook[];
374
- }
375
- //////////////////////////////// FORMS ////////////////////////////////////
376
- interface IInPersonAccessKey {
377
- id: string;
378
- type: "in_person_link";
379
- authentication?: string | null;
380
- recipient_name: string;
381
- envelope_id: string;
382
- key: string;
383
- expiration_date: string | null;
384
- created_at: string;
385
- first_used: string | null;
386
- last_used: string | null;
387
- envelope?: IEnvelope;
388
- }
389
- interface IEmailAccessKey {
390
- id: string;
391
- type: "email";
392
- authentication?: string | null;
393
- recipient_name: string;
394
- envelope_id: string;
395
- key: string;
396
- expiration_date: string | null;
397
- created_at: string;
398
- first_used: string | null;
399
- last_used: string | null;
400
- envelope?: IEnvelope;
401
- }
402
- interface ISMSAccessKey {
403
- id: string;
404
- type: "sms";
405
- authentication?: string | null;
406
- recipient_name: string;
407
- envelope_id: string;
408
- key: string;
409
- expiration_date: string | null;
410
- created_at: string;
411
- first_used: string | null;
412
- last_used: string | null;
413
- envelope?: IEnvelope;
414
- }
415
- type TAccessKey = IInPersonAccessKey | IEmailAccessKey | ISMSAccessKey;
155
+ value: string;
156
+ }[];
157
+ }
158
+ type TTemplateSenderType = "creator" | "organization_member" | "organization_member_as_creator" | "everyone" | "everyone_as_creator";
159
+ type TTemplatePermission = "template:creator:create:public" | "template:creator:create:org" | "template:creator:create:personal" | "template:creator:delete" | "template:creator:visibility" | "template:member:read" | "template:member:write" | "template:member:delete" | "template:member:visibility";
160
+ type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
161
+ /**
162
+ * Some template search and list endpoints return only a partial set of fields for each entry via this structure.
163
+ */
164
+ interface ITemplateSummary {
165
+ id: string;
166
+ name: string;
167
+ description: string | null;
168
+ sender: TTemplateSenderType;
169
+ counter: number;
170
+ star_counter: number;
171
+ created_at: string;
172
+ updated_at: string;
173
+ last_used_at: string | null;
416
174
  /**
417
- * An Envelope is a workflow wrapper that shepherds one or more Documents through the various recipients in a signing
418
- * process.
175
+ * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
419
176
  */
420
- interface IEnvelope {
421
- id: string;
422
- status: TEnvelopeStatus;
423
- profile_id: string;
424
- template_id: string | null;
425
- organization_id: string;
426
- reminder_id: string | null;
427
- name: string;
428
- no_contact: boolean;
429
- created_at: string;
430
- updated_at: string;
431
- canceled_at: string;
432
- /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
433
- visibility: "private" | "shared";
434
- search_key: string | null;
435
- /**
436
- * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Envelopes back to
437
- * internal systems/applications.
438
- */
439
- data: Record<string, any> | null;
440
- profile?: IProfile;
441
- template?: ITemplate | null;
442
- organization?: IOrganization;
443
- reminder?: IReminder | null;
444
- access_keys?: TAccessKey[];
445
- fields?: IEnvelopeField[];
446
- history_entries?: IEnvelopeHistory[];
447
- recipients: IRecipient[];
448
- /** Documents attached to this envelope */
449
- documents?: IEnvelopeDocument[] | null;
450
- }
451
- interface IEnvelopeDocument {
452
- id: string;
453
- envelope_id: string;
454
- template_document_id: string | null;
455
- order: number;
456
- type: "attachment" | "certificate";
457
- name: string;
458
- pages: number;
459
- mime: string;
460
- created_at: string;
461
- updated_at: string;
462
- envelope?: IEnvelope | null;
463
- template_document?: ITemplateDocument | null;
464
- fields?: IEnvelopeField[];
465
- }
466
- interface IEnvelopeField {
467
- /** The ID of the envelope the field is for. */
468
- envelope_id: string;
469
- /** The ID of the document the field is for. */
470
- document_id: string;
471
- /** The machine name of the field, e.g. `checkbox_groupP1-18` */
472
- name: string;
473
- /** The ID of the role in the recipients list, e.g. `Recipient 2` */
474
- recipient_role: string;
475
- /** The type of the field */
476
- type: TDocumentFieldType;
477
- /** If true, the field will be required */
478
- required: boolean;
479
- settings?: IEnvelopeFieldSettings;
480
- validator: string | null;
481
- /** If set, the placeholder/label for the field. */
482
- label: string | null;
483
- /** Not sent by the server. Used in the UI to identify prepared fields. */
484
- prepared?: boolean;
485
- /** The 1-based page number the field is displayed on. "Self-placed" fields that the user must apply will be on page 0. */
486
- page: number;
487
- /** The X position of the field. */
488
- x: number;
489
- /** The Y position of the field. */
490
- y: number;
491
- /** The width of the field. */
492
- width: number;
493
- /** The height of the field. */
494
- height: number;
495
- /** The default value for the field. */
496
- default: string | null;
497
- /** The placeholder to show in the field. */
498
- placeholder: string | null;
499
- /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
500
- group: string | null;
501
- value: string | null;
502
- is_valid: boolean;
503
- envelope?: IEnvelope;
504
- document?: IEnvelopeDocument;
505
- }
506
- interface IEnvelopeFieldOptions {
507
- /** The unique ID of the field */
508
- id: string;
509
- /** The X position of the field on the page. Self-placed fields will have an X value of 0. */
510
- x: number;
511
- /** The Y position of the field on the page. Self-placed fields will have an X value of 0. */
512
- y: number;
513
- /** For checkboxes, whether it is currently checked */
514
- checked?: boolean;
515
- /** For radio buttons, whether it is currently selected */
516
- selected?: boolean;
517
- /** The visible label for the field e.g. 'Not Applicable' */
518
- value: string;
519
- }
520
- interface IEnvelopeFieldSettings {
521
- type?: string;
522
- x: number;
523
- y: number;
524
- width?: number;
525
- height?: number;
526
- value?: number | string;
527
- /** If the field has been filled in, this contains the current value */
528
- result?: any;
529
- /** Text field settings */
530
- leading?: number;
531
- alignment?: number;
532
- upperCase?: boolean;
533
- /** Dropdowns, checkboxes, radio groups */
534
- options?: IEnvelopeFieldOptions[];
535
- /** Signatures and Initials, result will be "signed" */
536
- base64?: string;
537
- hash?: string;
538
- ip_address?: string;
539
- signature_id?: string;
540
- signed_at?: string;
541
- /** Checkbox settings */
542
- minimum_checked?: number;
543
- maximum_checked?: number;
544
- }
545
- interface IEnvelopeHistory {
546
- id: string;
547
- envelope_id: string;
548
- role_name: string;
549
- event: THistoryEvent;
550
- event_detail: TEventDetail;
551
- created_at: string;
552
- envelope?: IEnvelope;
553
- }
554
- interface IInitial {
555
- id?: string;
556
- profile_id: string;
557
- created_at?: string;
558
- updated_at?: string;
559
- deleted_at?: string;
560
- profile?: IProfile;
561
- }
562
- interface IRecipient {
563
- envelope_id: string;
564
- role_name: string;
565
- profile_id: string;
566
- status: TRecipientStatus;
567
- email: string;
568
- phone: string | null;
569
- full_name: string;
570
- /**
571
- * The sequence number indicates the order in which Recipients act. Multiple recipients may have the same sequence
572
- * number, in which case they may act in parallel. (e.g. all Recipients at sequence 2 will receive invites once
573
- * all Recipients at sequence 1 have signed.)
574
- */
575
- sequence: number;
576
- /**
577
- * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
578
- * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
579
- * arrange recipients to match related business processes so this field allows for that.
580
- */
581
- order: number;
582
- type: TRecipientType;
583
- delegator: boolean;
584
- delegated_to: string | null;
585
- message: string | null;
586
- claimed: boolean;
587
- agreed: boolean;
588
- key_used_to_conclude?: string;
589
- environment: string;
590
- created_at: string;
591
- updated_at: string;
592
- last_attempt_at: string;
593
- envelope?: IEnvelope;
594
- profile?: IProfile;
595
- }
596
- interface IReminder {
597
- id?: string;
598
- is_on: boolean;
599
- key: string;
600
- setup_time: number;
601
- interval_time: number;
602
- created_at?: string;
603
- last_time: number | null;
604
- next_time: number | null;
605
- }
606
- /**
607
- * A placeholder for an individual recipient, CC, or other party in a signing flow. Roles may be "known" or "unknown."
608
- * "Known" roles will have their email address supplied in the template which will get copied to envelopes created from
609
- * it. This is used when a certain party will always be the same, e.g. a leasing agent counter-signing a lease.
610
- * "Unknown" roles are dynamic, and will be filled in later when the envelope is created.
611
- */
612
- interface IRole {
613
- template_id: string;
614
- // The name of the recipient. Note that recipients do not have a separate ID - they are uniquely identified by name.
615
- name: string;
616
- type: TRecipientType;
617
- full_name: string | null;
618
- email: string | null;
619
- phone: string | null;
620
- message: string | null;
621
- /**
622
- * The sequence number indicates the order in which Roles act. Multiple roles may have the same sequence
623
- * number, in which case they may act in parallel. (e.g. all Roles at sequence 2 will receive invites once
624
- * all Recipients at sequence 1 have signed.)
625
- */
626
- sequence: number;
627
- /**
628
- * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
629
- * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
630
- * arrange recipients to match related business processes so this field allows for that.
631
- */
632
- order: number;
633
- delegator?: boolean;
634
- }
635
- interface ISignature {
636
- id: string;
637
- profile_id: string;
638
- created_at: string;
639
- updated_at: string;
640
- deleted_at: string | null;
641
- profile?: IProfile;
642
- }
643
- /**
644
- * A reusable template for creating signable instruments. Templates are used to create Envelopes which contain
645
- * Documents to sign.
646
- */
647
- interface ITemplate {
648
- /**
649
- * The unique ID of the template.
650
- */
651
- id: string;
652
- /**
653
- * The template's owner/creator.
654
- */
655
- profile_id: string;
656
- /**
657
- * Organization the template lives in.
658
- */
659
- organization_id: string;
660
- /**
661
- * If set, the template has reminders enabled.
662
- */
663
- reminder_id: string | null;
664
- /**
665
- * Who may create new documents from the template.
666
- */
667
- sender: TTemplateSenderType;
668
- /*
669
- The user-supplied name of the template.
670
- */
671
- name: string;
672
- /**
673
- * Optional description for the template.
674
- */
675
- description?: string;
676
- /**
677
- * Number of times the template has been used.
678
- */
679
- counter: number;
680
- /**
681
- * Number of times the template has been "starred".
682
- */
683
- star_counter: number;
684
- /**
685
- * If true, the template is only visible to the creator. If false, the template will also be visible to the user's
686
- * organization, if any.
687
- */
688
- is_personal: boolean;
689
- /**
690
- * If true, the template is visible publicly. Note that this does not necessarily mean it is also visible to the
691
- * user's organization. It may be desirable to create documents that are public but that do not appear in the
692
- * organization's shared templates list. To achieve this, set both `is_personal` and `is_public` to TRUE.
693
- */
694
- is_public: boolean;
695
- /**
696
- * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
697
- */
698
- is_sendable: boolean;
699
- /**
700
- * Creation date/time.
701
- */
702
- created_at: string;
703
- /**
704
- * Last-update date/time.
705
- */
706
- updated_at: string;
707
- /**
708
- * Last-used date/time (when the template was used to create a document).
709
- */
710
- last_used_at: string | null;
711
- search_key: string;
712
- /**
713
- * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Templates back to
714
- * internal systems/applications.
715
- */
716
- data: Record<string, any> | null;
717
- tags?: string[];
718
- profile?: IProfile;
719
- organization?: IOrganization;
720
- reminder?: IReminder | null;
721
- roles?: IRole[];
722
- documents?: ITemplateDocument[];
723
- fields?: ITemplateField[];
724
- }
725
- /**
726
- * A file attached to the template for display/signing.
727
- */
728
- interface ITemplateDocument {
729
- id: string;
730
- name: string;
731
- template_id: string;
732
- pages: number;
733
- mime: string;
734
- order: number;
735
- page_sizes: {
736
- width: number;
737
- height: number;
738
- }[];
739
- created_at?: string;
740
- updated_at?: string;
741
- template?: ITemplate;
742
- }
743
- interface ITemplateField {
744
- /** The machine name of the field, e.g. `checkbox_groupP1-18` */
745
- name: string;
746
- /** The ID of the role in the recipients list, e.g. `Recipient 2` */
747
- role_name: string;
748
- /** The ID of the template the field is for. */
749
- template_id: string;
750
- /** The ID of the document the field is for. */
751
- document_id: string;
752
- type: TDocumentFieldType;
753
- required: boolean;
754
- settings: ITemplateFieldSetting;
755
- page: number;
756
- validator: string | null;
757
- label: string | null;
758
- /** The X position of the field. */
759
- x: number;
760
- /** The Y position of the field. */
761
- y: number;
762
- /** The width of the field. */
763
- width: number;
764
- /** The height of the field. */
765
- height: number;
766
- /** The default value for the field. */
767
- default: string | null;
768
- /** The placeholder to show in the field. */
769
- placeholder: string | null;
770
- /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
771
- group: string | null;
772
- }
773
- interface ITextFieldSetting {
774
- x: number;
775
- y: number;
776
- width: number;
777
- height: number;
778
- result: string;
779
- leading: number;
780
- alignment: number;
781
- upperCase: boolean;
782
- }
783
- interface ITemplateFieldSetting {
784
- x?: number;
785
- y?: number;
786
- result?: string;
787
- width?: number;
788
- height?: number;
789
- // Text field settings
790
- leading?: number;
791
- alignment?: number;
792
- upperCase?: boolean;
793
- // Dropdowns, checkboxes, radio groups
794
- options?: any[];
795
- [key: string]: any;
796
- }
797
- interface IActivityEntry {
798
- id: string;
799
- name: string;
800
- canceled_at: string;
801
- created_at: string;
802
- updated_at: string;
803
- profile_id: string;
804
- status: TEnvelopeStatus;
805
- template_id: string;
806
- recipient: {
807
- claimed: boolean;
808
- email: string;
809
- name: string;
810
- profile_id: string;
811
- status: TRecipientStatus;
812
- type: TRecipientType;
813
- };
814
- }
815
- interface ISigningSessionRequest {
816
- envelopeId: string;
817
- roleId: string;
818
- inviteCode: string;
819
- }
820
- type TRecipientAction = "submit" | "decline" | "prepare" | "update";
821
- type TEnvelopeStatus = "complete" | "pending" | "in progress" | "declined" | "canceled";
822
- type TRecipientStatus = "invited" | "opened" | "signed" | "submitted" | "canceled" | "pending" | "declined";
823
- type TRecipientType = "signer" | "cc" | "approver";
824
- /**
825
- * One entry in an envelope search result.
826
- * NOTE: Many of the fields here are undefined unless "summary=true" is included in the search terms
827
- */
828
- interface IEnvelopesSearchResultEntry {
829
- id: string;
830
- canceled_at: string;
831
- certificate_document_id: string;
832
- created_at: string;
833
- histories: IEnvelopeHistory[];
834
- indexed_at: string;
835
- name: string;
836
- no_contact: boolean;
837
- organization_id: string;
838
- profile_id: string;
839
- recipients: IRecipient[];
840
- reminder_id: string | null;
841
- status: TEnvelopeStatus;
842
- /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
843
- visibility: "private" | "shared";
844
- next_recipient: {
845
- claimed: boolean;
846
- email: string;
847
- name: string;
848
- profile_id: string;
849
- status: TRecipientStatus;
850
- type: TRecipientType;
851
- };
852
- template_id: string;
853
- total_count: number;
854
- updated_at: string;
855
- }
856
- interface IEnvelopesSearchResult {
857
- page: number;
858
- total: number;
859
- result: IEnvelopesSearchResultEntry[];
860
- }
861
- interface IEnvelopesSummary {
862
- action_required: {
863
- page: number;
864
- total: number;
865
- result: IActivityEntry[];
866
- };
867
- completed: {
868
- page: number;
869
- total: number;
870
- result: IActivityEntry[];
871
- };
872
- waiting_others: {
873
- page: number;
874
- total: number;
875
- result: IActivityEntry[];
876
- };
877
- }
878
- type TDocumentFieldType = "signature" | "initial" | "checkbox_group" | "radio_button_group" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
879
- type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certificate" | "document" | "fields" | "profile">;
880
- interface IDocumentSearchOptions {
881
- rows?: number;
882
- page?: number;
883
- sort_by?: "updated_at" | "created_at";
884
- ascending?: boolean;
885
- is_owner?: boolean;
886
- is_recipient?: boolean;
887
- envelope_status?: TEnvelopeStatus[];
888
- recipient_status?: TEnvelopeStatus[];
889
- }
890
- type THistoryEvent = "recipient:signed" | "recipient:opened" | "recipient:submitted" | "recipient:prepared" | "recipient:claimed" | "recipient:agreed" | "recipient:invited" | "recipient:delegated" | "recipient:updated_info" | "recipient:declined" | "invitation:resent" | "envelope:cc" | "created" | "completed" | "canceled" | "owner:updated_recipient_info" | "owner:canceled" | "owner:get_in_person_link";
891
- type TEventDetail = "in_app" | "mail" | "signer" | "sms" | "reminder" | "preparer" | "manual" | "in_person_link" | "guest" | "email" | "" | string; // Modification events have a string description
892
- // Modification events have a string description
893
- interface ICreateEnvelopeRole {
894
- /** The type of role to create. Most participants in standard flows will be "signer" recipients. */
895
- type: TRecipientType;
896
- /**
897
- * The Role name of the recipient. Please note this is not the person's name. It is the ID of the role, e.g.
898
- * 'Recipient 1', 'Seller', etc. This must match one of the pre-defined roles in the template's Recipients list.
899
- */
900
- name: string;
901
- /** The full name of the recipient as it will be displayed in reports and queries, e.g. 'Paige Turner'. */
902
- full_name: string;
903
- /** The email address of the recipient. One of `email` or `phone` must be provided. */
904
- email?: string;
905
- /**
906
- * The phone number of the recipient. One of `email` or `phone` must be provided. If `phone` is included, the
907
- * recipient will receive an SMS notification for the document.
908
- */
909
- phone?: string;
910
- /**
911
- * The 1-based sequence number for the recipient. This can be used to override the template's workflow. Recipients
912
- * are processed in parallel for each matching sequence number (e.g. all recipients at level "1" may act in parallel)
913
- * and in series between sequence numbers (e.g. all recipients at level "1" must complete their tasks before
914
- * recipients at level "2" may act).
915
- */
916
- sequence: number;
917
- /** Whether the recipient may delegate their tasks to others. Should be false for most standard workflows. */
918
- delegator: boolean;
919
- /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
920
- message: string;
921
- }
922
- interface IEnvelopeSummary {
923
- id: string;
924
- profile_id: string;
925
- organization_id: string | null;
926
- name: string;
927
- status: TEnvelopeStatus;
928
- template_id: string;
929
- created_at: string;
930
- updated_at: string;
931
- canceled_at: string;
932
- envelope_document_id: string;
933
- certificate_document_id: string | null;
934
- reminder_id: string | null;
935
- no_contact: boolean;
936
- visibility: "private" | "shared";
937
- documents: IEnvelopeDocument[];
938
- recipients: IRecipient[];
939
- fields: IEnvelopeField[];
940
- }
941
- interface IEnvelopeSummaries {
942
- page: number;
943
- count: number;
944
- total: number;
945
- records: IEnvelopeSummary[];
946
- }
947
- interface IInPersonLinkResponse {
948
- link: string;
949
- envelope_id: string;
950
- profile_id: string;
951
- role_name: string;
952
- access_key: string;
953
- expiration_date: string;
954
- type: TAccessKey;
955
- }
956
- interface IUpdateRecipientSubmitParams {
957
- action: "submit";
958
- }
959
- interface IUpdateRecipientDeclineParams {
960
- action: "decline";
961
- }
962
- interface IUpdateRecipientClaimEnvelope {
963
- action: "owner_update";
964
- full_name: string;
965
- email: string;
966
- }
967
- interface IUpdateRecipientStatus {
968
- new_full_name?: string;
969
- agreed?: boolean;
970
- action?: "prepare" | "update";
971
- }
972
- interface IUpdateRecipientAgreedParams {
973
- action: "update";
974
- agreed: boolean;
975
- }
976
- interface IUpdateRecipientNameParams {
977
- action: "update";
978
- new_full_name: string;
979
- }
980
- interface IUpdateRecipientPrepareParams {
981
- action: "prepare";
982
- recipients: IRecipient[];
983
- }
984
- interface ICreateEnvelopeReminderRequest {
985
- setup_time: number;
986
- interval_time: number;
987
- }
988
- interface ICreateEnvelopeRequest {
989
- template_id: string;
990
- roles: ICreateEnvelopeRole[];
991
- name: string;
992
- environment?: string;
993
- prepared_fields?: {
994
- name: string;
995
- value: string;
996
- }[];
997
- }
998
- /////////////////////////////// NOTIFICATIONS /////////////////////////////
999
- interface IChannel {
1000
- id: string;
1001
- channel_type: string;
1002
- event_name: string;
1003
- disabled_channels?: IDisabledChannel[];
1004
- }
1005
- interface IDisabledChannel {
1006
- channel_id: string;
1007
- profile_id: string;
1008
- profile?: IProfile;
1009
- channel?: IChannel;
1010
- }
1011
- interface INotification {
1012
- id: string;
1013
- profile_id: string;
1014
- event_name: string;
1015
- data: any;
1016
- read: boolean;
1017
- deleted: boolean;
1018
- message: string;
1019
- time: string;
1020
- profile?: IProfile;
1021
- }
1022
- //////////////////////////////////////// IAM //////////////////////////////
1023
- interface IApiKey {
1024
- client_id: string;
1025
- name: string;
1026
- organization_id: string;
1027
- profile_id: string;
1028
- client_secret?: string;
1029
- permission: TApiKeyPermission;
1030
- profile?: IProfile;
1031
- organization?: IOrganization;
1032
- }
1033
- interface IGroup {
1034
- id: string;
1035
- name: string;
1036
- organization_id: string;
1037
- permissions: TPermission[];
1038
- organization?: IOrganization;
1039
- profiles?: IGroupProfile[];
1040
- }
1041
- interface IGroupProfile {
1042
- group_id: string;
1043
- profile_id: string;
1044
- organization_id: string;
1045
- group?: IGroup;
1046
- profile?: IProfile;
1047
- organization?: IOrganization;
1048
- }
1049
- interface IOAuth2App {
1050
- id: string;
1051
- profile_id: string;
1052
- organization_id: string;
1053
- name: string;
1054
- client_id: string;
1055
- client_secret?: string;
1056
- redirect_uris: string;
1057
- origins: string;
1058
- friendly_name: string;
1059
- logo_uri: string;
1060
- public_key: string;
1061
- private_key: string;
1062
- created_at: string;
1063
- updated_at: string;
1064
- organization?: IOrganization;
1065
- profile?: IProfile;
1066
- }
1067
- interface IOrganization {
1068
- /** The unique ID of the organization */
1069
- id: string;
1070
- /** The organization's name. */
1071
- name: string;
1072
- address: string | null;
1073
- address2: string | null;
1074
- phone: string | null;
1075
- /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
1076
- business_name: string | null;
1077
- /** If true, the organization is a business */
1078
- is_business: boolean;
1079
- /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
1080
- contact_email: string | null;
1081
- slug: string | null;
1082
- /** Web site URL */
1083
- url: string | null;
1084
- full_logo_url: string | null;
1085
- thumbnail_url: string | null;
1086
- primary_color: string | null;
1087
- secondary_color: string | null;
1088
- data?: Record<string, any>;
1089
- /** Creation date/time. */
1090
- created_at: string;
1091
- /** Last-update date/time. */
1092
- updated_at: string;
1093
- api_keys?: IApiKey[];
1094
- groups?: IGroup[];
1095
- oauth2_apps?: IOAuth2App[];
1096
- organization_invitations?: IOrganizationInvitation[];
1097
- profiles?: IProfile[];
1098
- webhooks?: IWebhook[];
1099
- envelopes?: IEnvelope[];
1100
- templates?: ITemplate[];
1101
- group_profiles?: IGroupProfile[];
1102
- pending_webhooks?: IPendingWebhook[];
1103
- }
1104
- interface IOrganizationInvitation {
1105
- organization_id: string;
1106
- email: string;
1107
- status: "pending";
1108
- role: TRole;
1109
- generated_at: string;
1110
- token?: string;
1111
- organization?: IOrganization;
1112
- }
1113
- interface IPendingWebhook {
1114
- id: string;
1115
- webhook_id: string;
1116
- organization_id: string;
1117
- url: string;
1118
- body: any;
1119
- created_at: string;
1120
- delivered_at: string | null;
1121
- last_attempt_at: string | null;
1122
- last_status: number | null;
1123
- last_result: string | null;
1124
- webhook?: IWebhook;
1125
- organization?: IOrganization;
1126
- }
1127
- interface IProfile {
1128
- /** The unique ID of the profile */
1129
- id: string;
1130
- /**
1131
- * The Verdocs back-end currently uses Auth0 for authentication. This value is a unique ID assigned by Auth0 to the
1132
- * user. This is typically used to identify multiple profiles owned by a single user, but its implementation may
1133
- * change in the future and developers should not develop code based on this field at this time.
1134
- */
1135
- user_id: string;
1136
- /** The profile's organization ID, or a global "Realster" organization that all personal profiles are members of. */
1137
- organization_id: string;
1138
- first_name: string;
1139
- last_name: string;
1140
- email: string;
1141
- phone: string | null;
1142
- /** If true, this is the caller's "currently selected" profile. All operations will performed "as" this profile. */
1143
- current: boolean;
1144
- permissions: TPermission[];
1145
- roles: TRole[];
1146
- plans: TPlan[];
1147
- // Creation date/time.
1148
- created_at: string;
1149
- // Last-update date/time.
1150
- updated_at: string;
1151
- /** The organization */
1152
- organization?: IOrganization;
1153
- api_keys?: IApiKey[];
1154
- group_profiles?: IGroupProfile[];
1155
- groups?: IGroup[];
1156
- notifications?: INotification[];
1157
- oauth2_apps?: IOAuth2App[];
1158
- signatures?: ISignature[];
1159
- initials?: IInitial[];
1160
- }
1161
- interface IWebhookEvents {
177
+ is_sendable: boolean;
178
+ is_personal: boolean;
179
+ is_public: boolean;
180
+ profile_id: string;
181
+ organization_id: string;
182
+ reminder_id: string;
183
+ tags: string[];
184
+ allowed_operations: TTemplateAction[];
185
+ }
186
+ interface ITimePeriod {
187
+ start_time: string; // Date
188
+ end_time: string; // Date
189
+ }
190
+ interface ITemplateTag {
191
+ tag_name: string;
192
+ template_id: string;
193
+ }
194
+ interface ITag {
195
+ name: string;
196
+ featured?: boolean;
197
+ organization_id?: string;
198
+ created_at?: string;
199
+ }
200
+ interface IStar {
201
+ template_id: string;
202
+ profile_id: string;
203
+ }
204
+ interface ITemplateOwnerInfo {
205
+ email: string;
206
+ name: string;
207
+ profile_id: string;
208
+ }
209
+ type TSortTemplateBy = "created_at" | "updated_at" | "name" | "last_used_at" | "counter" | "star_counter";
210
+ type TRequestStatus = "OK" | "ERROR";
211
+ type TAccountPermission = "owner:add" | "owner:remove" | "admin:add" | "admin:remove" | "member:view" | "member:add" | "member:remove";
212
+ /**
213
+ * Operation within Verdocs that users may perform.
214
+ */
215
+ type TPermission = TTemplatePermission | TOrgPermission | TAccountPermission;
216
+ /**
217
+ * Plans provide access to Verdocs product features.
218
+ */
219
+ type TPlan = "env:essential" | "org:standard";
220
+ /**
221
+ * Roles provide access to groups of permissions. Note that for historical reasons there is some overlap in the
222
+ * use of the term "role". TRole refers to a user type. A "Role" (IRole) is a Template participant placeholder.
223
+ */
224
+ type TRole = "contact" | "basic_user" | "member" | "admin" | "owner";
225
+ interface ICreateProfileRequest {
226
+ first_name: string;
227
+ last_name: string;
228
+ email: string;
229
+ phone?: string;
230
+ }
231
+ interface ISwitchProfileResponse {
232
+ profile: IProfile;
233
+ idToken: string;
234
+ accessToken: string;
235
+ refreshToken: string;
236
+ }
237
+ interface IUpdateProfileRequest {
238
+ first_name?: string;
239
+ last_name?: string;
240
+ phone?: string;
241
+ }
242
+ interface IAuthenticateUserRequest {
243
+ username: string;
244
+ password: string;
245
+ }
246
+ interface IAuthenticateAppRequest {
247
+ client_id: string;
248
+ client_secret: string;
249
+ }
250
+ interface IAuthenticateResponse {
251
+ idToken: string;
252
+ accessToken: string;
253
+ refreshToken: string;
254
+ }
255
+ interface TokenValidationRequest {
256
+ token: string;
257
+ }
258
+ interface TokenValidationResponse {
259
+ /** True if the token is valid */
260
+ valid: boolean;
261
+ /** The decoded and validated body of the JWT */
262
+ payload: any;
263
+ }
264
+ interface IUpdatePasswordRequest {
265
+ email: string;
266
+ oldPassword: string;
267
+ newPassword: string;
268
+ }
269
+ interface UpdatePasswordResponse {
270
+ status: TRequestStatus;
271
+ /** Success or failure message */
272
+ message: string;
273
+ }
274
+ interface UpdateEmailRequest {
275
+ email: string;
276
+ }
277
+ interface UpdateEmailResponse {
278
+ profiles: IProfile[];
279
+ }
280
+ interface ICreateBusinessAccountRequest {
281
+ email: string;
282
+ password: string;
283
+ firstName: string;
284
+ lastName: string;
285
+ orgName: string;
286
+ }
287
+ interface ICreateUserRequest {
288
+ firstName: string;
289
+ lastName: string;
290
+ email: string;
291
+ password: string;
292
+ fromInviteCode: string;
293
+ }
294
+ interface ICreateApiKeyRequest {
295
+ name: string;
296
+ permission: TApiKeyPermission;
297
+ }
298
+ interface IUpdateApiKeyRequest {
299
+ name?: string;
300
+ permission?: TApiKeyPermission;
301
+ }
302
+ type TApiKeyPermission = "personal" | "global_read" | "global_write";
303
+ interface ICreateInvitationRequest {
304
+ email: string;
305
+ role: TRole;
306
+ }
307
+ type TOrgPermission = "org:create" | "org:view" | "org:update" | "org:delete" | "org:transfer" | "org:list";
308
+ interface ISetWebhookRequest {
309
+ url: string;
310
+ active: boolean;
311
+ events: {
1162
312
  envelope_created: boolean;
1163
313
  envelope_completed: boolean;
1164
314
  envelope_canceled: boolean;
@@ -1166,459 +316,877 @@ declare namespace Models {
1166
316
  template_updated: boolean;
1167
317
  template_deleted: boolean;
1168
318
  template_used: boolean;
1169
- }
1170
- interface IWebhook {
1171
- id: string;
1172
- organization_id: string;
1173
- url: string;
1174
- active: boolean;
1175
- events: IWebhookEvents;
1176
- status: string | null;
1177
- last_success: string | null;
1178
- last_failure: string | null;
1179
- organization?: IOrganization;
1180
- pending_webhooks?: IPendingWebhook[];
1181
- }
1182
- //////////////////////////////// FORMS ////////////////////////////////////
1183
- interface IInPersonAccessKey {
1184
- id: string;
1185
- type: "in_person_link";
1186
- authentication?: string | null;
1187
- recipient_name: string;
1188
- envelope_id: string;
1189
- key: string;
1190
- expiration_date: string | null;
1191
- created_at: string;
1192
- first_used: string | null;
1193
- last_used: string | null;
1194
- envelope?: IEnvelope;
1195
- }
1196
- interface IEmailAccessKey {
1197
- id: string;
1198
- type: "email";
1199
- authentication?: string | null;
1200
- recipient_name: string;
1201
- envelope_id: string;
1202
- key: string;
1203
- expiration_date: string | null;
1204
- created_at: string;
1205
- first_used: string | null;
1206
- last_used: string | null;
1207
- envelope?: IEnvelope;
1208
- }
1209
- interface ISMSAccessKey {
1210
- id: string;
1211
- type: "sms";
1212
- authentication?: string | null;
1213
- recipient_name: string;
1214
- envelope_id: string;
1215
- key: string;
1216
- expiration_date: string | null;
1217
- created_at: string;
1218
- first_used: string | null;
1219
- last_used: string | null;
1220
- envelope?: IEnvelope;
1221
- }
1222
- type TAccessKey = IInPersonAccessKey | IEmailAccessKey | ISMSAccessKey;
319
+ };
320
+ }
321
+ /////////////////////////////// NOTIFICATIONS /////////////////////////////
322
+ interface IChannel {
323
+ id: string;
324
+ channel_type: string;
325
+ event_name: string;
326
+ disabled_channels?: IDisabledChannel[];
327
+ }
328
+ interface IDisabledChannel {
329
+ channel_id: string;
330
+ profile_id: string;
331
+ profile?: IProfile;
332
+ channel?: IChannel;
333
+ }
334
+ interface INotification {
335
+ id: string;
336
+ profile_id: string;
337
+ event_name: string;
338
+ data: any;
339
+ read: boolean;
340
+ deleted: boolean;
341
+ message: string;
342
+ time: string;
343
+ profile?: IProfile;
344
+ }
345
+ //////////////////////////////////////// IAM //////////////////////////////
346
+ interface IApiKey {
347
+ client_id: string;
348
+ name: string;
349
+ organization_id: string;
350
+ profile_id: string;
351
+ client_secret?: string;
352
+ permission: TApiKeyPermission;
353
+ profile?: IProfile;
354
+ organization?: IOrganization;
355
+ }
356
+ interface IGroup {
357
+ id: string;
358
+ name: string;
359
+ organization_id: string;
360
+ permissions: TPermission[];
361
+ organization?: IOrganization;
362
+ profiles?: IGroupProfile[];
363
+ }
364
+ interface IGroupProfile {
365
+ group_id: string;
366
+ profile_id: string;
367
+ organization_id: string;
368
+ group?: IGroup;
369
+ profile?: IProfile;
370
+ organization?: IOrganization;
371
+ }
372
+ interface IOAuth2App {
373
+ id: string;
374
+ profile_id: string;
375
+ organization_id: string;
376
+ name: string;
377
+ client_id: string;
378
+ client_secret?: string;
379
+ redirect_uris: string;
380
+ origins: string;
381
+ friendly_name: string;
382
+ logo_uri: string;
383
+ public_key: string;
384
+ private_key: string;
385
+ created_at: string;
386
+ updated_at: string;
387
+ organization?: IOrganization;
388
+ profile?: IProfile;
389
+ }
390
+ interface IOrganization {
391
+ /** The unique ID of the organization */
392
+ id: string;
393
+ /** The organization's name. */
394
+ name: string;
395
+ address: string | null;
396
+ address2: string | null;
397
+ phone: string | null;
398
+ /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
399
+ business_name: string | null;
400
+ /** If true, the organization is a business */
401
+ is_business: boolean;
402
+ /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
403
+ contact_email: string | null;
404
+ slug: string | null;
405
+ /** Web site URL */
406
+ url: string | null;
407
+ full_logo_url: string | null;
408
+ thumbnail_url: string | null;
409
+ primary_color: string | null;
410
+ secondary_color: string | null;
411
+ data?: Record<string, any>;
412
+ /** Creation date/time. */
413
+ created_at: string;
414
+ /** Last-update date/time. */
415
+ updated_at: string;
416
+ api_keys?: IApiKey[];
417
+ groups?: IGroup[];
418
+ oauth2_apps?: IOAuth2App[];
419
+ organization_invitations?: IOrganizationInvitation[];
420
+ profiles?: IProfile[];
421
+ webhooks?: IWebhook[];
422
+ envelopes?: IEnvelope[];
423
+ templates?: ITemplate[];
424
+ group_profiles?: IGroupProfile[];
425
+ pending_webhooks?: IPendingWebhook[];
426
+ }
427
+ interface IOrganizationInvitation {
428
+ organization_id: string;
429
+ email: string;
430
+ status: "pending";
431
+ role: TRole;
432
+ generated_at: string;
433
+ token?: string;
434
+ organization?: IOrganization;
435
+ }
436
+ interface IPendingWebhook {
437
+ id: string;
438
+ webhook_id: string;
439
+ organization_id: string;
440
+ url: string;
441
+ body: any;
442
+ created_at: string;
443
+ delivered_at: string | null;
444
+ last_attempt_at: string | null;
445
+ last_status: number | null;
446
+ last_result: string | null;
447
+ webhook?: IWebhook;
448
+ organization?: IOrganization;
449
+ }
450
+ interface IProfile {
451
+ /** The unique ID of the profile */
452
+ id: string;
1223
453
  /**
1224
- * An Envelope is a workflow wrapper that shepherds one or more Documents through the various recipients in a signing
1225
- * process.
454
+ * The Verdocs back-end currently uses Auth0 for authentication. This value is a unique ID assigned by Auth0 to the
455
+ * user. This is typically used to identify multiple profiles owned by a single user, but its implementation may
456
+ * change in the future and developers should not develop code based on this field at this time.
1226
457
  */
1227
- interface IEnvelope {
1228
- id: string;
1229
- status: TEnvelopeStatus;
1230
- profile_id: string;
1231
- template_id: string | null;
1232
- organization_id: string;
1233
- reminder_id: string | null;
1234
- name: string;
1235
- no_contact: boolean;
1236
- created_at: string;
1237
- updated_at: string;
1238
- canceled_at: string;
1239
- /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
1240
- visibility: "private" | "shared";
1241
- search_key: string | null;
1242
- /**
1243
- * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Envelopes back to
1244
- * internal systems/applications.
1245
- */
1246
- data: Record<string, any> | null;
1247
- profile?: IProfile;
1248
- template?: ITemplate | null;
1249
- organization?: IOrganization;
1250
- reminder?: IReminder | null;
1251
- access_keys?: TAccessKey[];
1252
- fields?: IEnvelopeField[];
1253
- history_entries?: IEnvelopeHistory[];
1254
- recipients: IRecipient[];
1255
- /** Documents attached to this envelope */
1256
- documents?: IEnvelopeDocument[] | null;
1257
- }
1258
- interface IEnvelopeDocument {
1259
- id: string;
1260
- envelope_id: string;
1261
- template_document_id: string | null;
1262
- order: number;
1263
- type: "attachment" | "certificate";
1264
- name: string;
1265
- pages: number;
1266
- mime: string;
1267
- created_at: string;
1268
- updated_at: string;
1269
- envelope?: IEnvelope | null;
1270
- template_document?: ITemplateDocument | null;
1271
- fields?: IEnvelopeField[];
1272
- }
1273
- interface IEnvelopeField {
1274
- /** The ID of the envelope the field is for. */
1275
- envelope_id: string;
1276
- /** The ID of the document the field is for. */
1277
- document_id: string;
1278
- /** The machine name of the field, e.g. `checkbox_groupP1-18` */
1279
- name: string;
1280
- /** The ID of the role in the recipients list, e.g. `Recipient 2` */
1281
- recipient_role: string;
1282
- /** The type of the field */
1283
- type: TDocumentFieldType;
1284
- /** If true, the field will be required */
1285
- required: boolean;
1286
- settings?: IEnvelopeFieldSettings;
1287
- validator: string | null;
1288
- /** If set, the placeholder/label for the field. */
1289
- label: string | null;
1290
- /** Not sent by the server. Used in the UI to identify prepared fields. */
1291
- prepared?: boolean;
1292
- /** The 1-based page number the field is displayed on. "Self-placed" fields that the user must apply will be on page 0. */
1293
- page: number;
1294
- /** The X position of the field. */
1295
- x: number;
1296
- /** The Y position of the field. */
1297
- y: number;
1298
- /** The width of the field. */
1299
- width: number;
1300
- /** The height of the field. */
1301
- height: number;
1302
- /** The default value for the field. */
1303
- default: string | null;
1304
- /** The placeholder to show in the field. */
1305
- placeholder: string | null;
1306
- /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
1307
- group: string | null;
1308
- value: string | null;
1309
- is_valid: boolean;
1310
- envelope?: IEnvelope;
1311
- document?: IEnvelopeDocument;
1312
- }
1313
- interface IEnvelopeFieldOptions {
1314
- /** The unique ID of the field */
1315
- id: string;
1316
- /** The X position of the field on the page. Self-placed fields will have an X value of 0. */
1317
- x: number;
1318
- /** The Y position of the field on the page. Self-placed fields will have an X value of 0. */
1319
- y: number;
1320
- /** For checkboxes, whether it is currently checked */
1321
- checked?: boolean;
1322
- /** For radio buttons, whether it is currently selected */
1323
- selected?: boolean;
1324
- /** The visible label for the field e.g. 'Not Applicable' */
1325
- value: string;
1326
- }
1327
- interface IEnvelopeFieldSettings {
1328
- type?: string;
1329
- x: number;
1330
- y: number;
1331
- width?: number;
1332
- height?: number;
1333
- value?: number | string;
1334
- /** If the field has been filled in, this contains the current value */
1335
- result?: any;
1336
- /** Text field settings */
1337
- leading?: number;
1338
- alignment?: number;
1339
- upperCase?: boolean;
1340
- /** Dropdowns, checkboxes, radio groups */
1341
- options?: IEnvelopeFieldOptions[];
1342
- /** Signatures and Initials, result will be "signed" */
1343
- base64?: string;
1344
- hash?: string;
1345
- ip_address?: string;
1346
- signature_id?: string;
1347
- signed_at?: string;
1348
- /** Checkbox settings */
1349
- minimum_checked?: number;
1350
- maximum_checked?: number;
1351
- }
1352
- interface IEnvelopeHistory {
1353
- id: string;
1354
- envelope_id: string;
1355
- role_name: string;
1356
- event: THistoryEvent;
1357
- event_detail: TEventDetail;
1358
- created_at: string;
1359
- envelope?: IEnvelope;
1360
- }
1361
- interface IInitial {
1362
- id?: string;
1363
- profile_id: string;
1364
- created_at?: string;
1365
- updated_at?: string;
1366
- deleted_at?: string;
1367
- profile?: IProfile;
1368
- }
1369
- interface IRecipient {
1370
- envelope_id: string;
1371
- role_name: string;
1372
- profile_id: string;
1373
- status: TRecipientStatus;
1374
- email: string;
1375
- phone: string | null;
1376
- full_name: string;
1377
- /**
1378
- * The sequence number indicates the order in which Recipients act. Multiple recipients may have the same sequence
1379
- * number, in which case they may act in parallel. (e.g. all Recipients at sequence 2 will receive invites once
1380
- * all Recipients at sequence 1 have signed.)
1381
- */
1382
- sequence: number;
1383
- /**
1384
- * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
1385
- * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
1386
- * arrange recipients to match related business processes so this field allows for that.
1387
- */
1388
- order: number;
1389
- type: TRecipientType;
1390
- delegator: boolean;
1391
- delegated_to: string | null;
1392
- message: string | null;
1393
- claimed: boolean;
1394
- agreed: boolean;
1395
- key_used_to_conclude?: string;
1396
- environment: string;
1397
- created_at: string;
1398
- updated_at: string;
1399
- last_attempt_at: string;
1400
- envelope?: IEnvelope;
1401
- profile?: IProfile;
1402
- }
1403
- interface IReminder {
1404
- id?: string;
1405
- is_on: boolean;
1406
- key: string;
1407
- setup_time: number;
1408
- interval_time: number;
1409
- created_at?: string;
1410
- last_time: number | null;
1411
- next_time: number | null;
1412
- }
458
+ user_id: string;
459
+ /** The profile's organization ID, or a global "Realster" organization that all personal profiles are members of. */
460
+ organization_id: string;
461
+ first_name: string;
462
+ last_name: string;
463
+ email: string;
464
+ phone: string | null;
465
+ /** If true, this is the caller's "currently selected" profile. All operations will performed "as" this profile. */
466
+ current: boolean;
467
+ permissions: TPermission[];
468
+ roles: TRole[];
469
+ plans: TPlan[];
470
+ // Creation date/time.
471
+ created_at: string;
472
+ // Last-update date/time.
473
+ updated_at: string;
474
+ /** The organization */
475
+ organization?: IOrganization;
476
+ api_keys?: IApiKey[];
477
+ group_profiles?: IGroupProfile[];
478
+ groups?: IGroup[];
479
+ notifications?: INotification[];
480
+ oauth2_apps?: IOAuth2App[];
481
+ signatures?: ISignature[];
482
+ initials?: IInitial[];
483
+ }
484
+ interface IWebhookEvents {
485
+ envelope_created: boolean;
486
+ envelope_completed: boolean;
487
+ envelope_canceled: boolean;
488
+ template_created: boolean;
489
+ template_updated: boolean;
490
+ template_deleted: boolean;
491
+ template_used: boolean;
492
+ }
493
+ interface IWebhook {
494
+ id: string;
495
+ organization_id: string;
496
+ url: string;
497
+ active: boolean;
498
+ events: IWebhookEvents;
499
+ status: string | null;
500
+ last_success: string | null;
501
+ last_failure: string | null;
502
+ organization?: IOrganization;
503
+ pending_webhooks?: IPendingWebhook[];
504
+ }
505
+ //////////////////////////////// FORMS ////////////////////////////////////
506
+ interface IInPersonAccessKey {
507
+ id: string;
508
+ type: "in_person_link";
509
+ authentication?: string | null;
510
+ recipient_name: string;
511
+ envelope_id: string;
512
+ key: string;
513
+ expiration_date: string | null;
514
+ created_at: string;
515
+ first_used: string | null;
516
+ last_used: string | null;
517
+ envelope?: IEnvelope;
518
+ }
519
+ interface IEmailAccessKey {
520
+ id: string;
521
+ type: "email";
522
+ authentication?: string | null;
523
+ recipient_name: string;
524
+ envelope_id: string;
525
+ key: string;
526
+ expiration_date: string | null;
527
+ created_at: string;
528
+ first_used: string | null;
529
+ last_used: string | null;
530
+ envelope?: IEnvelope;
531
+ }
532
+ interface ISMSAccessKey {
533
+ id: string;
534
+ type: "sms";
535
+ authentication?: string | null;
536
+ recipient_name: string;
537
+ envelope_id: string;
538
+ key: string;
539
+ expiration_date: string | null;
540
+ created_at: string;
541
+ first_used: string | null;
542
+ last_used: string | null;
543
+ envelope?: IEnvelope;
544
+ }
545
+ type TAccessKey = IInPersonAccessKey | IEmailAccessKey | ISMSAccessKey;
546
+ /**
547
+ * An Envelope is a workflow wrapper that shepherds one or more Documents through the various recipients in a signing
548
+ * process.
549
+ */
550
+ interface IEnvelope {
551
+ id: string;
552
+ status: TEnvelopeStatus;
553
+ profile_id: string;
554
+ template_id: string | null;
555
+ organization_id: string;
556
+ reminder_id: string | null;
557
+ name: string;
558
+ no_contact: boolean;
559
+ created_at: string;
560
+ updated_at: string;
561
+ canceled_at: string;
562
+ /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
563
+ visibility: "private" | "shared";
564
+ search_key: string | null;
565
+ /**
566
+ * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Envelopes back to
567
+ * internal systems/applications.
568
+ */
569
+ data: Record<string, any> | null;
570
+ profile?: IProfile;
571
+ template?: ITemplate | null;
572
+ organization?: IOrganization;
573
+ reminder?: IReminder | null;
574
+ access_keys?: TAccessKey[];
575
+ fields?: IEnvelopeField[];
576
+ history_entries?: IEnvelopeHistory[];
577
+ recipients: IRecipient[];
578
+ /** Documents attached to this envelope */
579
+ documents?: IEnvelopeDocument[] | null;
580
+ }
581
+ interface IEnvelopeDocument {
582
+ id: string;
583
+ envelope_id: string;
584
+ template_document_id: string | null;
585
+ order: number;
586
+ type: "attachment" | "certificate";
587
+ name: string;
588
+ pages: number;
589
+ mime: string;
590
+ created_at: string;
591
+ updated_at: string;
592
+ envelope?: IEnvelope | null;
593
+ template_document?: ITemplateDocument | null;
594
+ fields?: IEnvelopeField[];
595
+ }
596
+ interface IEnvelopeField {
597
+ /** The ID of the envelope the field is for. */
598
+ envelope_id: string;
599
+ /** The ID of the document the field is for. */
600
+ document_id: string;
601
+ /** The machine name of the field, e.g. `checkbox_groupP1-18` */
602
+ name: string;
603
+ /** The ID of the role in the recipients list, e.g. `Recipient 2` */
604
+ recipient_role: string;
605
+ /** The type of the field */
606
+ type: TDocumentFieldType;
607
+ /** If true, the field will be required */
608
+ required: boolean;
609
+ settings?: IEnvelopeFieldSettings;
610
+ validator: string | null;
611
+ /** If set, the placeholder/label for the field. */
612
+ label: string | null;
613
+ /** Not sent by the server. Used in the UI to identify prepared fields. */
614
+ prepared?: boolean;
615
+ /** The 1-based page number the field is displayed on. "Self-placed" fields that the user must apply will be on page 0. */
616
+ page: number;
617
+ /** The X position of the field. */
618
+ x: number;
619
+ /** The Y position of the field. */
620
+ y: number;
621
+ /** The width of the field. */
622
+ width: number;
623
+ /** The height of the field. */
624
+ height: number;
625
+ /** The default value for the field. */
626
+ default: string | null;
627
+ /** The placeholder to show in the field. */
628
+ placeholder: string | null;
629
+ /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
630
+ group: string | null;
631
+ value: string | null;
632
+ is_valid: boolean;
633
+ envelope?: IEnvelope;
634
+ document?: IEnvelopeDocument;
635
+ }
636
+ interface IEnvelopeFieldOptions {
637
+ /** The unique ID of the field */
638
+ id: string;
639
+ /** The X position of the field on the page. Self-placed fields will have an X value of 0. */
640
+ x: number;
641
+ /** The Y position of the field on the page. Self-placed fields will have an X value of 0. */
642
+ y: number;
643
+ /** For checkboxes, whether it is currently checked */
644
+ checked?: boolean;
645
+ /** For radio buttons, whether it is currently selected */
646
+ selected?: boolean;
647
+ /** The visible label for the field e.g. 'Not Applicable' */
648
+ value: string;
649
+ }
650
+ interface IEnvelopeFieldSettings {
651
+ type?: string;
652
+ x: number;
653
+ y: number;
654
+ width?: number;
655
+ height?: number;
656
+ value?: number | string;
657
+ /** If the field has been filled in, this contains the current value */
658
+ result?: any;
659
+ /** Text field settings */
660
+ leading?: number;
661
+ alignment?: number;
662
+ upperCase?: boolean;
663
+ /** Dropdowns, checkboxes, radio groups */
664
+ options?: IEnvelopeFieldOptions[];
665
+ /** Signatures and Initials, result will be "signed" */
666
+ base64?: string;
667
+ hash?: string;
668
+ ip_address?: string;
669
+ signature_id?: string;
670
+ signed_at?: string;
671
+ /** Checkbox settings */
672
+ minimum_checked?: number;
673
+ maximum_checked?: number;
674
+ }
675
+ interface IEnvelopeHistory {
676
+ id: string;
677
+ envelope_id: string;
678
+ role_name: string;
679
+ event: THistoryEvent;
680
+ event_detail: TEventDetail;
681
+ created_at: string;
682
+ envelope?: IEnvelope;
683
+ }
684
+ interface IInitial {
685
+ id?: string;
686
+ profile_id: string;
687
+ created_at?: string;
688
+ updated_at?: string;
689
+ deleted_at?: string;
690
+ profile?: IProfile;
691
+ }
692
+ interface IRecipient {
693
+ envelope_id: string;
694
+ role_name: string;
695
+ profile_id: string;
696
+ status: TRecipientStatus;
697
+ email: string;
698
+ phone: string | null;
699
+ full_name: string;
700
+ /**
701
+ * The sequence number indicates the order in which Recipients act. Multiple recipients may have the same sequence
702
+ * number, in which case they may act in parallel. (e.g. all Recipients at sequence 2 will receive invites once
703
+ * all Recipients at sequence 1 have signed.)
704
+ */
705
+ sequence: number;
706
+ /**
707
+ * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
708
+ * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
709
+ * arrange recipients to match related business processes so this field allows for that.
710
+ */
711
+ order: number;
712
+ type: TRecipientType;
713
+ delegator: boolean;
714
+ delegated_to: string | null;
715
+ message: string | null;
716
+ claimed: boolean;
717
+ agreed: boolean;
718
+ key_used_to_conclude?: string;
719
+ environment: string;
720
+ created_at: string;
721
+ updated_at: string;
722
+ last_attempt_at: string;
723
+ envelope?: IEnvelope;
724
+ profile?: IProfile;
725
+ }
726
+ interface IReminder {
727
+ id?: string;
728
+ is_on: boolean;
729
+ key: string;
730
+ setup_time: number;
731
+ interval_time: number;
732
+ created_at?: string;
733
+ last_time: number | null;
734
+ next_time: number | null;
735
+ }
736
+ /**
737
+ * A placeholder for an individual recipient, CC, or other party in a signing flow. Roles may be "known" or "unknown."
738
+ * "Known" roles will have their email address supplied in the template which will get copied to envelopes created from
739
+ * it. This is used when a certain party will always be the same, e.g. a leasing agent counter-signing a lease.
740
+ * "Unknown" roles are dynamic, and will be filled in later when the envelope is created.
741
+ */
742
+ interface IRole {
743
+ template_id: string;
744
+ // The name of the recipient. Note that recipients do not have a separate ID - they are uniquely identified by name.
745
+ name: string;
746
+ type: TRecipientType;
747
+ full_name: string | null;
748
+ email: string | null;
749
+ phone: string | null;
750
+ message: string | null;
751
+ /**
752
+ * The sequence number indicates the order in which Roles act. Multiple roles may have the same sequence
753
+ * number, in which case they may act in parallel. (e.g. all Roles at sequence 2 will receive invites once
754
+ * all Recipients at sequence 1 have signed.)
755
+ */
756
+ sequence: number;
1413
757
  /**
1414
- * A placeholder for an individual recipient, CC, or other party in a signing flow. Roles may be "known" or "unknown."
1415
- * "Known" roles will have their email address supplied in the template which will get copied to envelopes created from
1416
- * it. This is used when a certain party will always be the same, e.g. a leasing agent counter-signing a lease.
1417
- * "Unknown" roles are dynamic, and will be filled in later when the envelope is created.
758
+ * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
759
+ * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
760
+ * arrange recipients to match related business processes so this field allows for that.
1418
761
  */
1419
- interface IRole {
1420
- template_id: string;
1421
- // The name of the recipient. Note that recipients do not have a separate ID - they are uniquely identified by name.
1422
- name: string;
1423
- type: TRecipientType;
1424
- full_name: string | null;
1425
- email: string | null;
1426
- phone: string | null;
1427
- message: string | null;
1428
- /**
1429
- * The sequence number indicates the order in which Roles act. Multiple roles may have the same sequence
1430
- * number, in which case they may act in parallel. (e.g. all Roles at sequence 2 will receive invites once
1431
- * all Recipients at sequence 1 have signed.)
1432
- */
1433
- sequence: number;
1434
- /**
1435
- * The order indicates the order in which recipients are listed in a single "level" of the workflow. Note that
1436
- * recipients at the same level may act in parallel despite this value. However, it can often be useful to visually
1437
- * arrange recipients to match related business processes so this field allows for that.
1438
- */
1439
- order: number;
1440
- delegator?: boolean;
1441
- }
1442
- interface ISignature {
1443
- id: string;
1444
- profile_id: string;
1445
- created_at: string;
1446
- updated_at: string;
1447
- deleted_at: string | null;
1448
- profile?: IProfile;
1449
- }
762
+ order: number;
763
+ delegator?: boolean;
764
+ }
765
+ interface ISignature {
766
+ id: string;
767
+ profile_id: string;
768
+ created_at: string;
769
+ updated_at: string;
770
+ deleted_at: string | null;
771
+ profile?: IProfile;
772
+ }
773
+ /**
774
+ * A reusable template for creating signable instruments. Templates are used to create Envelopes which contain
775
+ * Documents to sign.
776
+ */
777
+ interface ITemplate {
1450
778
  /**
1451
- * A reusable template for creating signable instruments. Templates are used to create Envelopes which contain
1452
- * Documents to sign.
779
+ * The unique ID of the template.
1453
780
  */
1454
- interface ITemplate {
1455
- /**
1456
- * The unique ID of the template.
1457
- */
1458
- id: string;
1459
- /**
1460
- * The template's owner/creator.
1461
- */
1462
- profile_id: string;
1463
- /**
1464
- * Organization the template lives in.
1465
- */
1466
- organization_id: string;
1467
- /**
1468
- * If set, the template has reminders enabled.
1469
- */
1470
- reminder_id: string | null;
1471
- /**
1472
- * Who may create new documents from the template.
1473
- */
1474
- sender: TTemplateSenderType;
1475
- /*
1476
- The user-supplied name of the template.
1477
- */
1478
- name: string;
1479
- /**
1480
- * Optional description for the template.
1481
- */
1482
- description?: string;
1483
- /**
1484
- * Number of times the template has been used.
1485
- */
1486
- counter: number;
1487
- /**
1488
- * Number of times the template has been "starred".
1489
- */
1490
- star_counter: number;
1491
- /**
1492
- * If true, the template is only visible to the creator. If false, the template will also be visible to the user's
1493
- * organization, if any.
1494
- */
1495
- is_personal: boolean;
1496
- /**
1497
- * If true, the template is visible publicly. Note that this does not necessarily mean it is also visible to the
1498
- * user's organization. It may be desirable to create documents that are public but that do not appear in the
1499
- * organization's shared templates list. To achieve this, set both `is_personal` and `is_public` to TRUE.
1500
- */
1501
- is_public: boolean;
1502
- /**
1503
- * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
1504
- */
1505
- is_sendable: boolean;
1506
- /**
1507
- * Creation date/time.
1508
- */
1509
- created_at: string;
1510
- /**
1511
- * Last-update date/time.
1512
- */
1513
- updated_at: string;
1514
- /**
1515
- * Last-used date/time (when the template was used to create a document).
1516
- */
1517
- last_used_at: string | null;
1518
- search_key: string;
1519
- /**
1520
- * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Templates back to
1521
- * internal systems/applications.
1522
- */
1523
- data: Record<string, any> | null;
1524
- tags?: string[];
1525
- profile?: IProfile;
1526
- organization?: IOrganization;
1527
- reminder?: IReminder | null;
1528
- roles?: IRole[];
1529
- documents?: ITemplateDocument[];
1530
- fields?: ITemplateField[];
1531
- }
781
+ id: string;
1532
782
  /**
1533
- * A file attached to the template for display/signing.
783
+ * The template's owner/creator.
1534
784
  */
1535
- interface ITemplateDocument {
1536
- id: string;
1537
- name: string;
1538
- template_id: string;
1539
- pages: number;
1540
- mime: string;
1541
- order: number;
1542
- page_sizes: {
1543
- width: number;
1544
- height: number;
1545
- }[];
1546
- created_at?: string;
1547
- updated_at?: string;
1548
- template?: ITemplate;
1549
- }
1550
- interface ITemplateField {
1551
- /** The machine name of the field, e.g. `checkbox_groupP1-18` */
1552
- name: string;
1553
- /** The ID of the role in the recipients list, e.g. `Recipient 2` */
1554
- role_name: string;
1555
- /** The ID of the template the field is for. */
1556
- template_id: string;
1557
- /** The ID of the document the field is for. */
1558
- document_id: string;
1559
- type: TDocumentFieldType;
1560
- required: boolean;
1561
- settings: ITemplateFieldSetting;
1562
- page: number;
1563
- validator: string | null;
1564
- label: string | null;
1565
- /** The X position of the field. */
1566
- x: number;
1567
- /** The Y position of the field. */
1568
- y: number;
1569
- /** The width of the field. */
1570
- width: number;
1571
- /** The height of the field. */
1572
- height: number;
1573
- /** The default value for the field. */
1574
- default: string | null;
1575
- /** The placeholder to show in the field. */
1576
- placeholder: string | null;
1577
- /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
1578
- group: string | null;
1579
- }
1580
- interface ITextFieldSetting {
1581
- x: number;
1582
- y: number;
785
+ profile_id: string;
786
+ /**
787
+ * Organization the template lives in.
788
+ */
789
+ organization_id: string;
790
+ /**
791
+ * If set, the template has reminders enabled.
792
+ */
793
+ reminder_id: string | null;
794
+ /**
795
+ * Who may create new documents from the template.
796
+ */
797
+ sender: TTemplateSenderType;
798
+ /*
799
+ The user-supplied name of the template.
800
+ */
801
+ name: string;
802
+ /**
803
+ * Optional description for the template.
804
+ */
805
+ description?: string;
806
+ /**
807
+ * Number of times the template has been used.
808
+ */
809
+ counter: number;
810
+ /**
811
+ * Number of times the template has been "starred".
812
+ */
813
+ star_counter: number;
814
+ /**
815
+ * If true, the template is only visible to the creator. If false, the template will also be visible to the user's
816
+ * organization, if any.
817
+ */
818
+ is_personal: boolean;
819
+ /**
820
+ * If true, the template is visible publicly. Note that this does not necessarily mean it is also visible to the
821
+ * user's organization. It may be desirable to create documents that are public but that do not appear in the
822
+ * organization's shared templates list. To achieve this, set both `is_personal` and `is_public` to TRUE.
823
+ */
824
+ is_public: boolean;
825
+ /**
826
+ * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
827
+ */
828
+ is_sendable: boolean;
829
+ /**
830
+ * Creation date/time.
831
+ */
832
+ created_at: string;
833
+ /**
834
+ * Last-update date/time.
835
+ */
836
+ updated_at: string;
837
+ /**
838
+ * Last-used date/time (when the template was used to create a document).
839
+ */
840
+ last_used_at: string | null;
841
+ search_key: string;
842
+ /**
843
+ * Storage for arbitrary data that may be used e.g. to track source database/record IDs to relate Templates back to
844
+ * internal systems/applications.
845
+ */
846
+ data: Record<string, any> | null;
847
+ tags?: string[];
848
+ profile?: IProfile;
849
+ organization?: IOrganization;
850
+ reminder?: IReminder | null;
851
+ roles?: IRole[];
852
+ documents?: ITemplateDocument[];
853
+ fields?: ITemplateField[];
854
+ }
855
+ /**
856
+ * A file attached to the template for display/signing.
857
+ */
858
+ interface ITemplateDocument {
859
+ id: string;
860
+ name: string;
861
+ template_id: string;
862
+ pages: number;
863
+ mime: string;
864
+ order: number;
865
+ page_sizes: {
1583
866
  width: number;
1584
867
  height: number;
1585
- result: string;
1586
- leading: number;
1587
- alignment: number;
1588
- upperCase: boolean;
1589
- }
1590
- interface ITemplateFieldSetting {
1591
- x?: number;
1592
- y?: number;
1593
- result?: string;
1594
- width?: number;
1595
- height?: number;
1596
- // Text field settings
1597
- leading?: number;
1598
- alignment?: number;
1599
- upperCase?: boolean;
1600
- // Dropdowns, checkboxes, radio groups
1601
- options?: any[];
1602
- [key: string]: any;
1603
- }
1604
- interface IActivityEntry {
1605
- id: string;
868
+ }[];
869
+ created_at?: string;
870
+ updated_at?: string;
871
+ template?: ITemplate;
872
+ }
873
+ interface ITemplateField {
874
+ /** The machine name of the field, e.g. `checkbox_groupP1-18` */
875
+ name: string;
876
+ /** The ID of the role in the recipients list, e.g. `Recipient 2` */
877
+ role_name: string;
878
+ /** The ID of the template the field is for. */
879
+ template_id: string;
880
+ /** The ID of the document the field is for. */
881
+ document_id: string;
882
+ type: TDocumentFieldType;
883
+ required: boolean;
884
+ settings: ITemplateFieldSetting;
885
+ page: number;
886
+ validator: string | null;
887
+ label: string | null;
888
+ /** The X position of the field. */
889
+ x: number;
890
+ /** The Y position of the field. */
891
+ y: number;
892
+ /** The width of the field. */
893
+ width: number;
894
+ /** The height of the field. */
895
+ height: number;
896
+ /** The default value for the field. */
897
+ default: string | null;
898
+ /** The placeholder to show in the field. */
899
+ placeholder: string | null;
900
+ /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
901
+ group: string | null;
902
+ }
903
+ interface ITextFieldSetting {
904
+ x: number;
905
+ y: number;
906
+ width: number;
907
+ height: number;
908
+ result: string;
909
+ leading: number;
910
+ alignment: number;
911
+ upperCase: boolean;
912
+ }
913
+ interface ITemplateFieldSetting {
914
+ x?: number;
915
+ y?: number;
916
+ result?: string;
917
+ width?: number;
918
+ height?: number;
919
+ // Text field settings
920
+ leading?: number;
921
+ alignment?: number;
922
+ upperCase?: boolean;
923
+ // Dropdowns, checkboxes, radio groups
924
+ options?: any[];
925
+ [key: string]: any;
926
+ }
927
+ interface IActivityEntry {
928
+ id: string;
929
+ name: string;
930
+ canceled_at: string;
931
+ created_at: string;
932
+ updated_at: string;
933
+ profile_id: string;
934
+ status: TEnvelopeStatus;
935
+ template_id: string;
936
+ recipient: {
937
+ claimed: boolean;
938
+ email: string;
1606
939
  name: string;
1607
- canceled_at: string;
1608
- created_at: string;
1609
- updated_at: string;
1610
940
  profile_id: string;
1611
- status: TEnvelopeStatus;
1612
- template_id: string;
1613
- recipient: {
1614
- claimed: boolean;
1615
- email: string;
1616
- name: string;
1617
- profile_id: string;
1618
- status: TRecipientStatus;
1619
- type: TRecipientType;
1620
- };
1621
- }
941
+ status: TRecipientStatus;
942
+ type: TRecipientType;
943
+ };
944
+ }
945
+ interface ISigningSessionRequest$0 {
946
+ envelopeId: string;
947
+ roleId: string;
948
+ inviteCode: string;
949
+ }
950
+ /**
951
+ * A Signing Session connects a caller to a role within an envelope, and can be used only for calls related to signing that envelope.
952
+ */
953
+ interface ISigningSession {
954
+ profile_id: string;
955
+ envelope_id: string;
956
+ role: string;
957
+ email: string;
958
+ access_key: {
959
+ id: string;
960
+ type: string;
961
+ };
962
+ iss: string;
963
+ aud: string;
964
+ exp: number;
965
+ iat: number;
966
+ [key: string]: any;
967
+ }
968
+ /**
969
+ * A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform.
970
+ */
971
+ interface IUserSession {
972
+ sub: string;
973
+ email: string;
974
+ email_verified: boolean;
975
+ iat: number;
976
+ exp: number;
977
+ permissions: TPermission[];
978
+ roles: TRole[];
979
+ profile: IProfile;
980
+ profile_id: string;
981
+ organization_id: string;
982
+ plans?: TPlan[];
983
+ [key: string]: any;
984
+ }
985
+ /**
986
+ * Verdocs supports two types of authenticated sessions: User and Signing. Both behave similarly and have similar
987
+ * properties, but signing sessions only have access to a small set of signing-related functions.
988
+ */
989
+ type TSessionType = "user" | "signing";
990
+ /**
991
+ * Represents a possibly-authenticated session within Verdocs, either for signing or regular user-based operations.
992
+ */
993
+ type TSession = IUserSession | ISigningSession | null;
994
+ type TEnvironment = "verdocs" | "verdocs-stage";
995
+ type TSessionChangedListener = (endpoint: VerdocsEndpoint, session: TSession) => void;
996
+ interface VerdocsEndpointOptions {
997
+ baseURL?: string;
998
+ timeout?: number;
999
+ environment?: TEnvironment;
1000
+ sessionType?: TSessionType;
1001
+ clientID?: string;
1002
+ }
1003
+ /**
1004
+ * VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
1005
+ * Endpoints can be used for isolated session tasks.
1006
+ *
1007
+ * For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
1008
+ * In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
1009
+ * discarded once signing is complete.
1010
+ *
1011
+ * Note that endpoint configuration functions return the instance, so they can be chained, e.g.
1012
+ *
1013
+ * ```typescript
1014
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1015
+ *
1016
+ * const endpoint = new VerdocsEndpoint();
1017
+ * endpoint
1018
+ * .setSessionType('signing')
1019
+ * .logRequests(true)
1020
+ * .setClientID('1234)
1021
+ * .setTimeout(30000);
1022
+ * ```
1023
+ */
1024
+ declare class VerdocsEndpoint {
1025
+ private environment;
1026
+ private sessionType;
1027
+ private baseURL;
1028
+ private clientID;
1029
+ private timeout;
1030
+ private token;
1031
+ private nextListenerId;
1032
+ private sessionListeners;
1033
+ private requestLoggerId;
1034
+ /**
1035
+ * The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
1036
+ * presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
1037
+ * with Envelopes.
1038
+ */
1039
+ session: TSession;
1040
+ api: AxiosInstance;
1041
+ /**
1042
+ * Create a new VerdocsEndpoint to call Verdocs platform services.
1043
+ *
1044
+ * ```typescript
1045
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1046
+ * const endpoint = new VerdocsEndpoint();
1047
+ * ```
1048
+ */
1049
+ constructor(options?: VerdocsEndpointOptions);
1050
+ setDefault(): void;
1051
+ static getDefault(): VerdocsEndpoint;
1052
+ /**
1053
+ * Get the current environment.
1054
+ */
1055
+ getEnvironment(): TEnvironment;
1056
+ /**
1057
+ * Get the current session type.
1058
+ */
1059
+ getSessionType(): TSessionType;
1060
+ /**
1061
+ * Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
1062
+ */
1063
+ getBaseURL(): string;
1064
+ /**
1065
+ * Get the current client ID, if set.
1066
+ */
1067
+ getClientID(): string;
1068
+ /**
1069
+ * Get the current timeout.
1070
+ */
1071
+ getTimeout(): number;
1072
+ /**
1073
+ * Get the current session, if any.
1074
+ */
1075
+ getSession(): TSession;
1076
+ /**
1077
+ * Set the operating environment. This should rarely be anything other than 'verdocs'.
1078
+ *
1079
+ * ```typescript
1080
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1081
+ *
1082
+ * const endpoint = new VerdocsEndpoint();
1083
+ * endpoint.setEnvironment('verdocs-stage');
1084
+ * ```
1085
+ */
1086
+ setEnvironment(environment: TEnvironment): VerdocsEndpoint;
1087
+ /**
1088
+ * Set the session type. In general this should be done immediately when the endpoint is created. Changing the
1089
+ * session type may be done at any time, but may have unintended consequences if the endpoint is shared between
1090
+ * multiple widgets.
1091
+ *
1092
+ * Changing the session type will clear/reload the action session. This may trigger notifications to session state
1093
+ * observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to
1094
+ * handle this event.
1095
+ *
1096
+ * ```typescript
1097
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1098
+ *
1099
+ * const endpoint = new VerdocsEndpoint();
1100
+ * endpoint.setEnvironment('verdocs-stage');
1101
+ * ```
1102
+ */
1103
+ setSessionType(sessionType: TSessionType): VerdocsEndpoint;
1104
+ /**
1105
+ * Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
1106
+ *
1107
+ * ```typescript
1108
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1109
+ *
1110
+ * const endpoint = new VerdocsEndpoint();
1111
+ * endpoint.setBaseURL('https://api.verdocs.com');
1112
+ * ```
1113
+ */
1114
+ setBaseURL(url: string): VerdocsEndpoint;
1115
+ /**
1116
+ * Set the Client ID for Verdocs API calls.
1117
+ *
1118
+ * ```typescript
1119
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1120
+ *
1121
+ * const endpoint = new VerdocsEndpoint();
1122
+ * endpoint.setClientID('1234);
1123
+ * ```
1124
+ */
1125
+ setClientID(clientID: string): VerdocsEndpoint;
1126
+ /**
1127
+ * Set the timeout for API calls in milliseconds. 5000-20000ms is recommended for most purposes. 15000ms is the default.
1128
+ * Note that some calls may involve rendering operations that require some time to complete, so very short timeouts
1129
+ * are not recommended.
1130
+ *
1131
+ * ```typescript
1132
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1133
+ *
1134
+ * const endpoint = new VerdocsEndpoint();
1135
+ * endpoint.setTimeout(3000);
1136
+ * ```
1137
+ */
1138
+ setTimeout(timeout: number): VerdocsEndpoint;
1139
+ /**
1140
+ * Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
1141
+ *
1142
+ * ```typescript
1143
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1144
+ *
1145
+ * const endpoint = new VerdocsEndpoint();
1146
+ * endpoint.logRequests(true);
1147
+ * ```
1148
+ */
1149
+ logRequests(enable: boolean): VerdocsEndpoint;
1150
+ /**
1151
+ * Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata
1152
+ * and notify any listeners of the new data.
1153
+ *
1154
+ * If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those
1155
+ * settings should be made before calling this. Sessions are persisted to localStorage, and the environment and
1156
+ * type become part of the storage key.
1157
+ *
1158
+ * ```typescript
1159
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1160
+ *
1161
+ * const endpoint = new VerdocsEndpoint();
1162
+ * endpoint.setToken(accessToken);
1163
+ * ```
1164
+ */
1165
+ setToken(token: string | null): VerdocsEndpoint;
1166
+ /**
1167
+ * Retrieves the current session token, if any. Tokens should rarely be used for direct actions, but this is
1168
+ * required by the `<VerdocsView>` and other components to authorize requests to raw PDF files.
1169
+ */
1170
+ getToken(): string | null;
1171
+ private sessionStorageKey;
1172
+ /**
1173
+ * Clear the active session.
1174
+ */
1175
+ clearSession(): this;
1176
+ /**
1177
+ * Clear the active signing session.
1178
+ */
1179
+ clearSignerSession(): this;
1180
+ private notifySessionListeners;
1181
+ /**
1182
+ * Subscribe to session state change events.
1183
+ */
1184
+ onSessionChanged(listener: TSessionChangedListener): () => void;
1185
+ /**
1186
+ * Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
1187
+ * or component starts.
1188
+ */
1189
+ loadSession(): VerdocsEndpoint;
1622
1190
  }
1623
1191
  declare namespace Envelopes {
1624
1192
  type TTemplateSenderType = "creator" | "organization_member" | "organization_member_as_creator" | "everyone" | "everyone_as_creator";
@@ -40887,408 +40455,4 @@ declare namespace Types {
40887
40455
  }
40888
40456
  }
40889
40457
  declare namespace Utils { }
40890
- type TTemplateSenderType = "creator" | "organization_member" | "organization_member_as_creator" | "everyone" | "everyone_as_creator";
40891
- type TTemplatePermission = "template:creator:create:public" | "template:creator:create:org" | "template:creator:create:personal" | "template:creator:delete" | "template:creator:visibility" | "template:member:read" | "template:member:write" | "template:member:delete" | "template:member:visibility";
40892
- type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
40893
- /**
40894
- * Some template search and list endpoints return only a partial set of fields for each entry via this structure.
40895
- */
40896
- interface ITemplateSummary {
40897
- id: string;
40898
- name: string;
40899
- description: string | null;
40900
- sender: TTemplateSenderType;
40901
- counter: number;
40902
- star_counter: number;
40903
- created_at: string;
40904
- updated_at: string;
40905
- last_used_at: string | null;
40906
- /**
40907
- * If true, the template is considered "sendable" (it has at least one signer, and every signer has at least one field.)
40908
- */
40909
- is_sendable: boolean;
40910
- is_personal: boolean;
40911
- is_public: boolean;
40912
- profile_id: string;
40913
- organization_id: string;
40914
- reminder_id: string;
40915
- tags: string[];
40916
- allowed_operations: TTemplateAction[];
40917
- }
40918
- interface ITimePeriod {
40919
- start_time: string; // Date
40920
- end_time: string; // Date
40921
- }
40922
- interface ITemplateTag {
40923
- tag_name: string;
40924
- template_id: string;
40925
- }
40926
- interface ITag {
40927
- name: string;
40928
- featured?: boolean;
40929
- organization_id?: string;
40930
- created_at?: string;
40931
- }
40932
- interface IStar {
40933
- template_id: string;
40934
- profile_id: string;
40935
- }
40936
- interface ITemplateOwnerInfo {
40937
- email: string;
40938
- name: string;
40939
- profile_id: string;
40940
- }
40941
- type TSortTemplateBy = "created_at" | "updated_at" | "name" | "last_used_at" | "counter" | "star_counter";
40942
- interface ICreateApiKeyRequest {
40943
- name: string;
40944
- permission: TApiKeyPermission;
40945
- }
40946
- interface IUpdateApiKeyRequest {
40947
- name?: string;
40948
- permission?: TApiKeyPermission;
40949
- }
40950
- type TApiKeyPermission = "personal" | "global_read" | "global_write";
40951
- interface ICreateInvitationRequest {
40952
- email: string;
40953
- role: TRole;
40954
- }
40955
- type TOrgPermission = "org:create" | "org:view" | "org:update" | "org:delete" | "org:transfer" | "org:list";
40956
- interface ISetWebhookRequest {
40957
- url: string;
40958
- active: boolean;
40959
- events: {
40960
- envelope_created: boolean;
40961
- envelope_completed: boolean;
40962
- envelope_canceled: boolean;
40963
- template_created: boolean;
40964
- template_updated: boolean;
40965
- template_deleted: boolean;
40966
- template_used: boolean;
40967
- };
40968
- }
40969
- type TRequestStatus = "OK" | "ERROR";
40970
- type TAccountPermission = "owner:add" | "owner:remove" | "admin:add" | "admin:remove" | "member:view" | "member:add" | "member:remove";
40971
- /**
40972
- * Operation within Verdocs that users may perform.
40973
- */
40974
- type TPermission = TTemplatePermission | TOrgPermission | TAccountPermission;
40975
- /**
40976
- * Plans provide access to Verdocs product features.
40977
- */
40978
- type TPlan = "env:essential" | "org:standard";
40979
- /**
40980
- * Roles provide access to groups of permissions. Note that for historical reasons there is some overlap in the
40981
- * use of the term "role". TRole refers to a user type. A "Role" (IRole) is a Template participant placeholder.
40982
- */
40983
- type TRole = "contact" | "basic_user" | "member" | "admin" | "owner";
40984
- interface ICreateProfileRequest {
40985
- first_name: string;
40986
- last_name: string;
40987
- email: string;
40988
- phone?: string;
40989
- }
40990
- interface ISwitchProfileResponse {
40991
- profile: IProfile;
40992
- idToken: string;
40993
- accessToken: string;
40994
- refreshToken: string;
40995
- }
40996
- interface IUpdateProfileRequest {
40997
- first_name?: string;
40998
- last_name?: string;
40999
- phone?: string;
41000
- }
41001
- interface IAuthenticateUserRequest {
41002
- username: string;
41003
- password: string;
41004
- }
41005
- interface IAuthenticateAppRequest {
41006
- client_id: string;
41007
- client_secret: string;
41008
- }
41009
- interface IAuthenticateResponse {
41010
- idToken: string;
41011
- accessToken: string;
41012
- refreshToken: string;
41013
- }
41014
- interface TokenValidationRequest {
41015
- token: string;
41016
- }
41017
- interface TokenValidationResponse {
41018
- /** True if the token is valid */
41019
- valid: boolean;
41020
- /** The decoded and validated body of the JWT */
41021
- payload: any;
41022
- }
41023
- interface IUpdatePasswordRequest {
41024
- email: string;
41025
- oldPassword: string;
41026
- newPassword: string;
41027
- }
41028
- interface UpdatePasswordResponse {
41029
- status: TRequestStatus;
41030
- /** Success or failure message */
41031
- message: string;
41032
- }
41033
- interface UpdateEmailRequest {
41034
- email: string;
41035
- }
41036
- interface UpdateEmailResponse {
41037
- profiles: IProfile[];
41038
- }
41039
- interface ICreateBusinessAccountRequest {
41040
- email: string;
41041
- password: string;
41042
- firstName: string;
41043
- lastName: string;
41044
- orgName: string;
41045
- }
41046
- interface ICreateUserRequest {
41047
- firstName: string;
41048
- lastName: string;
41049
- email: string;
41050
- password: string;
41051
- fromInviteCode: string;
41052
- }
41053
- /**
41054
- * A Signing Session connects a caller to a role within an envelope, and can be used only for calls related to signing that envelope.
41055
- */
41056
- interface ISigningSession {
41057
- profile_id: string;
41058
- envelope_id: string;
41059
- role: string;
41060
- email: string;
41061
- access_key: {
41062
- id: string;
41063
- type: string;
41064
- };
41065
- iss: string;
41066
- aud: string;
41067
- exp: number;
41068
- iat: number;
41069
- [key: string]: any;
41070
- }
41071
- /**
41072
- * A User Session connects a caller to a Verdocs profile, and can be used for any operations that profile may perform.
41073
- */
41074
- interface IUserSession {
41075
- sub: string;
41076
- email: string;
41077
- email_verified: boolean;
41078
- iat: number;
41079
- exp: number;
41080
- permissions: TPermission[];
41081
- roles: TRole[];
41082
- profile: IProfile;
41083
- profile_id: string;
41084
- organization_id: string;
41085
- plans?: TPlan[];
41086
- [key: string]: any;
41087
- }
41088
- /**
41089
- * Verdocs supports two types of authenticated sessions: User and Signing. Both behave similarly and have similar
41090
- * properties, but signing sessions only have access to a small set of signing-related functions.
41091
- */
41092
- type TSessionType = "user" | "signing";
41093
- /**
41094
- * Represents a possibly-authenticated session within Verdocs, either for signing or regular user-based operations.
41095
- */
41096
- type TSession = IUserSession | ISigningSession | null;
41097
- type TEnvironment = "verdocs" | "verdocs-stage";
41098
- type TSessionChangedListener = (endpoint: VerdocsEndpoint, session: TSession) => void;
41099
- interface VerdocsEndpointOptions {
41100
- baseURL?: string;
41101
- timeout?: number;
41102
- environment?: TEnvironment;
41103
- sessionType?: TSessionType;
41104
- clientID?: string;
41105
- }
41106
- /**
41107
- * VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
41108
- * Endpoints can be used for isolated session tasks.
41109
- *
41110
- * For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
41111
- * In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
41112
- * discarded once signing is complete.
41113
- *
41114
- * Note that endpoint configuration functions return the instance, so they can be chained, e.g.
41115
- *
41116
- * ```typescript
41117
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41118
- *
41119
- * const endpoint = new VerdocsEndpoint();
41120
- * endpoint
41121
- * .setSessionType('signing')
41122
- * .logRequests(true)
41123
- * .setClientID('1234)
41124
- * .setTimeout(30000);
41125
- * ```
41126
- */
41127
- declare class VerdocsEndpoint {
41128
- private environment;
41129
- private sessionType;
41130
- private baseURL;
41131
- private clientID;
41132
- private timeout;
41133
- private token;
41134
- private nextListenerId;
41135
- private sessionListeners;
41136
- private requestLoggerId;
41137
- /**
41138
- * The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
41139
- * presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
41140
- * with Envelopes.
41141
- */
41142
- session: TSession;
41143
- api: AxiosInstance;
41144
- /**
41145
- * Create a new VerdocsEndpoint to call Verdocs platform services.
41146
- *
41147
- * ```typescript
41148
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41149
- * const endpoint = new VerdocsEndpoint();
41150
- * ```
41151
- */
41152
- constructor(options?: VerdocsEndpointOptions);
41153
- setDefault(): void;
41154
- static getDefault(): VerdocsEndpoint;
41155
- /**
41156
- * Get the current environment.
41157
- */
41158
- getEnvironment(): TEnvironment;
41159
- /**
41160
- * Get the current session type.
41161
- */
41162
- getSessionType(): TSessionType;
41163
- /**
41164
- * Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
41165
- */
41166
- getBaseURL(): string;
41167
- /**
41168
- * Get the current client ID, if set.
41169
- */
41170
- getClientID(): string;
41171
- /**
41172
- * Get the current timeout.
41173
- */
41174
- getTimeout(): number;
41175
- /**
41176
- * Get the current session, if any.
41177
- */
41178
- getSession(): TSession;
41179
- /**
41180
- * Set the operating environment. This should rarely be anything other than 'verdocs'.
41181
- *
41182
- * ```typescript
41183
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41184
- *
41185
- * const endpoint = new VerdocsEndpoint();
41186
- * endpoint.setEnvironment('verdocs-stage');
41187
- * ```
41188
- */
41189
- setEnvironment(environment: TEnvironment): VerdocsEndpoint;
41190
- /**
41191
- * Set the session type. In general this should be done immediately when the endpoint is created. Changing the
41192
- * session type may be done at any time, but may have unintended consequences if the endpoint is shared between
41193
- * multiple widgets.
41194
- *
41195
- * Changing the session type will clear/reload the action session. This may trigger notifications to session state
41196
- * observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to
41197
- * handle this event.
41198
- *
41199
- * ```typescript
41200
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41201
- *
41202
- * const endpoint = new VerdocsEndpoint();
41203
- * endpoint.setEnvironment('verdocs-stage');
41204
- * ```
41205
- */
41206
- setSessionType(sessionType: TSessionType): VerdocsEndpoint;
41207
- /**
41208
- * Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
41209
- *
41210
- * ```typescript
41211
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41212
- *
41213
- * const endpoint = new VerdocsEndpoint();
41214
- * endpoint.setBaseURL('https://api.verdocs.com');
41215
- * ```
41216
- */
41217
- setBaseURL(url: string): VerdocsEndpoint;
41218
- /**
41219
- * Set the Client ID for Verdocs API calls.
41220
- *
41221
- * ```typescript
41222
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41223
- *
41224
- * const endpoint = new VerdocsEndpoint();
41225
- * endpoint.setClientID('1234);
41226
- * ```
41227
- */
41228
- setClientID(clientID: string): VerdocsEndpoint;
41229
- /**
41230
- * Set the timeout for API calls in milliseconds. 5000-20000ms is recommended for most purposes. 15000ms is the default.
41231
- * Note that some calls may involve rendering operations that require some time to complete, so very short timeouts
41232
- * are not recommended.
41233
- *
41234
- * ```typescript
41235
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41236
- *
41237
- * const endpoint = new VerdocsEndpoint();
41238
- * endpoint.setTimeout(3000);
41239
- * ```
41240
- */
41241
- setTimeout(timeout: number): VerdocsEndpoint;
41242
- /**
41243
- * Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
41244
- *
41245
- * ```typescript
41246
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41247
- *
41248
- * const endpoint = new VerdocsEndpoint();
41249
- * endpoint.logRequests(true);
41250
- * ```
41251
- */
41252
- logRequests(enable: boolean): VerdocsEndpoint;
41253
- /**
41254
- * Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata
41255
- * and notify any listeners of the new data.
41256
- *
41257
- * If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those
41258
- * settings should be made before calling this. Sessions are persisted to localStorage, and the environment and
41259
- * type become part of the storage key.
41260
- *
41261
- * ```typescript
41262
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
41263
- *
41264
- * const endpoint = new VerdocsEndpoint();
41265
- * endpoint.setToken(accessToken);
41266
- * ```
41267
- */
41268
- setToken(token: string | null): VerdocsEndpoint;
41269
- /**
41270
- * Retrieves the current session token, if any. Tokens should rarely be used for direct actions, but this is
41271
- * required by the `<VerdocsView>` and other components to authorize requests to raw PDF files.
41272
- */
41273
- getToken(): string | null;
41274
- private sessionStorageKey;
41275
- /**
41276
- * Clear the active session.
41277
- */
41278
- clearSession(): this;
41279
- /**
41280
- * Clear the active signing session.
41281
- */
41282
- clearSignerSession(): this;
41283
- private notifySessionListeners;
41284
- /**
41285
- * Subscribe to session state change events.
41286
- */
41287
- onSessionChanged(listener: TSessionChangedListener): () => void;
41288
- /**
41289
- * Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
41290
- * or component starts.
41291
- */
41292
- loadSession(): VerdocsEndpoint;
41293
- }
41294
- export { Models, Envelopes, Organizations, Sessions, Templates, Users, Utils, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint };
40458
+ export { IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IWebhookEvents, IWebhook, IInPersonAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IRecipient, IReminder, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, IActivityEntry, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, Envelopes, Organizations, Sessions, Templates, Users, Utils };