@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.
@@ -448,6 +448,17 @@ 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();
452
+ }
453
+ handleStartSigning() {
454
+ this.markEnvelopeStarted();
455
+ this.signingProgressMode = 'signing';
456
+ const fields = this.getSortedFillableFields();
457
+ const startField = fields.find(field => !this.isFieldActuallyFilled(field)) || fields[0];
458
+ if (startField) {
459
+ this.focusFieldElement(startField);
460
+ }
461
+ this.adoptingSignature = true;
451
462
  }
452
463
  async handleFieldChange(field, e) {
453
464
  if (!e.target) {
@@ -611,22 +622,14 @@ const VerdocsSign = class {
611
622
  const allUnfilled = this.getSortedFillableFields().filter(f => !this.isFieldActuallyFilled(f));
612
623
  const nextUnfilled = this.getNextFieldFromList(allUnfilled);
613
624
  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;
625
+ this.focusFieldElement(nextUnfilled);
619
626
  }
620
627
  }
621
628
  handleNextOptional() {
622
629
  const unfilledOptional = this.getSortedFillableFields().filter(f => !f.required && !this.isFieldActuallyFilled(f));
623
630
  const next = this.getNextFieldFromList(unfilledOptional);
624
631
  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;
632
+ this.focusFieldElement(next);
630
633
  }
631
634
  }
632
635
  getRecipientFields() {
@@ -714,16 +717,11 @@ const VerdocsSign = class {
714
717
  return fields[nextFocusedIndex];
715
718
  }
716
719
  handlePrev() {
717
- var _a;
718
720
  const allFields = this.getSortedFillableFields();
719
721
  const focusedIndex = allFields.findIndex(f => f.name === this.focusedField);
720
722
  if (focusedIndex > 0) {
721
723
  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;
724
+ this.focusFieldElement(prevField);
727
725
  }
728
726
  }
729
727
  updateAllFlags() {
@@ -745,7 +743,7 @@ const VerdocsSign = class {
745
743
  // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
746
744
  // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
747
745
  // should guide the user to the current task if it's incomplete.
748
- if (focusedFieldObj && !jsSdk.isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
746
+ if (focusedFieldObj && !this.isFieldActuallyFilled(focusedFieldObj)) {
749
747
  nextField = focusedFieldObj;
750
748
  }
751
749
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
@@ -787,14 +785,11 @@ const VerdocsSign = class {
787
785
  label,
788
786
  showSkip,
789
787
  onSkip: () => {
788
+ this.focusedField = nextField.name;
790
789
  this.handleNext();
791
790
  },
792
791
  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);
792
+ this.focusFieldElement(nextField);
798
793
  },
799
794
  });
800
795
  }
@@ -810,6 +805,12 @@ const VerdocsSign = class {
810
805
  return;
811
806
  }
812
807
  el.setAttribute('attached', '1');
808
+ el.addEventListener('focusin', () => {
809
+ if (this.focusedField !== field.name) {
810
+ this.focusedField = field.name;
811
+ this.updateAllFlags();
812
+ }
813
+ });
813
814
  el.addEventListener('input', (e) => {
814
815
  // console.log('[SIGN] onfieldInput', e.detail, e.target.value);
815
816
  // These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
@@ -874,6 +875,7 @@ const VerdocsSign = class {
874
875
  });
875
876
  el.addEventListener('adopt', () => {
876
877
  this.focusedField = field.name;
878
+ this.updateAllFlags();
877
879
  this.adoptingSignature = true;
878
880
  });
879
881
  el.setAttribute('templateid', this.envelope.template_id);
@@ -1081,7 +1083,7 @@ const VerdocsSign = class {
1081
1083
  }
1082
1084
  return (index.h("span", { class: "remaining-count" }, index.h("span", { class: "check-icon", innerHTML: Icons.CheckCircleIcon }), "All required fields complete", optionalLeft > 0 && index.h("span", { class: "separator" }, "|"), optionalLeft > 0 && (index.h("span", { class: "review-optional", onClick: () => this.handleNextOptional() }, "Review ", optionalLeft, " optional"))));
1083
1085
  })(), !this.finishLater && (index.h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel === 'Next' ? 'Next Required' : this.nextButtonLabel, disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() })), index.h("div", { class: { 'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal' }, innerHTML: ToolbarMinusIcon, onClick: () => this.handleZoomOut() }), index.h("div", { class: { 'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2' }, innerHTML: ToolbarPlusIcon, onClick: () => this.handleZoomIn() }), index.h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })))), this.toolbarStyle === 'controls' && (index.h("div", { class: "controls-toolbar" }, index.h("div", { class: "left-controls" }, index.h("div", { class: "title" }, this.envelope.name)), index.h("div", { class: "center-controls", style: { display: 'none' } }, index.h("span", { class: "label" }, "Page"), index.h("div", { class: "select-wrapper" }, index.h("verdocs-select-input", { options: pageOptions, value: this.pageNumber.toString(), onInput: e => this.handlePageSelect(e) })), index.h("span", { class: "count" }, "of ", totalPages)), index.h("div", { class: "right-controls" }, index.h("verdocs-button", { class: "mobile-next-button", label: this.nextButtonLabel, size: "xsmall", disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() }), index.h("div", { class: { 'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal' }, innerHTML: ToolbarMinusIcon, onClick: () => this.handleZoomOut() }), index.h("div", { class: { 'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2' }, innerHTML: ToolbarPlusIcon, onClick: () => this.handleZoomIn() }), index.h("div", { class: "icon-button download", innerHTML: ToolbarDownloadIcon, onClick: () => this.handleOptionSelected({ detail: { id: 'download' } }) }), index.h("div", { class: "icon-button print", innerHTML: ToolbarPrintIcon, onClick: () => this.handleOptionSelected({ detail: { id: 'print' } }) })))), index.h("verdocs-signing-progress", { mode: this.signingProgressMode, focusedField: this.focusedField, fields: this.getSortedFillableFields(), recipientFields: this.getRecipientFields(), onStarted: () => {
1084
- this.adoptingSignature = true;
1086
+ this.handleStartSigning();
1085
1087
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }), index.h("div", { class: `document signed-document-container zoom-${this.zoomLevel}` }, (this.envelope.documents || []).map(envelopeDocument => {
1086
1088
  const pageNumbers = jsSdk.integerSequence(1, envelopeDocument.pages);
1087
1089
  return (index.h(index.Fragment, null, this.envelope.documents.length > 1 && (index.h("div", { class: "document-separator" }, index.h("div", { innerHTML: Icons.DocumentPageIcon }), index.h("span", null, envelopeDocument.name))), pageNumbers.map(pageNumber => {