@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.
@@ -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,40 @@ 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 (only if not the last field)
424
+ setTimeout(() => {
425
+ const fields = this.getSortedFillableFields();
426
+ const currentIndex = fields.findIndex(f => f.name === field.name);
427
+ // Only focus next field if current field is not the last one
428
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
429
+ const nextField = this.getNextFieldFromList(fields);
430
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
431
+ this.focusField(nextField);
432
+ }
433
+ }
434
+ }, 100);
435
+ return;
422
436
  }
423
437
  // If it's a UUID, it's an existing initial ID we can just reuse
424
438
  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
439
  console.log('[SIGN] Reusing initial', e.detail);
426
440
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
427
441
  this.initialId = e.detail;
428
- return this.updateRecipientFieldValue(field.name, updateResult);
442
+ this.updateRecipientFieldValue(field.name, updateResult);
443
+ // Auto-focus next field after filling initial (only if not the last field)
444
+ setTimeout(() => {
445
+ const fields = this.getSortedFillableFields();
446
+ const currentIndex = fields.findIndex(f => f.name === field.name);
447
+ // Only focus next field if current field is not the last one
448
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
449
+ const nextField = this.getNextFieldFromList(fields);
450
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
451
+ this.focusField(nextField);
452
+ }
453
+ }
454
+ }, 100);
455
+ return;
429
456
  }
430
457
  this.showSpinner = true;
431
458
  const initialsBlob = await (await fetch(e.detail)).blob();
@@ -435,6 +462,14 @@ const VerdocsSign = class {
435
462
  this.updateRecipientFieldValue(field.name, updateResult);
436
463
  this.initialId = newInitials.id;
437
464
  this.showSpinner = false;
465
+ // Auto-focus next field after filling initial
466
+ setTimeout(() => {
467
+ const fields = this.getSortedFillableFields();
468
+ const nextField = this.getNextFieldFromList(fields);
469
+ if (nextField) {
470
+ this.focusField(nextField);
471
+ }
472
+ }, 100);
438
473
  })
439
474
  .catch(e => {
440
475
  console.log('Error updating initials', e);
@@ -460,14 +495,40 @@ const VerdocsSign = class {
460
495
  if (this.signatureId) {
461
496
  console.log('[SIGN] Reusing signature', this.signatureId);
462
497
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
463
- return this.updateRecipientFieldValue(field.name, updateResult);
498
+ this.updateRecipientFieldValue(field.name, updateResult);
499
+ // Auto-focus next field after filling signature (only if not the last field)
500
+ setTimeout(() => {
501
+ const fields = this.getSortedFillableFields();
502
+ const currentIndex = fields.findIndex(f => f.name === field.name);
503
+ // Only focus next field if current field is not the last one
504
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
505
+ const nextField = this.getNextFieldFromList(fields);
506
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
507
+ this.focusField(nextField);
508
+ }
509
+ }
510
+ }, 100);
511
+ return;
464
512
  }
465
513
  // If it's a UUID, it's an existing signature ID we can just reuse
466
514
  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
515
  console.log('[SIGN] Reusing signature', e.detail);
468
516
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
469
517
  this.signatureId = e.detail;
470
- return this.updateRecipientFieldValue(field.name, updateResult);
518
+ this.updateRecipientFieldValue(field.name, updateResult);
519
+ // Auto-focus next field after filling signature (only if not the last field)
520
+ setTimeout(() => {
521
+ const fields = this.getSortedFillableFields();
522
+ const currentIndex = fields.findIndex(f => f.name === field.name);
523
+ // Only focus next field if current field is not the last one
524
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
525
+ const nextField = this.getNextFieldFromList(fields);
526
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
527
+ this.focusField(nextField);
528
+ }
529
+ }
530
+ }, 100);
531
+ return;
471
532
  }
472
533
  this.showSpinner = true;
473
534
  const signatureBlob = await (await fetch(e.detail)).blob();
@@ -479,6 +540,14 @@ const VerdocsSign = class {
479
540
  this.updateRecipientFieldValue(field.name, updateResult);
480
541
  this.signatureId = newSignature.id;
481
542
  this.showSpinner = false;
543
+ // Auto-focus next field after filling signature
544
+ setTimeout(() => {
545
+ const fields = this.getSortedFillableFields();
546
+ const nextField = this.getNextFieldFromList(fields);
547
+ if (nextField) {
548
+ this.focusField(nextField);
549
+ }
550
+ }, 100);
482
551
  })
483
552
  .catch(e => {
484
553
  console.warn('[SIGN] Error updating signature', e);
@@ -488,7 +557,20 @@ const VerdocsSign = class {
488
557
  case 'date':
489
558
  const { formattedDate } = e.detail;
490
559
  if (formattedDate) {
491
- return this.saveFieldChange(field.name, formattedDate, false);
560
+ return this.saveFieldChange(field.name, formattedDate, false).then(() => {
561
+ // Auto-focus next field after filling date (only if not the last field)
562
+ setTimeout(() => {
563
+ const fields = this.getSortedFillableFields();
564
+ const currentIndex = fields.findIndex(f => f.name === field.name);
565
+ // Only focus next field if current field is not the last one
566
+ if (currentIndex >= 0 && currentIndex < fields.length - 1) {
567
+ const nextField = this.getNextFieldFromList(fields);
568
+ if (nextField && fields.findIndex(f => f.name === nextField.name) > currentIndex) {
569
+ this.focusField(nextField);
570
+ }
571
+ }
572
+ }, 100);
573
+ });
492
574
  }
493
575
  break;
494
576
  case 'timestamp':