@verdocs/js-sdk 4.1.0 → 4.1.1

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
@@ -281,6 +281,8 @@ interface IEnvelopeDocument {
281
281
  mime: string;
282
282
  created_at: string;
283
283
  updated_at: string;
284
+ // @deprecated. Use pages instead.
285
+ page_numbers: number;
284
286
  envelope?: IEnvelope | null;
285
287
  template_document?: ITemplateDocument | null;
286
288
  fields?: IEnvelopeField[];
@@ -561,6 +563,8 @@ interface ITemplate {
561
563
  roles?: IRole[];
562
564
  documents?: ITemplateDocument[];
563
565
  fields?: ITemplateField[];
566
+ // @deprecated. Use documents instead.
567
+ template_documents?: ITemplateDocument[];
564
568
  }
565
569
  /**
566
570
  * A file attached to the template for display/signing.
@@ -578,6 +582,8 @@ interface ITemplateDocument {
578
582
  }[];
579
583
  created_at: string | null;
580
584
  updated_at: string | null;
585
+ // @deprecated. Use pages instead.
586
+ page_numbers?: number;
581
587
  template?: ITemplate;
582
588
  }
583
589
  interface ITemplateField {
@@ -609,6 +615,8 @@ interface ITemplateField {
609
615
  placeholder: string | null;
610
616
  /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
611
617
  group: string | null;
618
+ // @deprecated. Use settings instead.
619
+ setting?: ITemplateFieldSetting | null;
612
620
  }
613
621
  interface ITextFieldSetting {
614
622
  x: number;
package/dist/index.d.ts CHANGED
@@ -281,6 +281,8 @@ interface IEnvelopeDocument {
281
281
  mime: string;
282
282
  created_at: string;
283
283
  updated_at: string;
284
+ // @deprecated. Use pages instead.
285
+ page_numbers: number;
284
286
  envelope?: IEnvelope | null;
285
287
  template_document?: ITemplateDocument | null;
286
288
  fields?: IEnvelopeField[];
@@ -561,6 +563,8 @@ interface ITemplate {
561
563
  roles?: IRole[];
562
564
  documents?: ITemplateDocument[];
563
565
  fields?: ITemplateField[];
566
+ // @deprecated. Use documents instead.
567
+ template_documents?: ITemplateDocument[];
564
568
  }
565
569
  /**
566
570
  * A file attached to the template for display/signing.
@@ -578,6 +582,8 @@ interface ITemplateDocument {
578
582
  }[];
579
583
  created_at: string | null;
580
584
  updated_at: string | null;
585
+ // @deprecated. Use pages instead.
586
+ page_numbers?: number;
581
587
  template?: ITemplate;
582
588
  }
583
589
  interface ITemplateField {
@@ -609,6 +615,8 @@ interface ITemplateField {
609
615
  placeholder: string | null;
610
616
  /** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
611
617
  group: string | null;
618
+ // @deprecated. Use settings instead.
619
+ setting?: ITemplateFieldSetting | null;
612
620
  }
613
621
  interface ITextFieldSetting {
614
622
  x: number;
package/dist/index.js CHANGED
@@ -1219,7 +1219,19 @@ const getEnvelopeRecipients = async (endpoint, envelopeId) => endpoint.api //
1219
1219
  */
1220
1220
  const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
1221
1221
  .get(`/envelopes/${envelopeId}`)
1222
- .then((r) => r.data);
1222
+ .then((r) => {
1223
+ const envelope = r.data;
1224
+ // Post-process the envelope to upgrade to new data fields
1225
+ envelope.documents?.forEach((document) => {
1226
+ if (!document.order) {
1227
+ document.order = 0;
1228
+ }
1229
+ if (document.page_numbers) {
1230
+ document.pages = document.page_numbers;
1231
+ }
1232
+ });
1233
+ return envelope;
1234
+ });
1223
1235
  /**
1224
1236
  * Get an Envelope Document
1225
1237
  */
@@ -2142,7 +2154,27 @@ const getTemplates = (endpoint, params) => endpoint.api //
2142
2154
  */
2143
2155
  const getTemplate = (endpoint, templateId) => endpoint.api //
2144
2156
  .get(`/templates/${templateId}`)
2145
- .then((r) => r.data);
2157
+ .then((r) => {
2158
+ const template = r.data;
2159
+ // Post-process the template to upgrade to new data fields
2160
+ if (!template.documents && template.template_documents) {
2161
+ template.documents = template.template_documents;
2162
+ }
2163
+ template.documents?.forEach((document) => {
2164
+ if (!document.order) {
2165
+ document.order = 0;
2166
+ }
2167
+ if (document.page_numbers) {
2168
+ document.pages = document.page_numbers;
2169
+ }
2170
+ });
2171
+ template.fields?.forEach((field) => {
2172
+ if (field.setting) {
2173
+ field.settings = field.setting;
2174
+ }
2175
+ });
2176
+ return template;
2177
+ });
2146
2178
  /**
2147
2179
  * Get owner information for a template.
2148
2180
  *