@hubsync/esign-web-sdk 6.9.9 → 6.9.11

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,17 @@ 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();
475
+ }
476
+ handleStartSigning() {
477
+ this.markEnvelopeStarted();
478
+ this.signingProgressMode = 'signing';
479
+ const fields = this.getSortedFillableFields();
480
+ const startField = fields.find(field => !this.isFieldActuallyFilled(field)) || fields[0];
481
+ if (startField) {
482
+ this.focusFieldElement(startField);
483
+ }
484
+ this.adoptingSignature = true;
474
485
  }
475
486
  async handleFieldChange(field, e) {
476
487
  if (!e.target) {
@@ -634,22 +645,14 @@ export class VerdocsSign {
634
645
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
635
646
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
636
647
  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;
648
+ this.focusFieldElement(nextUnfilled);
642
649
  }
643
650
  }
644
651
  handleNextOptional() {
645
652
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
646
653
  const next = this.getNextFieldFromList(unfilledOptional);
647
654
  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;
655
+ this.focusFieldElement(next);
653
656
  }
654
657
  }
655
658
  getRecipientFields() {
@@ -737,16 +740,11 @@ export class VerdocsSign {
737
740
  return fields[nextFocusedIndex];
738
741
  }
739
742
  handlePrev() {
740
- var _a;
741
743
  const allFields = this.getSortedFillableFields();
742
744
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
743
745
  if (focusedIndex > 0) {
744
746
  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;
747
+ this.focusFieldElement(prevField);
750
748
  }
751
749
  }
752
750
  updateAllFlags() {
@@ -768,7 +766,7 @@ export class VerdocsSign {
768
766
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
769
767
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
770
768
  // should guide the user to the current task if it's incomplete.
771
- if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
769
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
772
770
  nextField = focusedFieldObj;
773
771
  }
774
772
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -810,14 +808,11 @@ export class VerdocsSign {
810
808
  label,
811
809
  showSkip,
812
810
  onSkip: () => {
811
+ this.focusedField = nextField.name;
813
812
  this.handleNext();
814
813
  },
815
814
  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);
815
+ this.focusFieldElement(nextField);
821
816
  },
822
817
  });
823
818
  }
@@ -833,6 +828,12 @@ export class VerdocsSign {
833
828
  return;
834
829
  }
835
830
  el.setAttribute('attached', '1');
831
+ el.addEventListener('focusin', () => {
832
+ if (this.focusedField !== field.name) {
833
+ this.focusedField = field.name;
834
+ this.updateAllFlags();
835
+ }
836
+ });
836
837
  el.addEventListener('input', (e) => {
837
838
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
838
839
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -897,6 +898,7 @@ export class VerdocsSign {
897
898
  });
898
899
  el.addEventListener('adopt', () => {
899
900
  this.focusedField = field.name;
901
+ this.updateAllFlags();
900
902
  this.adoptingSignature = true;
901
903
  });
902
904
  el.setAttribute('templateid', this.envelope.template_id);
@@ -1104,7 +1106,7 @@ export class VerdocsSign {
1104
1106
  }
1105
1107
  return (h("span", { class: "remaining-count" }, h("span", { class: "check-icon", innerHTML: CheckCircleIcon }), "All required fields complete", optionalLeft > 0 && h("span", { class: "separator" }, "|"), optionalLeft > 0 && (h("span", { class: "review-optional", onClick: () => this.handleNextOptional() }, "Review ", optionalLeft, " optional"))));
1106
1108
  })(), !this.finishLater && (h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel === 'Next' ? 'Next Required' : this.nextButtonLabel, disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() })), h("div", { class: { 'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal' }, innerHTML: ToolbarMinusIcon, onClick: () => this.handleZoomOut() }), h("div", { class: { 'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2' }, innerHTML: ToolbarPlusIcon, onClick: () => this.handleZoomIn() }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })))), this.toolbarStyle === 'controls' && (h("div", { class: "controls-toolbar" }, h("div", { class: "left-controls" }, h("div", { class: "title" }, this.envelope.name)), h("div", { class: "center-controls", style: { display: 'none' } }, h("span", { class: "label" }, "Page"), h("div", { class: "select-wrapper" }, h("verdocs-select-input", { options: pageOptions, value: this.pageNumber.toString(), onInput: e => this.handlePageSelect(e) })), h("span", { class: "count" }, "of ", totalPages)), h("div", { class: "right-controls" }, h("verdocs-button", { class: "mobile-next-button", label: this.nextButtonLabel, size: "xsmall", disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() }), h("div", { class: { 'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal' }, innerHTML: ToolbarMinusIcon, onClick: () => this.handleZoomOut() }), h("div", { class: { 'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2' }, innerHTML: ToolbarPlusIcon, onClick: () => this.handleZoomIn() }), h("div", { class: "icon-button download", innerHTML: ToolbarDownloadIcon, onClick: () => this.handleOptionSelected({ detail: { id: 'download' } }) }), h("div", { class: "icon-button print", innerHTML: ToolbarPrintIcon, onClick: () => this.handleOptionSelected({ detail: { id: 'print' } }) })))), h("verdocs-signing-progress", { mode: this.signingProgressMode, focusedField: this.focusedField, fields: this.getSortedFillableFields(), recipientFields: this.getRecipientFields(), onStarted: () => {
1107
- this.adoptingSignature = true;
1109
+ this.handleStartSigning();
1108
1110
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }), h("div", { class: `document signed-document-container zoom-${this.zoomLevel}` }, (this.envelope.documents || []).map(envelopeDocument => {
1109
1111
  const pageNumbers = integerSequence(1, envelopeDocument.pages);
1110
1112
  return (h(Fragment, null, this.envelope.documents.length > 1 && (h("div", { class: "document-separator" }, h("div", { innerHTML: DocumentPageIcon }), h("span", null, envelopeDocument.name))), pageNumbers.map(pageNumber => {