@verdocs/js-sdk 2.0.12 → 2.0.15

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.
@@ -1,161 +1,6 @@
1
- import { ISigningSession, ISigningSessionRequest } from './Types';
1
+ import { IDocument, IDocumentsSearchResult, IDocumentsSummary, IRecipient, ISigningSession, ISigningSessionRequest } from './Types';
2
+ import { TDocumentUpdateResult, IDocumentFieldSettings } from './Types';
2
3
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
- import { IFieldSetting } from '../Templates/Types';
4
- import { IProfile } from '../Users/Types';
5
- export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
6
- export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
7
- export declare type TRecipientType = 'signer' | 'cc' | 'approver';
8
- export interface IDocumentsSearchResultEntry {
9
- id: string;
10
- canceled_at: string;
11
- certificate_document_id: string;
12
- created_at: string;
13
- envelope_document_id: string;
14
- histories: IHistory[];
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: TDocumentStatus;
23
- next_recipient: {
24
- claimed: boolean;
25
- email: string;
26
- name: string;
27
- profile_id: string;
28
- status: TRecipientStatus;
29
- type: TRecipientType;
30
- };
31
- template_id: string;
32
- total_count: number;
33
- updated_at: string;
34
- }
35
- export interface IDocumentsSearchResult {
36
- page: number;
37
- total: number;
38
- result: IDocumentsSearchResultEntry[];
39
- }
40
- export interface IDocumentsSummary {
41
- action_required: {
42
- page: number;
43
- total: number;
44
- result: IActivityEntry[];
45
- };
46
- completed: {
47
- page: number;
48
- total: number;
49
- result: IActivityEntry[];
50
- };
51
- waiting_others: {
52
- page: number;
53
- total: number;
54
- result: IActivityEntry[];
55
- };
56
- }
57
- export interface IRecipient {
58
- agreed: boolean;
59
- claimed: boolean;
60
- created_at: string;
61
- delegated_to: string | null;
62
- delegator: boolean;
63
- email: string;
64
- envelope_id: string;
65
- full_name: string;
66
- in_app_access_key?: string;
67
- key_used_to_conclude?: string;
68
- message: string | null;
69
- phone: string | null;
70
- profile_id: string;
71
- role_name: string;
72
- sequence: number;
73
- status: TRecipientStatus;
74
- type: TRecipientType;
75
- updated_at: string;
76
- }
77
- export interface IDocumentAsset {
78
- created_at: string;
79
- id: string;
80
- mime: string;
81
- name: string;
82
- page_numbers: number;
83
- updated_at: string;
84
- url: string;
85
- }
86
- export interface IDocumentField {
87
- envelope_id: string;
88
- label: string | null;
89
- name: string;
90
- page: number;
91
- recipient_role: string;
92
- type: string;
93
- required: boolean;
94
- settings?: IFieldSetting;
95
- setting?: IFieldSetting;
96
- validator: string | null;
97
- prepared?: boolean;
98
- }
99
- export interface IDocument {
100
- id: string;
101
- created_at: string;
102
- canceled_at: string;
103
- envelope_document_id: string;
104
- certificate_document_id: string | null;
105
- histories: IHistory[];
106
- recipients: IRecipient[];
107
- name: string;
108
- no_contact: boolean;
109
- profile_id: string;
110
- reminder_id: string | null;
111
- status: TDocumentStatus;
112
- template_id: string;
113
- updated_at: string;
114
- organization_id: string | null;
115
- certificate?: IDocumentAsset | null;
116
- document?: IDocumentAsset | null;
117
- fields?: IDocumentField[];
118
- profile?: IProfile;
119
- }
120
- export declare type TDocumentUpdateResult = Omit<IDocument, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
121
- export interface IActivityEntry {
122
- id: string;
123
- name: string;
124
- canceled_at: string;
125
- created_at: string;
126
- updated_at: string;
127
- profile_id: string;
128
- status: TDocumentStatus;
129
- template_id: string;
130
- recipient: {
131
- claimed: boolean;
132
- email: string;
133
- name: string;
134
- profile_id: string;
135
- status: TRecipientStatus;
136
- type: TRecipientType;
137
- };
138
- }
139
- export interface IHistory {
140
- created_at: string;
141
- envelope_id: string;
142
- event: IHistoryEvent;
143
- event_detail: IEventDetail;
144
- id: string;
145
- role_name: string;
146
- }
147
- export interface IDocumentSearchOptions {
148
- rows?: number;
149
- page?: number;
150
- sort_by?: 'updated_at' | 'created_at';
151
- ascending?: boolean;
152
- is_owner?: boolean;
153
- is_recipient?: boolean;
154
- envelope_status: TDocumentStatus[];
155
- recipient_status: TDocumentStatus[];
156
- }
157
- export declare type IHistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
158
- export declare type IEventDetail = 'in_app' | 'mail' | 'signer' | '';
159
4
  /**
160
5
  * Get a summary of currently active documents.
161
6
  *
@@ -220,9 +65,9 @@ export declare const getDocumentFile: (endpoint: VerdocsEndpoint, documentId: st
220
65
  /**
221
66
  * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
222
67
  */
