@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.
@@ -418,12 +418,16 @@ const VerdocsSign = class {
418
418
  console.log('[SIGN] Reusing initial', this.initialId);
419
419
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
420
420
  this.updateRecipientFieldValue(field.name, updateResult);
421
- // Auto-focus next field after filling initial
421
+ // Auto-focus next field after filling initial (only if not the last field)
422
422
  setTimeout(() => {
423
423
  const fields = this.getSortedFillableFields();
424
- const nextField = this.getNextFieldFromList(fields);
425
- if (nextField) {
426
- this.focusField(nextField);
424
+ const currentIndex = fields.findIndex(f => f.name === field.name);
425
+ // Only focus next field if current field is not the last one
426
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
427
+ const nextField = this.getNextFieldFromList(fields);
428
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
429
+ this.focusField(nextField);
430
+ }
427
431
  }
428
432
  }, 100);
429
433
  return;
@@ -434,12 +438,16 @@ const VerdocsSign = class {
434
438
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
435
439
  this.initialId = e.detail;
436
440
  this.updateRecipientFieldValue(field.name, updateResult);
437
- // Auto-focus next field after filling initial
441
+ // Auto-focus next field after filling initial (only if not the last field)
438
442
  setTimeout(() => {
439
443
  const fields = this.getSortedFillableFields();
440
- const nextField = this.getNextFieldFromList(fields);
441
- if (nextField) {
442
- this.focusField(nextField);
444
+ const currentIndex = fields.findIndex(f => f.name === field.name);
445
+ // Only focus next field if current field is not the last one
446
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
447
+ const nextField = this.getNextFieldFromList(fields);
448
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
449
+ this.focusField(nextField);
450
+ }
443
451
  }
444
452
  }, 100);
445
453
  return;
@@ -486,12 +494,16 @@ const VerdocsSign = class {
486
494
  console.log('[SIGN] Reusing signature', this.signatureId);
487
495
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
488
496
  this.updateRecipientFieldValue(field.name, updateResult);
489
- // Auto-focus next field after filling signature
497
+ // Auto-focus next field after filling signature (only if not the last field)
490
498
  setTimeout(() => {
491
499
  const fields = this.getSortedFillableFields();
492
- const nextField = this.getNextFieldFromList(fields);
493
- if (nextField) {
494
- this.focusField(nextField);
500
+ const currentIndex = fields.findIndex(f => f.name === field.name);
501
+ // Only focus next field if current field is not the last one
502
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
503
+ const nextField = this.getNextFieldFromList(fields);
504
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
505
+ this.focusField(nextField);
506
+ }
495
507
  }
496
508
  }, 100);
497
509
  return;
@@ -502,12 +514,16 @@ const VerdocsSign = class {
502
514
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
503
515
  this.signatureId = e.detail;
504
516
  this.updateRecipientFieldValue(field.name, updateResult);
505
- // Auto-focus next field after filling signature
517
+ // Auto-focus next field after filling signature (only if not the last field)
506
518
  setTimeout(() => {
507
519
  const fields = this.getSortedFillableFields();
508
- const nextField = this.getNextFieldFromList(fields);
509
- if (nextField) {
510
- this.focusField(nextField);
520
+ const currentIndex = fields.findIndex(f => f.name === field.name);
521
+ // Only focus next field if current field is not the last one
522
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
523
+ const nextField = this.getNextFieldFromList(fields);
524
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
525
+ this.focusField(nextField);
526
+ }
511
527
  }
512
528
  }, 100);
513
529
  return;
@@ -540,12 +556,16 @@ const VerdocsSign = class {
540
556
  const { formattedDate } = e.detail;
541
557
  if (formattedDate) {
542
558
  return this.saveFieldChange(field.name, formattedDate, false).then(() => {
543
- // Auto-focus next field after filling date
559
+ // Auto-focus next field after filling date (only if not the last field)
544
560
  setTimeout(() => {
545
561
  const fields = this.getSortedFillableFields();
546
- const nextField = this.getNextFieldFromList(fields);
547
- if (nextField) {
548
- this.focusField(nextField);
562
+ const currentIndex = fields.findIndex(f => f.name === field.name);
563
+ // Only focus next field if current field is not the last one
564
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
565
+ const nextField = this.getNextFieldFromList(fields);
566
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
567
+ this.focusField(nextField);
568
+ }
549
569
  }
550
570
  }, 100);
551
571
  });