@verdocs/js-sdk 3.1.7 → 3.1.10

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.
@@ -255,9 +255,18 @@ export var getEnvelopesByTemplateId = function (endpoint, templateId) { return _
255
255
  * into PNG resources suitable for display in IMG tags although they may be used elsewhere. Note that these are intended
256
256
  * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
257
257
  */
258
- export var getEnvelopeDocumentPageDisplayUri = function (endpoint, envelopeId, documentId, page) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
259
- return [2 /*return*/, endpoint.api.get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "/pages/").concat(page, "/image")).then(function (r) { return r.data; })];
260
- }); }); };
258
+ export var getEnvelopeDocumentPageDisplayUri = function (endpoint, envelopeId, documentId, page) { return __awaiter(void 0, void 0, void 0, function () {
259
+ return __generator(this, function (_a) {
260
+ return [2 /*return*/, endpoint.api
261
+ .get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "/pages/").concat(page, "/image"), {
262
+ timeout: 20000,
263
+ 'axios-retry': {
264
+ retries: 5,
265
+ },
266
+ })
267
+ .then(function (r) { return r.data; })];
268
+ });
269
+ }); };
261
270
  var cachedEnvelopes = {};
262
271
  /**
263
272
  * Wrapper for `getEnvelope()` that limits queries to one every 2 seconds per template ID.
@@ -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
  /**
@@ -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.1.7",
3
+ "version": "3.1.10",
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"