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