223
- export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<IFieldSetting>;
68
+ export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<IDocumentFieldSettings>;
224
69
  /**
225
70
  * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
226
71
  * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
227
72
  */
228
- export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<IFieldSetting>;
73
+ export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<IDocumentFieldSettings>;
@@ -1,6 +1,6 @@
1
1
  import { IInPersonAccessKey, TRecipientAction } from './Types';
2
2
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
- import { IDocument, IRecipient } from './Documents';
3
+ import { IDocument, IRecipient } from './Types';
4
4
  export interface IUpdateRecipientParams {
5
5
  new_full_name?: string;
6
6
  agreed?: boolean;
@@ -15,4 +15,5 @@ export interface ISignerTokenResponse {
15
15
  signerToken: string;
16
16
  inPersonAccessKey: IInPersonAccessKey;
17
17
  }
18
- export declare const getSignerToken: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<import("axios").AxiosResponse<ISignerTokenResponse, any>>;
18
+ export declare const getSignerToken: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
19
+ export declare const getInPersonLink: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
@@ -57,5 +57,11 @@ export var updateRecipientStatus = function (endpoint, documentId, roleName, act
57
57
  }); };
58
58
  export var getSignerToken = function (endpoint, documentId, roleName) {
59
59
  return endpoint.api //
60
- .get("/documents/".concat(documentId, "/recipients/").concat(encodeURIComponent(roleName), "/signer-token"));
60
+ .get("/documents/".concat(documentId, "/recipients/").concat(encodeURIComponent(roleName), "/signer-token"))
61
+ .then(function (r) { return r.data; });
62
+ };
63
+ export var getInPersonLink = function (endpoint, documentId, roleName) {
64
+ return endpoint.api //
65
+ .get("/documents/".concat(documentId, "/recipients/").concat(encodeURIComponent(roleName), "?in_person_link=true"))
66
+ .then(function (r) { return r.data; });
61
67
  };
@@ -1,3 +1,4 @@
1
+ import { IProfile } from '../Users/Types';
1
2
  export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
