@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.
@@ -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,32 @@ 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
422
+ setTimeout(() => {
423
+ const fields = this.getSortedFillableFields();
424
+ const nextField = this.getNextFieldFromList(fields);
425
+ if (nextField) {
426
+ this.focusField(nextField);
427
+ }
428
+ }, 100);
429
+ return;
420
430
  }
421
431
  // If it's a UUID, it's an existing initial ID we can just reuse
422
432
  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
433
  console.log('[SIGN] Reusing initial', e.detail);
424
434
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
425
435
  this.initialId = e.detail;
426
- return this.updateRecipientFieldValue(field.name, updateResult);
436
+ this.updateRecipientFieldValue(field.name, updateResult);
437
+ // Auto-focus next field after filling initial
438
+ setTimeout(() => {
439
+ const fields = this.getSortedFillableFields();
440
+ const nextField = this.getNextFieldFromList(fields);
441
+ if (nextField) {
442
+ this.focusField(nextField);
443
+ }
444
+ }, 100);
445
+ return;
427
446
  }
428
447
  this.showSpinner = true;
429
448
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -433,6 +452,14 @@ const VerdocsSign = class {
433
452
  this.updateRecipientFieldValue(field.name, updateResult);
434
453
  this.initialId = newInitials.id;
435
454
  this.showSpinner = false;
455
+ // Auto-focus next field after filling initial
456
+ setTimeout(() => {
457
+ const fields = this.getSortedFillableFields();
458
+ const nextField = this.getNextFieldFromList(fields);
459
+ if (nextField) {
460
+ this.focusField(nextField);
461
+ }
462
+ }, 100);
436
463
  })
437
464
  .catch(e => {
438
465
  console.log('Error updating initials', e);
@@ -458,14 +485,32 @@ const VerdocsSign = class {
458
485
  if (this.signatureId) {
459
486
  console.log('[SIGN] Reusing signature', this.signatureId);
460
487
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
461
- return this.updateRecipientFieldValue(field.name, updateResult);
488
+ this.updateRecipientFieldValue(field.name, updateResult);
489
+ // Auto-focus next field after filling signature
490
+ setTimeout(() => {
491
+ const fields = this.getSortedFillableFields();
492
+ const nextField = this.getNextFieldFromList(fields);
493
+ if (nextField) {
494
+ this.focusField(nextField);
495
+ }
496
+ }, 100);
497
+ return;
462
498
  }
463
499
  // If it's a UUID, it's an existing signature ID we can just reuse
464
500
  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
501
  console.log('[SIGN] Reusing signature', e.detail);
466
502
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
467
503
  this.signatureId = e.detail;
468
- return this.updateRecipientFieldValue(field.name, updateResult);
504
+ this.updateRecipientFieldValue(field.name, updateResult);
505
+ // Auto-focus next field after filling signature
506
+ setTimeout(() => {
507
+ const fields = this.getSortedFillableFields();
508
+ const nextField = this.getNextFieldFromList(fields);
509
+ if (nextField) {
510
+ this.focusField(nextField);
511
+ }
512
+ }, 100);
513
+ return;
469
514
  }
470
515
  this.showSpinner = true;
471
516
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -477,6 +522,14 @@ const VerdocsSign = class {
477
522
  this.updateRecipientFieldValue(field.name, updateResult);
478
523
  this.signatureId = newSignature.id;
479
524
  this.showSpinner = false;
525
+ // Auto-focus next field after filling signature
526
+ setTimeout(() => {
527
+ const fields = this.getSortedFillableFields();
528
+ const nextField = this.getNextFieldFromList(fields);
529
+ if (nextField) {
530
+ this.focusField(nextField);
531
+ }
532
+ }, 100);
480
533
  })
481
534
  .catch(e => {
482
535
  console.warn('[SIGN] Error updating signature', e);
@@ -486,7 +539,16 @@ const VerdocsSign = class {
486
539
  case 'date':
487
540
  const { formattedDate } = e.detail;
488
541
  if (formattedDate) {
489
- return this.saveFieldChange(field.name, formattedDate, false);
542
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
543
+ // Auto-focus next field after filling date
544
+ setTimeout(() => {
545
+ const fields = this.getSortedFillableFields();
546
+ const nextField = this.getNextFieldFromList(fields);
547
+ if (nextField) {
548
+ this.focusField(nextField);
549
+ }
550
+ }, 100);
551
+ });
490
552
  }
491
553
  break;
492
554
  case 'timestamp':