@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.
@@ -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,40 @@ 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 (only if not the last field)
448
+ setTimeout(() => {
449
+ const fields = this.getSortedFillableFields();
450
+ const currentIndex = fields.findIndex(f => f.name === field.name);
451
+ // Only focus next field if current field is not the last one
452
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
453
+ const nextField = this.getNextFieldFromList(fields);
454
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
455
+ this.focusField(nextField);
456
+ }
457
+ }
458
+ }, 100);
459
+ return;
446
460
  }
447
461
  // If it's a UUID, it's an existing initial ID we can just reuse
448
462
  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
463
  console.log('[SIGN] Reusing initial', e.detail);
450
464
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
451
465
  this.initialId = e.detail;
452
- return this.updateRecipientFieldValue(field.name, updateResult);
466
+ this.updateRecipientFieldValue(field.name, updateResult);
467
+ // Auto-focus next field after filling initial (only if not the last field)
468
+ setTimeout(() => {
469
+ const fields = this.getSortedFillableFields();
470
+ const currentIndex = fields.findIndex(f => f.name === field.name);
471
+ // Only focus next field if current field is not the last one
472
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
473
+ const nextField = this.getNextFieldFromList(fields);
474
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
475
+ this.focusField(nextField);
476
+ }
477
+ }
478
+ }, 100);
479
+ return;
453
480
  }
454
481
  this.showSpinner = true;
455
482
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -459,6 +486,14 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
459
486
  this.updateRecipientFieldValue(field.name, updateResult);
460
487
  this.initialId = newInitials.id;
461
488
  this.showSpinner = false;
489
+ // Auto-focus next field after filling initial
490
+ setTimeout(() => {
491
+ const fields = this.getSortedFillableFields();
492
+ const nextField = this.getNextFieldFromList(fields);
493
+ if (nextField) {
494
+ this.focusField(nextField);
495
+ }
496
+ }, 100);
462
497
  })
463
498
  .catch(e => {
464
499
  console.log('Error updating initials', e);
@@ -484,14 +519,40 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
484
519
  if (this.signatureId) {
485
520
  console.log('[SIGN] Reusing signature', this.signatureId);
486
521
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
487
- return this.updateRecipientFieldValue(field.name, updateResult);
522
+ this.updateRecipientFieldValue(field.name, updateResult);
523
+ // Auto-focus next field after filling signature (only if not the last field)
524
+ setTimeout(() => {
525
+ const fields = this.getSortedFillableFields();
526
+ const currentIndex = fields.findIndex(f => f.name === field.name);
527
+ // Only focus next field if current field is not the last one
528
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
529
+ const nextField = this.getNextFieldFromList(fields);
530
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
531
+ this.focusField(nextField);
532
+ }
533
+ }
534
+ }, 100);
535
+ return;
488
536
  }
489
537
  // If it's a UUID, it's an existing signature ID we can just reuse
490
538
  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
539
  console.log('[SIGN] Reusing signature', e.detail);
492
540
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
493
541
  this.signatureId = e.detail;
494
- return this.updateRecipientFieldValue(field.name, updateResult);
542
+ this.updateRecipientFieldValue(field.name, updateResult);
543
+ // Auto-focus next field after filling signature (only if not the last field)
544
+ setTimeout(() => {
545
+ const fields = this.getSortedFillableFields();
546
+ const currentIndex = fields.findIndex(f => f.name === field.name);
547
+ // Only focus next field if current field is not the last one
548
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
549
+ const nextField = this.getNextFieldFromList(fields);
550
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
551
+ this.focusField(nextField);
552
+ }
553
+ }
554
+ }, 100);
555
+ return;
495
556
  }
496
557
  this.showSpinner = true;
497
558
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -503,6 +564,14 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
503
564
  this.updateRecipientFieldValue(field.name, updateResult);
504
565
  this.signatureId = newSignature.id;
505
566
  this.showSpinner = false;
567
+ // Auto-focus next field after filling signature
568
+ setTimeout(() => {
569
+ const fields = this.getSortedFillableFields();
570
+ const nextField = this.getNextFieldFromList(fields);
571
+ if (nextField) {
572
+ this.focusField(nextField);
573
+ }
574
+ }, 100);
506
575
  })
507
576
  .catch(e => {
508
577
  console.warn('[SIGN] Error updating signature', e);
@@ -512,7 +581,20 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
512
581
  case 'date':
513
582
  const { formattedDate } = e.detail;
514
583
  if (formattedDate) {
515
- return this.saveFieldChange(field.name, formattedDate, false);
584
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
585
+ // Auto-focus next field after filling date (only if not the last field)
586
+ setTimeout(() => {
587
+ const fields = this.getSortedFillableFields();
588
+ const currentIndex = fields.findIndex(f => f.name === field.name);
589
+ // Only focus next field if current field is not the last one
590
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
591
+ const nextField = this.getNextFieldFromList(fields);
592
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
593
+ this.focusField(nextField);
594
+ }
595
+ }
596
+ }, 100);
597
+ });
516
598
  }
517
599
  break;
518
600
  case 'timestamp':