2
3
  export interface ITemplateSummaryEntry {
3
4
  id: string;
@@ -53,3 +54,175 @@ export interface IInPersonAccessKey {
53
54
  first_used: string | null;
54
55
  last_used: string | null;
55
56
  }
57
+ export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
58
+ export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
59
+ export declare type TRecipientType = 'signer' | 'cc' | 'approver';
60
+ export interface IDocumentsSearchResultEntry {
61
+ id: string;
62
+ canceled_at: string;
63
+ certificate_document_id: string;
64
+ created_at: string;
65
+ envelope_document_id: string;
66
+ histories: IHistory[];
67
+ indexed_at: string;
68
+ name: string;
69
+ no_contact: boolean;
70
+ organization_id: string;
71
+ profile_id: string;
72
+ recipients: IRecipient[];
73
+ reminder_id: string | null;
74
+ status: TDocumentStatus;
75
+ next_recipient: {
76
+ claimed: boolean;
77
+ email: string;
78
+ name: string;
79
+ profile_id: string;
80
+ status: TRecipientStatus;
81
+ type: TRecipientType;
82
+ };
83
+ template_id: string;
84
+ total_count: number;
85
+ updated_at: string;
86
+ }
87
+ export interface IDocumentsSearchResult {
88
+ page: number;
89
+ total: number;
90
+ result: IDocumentsSearchResultEntry[];
91
+ }
92
+ export interface IDocumentsSummary {
93
+ action_required: {
94
+ page: number;
95
+ total: number;
96
+ result: IActivityEntry[];
97
+ };
98
+ completed: {
99
+ page: number;
100
+ total: number;
101
+ result: IActivityEntry[];
102
+ };
103
+ waiting_others: {
104
+ page: number;
105
+ total: number;
106
+ result: IActivityEntry[];
107
+ };
108
+ }
109
+ export interface IRecipient {
110
+ agreed: boolean;
111
+ claimed: boolean;
112
+ created_at: string;
113
+ delegated_to: string | null;
114
+ delegator: boolean;
115
+ email: string;
116
+ envelope_id: string;
117
+ full_name: string;
118
+ in_app_access_key?: string;
119
+ key_used_to_conclude?: string;
120
+ message: string | null;
121
+ phone: string | null;
122
+ profile_id: string;
123
+ role_name: string;
124
+ sequence: number;
125
+ status: TRecipientStatus;
126
+ type: TRecipientType;
127
+ updated_at: string;
128
+ }
129
+ export interface IDocumentAsset {
130
+ created_at: string;
131
+ id: string;
132
+ mime: string;
133
+ name: string;
134
+ page_numbers: number;
135
+ updated_at: string;
136
+ url: string;
137
+ }
138
+ export interface IDocumentFieldSettings {
139
+ type?: string;
140
+ x: number;
141
+ y: number;
142
+ width?: number;
143
+ height?: number;
144
+ value?: number | string;
145
+ result?: any;
146
+ leading?: number;
147
+ alignment?: number;
148
+ upperCase?: boolean;
149
+ options?: any[];
150
+ base64?: string;
151
+ hash?: string;
152
+ ip_address?: string;
153
+ signature_id?: string;
154
+ signed_at?: string;
155
+ [key: string]: any;
156
+ }
157
+ export interface IDocumentField {
158
+ envelope_id: string;
159
+ label: string | null;
160
+ name: string;
161
+ page: number;
162
+ recipient_role: string;
163
+ type: string;
164
+ required: boolean;
165
+ settings?: IDocumentFieldSettings;
166
+ validator: string | null;
167
+ prepared?: boolean;
168
+ }
169
+ export interface IDocument {
170
+ id: string;
171
+ created_at: string;
172
+ canceled_at: string;
173
+ envelope_document_id: string;
174
+ certificate_document_id: string | null;
175
+ histories: IHistory[];
176
+ recipients: IRecipient[];
177
+ name: string;
178
+ no_contact: boolean;
179
+ profile_id: string;
180
+ reminder_id: string | null;
181
+ status: TDocumentStatus;
182
+ template_id: string;
183
+ updated_at: string;
184
+ organization_id: string | null;
185
+ certificate?: IDocumentAsset | null;
186
+ document?: IDocumentAsset | null;
187
+ fields?: IDocumentField[];
188
+ profile?: IProfile;
189
+ }
190
+ export declare type TDocumentUpdateResult = Omit<IDocument, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
191
+ export interface IActivityEntry {
192
+ id: string;
193
+ name: string;
194
+ canceled_at: string;
195
+ created_at: string;
196
+ updated_at: string;
197
+ profile_id: string;
198
+ status: TDocumentStatus;
199
+ template_id: string;
200
+ recipient: {
201
+ claimed: boolean;
202
+ email: string;
203
+ name: string;
204
+ profile_id: string;
205
+ status: TRecipientStatus;
206
+ type: TRecipientType;
207
+ };
208
+ }
209
+ export interface IHistory {
210
+ created_at: string;
211
+ envelope_id: string;
212
+ event: THistoryEvent;
213
+ event_detail: TEventDetail;
214
+ id: string;
215
+ role_name: string;
216
+ }
217
+ export interface IDocumentSearchOptions {
218
+ rows?: number;
219
+ page?: number;
220
+ sort_by?: 'updated_at' | 'created_at';
221
+ ascending?: boolean;
222
+ is_owner?: boolean;
223
+ is_recipient?: boolean;
224
+ envelope_status: TDocumentStatus[];
225
+ recipient_status: TDocumentStatus[];
226
+ }
227
+ export declare type THistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
228
+ export declare type TEventDetail = 'in_app' | 'mail' | 'signer' | '';
@@ -1,10 +1,11 @@
1
1
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
2
+ import { IProfile } from '../Users/Types';
2
3
  /**
3
4
  * An Organization Member (aka Profile) is an individual user with access to an organization.
4
5
  *
5
6
  * @module
6
7
  */
7
- export declare const getMembers: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<any>;
8
+ export declare const getMembers: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IProfile[]>;
8
9
  export declare const deleteMember: (endpoint: VerdocsEndpoint, organizationId: string, profileId: string) => Promise<any>;
9
10
  export declare const addMemberRole: (endpoint: VerdocsEndpoint, organizationId: string, profileId: string, roleId: string) => Promise<any>;
10
11
  export declare const deleteMemberRole: (endpoint: VerdocsEndpoint, organizationId: string, profileId: string, roleId: string) => Promise<any>;
@@ -28,6 +28,7 @@ export interface IApiKey {
28
28
  name: string;
29
29
  profile_id: string;
30
30
  organization_id: string;
31
+ profile?: IProfile;
31
32
  }
32
33
  export interface IApiKeyWithSecret extends IApiKey {
33
34
  client_id: string;
package/Search/Types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { TDocumentStatus } from '../Documents/Documents';
2
1
  import { TTemplateSender } from '../Templates/Types';
2
+ import { TDocumentStatus } from '../Documents/Types';
3
3
  export declare type TMimeType = 'application/pdf' | string;
4
4
  /**
5
5
  * An individual hit in a document search result. Note that this schema does not precisely match IDocument because fields
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- import { ITemplate, ITemplatesSearchResult, ITemplatesSummary } from './Types';
7
+ import { ITemplate, ITemplateOwnerInfo, ITemplatesSearchResult, ITemplatesSummary } from './Types';
8
8
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
9
9
  export interface IGetTemplatesParams {
10
10
  is_starred?: boolean;
@@ -23,7 +23,7 @@ export interface IGetTemplatesParams {
23
23
  * await Templates.getTemplates({ is_organization: true });
24
24
  * ```
25
25
  */
26
- export declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemplatesParams) => Promise<any[]>;
26
+ export declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemplatesParams) => Promise<ITemplate[]>;
27
27
  /**
28
28
  * Get one template by its ID.
29
29
  *
@@ -33,7 +33,17 @@ export declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemp
33
33
  * const template = await Templates.getTemplate('83da3d70-7857-4392-b876-c4592a304bc9');
34
34
  * ```
35
35
  */
