@hubsync/esign-web-sdk 6.9.20 → 6.9.22

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.
@@ -412,8 +412,10 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
412
412
  updateDocumentFieldValue(oldField);
413
413
  this.fieldUpdateCounter++;
414
414
  this.markEnvelopeStarted();
415
- // If a previously skipped field gets filled, remove it from the skipped list
416
- if (this.skippedFields.includes(fieldName)) {
415
+ // Only unmark as skipped when the field is actually filled with a real value.
416
+ // An empty-string save (e.g. focusout when navigating away from a skipped textbox)
417
+ // must not remove the field from skippedFields or the skip loop re-triggers.
418
+ if (this.skippedFields.includes(fieldName) && this.isFieldActuallyFilled(oldField)) {
417
419
  this.skippedFields = this.skippedFields.filter(n => n !== fieldName);
418
420
  }
419
421
  this.checkRecipientFields();
@@ -443,6 +445,12 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
443
445
  if (field === null || field === void 0 ? void 0 : field.readonly) {
444
446
  return Promise.resolve();
445
447
  }
448
+ // Don't persist focusout-triggered saves for skipped fields — navigating away from
449
+ // a skipped textbox fires focusout with an empty value which would cause a pointless
450
+ // API call and trigger the skip loop via updateRecipientFieldValue.
451
+ if (this.skippedFields.includes(fieldName)) {
452
+ return Promise.resolve();
453
+ }
446
454
  console.log('[SIGN] saveFieldChange', fieldName, { value, prepared });
447
455
  return updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
448
456
  .then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
@@ -517,7 +525,10 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
517
525
  console.log('[SIGN] Clearing initial');
518
526
  this.initialId = null;
519
527
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
520
- return this.updateRecipientFieldValue(field.name, updateResult);
528
+ this.updateRecipientFieldValue(field.name, updateResult);
529
+ if (field.required)
530
+ this.focusFieldElement(field);
531
+ return;
521
532
  }
522
533
  // If we already have an initials block, apply it
523
534
  if (this.initialId) {
@@ -563,7 +574,10 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
563
574
  console.log('[SIGN] Clearing signature');
564
575
  this.signatureId = null;
565
576
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
566
- return this.updateRecipientFieldValue(field.name, updateResult);
577
+ this.updateRecipientFieldValue(field.name, updateResult);
578
+ if (field.required)
579
+ this.focusFieldElement(field);
580
+ return;
567
581
  }
568
582
  // If we already have a signature block, apply it
569
583
  if (this.signatureId) {
@@ -724,6 +738,12 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
724
738
  }
725
739
  }
726
740
  isFieldActuallyFilled(field) {
741
+ var _a;
742
+ // The server keeps value="signed" even after a signature/initial is cleared;
743
+ // settings.signature_id is the authoritative indicator of whether it's actually signed.
744
+ if (field.type === 'signature' || field.type === 'initial') {
745
+ return !!((_a = field.settings) === null || _a === void 0 ? void 0 : _a.signature_id);
746
+ }
727
747
  if (field.type === 'radio' && field.group) {
728
748
  const groupFilled = this.getRecipientFields().some(f => f.group === field.group && f.value === 'true');
729
749
  if (groupFilled) {