@hubsync/esign-web-sdk 6.9.9 → 6.9.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.
@@ -471,6 +471,7 @@ export class VerdocsSign {
471
471
  el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
472
472
  (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
473
473
  this.focusedField = field.name;
474
+ this.updateAllFlags();
474
475
  }
475
476
  async handleFieldChange(field, e) {
476
477
  if (!e.target) {
@@ -634,22 +635,14 @@ export class VerdocsSign {
634
635
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
635
636
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
636
637
  if (nextUnfilled) {
637
- const id = getFieldId(nextUnfilled);
638
- const el = document.getElementById(id);
639
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
640
- el === null || el === void 0 ? void 0 : el.focusField();
641
- this.focusedField = nextUnfilled.name;
638
+ this.focusFieldElement(nextUnfilled);
642
639
  }
643
640
  }
644
641
  handleNextOptional() {
645
642
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
646
643
  const next = this.getNextFieldFromList(unfilledOptional);
647
644
  if (next) {
648
- const id = getFieldId(next);
649
- const el = document.getElementById(id);
650
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
651
- el === null || el === void 0 ? void 0 : el.focusField();
652
- this.focusedField = next.name;
645
+ this.focusFieldElement(next);
653
646
  }
654
647
  }
655
648
  getRecipientFields() {
@@ -737,16 +730,11 @@ export class VerdocsSign {
737
730
  return fields[nextFocusedIndex];
738
731
  }
739
732
  handlePrev() {
740
- var _a;
741
733
  const allFields = this.getSortedFillableFields();
742
734
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
743
735
  if (focusedIndex > 0) {
744
736
  const prevField = allFields[focusedIndex - 1];
745
- const id = getFieldId(prevField);
746
- const el = document.getElementById(id);
747
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center' });
748
- (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
749
- this.focusedField = prevField.name;
737
+ this.focusFieldElement(prevField);
750
738
  }
751
739
  }
752
740
  updateAllFlags() {
@@ -768,7 +756,7 @@ export class VerdocsSign {
768
756
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
769
757
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
770
758
  // should guide the user to the current task if it's incomplete.
771
- if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
759
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
772
760
  nextField = focusedFieldObj;
773
761
  }
774
762
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -810,14 +798,11 @@ export class VerdocsSign {
810
798
  label,
811
799
  showSkip,
812
800
  onSkip: () => {
801
+ this.focusedField = nextField.name;
813
802
  this.handleNext();
814
803
  },
815
804
  onClick: () => {
816
- var _a;
817
- const id = getFieldId(nextField);
818
- const el = document.getElementById(id);
819
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center' });
820
- (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
805
+ this.focusFieldElement(nextField);
821
806
  },
822
807
  });
823
808
  }
@@ -833,6 +818,12 @@ export class VerdocsSign {
833
818
  return;
834
819
  }
835
820
  el.setAttribute('attached', '1');
821
+ el.addEventListener('focusin', () => {
822
+ if (this.focusedField !== field.name) {
823
+ this.focusedField = field.name;
824
+ this.updateAllFlags();
825
+ }
826
+ });
836
827
  el.addEventListener('input', (e) => {
837
828
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
838
829
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -897,6 +888,7 @@ export class VerdocsSign {
897
888
  });
898
889
  el.addEventListener('adopt', () => {
899
890
  this.focusedField = field.name;
891
+ this.updateAllFlags();
900
892
  this.adoptingSignature = true;
901
893
  });
902
894
  el.setAttribute('templateid', this.envelope.template_id);