@verdocs/web-sdk 6.5.0-beta.10 → 6.5.0-beta.11

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.
Files changed (108) hide show
  1. package/dist/cjs/index-CQ5bTnED.js +10 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{verdocs-field-attachment_13.cjs.entry.js → verdocs-field-attachment_11.cjs.entry.js} +14 -623
  4. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +229 -0
  5. package/dist/cjs/verdocs-initial-dialog.entry.cjs.js.map +1 -0
  6. package/dist/cjs/verdocs-sign.cjs.entry.js +72 -5
  7. package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
  8. package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +355 -0
  9. package/dist/cjs/verdocs-signature-dialog.entry.cjs.js.map +1 -0
  10. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  11. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +72 -5
  12. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  13. package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +17 -26
  14. package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js.map +1 -1
  15. package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +32 -26
  16. package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js.map +1 -1
  17. package/dist/components/{p-CYoBhLFP.js → p-B4XIUesD.js} +42 -54
  18. package/dist/components/p-B4XIUesD.js.map +1 -0
  19. package/dist/components/{p-DjOK66Dt.js → p-BoIZ0eWm.js} +43 -55
  20. package/dist/components/p-BoIZ0eWm.js.map +1 -0
  21. package/dist/components/{p-BxnX5zPJ.js → p-BzCNCMTQ.js} +24 -53
  22. package/dist/components/p-BzCNCMTQ.js.map +1 -0
  23. package/dist/components/{p-DKJPJj6P.js → p-CaA92LBj.js} +43 -55
  24. package/dist/components/p-CaA92LBj.js.map +1 -0
  25. package/dist/components/{p-Bygkg9Ho.js → p-DlWkjPea.js} +17 -41
  26. package/dist/components/p-DlWkjPea.js.map +1 -0
  27. package/dist/components/verdocs-build.js +56 -68
  28. package/dist/components/verdocs-build.js.map +1 -1
  29. package/dist/components/verdocs-field-initial.js +1 -1
  30. package/dist/components/verdocs-field-signature.js +1 -1
  31. package/dist/components/verdocs-initial-dialog.js +263 -1
  32. package/dist/components/verdocs-initial-dialog.js.map +1 -1
  33. package/dist/components/verdocs-preview.js +1 -1
  34. package/dist/components/verdocs-sign.js +72 -5
  35. package/dist/components/verdocs-sign.js.map +1 -1
  36. package/dist/components/verdocs-signature-dialog.js +393 -1
  37. package/dist/components/verdocs-signature-dialog.js.map +1 -1
  38. package/dist/components/verdocs-template-document-page.js +1 -1
  39. package/dist/components/verdocs-template-fields.js +1 -1
  40. package/dist/esm/index-BIRwgFLv.js +10 -2
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/{verdocs-field-attachment_13.entry.js → verdocs-field-attachment_11.entry.js} +15 -622
  43. package/dist/{components/p-Daqfz15U.js → esm/verdocs-initial-dialog.entry.js} +8 -49
  44. package/dist/esm/verdocs-initial-dialog.entry.js.map +1 -0
  45. package/dist/esm/verdocs-sign.entry.js +72 -5
  46. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  47. package/dist/{components/p-0L80sqd9.js → esm/verdocs-signature-dialog.entry.js} +8 -53
  48. package/dist/esm/verdocs-signature-dialog.entry.js.map +1 -0
  49. package/dist/esm/verdocs-web-sdk.js +1 -1
  50. package/dist/esm-es5/index-BIRwgFLv.js +1 -1
  51. package/dist/esm-es5/loader.js +1 -1
  52. package/dist/esm-es5/verdocs-field-attachment_11.entry.js +2 -0
  53. package/dist/esm-es5/verdocs-field-attachment_11.entry.js.map +1 -0
  54. package/dist/esm-es5/verdocs-initial-dialog.entry.js +2 -0
  55. package/dist/esm-es5/verdocs-initial-dialog.entry.js.map +1 -0
  56. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  58. package/dist/esm-es5/verdocs-signature-dialog.entry.js +2 -0
  59. package/dist/esm-es5/verdocs-signature-dialog.entry.js.map +1 -0
  60. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  61. package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +1 -4
  62. package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +2 -4
  63. package/dist/types/components.d.ts +10 -8
  64. package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js +2 -0
  65. package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js.map +1 -0
  66. package/dist/verdocs-web-sdk/p-2fb3119a.entry.js +2 -0
  67. package/dist/verdocs-web-sdk/p-2fb3119a.entry.js.map +1 -0
  68. package/dist/verdocs-web-sdk/p-36659fcd.entry.js +2 -0
  69. package/dist/verdocs-web-sdk/p-36659fcd.entry.js.map +1 -0
  70. package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js +2 -0
  71. package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js.map +1 -0
  72. package/dist/verdocs-web-sdk/p-5d720de7.entry.js +2 -0
  73. package/dist/verdocs-web-sdk/p-5d720de7.entry.js.map +1 -0
  74. package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js +2 -0
  75. package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js.map +1 -0
  76. package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
  77. package/dist/verdocs-web-sdk/p-BYyqNgjP.system.js.map +1 -0
  78. package/dist/verdocs-web-sdk/p-D2FLn0Fu.system.js.map +1 -0
  79. package/dist/verdocs-web-sdk/p-DQr2_l0b.system.js.map +1 -0
  80. package/dist/verdocs-web-sdk/p-c7243201.system.entry.js +2 -0
  81. package/dist/verdocs-web-sdk/p-c7243201.system.entry.js.map +1 -0
  82. package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js +2 -0
  83. package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js.map +1 -0
  84. package/dist/verdocs-web-sdk/p-u99GfztJ.system.js.map +1 -0
  85. package/dist/verdocs-web-sdk/verdocs-initial-dialog.entry.esm.js.map +1 -0
  86. package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
  87. package/dist/verdocs-web-sdk/verdocs-signature-dialog.entry.esm.js.map +1 -0
  88. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  89. package/package.json +2 -2
  90. package/dist/components/p-0L80sqd9.js.map +0 -1
  91. package/dist/components/p-BxnX5zPJ.js.map +0 -1
  92. package/dist/components/p-Bygkg9Ho.js.map +0 -1
  93. package/dist/components/p-CYoBhLFP.js.map +0 -1
  94. package/dist/components/p-DKJPJj6P.js.map +0 -1
  95. package/dist/components/p-Daqfz15U.js.map +0 -1
  96. package/dist/components/p-DjOK66Dt.js.map +0 -1
  97. package/dist/esm-es5/verdocs-field-attachment_13.entry.js +0 -2
  98. package/dist/esm-es5/verdocs-field-attachment_13.entry.js.map +0 -1
  99. package/dist/verdocs-web-sdk/p-198d3577.entry.js +0 -2
  100. package/dist/verdocs-web-sdk/p-198d3577.entry.js.map +0 -1
  101. package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js +0 -2
  102. package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js.map +0 -1
  103. package/dist/verdocs-web-sdk/p-644689ce.system.entry.js +0 -2
  104. package/dist/verdocs-web-sdk/p-644689ce.system.entry.js.map +0 -1
  105. package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js +0 -2
  106. package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js.map +0 -1
  107. package/dist/verdocs-web-sdk/p-BBoL1FXa.system.js.map +0 -1
  108. package/dist/verdocs-web-sdk/p-DSPz-5FG.system.js.map +0 -1
