@verdocs/js-sdk 3.10.29 → 4.0.0

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.
Files changed (112) hide show
  1. package/dist/README.md +75 -0
  2. package/dist/index.d.mts +41294 -0
  3. package/dist/index.d.ts +41294 -0
  4. package/dist/index.js +3045 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +3036 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/package.json +85 -0
  9. package/dist/tsconfig.json +16 -0
  10. package/package.json +31 -14
  11. package/.github/workflows/generate-docs.yml +0 -41
  12. package/Envelopes/Envelopes.d.ts +0 -242
  13. package/Envelopes/Envelopes.js +0 -339
  14. package/Envelopes/Initials.d.ts +0 -15
  15. package/Envelopes/Initials.js +0 -13
  16. package/Envelopes/Permissions.d.ts +0 -52
  17. package/Envelopes/Permissions.js +0 -84
  18. package/Envelopes/Recipients.d.ts +0 -89
  19. package/Envelopes/Recipients.js +0 -112
  20. package/Envelopes/Reminders.d.ts +0 -23
  21. package/Envelopes/Reminders.js +0 -33
  22. package/Envelopes/Signatures.d.ts +0 -28
  23. package/Envelopes/Signatures.js +0 -37
  24. package/Envelopes/Types.d.ts +0 -390
  25. package/Envelopes/Types.js +0 -45
  26. package/Envelopes/index.d.ts +0 -7
  27. package/Envelopes/index.js +0 -7
  28. package/Organizations/ApiKeys.d.ts +0 -64
  29. package/Organizations/ApiKeys.js +0 -82
  30. package/Organizations/Groups.d.ts +0 -47
  31. package/Organizations/Groups.js +0 -76
  32. package/Organizations/Invitations.d.ts +0 -24
  33. package/Organizations/Invitations.js +0 -45
  34. package/Organizations/Members.d.ts +0 -12
  35. package/Organizations/Members.js +0 -30
  36. package/Organizations/Organizations.d.ts +0 -27
  37. package/Organizations/Organizations.js +0 -45
  38. package/Organizations/Types.d.ts +0 -104
  39. package/Organizations/Types.js +0 -1
  40. package/Organizations/Webhooks.d.ts +0 -34
  41. package/Organizations/Webhooks.js +0 -10
  42. package/Organizations/Whitelabel.d.ts +0 -31
  43. package/Organizations/Whitelabel.js +0 -38
  44. package/Organizations/index.d.ts +0 -16
  45. package/Organizations/index.js +0 -16
  46. package/Sessions/Types.d.ts +0 -54
  47. package/Sessions/Types.js +0 -1
  48. package/Sessions/index.d.ts +0 -6
  49. package/Sessions/index.js +0 -7
  50. package/Templates/Actions.d.ts +0 -26
  51. package/Templates/Actions.js +0 -104
  52. package/Templates/Fields.d.ts +0 -14
  53. package/Templates/Fields.js +0 -24
  54. package/Templates/Pages.d.ts +0 -30
  55. package/Templates/Pages.js +0 -41
  56. package/Templates/Permissions.d.ts +0 -73
  57. package/Templates/Permissions.js +0 -124
  58. package/Templates/Reminders.d.ts +0 -23
  59. package/Templates/Reminders.js +0 -33
  60. package/Templates/Roles.d.ts +0 -16
  61. package/Templates/Roles.js +0 -42
  62. package/Templates/Stars.d.ts +0 -10
  63. package/Templates/Stars.js +0 -16
  64. package/Templates/Tags.d.ts +0 -33
  65. package/Templates/Tags.js +0 -55
  66. package/Templates/TemplateDocuments.d.ts +0 -66
  67. package/Templates/TemplateDocuments.js +0 -139
  68. package/Templates/Templates.d.ts +0 -284
  69. package/Templates/Templates.js +0 -309
  70. package/Templates/Types.d.ts +0 -346
  71. package/Templates/Types.js +0 -29
  72. package/Templates/Validators.d.ts +0 -21
  73. package/Templates/Validators.js +0 -27
  74. package/Templates/index.d.ts +0 -11
  75. package/Templates/index.js +0 -11
  76. package/Users/Auth.d.ts +0 -123
  77. package/Users/Auth.js +0 -142
  78. package/Users/Billing.d.ts +0 -1
  79. package/Users/Billing.js +0 -2
  80. package/Users/Notifications.d.ts +0 -2
  81. package/Users/Notifications.js +0 -43
  82. package/Users/Profiles.d.ts +0 -151
  83. package/Users/Profiles.js +0 -179
  84. package/Users/Types.d.ts +0 -146
  85. package/Users/Types.js +0 -47
  86. package/Users/index.d.ts +0 -5
  87. package/Users/index.js +0 -5
  88. package/Utils/Colors.d.ts +0 -18
  89. package/Utils/Colors.js +0 -102
  90. package/Utils/DateTime.d.ts +0 -6
  91. package/Utils/DateTime.js +0 -79
  92. package/Utils/Fields.d.ts +0 -5
  93. package/Utils/Fields.js +0 -24
  94. package/Utils/Files.d.ts +0 -16
  95. package/Utils/Files.js +0 -42
  96. package/Utils/Locales.d.ts +0 -17
  97. package/Utils/Locales.js +0 -1358
  98. package/Utils/Primitives.d.ts +0 -18
  99. package/Utils/Primitives.js +0 -31
  100. package/Utils/Strings.d.ts +0 -9
  101. package/Utils/Strings.js +0 -28
  102. package/Utils/Token.d.ts +0 -19
  103. package/Utils/Token.js +0 -67
  104. package/Utils/globalThis.d.ts +0 -2
  105. package/Utils/globalThis.js +0 -52
  106. package/Utils/index.d.ts +0 -8
  107. package/Utils/index.js +0 -8
  108. package/VerdocsEndpoint.d.ts +0 -199
  109. package/VerdocsEndpoint.js +0 -319
  110. package/index.d.ts +0 -18
  111. package/index.js +0 -18
  112. package/tsconfig-typedoc.json +0 -26
