@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.
@@ -361,10 +361,10 @@ const VerdocsSign = class {
361
361
  // logic to the fields.
362
362
  const field = this.getRecipientFields().find(field => field.name === fieldName);
363
363
  if (field === null || field === void 0 ? void 0 : field.readonly) {
364
- return;
364
+ return Promise.resolve();
365
365
  }
366
366
  console.log('[SIGN] saveFieldChange', fieldName, { value, prepared });
367
- jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
367
+ return jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, fieldName, value, prepared)
368
368
  .then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
369
369
  .catch(e => {
370
370
  var _a, _b, _c, _d, _e, _f;
@@ -378,6 +378,7 @@ const VerdocsSign = class {
378
378
  Toast.VerdocsToast('Unable to save change, please try again later', { style: 'error' });
379
379
  }
380
380
  (_d = this.sdkError) === null || _d === void 0 ? void 0 : _d.emit(new errors.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));
381
+ throw e;
381
382
  });
382
383
  }
383
384
  async handleFieldChange(field, e) {
@@ -418,14 +419,32 @@ const VerdocsSign = class {
418
419
  if (this.initialId) {
419
420
  console.log('[SIGN] Reusing initial', this.initialId);
420
421
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
421
- return this.updateRecipientFieldValue(field.name, updateResult);
422
+ this.updateRecipientFieldValue(field.name, updateResult);
423
+ // Auto-focus next field after filling initial
424
+ setTimeout(() => {
425
+ const fields = this.getSortedFillableFields();
426
+ const nextField = this.getNextFieldFromList(fields);
427
+ if (nextField) {
428
+ this.focusField(nextField);
429
+ }
430
+ }, 100);
431
+ return;
422
432
  }
423
433
  // If it's a UUID, it's an existing initial ID we can just reuse
424
434
  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)) {
425
435
  console.log('[SIGN] Reusing initial', e.detail);
426
436
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
427
437
  this.initialId = e.detail;
428
- return this.updateRecipientFieldValue(field.name, updateResult);
438
+ this.updateRecipientFieldValue(field.name, updateResult);
439
+ // Auto-focus next field after filling initial
440
+ setTimeout(() => {
441
+ const fields = this.getSortedFillableFields();
442
+ const nextField = this.getNextFieldFromList(fields);
443
+ if (nextField) {
444
+ this.focusField(nextField);
445
+ }
446
+ }, 100);
447
+ return;
429
448
  }
430
449
  this.showSpinner = true;
431
450
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -435,6 +454,14 @@ const VerdocsSign = class {
435
454
  this.updateRecipientFieldValue(field.name, updateResult);
436
455
  this.initialId = newInitials.id;
437
456
  this.showSpinner = false;
457
+ // Auto-focus next field after filling initial
458
+ setTimeout(() => {
459
+ const fields = this.getSortedFillableFields();
460
+ const nextField = this.getNextFieldFromList(fields);
461
+ if (nextField) {
462
+ this.focusField(nextField);
463
+ }
464
+ }, 100);
438
465
  })
439
466
  .catch(e => {
440
467
  console.log('Error updating initials', e);
@@ -460,14 +487,32 @@ const VerdocsSign = class {
460
487
  if (this.signatureId) {
461
488
  console.log('[SIGN] Reusing signature', this.signatureId);
462
489
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
463
- return this.updateRecipientFieldValue(field.name, updateResult);
490
+ this.updateRecipientFieldValue(field.name, updateResult);
491
+ // Auto-focus next field after filling signature
492
+ setTimeout(() => {
493
+ const fields = this.getSortedFillableFields();
494
+ const nextField = this.getNextFieldFromList(fields);
495
+ if (nextField) {
496
+ this.focusField(nextField);
497
+ }
498
+ }, 100);
499
+ return;
464
500
  }
465
501
  // If it's a UUID, it's an existing signature ID we can just reuse
466
502
  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)) {
467
503
  console.log('[SIGN] Reusing signature', e.detail);
468
504
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
469
505
  this.signatureId = e.detail;
470
- return this.updateRecipientFieldValue(field.name, updateResult);
506
+ this.updateRecipientFieldValue(field.name, updateResult);
507
+ // Auto-focus next field after filling signature
508
+ setTimeout(() => {
509
+ const fields = this.getSortedFillableFields();
510
+ const nextField = this.getNextFieldFromList(fields);
511
+ if (nextField) {
512
+ this.focusField(nextField);
513
+ }
514
+ }, 100);
515
+ return;
471
516
  }
472
517
  this.showSpinner = true;
473
518
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -479,6 +524,14 @@ const VerdocsSign = class {
479
524
  this.updateRecipientFieldValue(field.name, updateResult);
480
525
  this.signatureId = newSignature.id;
481
526
  this.showSpinner = false;
527
+ // Auto-focus next field after filling signature
528
+ setTimeout(() => {
529
+ const fields = this.getSortedFillableFields();
530
+ const nextField = this.getNextFieldFromList(fields);
531
+ if (nextField) {
532
+ this.focusField(nextField);
533
+ }
534
+ }, 100);
482
535
  })
483
536
  .catch(e => {
484
537
  console.warn('[SIGN] Error updating signature', e);
@@ -488,7 +541,16 @@ const VerdocsSign = class {
488
541
  case 'date':
489
542
  const { formattedDate } = e.detail;
490
543
  if (formattedDate) {
491
- return this.saveFieldChange(field.name, formattedDate, false);
544
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
545
+ // Auto-focus next field after filling date
546
+ setTimeout(() => {
547
+ const fields = this.getSortedFillableFields();
548
+ const nextField = this.getNextFieldFromList(fields);
549
+ if (nextField) {
550
+ this.focusField(nextField);
551
+ }
552
+ }, 100);
553
+ });
492
554
  }
493
555
  break;
494
556
  case 'timestamp':