@hubsync/esign-web-sdk 6.5.16 → 6.5.17

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.
@@ -441,12 +441,16 @@ export class VerdocsSign {
441
441
  console.log('[SIGN] Reusing initial', this.initialId);
442
442
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
443
443
  this.updateRecipientFieldValue(field.name, updateResult);
444
- // Auto-focus next field after filling initial
444
+ // Auto-focus next field after filling initial (only if not the last field)
445
445
  setTimeout(() => {
446
446
  const fields = this.getSortedFillableFields();
447
- const nextField = this.getNextFieldFromList(fields);
448
- if (nextField) {
449
- this.focusField(nextField);
447
+ const currentIndex = fields.findIndex(f => f.name === field.name);
448
+ // Only focus next field if current field is not the last one
449
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
450
+ const nextField = this.getNextFieldFromList(fields);
451
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
452
+ this.focusField(nextField);
453
+ }
450
454
  }
451
455
  }, 100);
452
456
  return;
@@ -457,12 +461,16 @@ export class VerdocsSign {
457
461
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
458
462
  this.initialId = e.detail;
459
463
  this.updateRecipientFieldValue(field.name, updateResult);
460
- // Auto-focus next field after filling initial
464
+ // Auto-focus next field after filling initial (only if not the last field)
461
465
  setTimeout(() => {
462
466
  const fields = this.getSortedFillableFields();
463
- const nextField = this.getNextFieldFromList(fields);
464
- if (nextField) {
465
- this.focusField(nextField);
467
+ const currentIndex = fields.findIndex(f => f.name === field.name);
468
+ // Only focus next field if current field is not the last one
469
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
470
+ const nextField = this.getNextFieldFromList(fields);
471
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
472
+ this.focusField(nextField);
473
+ }
466
474
  }
467
475
  }, 100);
468
476
  return;
@@ -509,12 +517,16 @@ export class VerdocsSign {
509
517
  console.log('[SIGN] Reusing signature', this.signatureId);
510
518
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
511
519
  this.updateRecipientFieldValue(field.name, updateResult);
512
- // Auto-focus next field after filling signature
520
+ // Auto-focus next field after filling signature (only if not the last field)
513
521
  setTimeout(() => {
514
522
  const fields = this.getSortedFillableFields();
515
- const nextField = this.getNextFieldFromList(fields);
516
- if (nextField) {
517
- this.focusField(nextField);
523
+ const currentIndex = fields.findIndex(f => f.name === field.name);
524
+ // Only focus next field if current field is not the last one
525
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
526
+ const nextField = this.getNextFieldFromList(fields);
527
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
528
+ this.focusField(nextField);
529
+ }
518
530
  }
519
531
  }, 100);
520
532
  return;
@@ -525,12 +537,16 @@ export class VerdocsSign {
525
537
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
526
538
  this.signatureId = e.detail;
527
539
  this.updateRecipientFieldValue(field.name, updateResult);
528
- // Auto-focus next field after filling signature
540
+ // Auto-focus next field after filling signature (only if not the last field)
529
541
  setTimeout(() => {
530
542
  const fields = this.getSortedFillableFields();
531
- const nextField = this.getNextFieldFromList(fields);
532
- if (nextField) {
533
- this.focusField(nextField);
543
+ const currentIndex = fields.findIndex(f => f.name === field.name);
544
+ // Only focus next field if current field is not the last one
545
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
546
+ const nextField = this.getNextFieldFromList(fields);
547
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
548
+ this.focusField(nextField);
549
+ }
534
550
  }
535
551
  }, 100);
536
552
  return;
@@ -563,12 +579,16 @@ export class VerdocsSign {
563
579
  const { formattedDate } = e.detail;
564
580
  if (formattedDate) {
565
581
  return this.saveFieldChange(field.name, formattedDate, false).then(() => {
566
- // Auto-focus next field after filling date
582
+ // Auto-focus next field after filling date (only if not the last field)
567
583
  setTimeout(() => {
568
584
  const fields = this.getSortedFillableFields();
569
- const nextField = this.getNextFieldFromList(fields);
570
- if (nextField) {
571
- this.focusField(nextField);
585
+ const currentIndex = fields.findIndex(f => f.name === field.name);
586
+ // Only focus next field if current field is not the last one
587
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
588
+ const nextField = this.getNextFieldFromList(fields);
589
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
590
+ this.focusField(nextField);
591
+ }
572
592
  }
573
593
  }, 100);
574
594
  });