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