@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.
@@ -446,6 +446,17 @@ 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();
450
+ }
451
+ handleStartSigning() {
452
+ this.markEnvelopeStarted();
453
+ this.signingProgressMode = 'signing';
454
+ const fields = this.getSortedFillableFields();
455
+ const startField = fields.find(field => !this.isFieldActuallyFilled(field)) || fields[0];
456
+ if (startField) {
457
+ this.focusFieldElement(startField);
458
+ }
459
+ this.adoptingSignature = true;
449
460
  }
450
461
  async handleFieldChange(field, e) {
451
462
  if (!e.target) {
@@ -609,22 +620,14 @@ const VerdocsSign = class {
609
620
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
610
621
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
611
622
  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;
623
+ this.focusFieldElement(nextUnfilled);
617
624
  }
618
625
  }
619
626
  handleNextOptional() {
620
627
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
621
628
  const next = this.getNextFieldFromList(unfilledOptional);
622
629
  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;
630
+ this.focusFieldElement(next);
628
631
  }
629
632
  }
630
633
  getRecipientFields() {
@@ -712,16 +715,11 @@ const VerdocsSign = class {
712
715
  return fields[nextFocusedIndex];
713
716
  }
714
717
  handlePrev() {
715
- var _a;
716
718
  const allFields = this.getSortedFillableFields();
717
719
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
718
720
  if (focusedIndex > 0) {
719
721
  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;
722
+ this.focusFieldElement(prevField);
725
723
  }
726
724
  }
727
725
  updateAllFlags() {
@@ -743,7 +741,7 @@ const VerdocsSign = class {
743
741
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
744
742
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
745
743
  // should guide the user to the current task if it's incomplete.
746
- if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
744
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
747
745
  nextField = focusedFieldObj;
748
746
  }
749
747
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -785,14 +783,11 @@ const VerdocsSign = class {
785
783
  label,
786
784
  showSkip,
787
785
  onSkip: () => {
786
+ this.focusedField = nextField.name;
788
787
  this.handleNext();
789
788
  },
790
789
  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);
790
+ this.focusFieldElement(nextField);
796
791
  },
797
792
  });
798
793
  }
@@ -808,6 +803,12 @@ const VerdocsSign = class {
808
803
  return;
809
804
  }
810
805
  el.setAttribute('attached', '1');
806
+ el.addEventListener('focusin', () => {
807
+ if (this.focusedField !== field.name) {
808
+ this.focusedField = field.name;
809
+ this.updateAllFlags();
810
+ }
811
+ });
811
812
  el.addEventListener('input', (e) => {
812
813
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
813
814
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -872,6 +873,7 @@ const VerdocsSign = class {
872
873
  });
873
874
  el.addEventListener('adopt', () => {
874
875
  this.focusedField = field.name;
876
+ this.updateAllFlags();
875
877
  this.adoptingSignature = true;
876
878
  });
877
879
  el.setAttribute('templateid', this.envelope.template_id);
@@ -1079,7 +1081,7 @@ const VerdocsSign = class {
1079
1081
  }
1080
1082
  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"))));
1081
1083
  })(), !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: () => {
1082
- this.adoptingSignature = true;
1084
+ this.handleStartSigning();
1083
1085
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }), h("div", { class: `document signed-document-container zoom-${this.zoomLevel}` }, (this.envelope.documents || []).map(envelopeDocument => {
1084
1086
  const pageNumbers = integerSequence(1, envelopeDocument.pages);
1085
1087
  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 => {