@verdocs/js-sdk 3.1.8 → 3.2.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.
- package/Envelopes/Envelopes.d.ts +1 -1
- package/Envelopes/Envelopes.js +9 -4
- package/Envelopes/Types.d.ts +2 -0
- package/Templates/Pages.js +6 -1
- package/Templates/Templates.d.ts +1 -1
- package/Templates/Templates.js +2 -2
- package/Templates/Types.d.ts +6 -7
- package/VerdocsEndpoint.js +9 -0
- package/package.json +3 -2
package/Envelopes/Envelopes.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export declare const getEnvelopeRecipients: (endpoint: VerdocsEndpoint, envelope
|
|
|
133
133
|
/**
|
|
134
134
|
* Get all metadata for an Envelope.
|
|
135
135
|
*/
|
|
136
|
-
export declare const getEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string
|
|
136
|
+
export declare const getEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Promise<IEnvelope>;
|
|
137
137
|
/**
|
|
138
138
|
* Get all metadata for an Envelope.
|
|
139
139
|
*/
|
package/Envelopes/Envelopes.js
CHANGED
|
@@ -136,10 +136,10 @@ export var getEnvelopeRecipients = function (endpoint, envelopeId) { return __aw
|
|
|
136
136
|
/**
|
|
137
137
|
* Get all metadata for an Envelope.
|
|
138
138
|
*/
|
|
139
|
-
export var getEnvelope = function (endpoint, envelopeId
|
|
139
|
+
export var getEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
140
140
|
return __generator(this, function (_a) {
|
|
141
141
|
return [2 /*return*/, endpoint.api //
|
|
142
|
-
.get("/envelopes/".concat(envelopeId)
|
|
142
|
+
.get("/envelopes/".concat(envelopeId))
|
|
143
143
|
.then(function (r) { return r.data; })];
|
|
144
144
|
});
|
|
145
145
|
}); };
|
|
@@ -258,7 +258,12 @@ export var getEnvelopesByTemplateId = function (endpoint, templateId) { return _
|
|
|
258
258
|
export var getEnvelopeDocumentPageDisplayUri = function (endpoint, envelopeId, documentId, page) { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
259
|
return __generator(this, function (_a) {
|
|
260
260
|
return [2 /*return*/, endpoint.api
|
|
261
|
-
.get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "/pages/").concat(page, "/image"), {
|
|
261
|
+
.get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "/pages/").concat(page, "/image"), {
|
|
262
|
+
timeout: 20000,
|
|
263
|
+
'axios-retry': {
|
|
264
|
+
retries: 5,
|
|
265
|
+
},
|
|
266
|
+
})
|
|
262
267
|
.then(function (r) { return r.data; })];
|
|
263
268
|
});
|
|
264
269
|
}); };
|
|
@@ -272,7 +277,7 @@ export var throttledGetEnvelope = function (endpoint, envelopeId) {
|
|
|
272
277
|
if (cachedEnvelopes[envelopeId] && cachedEnvelopes[envelopeId].loaded + 2000 < new Date().getTime()) {
|
|
273
278
|
return cachedEnvelopes[envelopeId].envelope;
|
|
274
279
|
}
|
|
275
|
-
return getEnvelope(endpoint, envelopeId
|
|
280
|
+
return getEnvelope(endpoint, envelopeId).then(function (envelope) {
|
|
276
281
|
cachedEnvelopes[envelopeId] = { loaded: new Date().getTime(), envelope: envelope };
|
|
277
282
|
return envelope;
|
|
278
283
|
});
|
package/Envelopes/Types.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export type TRecipientType = `${RecipientTypes}`;
|
|
|
54
54
|
export interface IEnvelopesSearchResultEntry {
|
|
55
55
|
id: string;
|
|
56
56
|
canceled_at: string;
|
|
57
|
+
/** @deprecated. New envelopes may have more than one certificate attached. */
|
|
57
58
|
certificate_document_id: string;
|
|
58
59
|
/** @deprecated. New envelopes may have more than one document attached. */
|
|
59
60
|
envelope_document_id: string;
|
|
@@ -244,6 +245,7 @@ export interface IEnvelope {
|
|
|
244
245
|
reminder_id: string | null;
|
|
245
246
|
/** @deprecated. New envelopes will support more than one document attachment so new code should no longer refer to this field. */
|
|
246
247
|
envelope_document_id: string;
|
|
248
|
+
/** @deprecated. New envelopes may have more than one certificate attached. */
|
|
247
249
|
certificate_document_id: string | null;
|
|
248
250
|
/** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
|
|
249
251
|
visibility: 'private' | 'shared';
|
package/Templates/Pages.js
CHANGED
|
@@ -20,7 +20,12 @@ export var editPage = function (endpoint, templateId, sequence) {
|
|
|
20
20
|
export var getPage = function (endpoint, templateId, sequence, thumbnail) {
|
|
21
21
|
if (thumbnail === void 0) { thumbnail = false; }
|
|
22
22
|
return endpoint.api //
|
|
23
|
-
.get("/templates/".concat(templateId, "/pages/").concat(sequence).concat(thumbnail ? '?thumbnail=true' : '')
|
|
23
|
+
.get("/templates/".concat(templateId, "/pages/").concat(sequence).concat(thumbnail ? '?thumbnail=true' : ''), {
|
|
24
|
+
timeout: 20000,
|
|
25
|
+
'axios-retry': {
|
|
26
|
+
retries: 5,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
24
29
|
.then(function (r) { return r.data; });
|
|
25
30
|
};
|
|
26
31
|
/**
|
package/Templates/Templates.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemp
|
|
|
33
33
|
* const template = await Templates.getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export declare const getTemplate: (endpoint: VerdocsEndpoint, templateId: string
|
|
36
|
+
export declare const getTemplate: (endpoint: VerdocsEndpoint, templateId: string) => Promise<ITemplate>;
|
|
37
37
|
/**
|
|
38
38
|
* Get owner information for a template.
|
|
39
39
|
*
|
package/Templates/Templates.js
CHANGED
|
@@ -66,9 +66,9 @@ export var getTemplates = function (endpoint, params) {
|
|
|
66
66
|
* const template = await Templates.getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
export var getTemplate = function (endpoint, templateId
|
|
69
|
+
export var getTemplate = function (endpoint, templateId) {
|
|
70
70
|
return endpoint.api //
|
|
71
|
-
.get("/templates/".concat(templateId)
|
|
71
|
+
.get("/templates/".concat(templateId))
|
|
72
72
|
.then(function (r) { return r.data; });
|
|
73
73
|
};
|
|
74
74
|
/**
|
package/Templates/Types.d.ts
CHANGED
|
@@ -290,17 +290,16 @@ export interface IPage {
|
|
|
290
290
|
* @deprecated. New code should use `sequence`
|
|
291
291
|
*/
|
|
292
292
|
page_number: number;
|
|
293
|
-
thumbnail_url?: string;
|
|
294
293
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
294
|
+
* @deprecated. Clients should not attempt to access images directly. Call `getTemplateDocumentPageDisplayUri()`
|
|
295
|
+
* instead.
|
|
297
296
|
*/
|
|
298
|
-
|
|
297
|
+
thumbnail_url?: string;
|
|
299
298
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
299
|
+
* @deprecated. Clients should not attempt to access images directly. Call `getTemplateDocumentPageDisplayUri()`
|
|
300
|
+
* instead.
|
|
302
301
|
*/
|
|
303
|
-
|
|
302
|
+
image_uri?: string | null;
|
|
304
303
|
template_document?: ITemplateDocument;
|
|
305
304
|
fields?: ITemplateField[];
|
|
306
305
|
}
|
package/VerdocsEndpoint.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import axiosRetry from 'axios-retry';
|
|
1
2
|
import axios from 'axios';
|
|
2
3
|
import { decodeAccessTokenBody } from './Utils/Token';
|
|
3
4
|
import globalThis from './Utils/globalThis';
|
|
@@ -61,6 +62,14 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
61
62
|
this.sessionType = (options === null || options === void 0 ? void 0 : options.sessionType) || 'user';
|
|
62
63
|
this.clientID = (options === null || options === void 0 ? void 0 : options.clientID) || 'not-set';
|
|
63
64
|
this.api = axios.create({ baseURL: this.baseURL, timeout: this.timeout });
|
|
65
|
+
// We set the default retries to zero because we only actually want this feature on certain calls for now
|
|
66
|
+
axiosRetry(this.api, {
|
|
67
|
+
retries: 0,
|
|
68
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
69
|
+
onRetry: function (retryCount, error, requestConfig) {
|
|
70
|
+
window.console.debug("[JS_SDK] Retrying request (".concat(retryCount, ")"), error.message, requestConfig.url);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
64
73
|
}
|
|
65
74
|
VerdocsEndpoint.prototype.setDefault = function () {
|
|
66
75
|
globalThis[ENDPOINT_KEY] = this;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdocs/js-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": "https://github.com/Verdocs/js-sdk",
|
|
6
6
|
"description": "Verdocs JS SDK",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"axios": "^1.3.4"
|
|
49
|
+
"axios": "^1.3.4",
|
|
50
|
+
"axios-retry": "^3.4.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"typescript": "^4.7.3"
|