@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.
@@ -472,6 +472,17 @@ 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();
476
+ }
477
+ handleStartSigning() {
478
+ this.markEnvelopeStarted();
479
+ this.signingProgressMode = 'signing';
480
+ const fields = this.getSortedFillableFields();
481
+ const startField = fields.find(field => !this.isFieldActuallyFilled(field)) || fields[0];
482
+ if (startField) {
483
+ this.focusFieldElement(startField);
484
+ }
485
+ this.adoptingSignature = true;
475
486
  }
476
487
  async handleFieldChange(field, e) {
477
488
  if (!e.target) {
@@ -635,22 +646,14 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
635
646
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
636
647
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
637
648
  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;
649
+ this.focusFieldElement(nextUnfilled);
643
650
  }
644
651
  }
645
652
  handleNextOptional() {
646
653
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
647
654
  const next = this.getNextFieldFromList(unfilledOptional);
648
655
  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;
656
+ this.focusFieldElement(next);
654
657
  }
655
658
  }
656
659
  getRecipientFields() {
@@ -738,16 +741,11 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
738
741
  return fields[nextFocusedIndex];
739
742
  }
740
743
  handlePrev() {
741
- var _a;
742
744
  const allFields = this.getSortedFillableFields();
743
745
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
744
746
  if (focusedIndex > 0) {
745
747
  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;
748
+ this.focusFieldElement(prevField);
751
749
  }
752
750
  }
753
751
  updateAllFlags() {
@@ -769,7 +767,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
769
767
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
770
768
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
771
769
  // should guide the user to the current task if it's incomplete.
772
- if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
770
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
773
771
  nextField = focusedFieldObj;
774
772
  }
775
773
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -811,14 +809,11 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
811
809
  label,
812
810
  showSkip,
813
811
  onSkip: () => {
812
+ this.focusedField = nextField.name;
814
813
  this.handleNext();
815
814
  },
816
815
  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);
816
+ this.focusFieldElement(nextField);
822
817
  },
823
818
  });
824
819
  }
@@ -834,6 +829,12 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
834
829
  return;
835
830
  }
836
831
  el.setAttribute('attached', '1');
832
+ el.addEventListener('focusin', () => {
833
+ if (this.focusedField !== field.name) {
834
+ this.focusedField = field.name;
835
+ this.updateAllFlags();
836
+ }
837
+ });
837
838
  el.addEventListener('input', (e) => {
838
839
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
839
840
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -898,6 +899,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
898
899
  });
899
900
  el.addEventListener('adopt', () => {
900
901
  this.focusedField = field.name;
902
+ this.updateAllFlags();
901
903
  this.adoptingSignature = true;
902
904
  });
903
905
  el.setAttribute('templateid', this.envelope.template_id);
@@ -1105,7 +1107,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
1105
1107
  }
1106
1108
  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"))));
1107
1109
  })(), !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: () => {
1108
- this.adoptingSignature = true;
1110
+ this.handleStartSigning();
1109
1111
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }), h("div", { class: `document signed-document-container zoom-${this.zoomLevel}` }, (this.envelope.documents || []).map(envelopeDocument => {
1110
1112
  const pageNumbers = integerSequence(1, envelopeDocument.pages);
1111
1113
  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 => {