@verdocs/js-sdk 2.0.11 → 2.0.14

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,160 +1,7 @@
1
- import { ISigningSession, ISigningSessionRequest } from './Types';
1
+ import { IDocument, IDocumentsSearchResult, IDocumentsSummary, IRecipient, ISigningSession, ISigningSessionRequest } from './Types';
2
2
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
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 interface IActivityEntry {
121
- id: string;
122
- name: string;
123
- canceled_at: string;
124
- created_at: string;
125
- updated_at: string;
126
- profile_id: string;
127
- status: TDocumentStatus;
128
- template_id: string;
129
- recipient: {
130
- claimed: boolean;
131
- email: string;
132
- name: string;
133
- profile_id: string;
134
- status: TRecipientStatus;
135
- type: TRecipientType;
136
- };
137
- }
138
- export interface IHistory {
139
- created_at: string;
140
- envelope_id: string;
141
- event: IHistoryEvent;
142
- event_detail: IEventDetail;
143
- id: string;
144
- role_name: string;
145
- }
146
- export interface IDocumentSearchOptions {
147
- rows?: number;
148
- page?: number;
149
- sort_by?: 'updated_at' | 'created_at';
150
- ascending?: boolean;
151
- is_owner?: boolean;
152
- is_recipient?: boolean;
153
- envelope_status: TDocumentStatus[];
154
- recipient_status: TDocumentStatus[];
155
- }
156
- export declare type IHistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
157
- export declare type IEventDetail = 'in_app' | 'mail' | 'signer' | '';
4
+ import { TDocumentUpdateResult } from './Types';
158
5
  /**
159
6
  * Get a summary of currently active documents.
160
7
  *
@@ -195,7 +42,7 @@ export declare const getDocument: (endpoint: VerdocsEndpoint, documentId: string
195
42
  /**
196
43
  * Cancel a Document.
197
44
  */
198
- export declare const cancelDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IDocument>;
45
+ export declare const cancelDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<TDocumentUpdateResult>;
199
46
  /**
200
47
  * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
201
48
  */
@@ -1,6 +1,6 @@
1
- import { IRecipient } from './Documents';
1
+ import { IInPersonAccessKey, TRecipientAction } from './Types';
2
2
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
- export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
3
+ import { IDocument, IRecipient } from './Types';
4
4
  export interface IUpdateRecipientParams {
5
5
  new_full_name?: string;
6
6
  agreed?: boolean;
@@ -9,3 +9,11 @@ export interface IUpdateRecipientParams {
9
9
  * Update a recipient's status block
10
10
  */
11
11
  export declare const updateRecipientStatus: (endpoint: VerdocsEndpoint, documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
12
+ export interface ISignerTokenResponse {
13
+ recipient: IRecipient;
14
+ envelope: IDocument;
15
+ signerToken: string;
16
+ inPersonAccessKey: IInPersonAccessKey;
17
+ }
18
+ export declare const getSignerToken: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
19
+ export declare const getInPersonLink: (endpoint: VerdocsEndpoint, documentId: string, roleName: string) => Promise<ISignerTokenResponse>;
@@ -55,3 +55,13 @@ export var updateRecipientStatus = function (endpoint, documentId, roleName, act
55
55
  .then(function (r) { return r.data; })];
56
56
  });
57
57
  }); };
