@verdocs/js-sdk 4.2.148 → 5.0.2

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.d.mts CHANGED
@@ -381,6 +381,7 @@ interface IUser {
381
381
  interface IWebhookEvents {
382
382
  envelope_created: boolean;
383
383
  envelope_completed: boolean;
384
+ envelope_updated: boolean;
384
385
  envelope_canceled: boolean;
385
386
  template_created: boolean;
386
387
  template_updated: boolean;
package/dist/index.d.ts CHANGED
@@ -381,6 +381,7 @@ interface IUser {
381
381
  interface IWebhookEvents {
382
382
  envelope_created: boolean;
383
383
  envelope_completed: boolean;
384
+ envelope_updated: boolean;
384
385
  envelope_canceled: boolean;
385
386
  template_created: boolean;
386
387
  template_updated: boolean;
package/dist/index.js CHANGED
@@ -2953,31 +2953,34 @@ const getTemplates = (endpoint, params) => endpoint.api //
2953
2953
  * const template = await getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
2954
2954
  * ```
2955
2955
  */
2956
- const getTemplate = (endpoint, templateId) => endpoint.api //
2957
- .get(`/v2/templates/${templateId}`)
2958
- .then((r) => {
2959
- const template = r.data;
2960
- window?.console?.log('[JS_SDK] Post-processing template', template);
2961
- // Post-process the template to upgrade to new data fields
2962
- if (!template.documents && template.template_documents) {
2963
- template.documents = template.template_documents;
2964
- }
2965
- template.documents?.forEach((document) => {
2966
- if (!document.order) {
2967
- document.order = 0;
2968
- }
2969
- if (document.page_numbers) {
2970
- document.pages = document.page_numbers;
2971
- }
2972
- });
2973
- // Temporary upgrade from legacy app
2974
- template.fields?.forEach((field) => {
2975
- if (field.setting) {
2976
- field.settings = field.setting;
2956
+ const getTemplate = (endpoint, templateId) => {
2957
+ window?.console?.log('[JS_SDK] Loading template', templateId);
2958
+ return endpoint.api //
2959
+ .get(`/v2/templates/${templateId}`)
2960
+ .then((r) => {
2961
+ const template = r.data;
2962
+ window?.console?.log('[JS_SDK] Post-processing template', template);
2963
+ // Post-process the template to upgrade to new data fields
2964
+ if (!template.documents && template.template_documents) {
2965
+ template.documents = template.template_documents;
2977
2966
  }
2967
+ template.documents?.forEach((document) => {
2968
+ if (!document.order) {
2969
+ document.order = 0;
2970
+ }
2971
+ if (document.page_numbers) {
2972
+ document.pages = document.page_numbers;
2973
+ }
2974
+ });
2975
+ // Temporary upgrade from legacy app
2976
+ template.fields?.forEach((field) => {
2977
+ if (field.setting) {
2978
+ field.settings = field.setting;
2979
+ }
2980
+ });
2981
+ return template;
2978
2982
  });
2979
- return template;
2980
- });
2983
+ };
2981
2984
  const ALLOWED_CREATE_FIELDS = [
2982
2985
  'name',
2983
2986
  'is_personal',