@hubsync/esign-web-sdk 6.5.15 → 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.
@@ -359,10 +359,10 @@ const VerdocsSign = class {
359
359
  // logic to the fields.
360
360
  const field = this.getRecipientFields().find(field => field.name === fieldName);
361
361
  if (field === null || field === void 0 ? void 0 : field.readonly) {
362
- return;
362
+ return Promise.resolve();
363
363
  }
364
364
  console.log('[SIGN] saveFieldChange', fieldName, { value, prepared });
365
- updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
365
+ return updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
366
366
  .then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
367
367
  .catch(e => {
368
368
  var _a, _b, _c, _d, _e, _f;
@@ -376,6 +376,7 @@ const VerdocsSign = class {
376
376
  VerdocsToast('Unable to save change, please try again later', { style: 'error' });
377
377
  }
378
378
  (_d = this.sdkError) === null || _d === void 0 ? void 0 : _d.emit(new SDKError(e.message, (_e = e.response) === null || _e === void 0 ? void 0 : _e.status, (_f = e.response) === null || _f === void 0 ? void 0 : _f.data));
379
+ throw e;
379
380
  });
380
381
  }
381
382
  async handleFieldChange(field, e) {
@@ -416,14 +417,40 @@ const VerdocsSign = class {
416
417
  if (this.initialId) {
417
418
  console.log('[SIGN] Reusing initial', this.initialId);
418
419
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
419
- return this.updateRecipientFieldValue(field.name, updateResult);
420
+ this.updateRecipientFieldValue(field.name, updateResult);
421
+ // Auto-focus next field after filling initial (only if not the last field)
422
+ setTimeout(() => {
423
+ const fields = this.getSortedFillableFields();
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
+ }
431
+ }
432
+ }, 100);
433
+ return;
420
434
  }
421
435
  // If it's a UUID, it's an existing initial ID we can just reuse
422
436
  if (typeof e.detail === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.detail)) {
423
437
  console.log('[SIGN] Reusing initial', e.detail);
424
438
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
425
439
  this.initialId = e.detail;
426
- return this.updateRecipientFieldValue(field.name, updateResult);
440
+ this.updateRecipientFieldValue(field.name, updateResult);
441
+ // Auto-focus next field after filling initial (only if not the last field)
442
+ setTimeout(() => {
443
+ const fields = this.getSortedFillableFields();
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
+ }
451
+ }
452
+ }, 100);
453
+ return;
427
454
  }
428
455
  this.showSpinner = true;
429
456
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -433,6 +460,14 @@ const VerdocsSign = class {
433
460
  this.updateRecipientFieldValue(field.name, updateResult);
434
461
  this.initialId = newInitials.id;
435
462
  this.showSpinner = false;
463
+ // Auto-focus next field after filling initial
464
+ setTimeout(() => {
465
+ const fields = this.getSortedFillableFields();
466
+ const nextField = this.getNextFieldFromList(fields);
467
+ if (nextField) {
468
+ this.focusField(nextField);
469
+ }
470
+ }, 100);
436
471
  })
437
472
  .catch(e => {
438
473
  console.log('Error updating initials', e);
@@ -458,14 +493,40 @@ const VerdocsSign = class {
458
493
  if (this.signatureId) {
459
494
  console.log('[SIGN] Reusing signature', this.signatureId);
460
495
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
461
- return this.updateRecipientFieldValue(field.name, updateResult);
496
+ this.updateRecipientFieldValue(field.name, updateResult);
497
+ // Auto-focus next field after filling signature (only if not the last field)
498
+ setTimeout(() => {
499
+ const fields = this.getSortedFillableFields();
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
+ }
507
+ }
508
+ }, 100);
509
+ return;
462
510
  }
463
511
  // If it's a UUID, it's an existing signature ID we can just reuse
464
512
  if (typeof e.detail === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.detail)) {
465
513
  console.log('[SIGN] Reusing signature', e.detail);
466
514
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
467
515
  this.signatureId = e.detail;
468
- return this.updateRecipientFieldValue(field.name, updateResult);
516
+ this.updateRecipientFieldValue(field.name, updateResult);
517
+ // Auto-focus next field after filling signature (only if not the last field)
518
+ setTimeout(() => {
519
+ const fields = this.getSortedFillableFields();
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
+ }
527
+ }
528
+ }, 100);
529
+ return;
469
530
  }
470
531
  this.showSpinner = true;
471
532
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -477,6 +538,14 @@ const VerdocsSign = class {
477
538
  this.updateRecipientFieldValue(field.name, updateResult);
478
539
  this.signatureId = newSignature.id;
479
540
  this.showSpinner = false;
541
+ // Auto-focus next field after filling signature
542
+ setTimeout(() => {
543
+ const fields = this.getSortedFillableFields();
544
+ const nextField = this.getNextFieldFromList(fields);
545
+ if (nextField) {
546
+ this.focusField(nextField);
547
+ }
548
+ }, 100);
480
549
  })
481
550
  .catch(e => {
482
551
  console.warn('[SIGN] Error updating signature', e);
@@ -486,7 +555,20 @@ const VerdocsSign = class {
486
555
  case 'date':
487
556
  const { formattedDate } = e.detail;
488
557
  if (formattedDate) {
489
- return this.saveFieldChange(field.name, formattedDate, false);
558
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
559
+ // Auto-focus next field after filling date (only if not the last field)
560
+ setTimeout(() => {
561
+ const fields = this.getSortedFillableFields();
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
+ }
569
+ }
570
+ }, 100);
571
+ });
490
572
  }
491
573
  break;
492
574
  case 'timestamp':