@hubsync/esign-web-sdk 6.5.15 → 6.5.16

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.
@@ -382,10 +382,10 @@ export class VerdocsSign {
382
382
  // logic to the fields.
383
383
  const field = this.getRecipientFields().find(field => field.name === fieldName);
384
384
  if (field === null || field === void 0 ? void 0 : field.readonly) {
385
- return;
385
+ return Promise.resolve();
386
386
  }
387
387
  console.log('[SIGN] saveFieldChange', fieldName, { value, prepared });
388
- updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
388
+ return updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
389
389
  .then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
390
390
  .catch(e => {
391
391
  var _a, _b, _c, _d, _e, _f;
@@ -399,6 +399,7 @@ export class VerdocsSign {
399
399
  VerdocsToast('Unable to save change, please try again later', { style: 'error' });
400
400
  }
401
401
  (_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));
402
+ throw e;
402
403
  });
403
404
  }
404
405
  async handleFieldChange(field, e) {
@@ -439,14 +440,32 @@ export class VerdocsSign {
439
440
  if (this.initialId) {
440
441
  console.log('[SIGN] Reusing initial', this.initialId);
441
442
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
442
- return this.updateRecipientFieldValue(field.name, updateResult);
443
+ this.updateRecipientFieldValue(field.name, updateResult);
444
+ // Auto-focus next field after filling initial
445
+ setTimeout(() => {
446
+ const fields = this.getSortedFillableFields();
447
+ const nextField = this.getNextFieldFromList(fields);
448
+ if (nextField) {
449
+ this.focusField(nextField);
450
+ }
451
+ }, 100);
452
+ return;
443
453
  }
444
454
  // If it's a UUID, it's an existing initial ID we can just reuse
445
455
  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)) {
446
456
  console.log('[SIGN] Reusing initial', e.detail);
447
457
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
448
458
  this.initialId = e.detail;
449
- return this.updateRecipientFieldValue(field.name, updateResult);
459
+ this.updateRecipientFieldValue(field.name, updateResult);
460
+ // Auto-focus next field after filling initial
461
+ setTimeout(() => {
462
+ const fields = this.getSortedFillableFields();
463
+ const nextField = this.getNextFieldFromList(fields);
464
+ if (nextField) {
465
+ this.focusField(nextField);
466
+ }
467
+ }, 100);
468
+ return;
450
469
  }
451
470
  this.showSpinner = true;
452
471
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -456,6 +475,14 @@ export class VerdocsSign {
456
475
  this.updateRecipientFieldValue(field.name, updateResult);
457
476
  this.initialId = newInitials.id;
458
477
  this.showSpinner = false;
478
+ // Auto-focus next field after filling initial
479
+ setTimeout(() => {
480
+ const fields = this.getSortedFillableFields();
481
+ const nextField = this.getNextFieldFromList(fields);
482
+ if (nextField) {
483
+ this.focusField(nextField);
484
+ }
485
+ }, 100);
459
486
  })
460
487
  .catch(e => {
461
488
  console.log('Error updating initials', e);
@@ -481,14 +508,32 @@ export class VerdocsSign {
481
508
  if (this.signatureId) {
482
509
  console.log('[SIGN] Reusing signature', this.signatureId);
483
510
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
484
- return this.updateRecipientFieldValue(field.name, updateResult);
511
+ this.updateRecipientFieldValue(field.name, updateResult);
512
+ // Auto-focus next field after filling signature
513
+ setTimeout(() => {
514
+ const fields = this.getSortedFillableFields();
515
+ const nextField = this.getNextFieldFromList(fields);
516
+ if (nextField) {
517
+ this.focusField(nextField);
518
+ }
519
+ }, 100);
520
+ return;
485
521
  }
486
522
  // If it's a UUID, it's an existing signature ID we can just reuse
487
523
  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)) {
488
524
  console.log('[SIGN] Reusing signature', e.detail);
489
525
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
490
526
  this.signatureId = e.detail;
491
- return this.updateRecipientFieldValue(field.name, updateResult);
527
+ this.updateRecipientFieldValue(field.name, updateResult);
528
+ // Auto-focus next field after filling signature
529
+ setTimeout(() => {
530
+ const fields = this.getSortedFillableFields();
531
+ const nextField = this.getNextFieldFromList(fields);
532
+ if (nextField) {
533
+ this.focusField(nextField);
534
+ }
535
+ }, 100);
536
+ return;
492
537
  }
493
538
  this.showSpinner = true;
494
539
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -500,6 +545,14 @@ export class VerdocsSign {
500
545
  this.updateRecipientFieldValue(field.name, updateResult);
501
546
  this.signatureId = newSignature.id;
502
547
  this.showSpinner = false;
548
+ // Auto-focus next field after filling signature
549
+ setTimeout(() => {
550
+ const fields = this.getSortedFillableFields();
551
+ const nextField = this.getNextFieldFromList(fields);
552
+ if (nextField) {
553
+ this.focusField(nextField);
554
+ }
555
+ }, 100);
503
556
  })
504
557
  .catch(e => {
505
558
  console.warn('[SIGN] Error updating signature', e);
@@ -509,7 +562,16 @@ export class VerdocsSign {
509
562
  case 'date':
510
563
  const { formattedDate } = e.detail;
511
564
  if (formattedDate) {
512
- return this.saveFieldChange(field.name, formattedDate, false);
565
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
566
+ // Auto-focus next field after filling date
567
+ setTimeout(() => {
568
+ const fields = this.getSortedFillableFields();
569
+ const nextField = this.getNextFieldFromList(fields);
570
+ if (nextField) {
571
+ this.focusField(nextField);
572
+ }
573
+ }, 100);
574
+ });
513
575
  }
514
576
  break;
515
577
  case 'timestamp':