58
+ export var getSignerToken = function (endpoint, documentId, roleName) {
59
+ return endpoint.api //
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; });
67
+ };
@@ -1,3 +1,6 @@
1
+ import { IFieldSetting } from '../Templates/Types';
2
+ import { IProfile } from '../Users/Types';
3
+ export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
1
4
  export interface ITemplateSummaryEntry {
2
5
  id: string;
3
6
  name: string;
@@ -41,3 +44,168 @@ export interface ISigningSession {
41
44
  iat: number;
42
45
  [key: string]: any;
43
46
  }
47
+ export interface IInPersonAccessKey {
48
+ id: string;
49
+ created_at: string;
50
+ recipient_name: string;
51
+ envelope_id: string;
52
+ type: 'in_person_link';
53
+ key: string;
54
+ expiration_date: string | null;
55
+ first_used: string | null;
56
+ last_used: string | null;
57
+ }
58
+ export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
59
+ export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
60
+ export declare type TRecipientType = 'signer' | 'cc' | 'approver';
61
+ export interface IDocumentsSearchResultEntry {
62
+ id: string;
63
+ canceled_at: string;
64
+ certificate_document_id: string;
65
+ created_at: string;
66
+ envelope_document_id: string;
67
+ histories: IHistory[];
68
+ indexed_at: string;
69
+ name: string;
70
+ no_contact: boolean;
71
+ organization_id: string;
72
+ profile_id: string;
73
+ recipients: IRecipient[];
74
+ reminder_id: string | null;
75
+ status: TDocumentStatus;
76
+ next_recipient: {
77
+ claimed: boolean;
78
+ email: string;
79
+ name: string;
80
+ profile_id: string;
81
+ status: TRecipientStatus;
82
+ type: TRecipientType;
83
+ };
84
+ template_id: string;
85
+ total_count: number;
86
+ updated_at: string;
87
+ }
88
+ export interface IDocumentsSearchResult {
89
+ page: number;
90
+ total: number;
91
+ result: IDocumentsSearchResultEntry[];
92
+ }
93
+ export interface IDocumentsSummary {
94
+ action_required: {
95
+ page: number;
96
+ total: number;
97
+ result: IActivityEntry[];
98
+ };
99
+ completed: {
100
+ page: number;
101
+ total: number;
102
+ result: IActivityEntry[];
103
+ };
104
+ waiting_others: {
105
+ page: number;
106
+ total: number;
107
+ result: IActivityEntry[];
108
+ };
109
+ }
110
+ export interface IRecipient {
111
+ agreed: boolean;
112
+ claimed: boolean;
113
+ created_at: string;
114
+ delegated_to: string | null;
115
+ delegator: boolean;
116
+ email: string;
117
+ envelope_id: string;
118
+ full_name: string;
119
+ in_app_access_key?: string;
120
+ key_used_to_conclude?: string;
121
+ message: string | null;
122
+ phone: string | null;
123
+ profile_id: string;
124
+ role_name: string;
125
+ sequence: number;
126
+ status: TRecipientStatus;
127
+ type: TRecipientType;
128
+ updated_at: string;
129
+ }
130
+ export interface IDocumentAsset {
131
+ created_at: string;
132
+ id: string;
133
+ mime: string;
134
+ name: string;
135
+ page_numbers: number;
136
+ updated_at: string;
137
+ url: string;
138
+ }
139
+ export interface IDocumentField {
140
+ envelope_id: string;
141
+ label: string | null;
142
+ name: string;
143
+ page: number;
144
+ recipient_role: string;
145
+ type: string;
146
+ required: boolean;
147
+ settings?: IFieldSetting;
148
+ setting?: IFieldSetting;
149
+ validator: string | null;
150
+ prepared?: boolean;
151
+ }
152
+ export interface IDocument {
153
+ id: string;
154
+ created_at: string;
155
+ canceled_at: string;
156
+ envelope_document_id: string;
157
+ certificate_document_id: string | null;
158
+ histories: IHistory[];
159
+ recipients: IRecipient[];
160
+ name: string;
161
+ no_contact: boolean;
162
+ profile_id: string;
163
+ reminder_id: string | null;
164
+ status: TDocumentStatus;
165
+ template_id: string;
166
+ updated_at: string;
167
+ organization_id: string | null;
168
+ certificate?: IDocumentAsset | null;
169
+ document?: IDocumentAsset | null;
170
+ fields?: IDocumentField[];
171
+ profile?: IProfile;
172
+ }
173
+ export declare type TDocumentUpdateResult = Omit<IDocument, 'histories' | 'recipients' | 'certificate' | 'document' | 'fields' | 'profile'>;
174
+ export interface IActivityEntry {
175
+ id: string;
176
+ name: string;
177
+ canceled_at: string;
178
+ created_at: string;
179
+ updated_at: string;
180
+ profile_id: string;
181
+ status: TDocumentStatus;
182
+ template_id: string;
183
+ recipient: {
184
+ claimed: boolean;
185
+ email: string;
186
+ name: string;
187
+ profile_id: string;
188
+ status: TRecipientStatus;
189
+ type: TRecipientType;
190
+ };
191
+ }
192
+ export interface IHistory {
193
+ created_at: string;
194
+ envelope_id: string;
195
+ event: THistoryEvent;
196
+ event_detail: TEventDetail;
197
+ id: string;
198
+ role_name: string;
199
+ }
200
+ export interface IDocumentSearchOptions {
201
+ rows?: number;
202
+ page?: number;
203
+ sort_by?: 'updated_at' | 'created_at';
204
+ ascending?: boolean;
205
+ is_owner?: boolean;
206
+ is_recipient?: boolean;
207
+ envelope_status: TDocumentStatus[];
208
+ recipient_status: TDocumentStatus[];
209
+ }
210
+ export declare type THistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
211
+ 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
  *
@@ -198,3 +198,8 @@ export interface IReminder {
198
198
  envelope_id: string;
199
199
  template_id: string;
200
200
  }
201
+ export interface ITemplateOwnerInfo {
202
+ email: string;
203
+ name: string;
204
+ profile_id: string;
205
+ }
@@ -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.11",
3
+ "version": "2.0.14",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",