@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.
@@ -446,6 +446,7 @@ const VerdocsSign = class {
446
446
  el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
447
447
  (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
448
448
  this.focusedField = field.name;
449
+ this.updateAllFlags();
449
450
  }
450
451
  async handleFieldChange(field, e) {
451
452
  if (!e.target) {
@@ -609,22 +610,14 @@ const VerdocsSign = class {
609
610
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
610
611
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
611
612
  if (nextUnfilled) {
612
- const id = getFieldId(nextUnfilled);
613
- const el = document.getElementById(id);
614
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
615
- el === null || el === void 0 ? void 0 : el.focusField();
616
- this.focusedField = nextUnfilled.name;
613
+ this.focusFieldElement(nextUnfilled);
617
614
  }
618
615
  }
619
616
  handleNextOptional() {
620
617
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
621
618
  const next = this.getNextFieldFromList(unfilledOptional);
622
619
  if (next) {
623
- const id = getFieldId(next);
624
- const el = document.getElementById(id);
625
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });
626
- el === null || el === void 0 ? void 0 : el.focusField();
627
- this.focusedField = next.name;
620
+ this.focusFieldElement(next);
628
621
  }
629
622
  }
630
623
  getRecipientFields() {
@@ -712,16 +705,11 @@ const VerdocsSign = class {
712
705
  return fields[nextFocusedIndex];
713
706
  }
714
707
  handlePrev() {
715
- var _a;
716
708
  const allFields = this.getSortedFillableFields();
717
709
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
718
710
  if (focusedIndex > 0) {
719
711
  const prevField = allFields[focusedIndex - 1];
720
- const id = getFieldId(prevField);
721
- const el = document.getElementById(id);
722
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center' });
723
- (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
724
- this.focusedField = prevField.name;
712
+ this.focusFieldElement(prevField);
725
713
  }
726
714
  }
727
715
  updateAllFlags() {
@@ -743,7 +731,7 @@ const VerdocsSign = class {
743
731
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
744
732
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
745
733
  // should guide the user to the current task if it's incomplete.
746
- if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
734
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
747
735
  nextField = focusedFieldObj;
748
736
  }
749
737
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -785,14 +773,11 @@ const VerdocsSign = class {
785
773
  label,
786
774
  showSkip,
787
775
  onSkip: () => {
776
+ this.focusedField = nextField.name;
788
777
  this.handleNext();
789
778
  },
790
779
  onClick: () => {
791
- var _a;
792
- const id = getFieldId(nextField);
793
- const el = document.getElementById(id);
794
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth', block: 'center' });
795
- (_a = el === null || el === void 0 ? void 0 : el.focusField) === null || _a === void 0 ? void 0 : _a.call(el);
780
+ this.focusFieldElement(nextField);
796
781
  },
797
782
  });
798
783
  }
@@ -808,6 +793,12 @@ const VerdocsSign = class {
808
793
  return;
809
794
  }
810
795
  el.setAttribute('attached', '1');
796
+ el.addEventListener('focusin', () => {
797
+ if (this.focusedField !== field.name) {
798
+ this.focusedField = field.name;
799
+ this.updateAllFlags();
800
+ }
801
+ });
811
802
  el.addEventListener('input', (e) => {
812
803
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
813
804
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -872,6 +863,7 @@ const VerdocsSign = class {
872
863
  });
873
864
  el.addEventListener('adopt', () => {
874
865
  this.focusedField = field.name;
866
+ this.updateAllFlags();
875
867
  this.adoptingSignature = true;
876
868
  });
877
869
  el.setAttribute('templateid', this.envelope.template_id);