@@ -1,339 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { decodeAccessTokenBody } from '../Utils/Token';
38
- /**
39
- * Create an envelope
40
- *
41
- * ```typescript
42
- * import {Envelopes, ICreateEnvelopeRole, ICreateEnvelopeRequest} from '@verdocs/js-sdk/Envelopes';
43
- *
44
- * const role1: ICreateEnvelopeRole = {
45
- * type: 'signer',
46
- * name: 'Seller',
47
- * full_name: 'Paige Turner',
48
- * email: 'paige.turner@nomail.com',
49
- * phone: '',
50
- * sequence: 1,
51
- * delegator: false,
52
- * message: '',
53
- * };
54
- *
55
- * const role2: ICreateEnvelopeRole = {
56
- * type: 'signer',
57
- * name: 'Buyer',
58
- * full_name: 'Will Power',
59
- * email: 'will.power@nomail.com',
60
- * phone: '',
61
- * sequence: 2,
62
- * delegator: false,
63
- * message: '',
64
- * };
65
- *
66
- * const request: ICreateEnvelopeRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};
67
- * const {id, recipients} = await Envelopes.createEnvelope(VerdocsEndpoint.getDefault(), request);
68
- * ```
69
- */
70
- export var createEnvelope = function (endpoint, request) { return __awaiter(void 0, void 0, void 0, function () {
71
- return __generator(this, function (_a) {
72
- return [2 /*return*/, endpoint.api //
73
- .post('/envelopes', request)
74
- .then(function (r) { return r.data; })];
75
- });
76
- }); };
77
- /**
78
- * Get a summary of currently active envelopes.
79
- *
80
- * ```typescript
81
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
82
- *
83
- * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());
84
- * ```
85
- */
86
- export var getSummary = function (endpoint, page) { return __awaiter(void 0, void 0, void 0, function () {
87
- return __generator(this, function (_a) {
88
- return [2 /*return*/, endpoint.api //
89
- .post('/envelopes/summary', { page: page })
90
- .then(function (r) { return r.data; })];
91
- });
92
- }); };
93
- /**
94
- * Search for envelopes matching various criteria.
95
- *
96
- * ```typescript
97
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
98
- *
99
- * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });
100
- * ```
101
- */
102
- export var searchEnvelopes = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- return [2 /*return*/, endpoint.api //
105
- .post('/envelopes/search', params)
106
- .then(function (r) { return r.data; })];
107
- });
108
- }); };
109
- /**
110
- * Get a signing session for an Envelope.
111
- */
112
- export var getSigningSession = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
113
- return __generator(this, function (_a) {
114
- window.console.log('[JS_SDK] getSigningSession', params, endpoint.api);
115
- return [2 /*return*/, endpoint.api //
116
- .get("/envelopes/".concat(params.envelopeId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
117
- .then(function (r) {
118
- var _a;
119
- // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
120
- var signerToken = ((_a = r.headers) === null || _a === void 0 ? void 0 : _a.signer_token) || '';
121
- var session = decodeAccessTokenBody(signerToken);
122
- endpoint.setToken(signerToken);
123
- return { recipient: r.data, session: session, signerToken: signerToken };
124
- })];
125
- });
126
- }); };
127
- /**
128
- * Get the list of recipients for an Envelope.
129
- */
130
- export var getEnvelopeRecipients = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
131
- return __generator(this, function (_a) {
132
- return [2 /*return*/, endpoint.api //
133
- .get("/envelopes/".concat(envelopeId, "/recipients"))
134
- .then(function (r) { return r.data; })];
135
- });
136
- }); };
137
- /**
138
- * Get all metadata for an Envelope.
139
- */
140
- export var getEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
141
- return __generator(this, function (_a) {
142
- return [2 /*return*/, endpoint.api //
143
- .get("/envelopes/".concat(envelopeId))
144
- .then(function (r) { return r.data; })];
145
- });
146
- }); };
147
- /**
148
- * Get an Envelope Document
149
- */
150
- export var getEnvelopeDocument = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
151
- return __generator(this, function (_a) {
152
- return [2 /*return*/, endpoint.api //
153
- .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId))
154
- .then(function (r) { return r.data; })];
155
- });
156
- }); };
157
- /**
158
- * Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
159
- * be accessed immediately and never shared. Content-Disposition will be set to "download".
160
- */
161
- export var getDocumentDownloadLink = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
162
- return __generator(this, function (_a) {
163
- return [2 /*return*/, endpoint.api //
164
- .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?download=true"))
165
- .then(function (r) { return r.data; })];
166
- });
167
- }); };
168
- /**
169
- * Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
170
- * be accessed immediately and never shared. Content-Disposition will be set to "inline".
171
- */
172
- export var getDocumentPreviewLink = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
173
- return __generator(this, function (_a) {
174
- return [2 /*return*/, endpoint.api //
175
- .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?preview=true"))
176
- .then(function (r) { return r.data; })];
177
- });
178
- }); };
179
- /**
180
- * Cancel an Envelope.
181
- */
182
- export var cancelEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
183
- return __generator(this, function (_a) {
184
- return [2 /*return*/, endpoint.api //
185
- .put("/envelopes/".concat(envelopeId), { action: 'cancel' })
186
- .then(function (r) { return r.data; })];
187
- });
188
- }); };
189
- /**
190
- * Get (binary download) a file attached to an Envelope. It is important to use this method
191
- * rather than a direct A HREF or similar link to set the authorization headers for the
192
- * request.
193
- */
194
- export var getEnvelopeFile = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
195
- return __generator(this, function (_a) {
196
- return [2 /*return*/, endpoint.api //
197
- .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?file=true"), { responseType: 'blob' })
198
- .then(function (r) { return r.data; })];
199
- });
200
- }); };
201
- /**
202
- * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
203
- */
204
- export var updateEnvelopeField = function (endpoint, envelopeId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
205
- return __generator(this, function (_a) {
206
- return [2 /*return*/, endpoint.api //
207
- .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName), value)
208
- .then(function (r) { return r.data; })];
209
- });
210
- }); };
211
- /**
212
- * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
213
- * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
214
- */
215
- export var updateEnvelopeFieldSignature = function (endpoint, envelopeId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
216
- return __generator(this, function (_a) {
217
- return [2 /*return*/, endpoint.api //
218
- .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
219
- .then(function (r) { return r.data; })];
220
- });
221
- }); };
222
- /**
223
- * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
224
- * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
225
- */
226
- export var updateEnvelopeFieldInitials = function (endpoint, envelopeId, fieldName, initialId) { return __awaiter(void 0, void 0, void 0, function () {
227
- return __generator(this, function (_a) {
228
- return [2 /*return*/, endpoint.api //
229
- .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName, "/initial/").concat(initialId))
230
- .then(function (r) { return r.data; })];
231
- });
232
- }); };
233
- /**
234
- * Upload an attachment.
235
- */
236
- export var uploadEnvelopeFieldAttachment = function (endpoint, envelopeId, fieldName, file, onUploadProgress) { return __awaiter(void 0, void 0, void 0, function () {
237
- var formData;
238
- return __generator(this, function (_a) {
239
- formData = new FormData();
240
- formData.append('document', file, file.name);
241
- return [2 /*return*/, endpoint.api //
242
- .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName), formData, {
243
- timeout: 120000,
244
- onUploadProgress: function (event) {
245
- var total = event.total || 1;
246
- var loaded = event.loaded || 0;
247
- onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
248
- },
249
- })
250
- .then(function (r) { return r.data; })];
251
- });
252
- }); };
253
- /**
254
- * Delete an attachment.
255
- */
256
- export var deleteEnvelopeFieldAttachment = function (endpoint, envelopeId, fieldName, file, onUploadProgress) { return __awaiter(void 0, void 0, void 0, function () {
257
- var formData;
258
- return __generator(this, function (_a) {
259
- formData = new FormData();
260
- // Omitting file is the trigger here
261
- return [2 /*return*/, endpoint.api //
262
- .put("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName), formData, {
263
- timeout: 120000,
264
- onUploadProgress: function (event) {
265
- var total = event.total || 1;
266
- var loaded = event.loaded || 0;
267
- onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
268
- },
269
- })
270
- .then(function (r) { return r.data; })];
271
- });
272
- }); };
273
- /**
274
- * Get the attached file for an attachment field (if any)
275
- */
276
- export var getFieldAttachment = function (endpoint, envelopeId, fieldName) { return __awaiter(void 0, void 0, void 0, function () {
277
- return __generator(this, function (_a) {
278
- return [2 /*return*/, endpoint.api //
279
- .get("/envelopes/".concat(envelopeId, "/fields/").concat(fieldName, "/document"), { responseType: 'blob' })
280
- .then(function (r) { return r.data; })];
281
- });
282
- }); };
283
- /**
284
- * Get all of the envelopes that were sent using a given template.
285
- * NOTE: This endpoint will be retired soon. Its response is not paginated and it is typically used only to retrieve
286
- * "submitted data" for a template. A new endpoint will be introduced to provide this function more directly.
287
- * @deprecated
288
- */
289
- export var getEnvelopesByTemplateId = function (endpoint, templateId) { return __awaiter(void 0, void 0, void 0, function () {
290
- return __generator(this, function (_a) {
291
- return [2 /*return*/, endpoint.api //
292
- .get("/envelopes?template_id=".concat(templateId))
293
- .then(function (r) { return r.data; })];
294
- });
295
- }); };
296
- /**
297
- * Get a display URI for a given page in a file attached to an envelope document. These pages are rendered server-side
298
- * into PNG resources suitable for display in IMG tags although they may be used elsewhere. Note that these are intended
299
- * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
300
- */
301
- export var getEnvelopeDocumentPageDisplayUri = function (endpoint, envelopeId, documentId, page, type) {
302
- if (type === void 0) { type = 'original'; }
303
- return __awaiter(void 0, void 0, void 0, function () {
304
- return __generator(this, function (_a) {
305
- return [2 /*return*/, endpoint.api
306
- .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "/pages/").concat(page, "/image?type=").concat(type), { timeout: 20000 })
307
- .then(function (r) { return r.data; })];
308
- });
309
- });
310
- };
311
- var cachedEnvelopes = {};
312
- /**
313
- * Wrapper for `getEnvelope()` that limits queries to one every 2 seconds per template ID.
314
- * This is intended for use in component hierarchies that all rely on the same template
315
- * to avoid unnecessary repeat server calls.
316
- */
317
- export var throttledGetEnvelope = function (endpoint, envelopeId) {
318
- if (cachedEnvelopes[envelopeId] && cachedEnvelopes[envelopeId].loaded + 2000 < new Date().getTime()) {
319
- return cachedEnvelopes[envelopeId].envelope;
320
- }
321
- return getEnvelope(endpoint, envelopeId).then(function (envelope) {
322
- cachedEnvelopes[envelopeId] = { loaded: new Date().getTime(), envelope: envelope };
323
- return envelope;
324
- });
325
- };
326
- /**a
327
- * Lists all envelopes accessible by the caller, with optional filters.
328
- *
329
- * ```typescript
330
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
331
- *
332
- * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
333
- * ```
334
- */
335
- export var listEnvelopes = function (endpoint, params) {
336
- return endpoint.api //
337
- .post('/envelopes/list', params)
338
- .then(function (r) { return r.data; });
339
- };
@@ -1,15 +0,0 @@
1
- import { VerdocsEndpoint } from '../VerdocsEndpoint';
2
- export interface IInitials {
3
- id?: string;
4
- profile_id: string;
5
- url: string;
6
- created_at?: string;
7
- updated_at?: string;
8
- }
9
- /**
10
- * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
11
- * an initials block to be used for all initials fields in the document. Thus, this is typically called one time to
12
- * create and store an initials block. Thereafter, the ID of the initials block may be re-used for each initials field
13
- * to be "stamped" by the user.
14
- */
15
- export declare const createInitials: (endpoint: VerdocsEndpoint, name: string, initials: Blob) => Promise<IInitials>;
@@ -1,13 +0,0 @@
1
- /**
2
- * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
3
- * an initials block to be used for all initials fields in the document. Thus, this is typically called one time to
4
- * create and store an initials block. Thereafter, the ID of the initials block may be re-used for each initials field
5
- * to be "stamped" by the user.
6
- */
7
- export var createInitials = function (endpoint, name, initials) {
8
- var data = new FormData();
9
- data.append('initial', initials, name);
10
- return endpoint.api //
11
- .post("/initials", data)
12
- .then(function (r) { return r.data; });
13
- };
@@ -1,52 +0,0 @@
1
- /**
2
- * Various helpers to identify available operations for an envelope by a user.
3
- *
4
- * @module
5
- */
6
- import { IEnvelope, IEnvelopeSummary, IRecipient } from './Types';
7
- import { TSession } from '../Sessions/Types';
8
- /**
9
- * Check to see if the user owns the envelope.
10
- */
11
- export declare const userIsEnvelopeOwner: (session: TSession, envelope: IEnvelope | IEnvelopeSummary) => boolean;
12
- /**
13
- * Check to see if the user owns the envelope.
14
- */
15
- export declare const userIsEnvelopeRecipient: (session: TSession, envelope: IEnvelope | IEnvelopeSummary) => boolean;
16
- /**
17
- * Check to see if the envelope has pending actions.
18
- */
19
- export declare const envelopeIsActive: (envelope: IEnvelope | IEnvelopeSummary) => boolean;
20
- /**
21
- * Check to see if the envelope has been completed.
22
- */
23
- export declare const envelopeIsComplete: (envelope: IEnvelope | IEnvelopeSummary) => boolean;
24
- /**
25
- * Check to see if the user owns the envelope.
26
- */
27
- export declare const userCanCancelEnvelope: (session: TSession, envelope: IEnvelope | IEnvelopeSummary) => boolean;
28
- /**
29
- * Check to see if the user owns the envelope.
30
- */
31
- export declare const userCanFinishEnvelope: (session: TSession, envelope: IEnvelope | IEnvelopeSummary) => boolean;
32
- /**
33
- * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
34
- */
35
- export declare const recipientHasAction: (recipient: IRecipient) => boolean;
36
- /**
37
- * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
38
- */
39
- export declare const getRecipientsWithActions: (envelope: IEnvelope | IEnvelopeSummary) => IRecipient[];
40
- /**
41
- * Returns true if the recipient can act.
42
- */
43
- export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
44
- /**
45
- * Returns true if the user can act.
46
- */
47
- export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
48
- /**
49
- * Returns true if the user can act.
50
- */
51
- export declare const userCanSignNow: (session: TSession, envelope: IEnvelope | IEnvelopeSummary) => boolean | undefined;
52
- export declare const getNextRecipient: (envelope: IEnvelope | IEnvelopeSummary) => IRecipient;
@@ -1,84 +0,0 @@
1
- /**
2
- * Various helpers to identify available operations for an envelope by a user.
3
- *
4
- * @module
5
- */
6
- import { EnvelopeStates } from './Types';
7
- /**
8
- * Check to see if the user owns the envelope.
9
- */
10
- export var userIsEnvelopeOwner = function (session, envelope) {
11
- return envelope.profile_id === (session === null || session === void 0 ? void 0 : session.profile_id);
12
- };
13
- /**
14
- * Check to see if the user owns the envelope.
15
- */
16
- export var userIsEnvelopeRecipient = function (session, envelope) {
17
- return envelope.profile_id === (session === null || session === void 0 ? void 0 : session.profile_id);
18
- };
19
- /**
20
- * Check to see if the envelope has pending actions.
21
- */
22
- export var envelopeIsActive = function (envelope) {
23
- return envelope.status !== EnvelopeStates.COMPLETE && envelope.status !== EnvelopeStates.DECLINED && envelope.status !== EnvelopeStates.CANCELED;
24
- };
25
- /**
26
- * Check to see if the envelope has been completed.
27
- */
28
- export var envelopeIsComplete = function (envelope) { return envelope.status !== EnvelopeStates.COMPLETE; };
29
- /**
30
- * Check to see if the user owns the envelope.
31
- */
32
- export var userCanCancelEnvelope = function (session, envelope) {
33
- return userIsEnvelopeOwner(session, envelope) &&
34
- envelope.status !== EnvelopeStates.COMPLETE &&
35
- envelope.status !== EnvelopeStates.DECLINED &&
36
- envelope.status !== EnvelopeStates.CANCELED;
37
- };
38
- /**
39
- * Check to see if the user owns the envelope.
40
- */
41
- export var userCanFinishEnvelope = function (session, envelope) {
42
- return userIsEnvelopeOwner(session, envelope) &&
43
- envelope.status !== EnvelopeStates.COMPLETE &&
44
- envelope.status !== EnvelopeStates.DECLINED &&
45
- envelope.status !== EnvelopeStates.CANCELED;
46
- };
47
- /**
48
- * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
49
- */
50
- export var recipientHasAction = function (recipient) { return !['submitted', 'canceled', 'declined'].includes(recipient.status); };
51
- /**
52
- * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
53
- */
54
- export var getRecipientsWithActions = function (envelope) { return ((envelope === null || envelope === void 0 ? void 0 : envelope.recipients) || []).filter(recipientHasAction); };
55
- /**
56
- * Returns true if the recipient can act.
57
- */
58
- export var recipientCanAct = function (recipient, recipientsWithActions) { var _a; return recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence); };
59
- /**
60
- * Returns true if the user can act.
61
- */
62
- export var userCanAct = function (email, recipientsWithActions) {
63
- var _a;
64
- var recipient = recipientsWithActions.find(function (r) { return r.email === email; });
65
- return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
66
- };
67
- /**
68
- * Returns true if the user can act.
69
- */
70
- export var userCanSignNow = function (session, envelope) {
71
- if (!session) {
72
- return false;
73
- }
74
- var recipientsWithActions = getRecipientsWithActions(envelope);
75
- var myRecipient = recipientsWithActions.find(function (r) { return r.profile_id === (session === null || session === void 0 ? void 0 : session.profile_id) || r.email === (session === null || session === void 0 ? void 0 : session.email); });
76
- return (myRecipient &&
77
- envelopeIsActive(envelope) &&
78
- userIsEnvelopeRecipient(session, envelope) &&
79
- recipientCanAct(myRecipient, recipientsWithActions));
80
- };
81
- export var getNextRecipient = function (envelope) {
82
- var recipientsWithActions = getRecipientsWithActions(envelope);
83
- return recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0];
84
- };
@@ -1,89 +0,0 @@
1
- import { IEnvelope, IRecipient, IInPersonAccessKey, TAccessKey } from './Types';
2
- import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
- export interface IUpdateRecipientSubmitParams {
4
- action: 'submit';
5
- }
6
- export interface IUpdateRecipientDeclineParams {
7
- action: 'decline';
8
- }
9
- export interface IUpdateRecipientClaimEnvelope {
10
- action: 'owner_update';
11
- full_name: string;
12
- email: string;
13
- }
14
- export interface IUpdateRecipientStatus {
15
- new_full_name?: string;
16
- agreed?: boolean;
17
- action?: 'prepare' | 'update';
18
- }
19
- export interface IUpdateRecipientAgreedParams {
20
- action: 'update';
21
- agreed: boolean;
22
- }
23
- export interface IUpdateRecipientNameParams {
24
- action: 'update';
25
- new_full_name: string;
26
- }
27
- export interface IUpdateRecipientPrepareParams {
28
- action: 'prepare';
29
- recipients: IRecipient[];
30
- }
31
- /**
32
- * Update a recipient's status block
33
- */
34
- export declare const updateRecipient: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, params: IUpdateRecipientSubmitParams | IUpdateRecipientClaimEnvelope | IUpdateRecipientAgreedParams | IUpdateRecipientNameParams | IUpdateRecipientDeclineParams | IUpdateRecipientPrepareParams) => Promise<IRecipient>;
35
- /**
36
- * Submit an envelope (signing is finished). Note that all fields must be valid/completed for this to succeed.
37
- */
38
- export declare const envelopeRecipientSubmit: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<IRecipient>;
39
- /**
40
- * Decline to complete an envelope (signing will not terminated).
41
- */
42
- export declare const envelopeRecipientDecline: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<IRecipient>;
43
- /**
44
- * Claim / change ownership of an envelope. This is a special-case operation only available in certain workflows.
45
- */
46
- export declare const envelopeRecipientChangeOwner: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, email: string, fullName: string) => Promise<IRecipient>;
47
- /**
48
- * Agree to electronic signing.
49
- */
50
- export declare const envelopeRecipientAgree: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, agreed: boolean) => Promise<IRecipient>;
51
- /**
52
- * Change a recipient's name.
53
- */
54
- export declare const envelopeRecipientUpdateName: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, fullName: string) => Promise<IRecipient>;
55
- /**
56
- * Change a recipient's name.
57
- */
58
- export declare const envelopeRecipientPrepare: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string, recipients: IRecipient[]) => Promise<IRecipient>;
59
- export interface ISignerTokenResponse {
60
- recipient: IRecipient;
61
- envelope: IEnvelope;
62
- signerToken: string;
63
- inPersonAccessKey: IInPersonAccessKey;
64
- }
65
- /**
66
- * Get a signing token.
67
- */
68
- export declare const getSignerToken: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<ISignerTokenResponse>;
69
- export interface IInPersonLinkResponse {
70
- link: string;
71
- envelope_id: string;
72
- profile_id: string;
73
- role_name: string;
74
- access_key: string;
75
- expiration_date: string;
76
- type: TAccessKey;
77
- }
78
- /**
79
- * Get an in-person signing link.
80
- */
81
- export declare const getInPersonLink: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<IInPersonLinkResponse>;
82
- /**
83
- * Send a delegation request.
84
- */
85
- export declare const sendDelegate: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<IEnvelope>;
86
- /**
87
- * Resend a recipient's invitation.
88
- */
89
- export declare const resendInvitation: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<any>;