@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.
@@ -386,8 +386,10 @@ const VerdocsSign = class {
386
386
  updateDocumentFieldValue(oldField);
387
387
  this.fieldUpdateCounter++;
388
388
  this.markEnvelopeStarted();
389
- // If a previously skipped field gets filled, remove it from the skipped list
390
- if (this.skippedFields.includes(fieldName)) {
389
+ // Only unmark as skipped when the field is actually filled with a real value.
390
+ // An empty-string save (e.g. focusout when navigating away from a skipped textbox)
391
+ // must not remove the field from skippedFields or the skip loop re-triggers.
392
+ if (this.skippedFields.includes(fieldName) && this.isFieldActuallyFilled(oldField)) {
391
393
  this.skippedFields = this.skippedFields.filter(n => n !== fieldName);
392
394
  }
393
395
  this.checkRecipientFields();
@@ -417,6 +419,12 @@ const VerdocsSign = class {
417
419
  if (field === null || field === void 0 ? void 0 : field.readonly) {
418
420
  return Promise.resolve();
419
421
  }
422
+ // Don't persist focusout-triggered saves for skipped fields — navigating away from
423
+ // a skipped textbox fires focusout with an empty value which would cause a pointless
424
+ // API call and trigger the skip loop via updateRecipientFieldValue.
425
+ if (this.skippedFields.includes(fieldName)) {
426
+ return Promise.resolve();
427
+ }
420
428
  console.log('[SIGN] saveFieldChange', fieldName, { value, prepared });
421
429
  return updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
422
430
  .then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
@@ -491,7 +499,10 @@ const VerdocsSign = class {
491
499
  console.log('[SIGN] Clearing initial');
492
500
  this.initialId = null;
493
501
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
494
- return this.updateRecipientFieldValue(field.name, updateResult);
502
+ this.updateRecipientFieldValue(field.name, updateResult);
503
+ if (field.required)
504
+ this.focusFieldElement(field);
505
+ return;
495
506
  }
496
507
  // If we already have an initials block, apply it
497
508
  if (this.initialId) {
@@ -537,7 +548,10 @@ const VerdocsSign = class {
537
548
  console.log('[SIGN] Clearing signature');
538
549
  this.signatureId = null;
539
550
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
540
- return this.updateRecipientFieldValue(field.name, updateResult);
551
+ this.updateRecipientFieldValue(field.name, updateResult);
552
+ if (field.required)
553
+ this.focusFieldElement(field);
554
+ return;
541
555
  }
542
556
  // If we already have a signature block, apply it
543
557
  if (this.signatureId) {
@@ -698,6 +712,12 @@ const VerdocsSign = class {
698
712
  }
699
713
  }
700
714
  isFieldActuallyFilled(field) {
715
+ var _a;
716
+ // The server keeps value="signed" even after a signature/initial is cleared;
717
+ // settings.signature_id is the authoritative indicator of whether it's actually signed.
718
+ if (field.type === 'signature' || field.type === 'initial') {
719
+ return !!((_a = field.settings) === null || _a === void 0 ? void 0 : _a.signature_id);
720
+ }
701
721
  if (field.type === 'radio' && field.group) {
702
722
  const groupFilled = this.getRecipientFields().some(f => f.group === field.group && f.value === 'true');
703
723
  if (groupFilled) {