36
- export declare const getTemplate: (endpoint: VerdocsEndpoint, templateId: string) => Promise<any>;
36
+ export declare const getTemplate: (endpoint: VerdocsEndpoint, templateId: string) => Promise<ITemplate>;
37
+ /**
38
+ * Get owner information for a template.
39
+ *
40
+ * ```typescript
41
+ * import {Templates} from '@verdocs/js-sdk/Templates';
42
+ *
43
+ * const template = await Templates.getTemplateOwnerInfo('83da3d70-7857-4392-b876-c4592a304bc9');
44
+ * ```
45
+ */
46
+ export declare const getTemplateOwnerInfo: (endpoint: VerdocsEndpoint, templateId: string) => Promise<ITemplateOwnerInfo>;
37
47
  /**
38
48
  * Create a template.
39
49
  *
@@ -54,7 +54,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
54
54
  */
55
55
  export var getTemplates = function (endpoint, params) {
56
56
  return endpoint.api //
57
- .get('/templates/', { params: params })
57
+ .get('/templates', { params: params })
58
58
  .then(function (r) { return r.data; });
59
59
  };
60
60
  /**
@@ -71,6 +71,20 @@ export var getTemplate = function (endpoint, templateId) {
71
71
  .get("/templates/".concat(templateId))
72
72
  .then(function (r) { return r.data; });
73
73
  };
74
+ /**
75
+ * Get owner information for a template.
76
+ *
77
+ * ```typescript
78
+ * import {Templates} from '@verdocs/js-sdk/Templates';
79
+ *
80
+ * const template = await Templates.getTemplateOwnerInfo('83da3d70-7857-4392-b876-c4592a304bc9');
81
+ * ```
82
+ */
83
+ export var getTemplateOwnerInfo = function (endpoint, templateId) {
84
+ return endpoint.api //
85
+ .get("/templates/".concat(templateId))
86
+ .then(function (r) { return r.data; });
87
+ };
74
88
  /**
75
89
  * Create a template.
76
90
  *
@@ -154,28 +154,21 @@ export interface ITemplateField {
154
154
  template_id: string;
155
155
  type: string;
156
156
  required: boolean;
157
- setting?: IFieldSetting;
157
+ setting: ITemplateFieldSetting;
158
158
  page_sequence: number;
159
159
  validator?: string;
160
160
  label?: string;
161
161
  }
162
- export interface IFieldSetting {
162
+ export interface ITemplateFieldSetting {
163
163
  x: number;
164
164
  y: number;
165
+ result?: string;
165
166
  width?: number;
166
167
  height?: number;
167
- result?: any;
168
- type?: string;
169
- value?: string;
170
168
  leading?: number;
171
169
  alignment?: number;
172
170
  upperCase?: boolean;
173
171
  options?: any[];
174
- base64?: string;
175
- hash?: string;
176
- ip_address?: string;
177
- signature_id?: string;
178
- signed_at?: string;
179
172
  [key: string]: any;
180
173
  }
181
174
  export interface IPage {
@@ -198,3 +191,8 @@ export interface IReminder {
198
191
  envelope_id: string;
199
192
  template_id: string;
200
193
  }
194
+ export interface ITemplateOwnerInfo {
195
+ email: string;
196
+ name: string;
197
+ profile_id: string;
198
+ }
@@ -37,7 +37,7 @@ export interface VerdocsEndpointOptions {
37
37
  export declare class VerdocsEndpoint {
38
38
  private environment;
39
39
  private sessionType;
40
- private baseURL;
40
+ private readonly baseURL;
41
41
  private clientID;
42
42
  private timeout;
43
43
  private token;
@@ -72,9 +72,6 @@ var VerdocsEndpoint = /** @class */ (function () {
72
72
  globalThis[ENDPOINT_KEY] = new VerdocsEndpoint();
73
73
  window.console.debug('[JS_SDK] Created default endpoint', globalThis[ENDPOINT_KEY]);
74
74
  }
75
- else {
76
- window.console.debug('[JS SDK] Re-using existing endpoint', globalThis[ENDPOINT_KEY]);
77
- }
78
75
  return globalThis[ENDPOINT_KEY];
79
76
  };
80
77
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "2.0.12",
3
+ "version": "2.0.15",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",