@verdocs/web-sdk 4.2.117 → 4.2.118

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.
@@ -334,19 +334,7 @@ const VerdocsSign = class {
334
334
  }
335
335
  getSortedFillableFields() {
336
336
  const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
337
- recipientFields.sort((a, b) => {
338
- const aX = a.x || 0;
339
- const aY = a.y || 0;
340
- const bX = b.x || 0;
341
- const bY = b.y || 0;
342
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
343
- // left to right. But Y coordinates are inverted in PDFs. The reason for
344
- // the division is because no human makes perfect templates and frequently
345
- // two fields on the "same line" will be slightly offset vertically.
346
- const divaY = Math.floor(aY / 5);
347
- const divbY = Math.floor(bY / 5);
348
- return divbY !== divaY ? divbY - divaY : aX - bX;
349
- });
337
+ jsSdk.sortFields(recipientFields);
350
338
  return recipientFields;
351
339
  }
352
340
  async handleNext() {
@@ -380,19 +368,7 @@ const VerdocsSign = class {
380
368
  }
381
369
  // Find and focus the next incomplete` field (that is fillable)
382
370
  const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
383
- emptyFields.sort((a, b) => {
384
- const aX = a.x || 0;
385
- const aY = a.y || 0;
386
- const bX = b.x || 0;
387
- const bY = b.y || 0;
388
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
389
- // left to right. But Y coordinates are inverted in PDFs. The reason for
390
- // the division is because no human makes perfect templates and frequently
391
- // two fields on the "same line" will be slightly offset vertically.
392
- const divaY = Math.floor(aY / 5);
393
- const divbY = Math.floor(bY / 5);
394
- return divbY !== divaY ? divbY - divaY : aX - bX;
395
- });
371
+ jsSdk.sortFields(emptyFields);
396
372
  const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
397
373
  let nextFocusedIndex = focusedIndex + 1;
398
374
  if (nextFocusedIndex >= emptyFields.length) {
@@ -1,7 +1,7 @@
1
1
  import { Host, Fragment, h } from "@stencil/core";
2
- import { getEnvelope, integerSequence, isValidEmail, isValidPhone, submitKbaPin, updateEnvelopeFieldInitials } from "@verdocs/js-sdk";
3
- import { updateEnvelopeFieldSignature, uploadEnvelopeFieldAttachment, VerdocsEndpoint, updateEnvelopeField } from "@verdocs/js-sdk";
2
+ import { updateEnvelopeFieldSignature, uploadEnvelopeFieldAttachment, VerdocsEndpoint, updateEnvelopeField, sortFields } from "@verdocs/js-sdk";
4
3
  import { fullNameToInitials, startSigningSession, deleteEnvelopeFieldAttachment, getKbaStep } from "@verdocs/js-sdk";
4
+ import { getEnvelope, integerSequence, isValidEmail, isValidPhone, submitKbaPin, updateEnvelopeFieldInitials } from "@verdocs/js-sdk";
5
5
  import { createInitials, createSignature, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, formatFullName } from "@verdocs/js-sdk";
6
6
  import { getFieldId, renderDocumentField, saveAttachment, updateDocumentFieldValue } from "../../../utils/utils";
7
7
  import { createTemplateFieldStoreFromEnvelope } from "../../../utils/TemplateFieldStore";
@@ -338,19 +338,7 @@ export class VerdocsSign {
338
338
  }
339
339
  getSortedFillableFields() {
340
340
  const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
341
- recipientFields.sort((a, b) => {
342
- const aX = a.x || 0;
343
- const aY = a.y || 0;
344
- const bX = b.x || 0;
345
- const bY = b.y || 0;
346
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
347
- // left to right. But Y coordinates are inverted in PDFs. The reason for
348
- // the division is because no human makes perfect templates and frequently
349
- // two fields on the "same line" will be slightly offset vertically.
350
- const divaY = Math.floor(aY / 5);
351
- const divbY = Math.floor(bY / 5);
352
- return divbY !== divaY ? divbY - divaY : aX - bX;
353
- });
341
+ sortFields(recipientFields);
354
342
  return recipientFields;
355
343
  }
356
344
  async handleNext() {
@@ -384,19 +372,7 @@ export class VerdocsSign {
384
372
  }
385
373
  // Find and focus the next incomplete` field (that is fillable)
386
374
  const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
387
- emptyFields.sort((a, b) => {
388
- const aX = a.x || 0;
389
- const aY = a.y || 0;
390
- const bX = b.x || 0;
391
- const bY = b.y || 0;
392
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
393
- // left to right. But Y coordinates are inverted in PDFs. The reason for
394
- // the division is because no human makes perfect templates and frequently
395
- // two fields on the "same line" will be slightly offset vertically.
396
- const divaY = Math.floor(aY / 5);
397
- const divbY = Math.floor(bY / 5);
398
- return divbY !== divaY ? divbY - divaY : aX - bX;
399
- });
375
+ sortFields(emptyFields);
400
376
  const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
401
377
  let nextFocusedIndex = focusedIndex + 1;
402
378
  if (nextFocusedIndex >= emptyFields.length) {
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
2
- import { VerdocsEndpoint, startSigningSession, getKbaStep, envelopeRecipientAgree, envelopeRecipientDecline, getEnvelope, updateEnvelopeField, createSignature, updateEnvelopeFieldSignature, createInitials, updateEnvelopeFieldInitials, isValidPhone, isValidEmail, envelopeRecipientSubmit, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, formatFullName, fullNameToInitials, submitKbaPin, integerSequence } from '@verdocs/js-sdk';
2
+ import { VerdocsEndpoint, startSigningSession, getKbaStep, envelopeRecipientAgree, envelopeRecipientDecline, getEnvelope, updateEnvelopeField, createSignature, updateEnvelopeFieldSignature, createInitials, updateEnvelopeFieldInitials, isValidPhone, isValidEmail, sortFields, envelopeRecipientSubmit, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, formatFullName, fullNameToInitials, submitKbaPin, integerSequence } from '@verdocs/js-sdk';
3
3
  import { a as saveAttachment, u as updateDocumentFieldValue, r as renderDocumentField, g as getFieldId } from './utils.js';
4
4
  import { c as createTemplateFieldStoreFromEnvelope } from './TemplateFieldStore.js';
5
5
  import { V as VerdocsToast } from './Toast.js';
@@ -336,19 +336,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
336
336
  }
337
337
  getSortedFillableFields() {
338
338
  const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
339
- recipientFields.sort((a, b) => {
340
- const aX = a.x || 0;
341
- const aY = a.y || 0;
342
- const bX = b.x || 0;
343
- const bY = b.y || 0;
344
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
345
- // left to right. But Y coordinates are inverted in PDFs. The reason for
346
- // the division is because no human makes perfect templates and frequently
347
- // two fields on the "same line" will be slightly offset vertically.
348
- const divaY = Math.floor(aY / 5);
349
- const divbY = Math.floor(bY / 5);
350
- return divbY !== divaY ? divbY - divaY : aX - bX;
351
- });
339
+ sortFields(recipientFields);
352
340
  return recipientFields;
353
341
  }
354
342
  async handleNext() {
@@ -382,19 +370,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
382
370
  }
383
371
  // Find and focus the next incomplete` field (that is fillable)
384
372
  const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
385
- emptyFields.sort((a, b) => {
386
- const aX = a.x || 0;
387
- const aY = a.y || 0;
388
- const bX = b.x || 0;
389
- const bY = b.y || 0;
390
- // NOTE: Logic looks a little strange X vs Y. It's because we go top down,
391
- // left to right. But Y coordinates are inverted in PDFs. The reason for
392
- // the division is because no human makes perfect templates and frequently
393
- // two fields on the "same line" will be slightly offset vertically.
394
- const divaY = Math.floor(aY / 5);
395
- const divbY = Math.floor(bY / 5);
396
- return divbY !== divaY ? divbY - divaY : aX - bX;
397
- });
373
+ sortFields(emptyFields);
398
374
  const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
399
375
  let nextFocusedIndex = focusedIndex + 1;
400
376
  if (nextFocusedIndex >= emptyFields.length) {