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