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