@@ -9,6 +9,29 @@ import { getFieldId, renderDocumentField, renderDocumentFlag, saveAttachment, up
9
9
  import { VerdocsToast } from "../../../utils/Toast";
10
10
  import { SDKError } from "../../../utils/errors";
11
11
  import { Store } from "../../../utils/Datastore";
12
+ /**
13
+ * Helper to generate a human-readable label for a field.
14
+ */
15
+ const getFieldLabel = (field) => {
16
+ if (!field)
17
+ return '';
18
+ const typeMap = {
19
+ signature: 'Signature',
20
+ initial: 'Initials',
21
+ date: 'Date',
22
+ textbox: 'Text Field',
23
+ checkbox: 'Checkbox',
24
+ radio: 'Radio Button',
25
+ dropdown: 'Dropdown',
26
+ attachment: 'Attachment',
27
+ payment: 'Payment',
28
+ };
29
+ const typeName = typeMap[field.type] || 'Field';
30
+ if (field.required) {
31
+ return `Required ${typeName}*`;
32
+ }
33
+ return `Optional ${typeName}`;
34
+ };
12
35
  /**
13
36
  * Display an envelope signing experience. This will display the envelope's attached
14
37
  * documents with signing fields overlaid on each page.
@@ -116,6 +139,12 @@ export class VerdocsSign {
116
139
  // session and might have a different "view" of the envelope.
117
140
  const response = await startSigningSession(this.endpoint, this.envelopeId, this.roleId, this.inviteCode);
118
141
  this.processAuthResponse(response);
142
+ const fillable = this.getSortedFillableFields();
143
+ if (fillable.length > 0) {
144
+ setTimeout(() => {
145
+ this.focusedField = fillable[0].name;
146
+ }, 500);
147
+ }
119
148
  }
120
149
  catch (e) {
121
150
  console.log('[SIGN] Error with signing session', e);
@@ -451,6 +480,7 @@ export class VerdocsSign {
451
480
  // Find and focus the next incomplete field (that is fillable)
452
481
  const emptyFields = this.getSortedFillableFields().filter(field => field.required && !isFieldFilled(field, this.getRecipientFields()));
453
482
  sortFields(emptyFields);
483
+ console.log('[SIGN] Pending fields', emptyFields.map(f => `${f.name} (${f.type}) req=${f.required}`));
454
484
  // If everything required is filled, try optional fields?
455
485
  // The previous logic only looked for required fields for "Next".
456
486
  // If we want "Fill or Skip", we should probably look for ANY unfilled field if we want to guide them to optionals too.
@@ -508,7 +538,14 @@ export class VerdocsSign {
508
538
  // Remove existing flags
509
539
  const existingFlags = controlsDiv.querySelectorAll('.verdocs-flag-instance');
510
540
  existingFlags.forEach(el => el.remove());
511
- const nextField = this.getNextRequiredField();
541
+ let nextField = this.getNextRequiredField();
542
+ const focusedFieldObj = this.getRecipientFields().find(f => f.name === this.focusedField);
543
+ // If the currently focused field is unfilled, we should point the flag to IT, not the next one.
544
+ // getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
545
+ // should guide the user to the current task if it's incomplete.
546
+ if (focusedFieldObj && !isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
547
+ nextField = focusedFieldObj;
548
+ }
512
549
  if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
513
550
  const variant = 'fill';
514
551
  let label = 'FILL';
@@ -695,6 +732,10 @@ export class VerdocsSign {
695
732
  el.addEventListener('fieldChange', e => {
696
733
  this.handleFieldChange(field, e).finally(() => this.checkRecipientFields());
697
734
  });
735
+ el.addEventListener('adopt', () => {
736
+ this.focusedField = field.name;
737
+ this.adoptingSignature = true;
738
+ });
698
739
  el.setAttribute('templateid', this.envelope.template_id);
699
740
  el.setAttribute('fieldname', field.name);
700
741
  el.setAttribute('page', pageInfo.pageNumber);
@@ -763,15 +804,16 @@ export class VerdocsSign {
763
804
  this.processAuthResponse(r);
764
805
  })
765
806
  .catch(e => {
766
- var _a, _b, _c, _d, _e;
807
+ var _a, _b, _c, _d, _e, _f;
767
808
  console.log('[SIGN] Error submitting authentication step', e);
768
- if ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.includes('failed')) {
809
+ console.log((_a = e.response) === null || _a === void 0 ? void 0 : _a.data);
810
+ if ((_d = (_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === null || _d === void 0 ? void 0 : _d.includes('failed')) {
769
811
  this.fatalErrorHeader = 'Recipient Verification Failed';
770
812
  this.fatalErrorMessage = 'We were unable to verify your identity. The sender has been notified.';
771
813
  this.isDone = true;
772
814
  }
773
815
  else {
774
- VerdocsToast(((_e = (_d = e.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) || 'Unable to verify your identity. Please try again.', { style: 'error' });
816
+ VerdocsToast(((_f = (_e = e.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.error) || 'Unable to verify your identity. Please try again.', { style: 'error' });
775
817
  }
776
818
  });
777
819
  }
@@ -885,7 +927,16 @@ export class VerdocsSign {
885
927
  : console.log('[SIGN] All field valid');
886
928
  return (h(Host, null, h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), !this.finishLater && h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel, disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), (() => {
887
929
  const focusedFieldObj = this.getSortedFillableFields().find(f => f.name === this.focusedField);
888
- return (h("verdocs-signing-progress", { mode: this.nextSubmits ? 'completed' : false && this.signatureId && this.initialId ? 'signing' : 'start', current: Math.max(1, this.getSortedFillableFields().findIndex(f => f.name === this.focusedField) + 1), total: this.getSortedFillableFields().length, fieldLabel: (focusedFieldObj === null || focusedFieldObj === void 0 ? void 0 : focusedFieldObj.label) || (focusedFieldObj === null || focusedFieldObj === void 0 ? void 0 : focusedFieldObj.name) || '', fieldCompleted: focusedFieldObj ? !!isFieldFilled(focusedFieldObj, this.getRecipientFields()) : false, onStarted: () => {
930
+ const currentIndex = this.getSortedFillableFields().findIndex(f => f.name === this.focusedField) + 1;
931
+ const totalFields = this.getSortedFillableFields().length;
932
+ let mode = 'start';
933
+ if (this.nextSubmits) {
934
+ mode = 'completed';
935
+ }
936
+ else if (this.signatureId || this.initialId) {
937
+ mode = 'signing';
938
+ }
939
+ return (h("verdocs-signing-progress", { mode: mode, current: Math.max(1, currentIndex), total: totalFields, fieldLabel: getFieldLabel(focusedFieldObj), fieldCompleted: focusedFieldObj ? !!isFieldFilled(focusedFieldObj, this.getRecipientFields()) : false, onStarted: () => {
889
940
  this.adoptingSignature = true;
890
941
  // this.handleNext();
891
942
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }));
@@ -926,6 +977,22 @@ export class VerdocsSign {
926
977
  this.initialId = initResult.id;
927
978
  this.showSpinner = false;
928
979
  this.adoptingSignature = false;
980
+ // If we have a focused field, we should auto-apply the new signature/initials to it
981
+ if (this.focusedField) {
982
+ const field = this.getRecipientFields().find(f => f.name === this.focusedField);
983
+ if (field && !isFieldFilled(field, this.getRecipientFields())) {
984
+ console.log('[SIGN] Auto-applying adopted signature to focused field', field.name);
985
+ if (field.type === 'signature') {
986
+ const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
987
+ this.updateRecipientFieldValue(field.name, updateResult);
988
+ }
989
+ else if (field.type === 'initial') {
990
+ const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
991
+ this.updateRecipientFieldValue(field.name, updateResult);
992
+ }
993
+ this.checkRecipientFields();
994
+ }
995
+ }
929
996
  }, onExit: () => (this.adoptingSignature = false) })), (this.submitting || this.showSpinner) && (h("verdocs-portal", null, h("div", { class: "spinner-overlay" }, h("verdocs-spinner", null)))), !this.loading && !this.isDone && (h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, isDone: this.isDone, onAskQuestion: (e) => {
930
997
  askQuestion(this.endpoint, this.envelopeId, this.roleId, { question: e.detail.question })
931
998
  .then(() => VerdocsToast('Your question has been sent.', { style: 'success' }))