@verdocs/js-sdk 4.2.86 → 4.2.88

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/dist/index.mjs CHANGED
@@ -1067,6 +1067,7 @@ const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
1067
1067
  // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
1068
1068
  // Also see globalThis for comments about why we're doing this in the first place.
1069
1069
  const ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
1070
+ const BETA_ORIGINS = ['https://beta.verdocs.com', 'https://stage.verdocs.com', 'http://localhost:6006', 'http://localhost:5173'];
1070
1071
  const requestLogger = (r) => {
1071
1072
  // tslint:disable-next-line
1072
1073
  console.debug(`[JS-SDK] ${r.method.toUpperCase()} ${r.baseURL}${r.url}`, r.data ? JSON.stringify(r.data) : '');
@@ -1097,9 +1098,7 @@ class VerdocsEndpoint {
1097
1098
  environment = 'verdocs';
1098
1099
  sessionType = 'user';
1099
1100
  persist = true;
1100
- baseURL = (window.location.origin === 'https://beta.verdocs.com' || window.location.origin === 'https://stage.verdocs.com'
1101
- ? 'https://stage-api.verdocs.com'
1102
- : 'https://api.verdocs.com');
1101
+ baseURL = BETA_ORIGINS.includes(window.location.origin) ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
1103
1102
  clientID = 'not-set';
1104
1103
  timeout = 60000;
1105
1104
  token = null;
@@ -1578,9 +1577,7 @@ const getFieldAttachment = async (endpoint, envelopeId, fieldName) => endpoint.a
1578
1577
  * into PNG resources suitable for display in IMG tags although they may be used elsewhere. Note that these are intended
1579
1578
  * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
1580
1579
  */
1581
- const getEnvelopeDocumentPageDisplayUri = async (endpoint, envelopeId, documentId, page, type = 'original') => endpoint.api
1582
- .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}/pages/${page}/image?type=${type}`, { timeout: 20000 })
1583
- .then((r) => r.data);
1580
+ const getEnvelopeDocumentPageDisplayUri = async (endpoint, documentId, page, variant = 'original') => endpoint.api.get(`/v2/envelope-documents/page-image/${documentId}/${variant}/${page}`, { timeout: 20000 }).then((r) => r.data);
1584
1581
  /**
1585
1582
  * Lists all envelopes accessible by the caller, with optional filters.
1586
1583
  *
@@ -2896,7 +2893,7 @@ const getTemplateDocumentThumbnail = async (endpoint, templateId, documentId) =>
2896
2893
  * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants. The
2897
2894
  * original asset may be obtained by calling `getTemplateDocumentFile()` or similar.
2898
2895
  */
2899
- const getTemplateDocumentPageDisplayUri = async (endpoint, templateId, documentId, page) => endpoint.api.get(`/templates/${templateId}/documents/${documentId}/pages/${page}/image`).then((r) => r.data);
2896
+ const getTemplateDocumentPageDisplayUri = async (endpoint, documentId, page, variant = 'original') => endpoint.api.get(`/v2/template-documents/page-image/${documentId}/${variant}/${page}`, { timeout: 20000 }).then((r) => r.data);
2900
2897
 
2901
2898
  /**
2902
2899
  * Get all defined validators