@hubsync/esign-web-sdk 6.9.44 → 6.9.45

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 (58) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.cjs.js.map +1 -1
  3. package/dist/cjs/verdocs-adopt-signature-dialog_8.cjs.entry.js +33 -6
  4. package/dist/cjs/verdocs-sign.cjs.entry.js +52 -2
  5. package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
  6. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  7. package/dist/collection/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.js +87 -11
  8. package/dist/collection/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.js.map +1 -1
  9. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +54 -2
  10. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  11. package/dist/components/{p-DSzyP6KP.js → p-DFsjkMkI.js} +37 -8
  12. package/dist/components/p-DFsjkMkI.js.map +1 -0
  13. package/dist/components/verdocs-adopt-signature-dialog.js +1 -1
  14. package/dist/components/verdocs-sign.js +55 -3
  15. package/dist/components/verdocs-sign.js.map +1 -1
  16. package/dist/custom-elements.json +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +1 -1
  19. package/dist/esm/verdocs-adopt-signature-dialog_8.entry.js +33 -6
  20. package/dist/esm/verdocs-sign.entry.js +52 -2
  21. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  22. package/dist/esm/verdocs-web-sdk.js +1 -1
  23. package/dist/esm-es5/loader.js +1 -1
  24. package/dist/esm-es5/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +1 -1
  25. package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js +1 -1
  26. package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js.map +1 -1
  27. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  28. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  29. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  30. package/dist/types/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.d.ts +30 -3
  31. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +13 -0
  32. package/dist/types/components.d.ts +35 -5
  33. package/dist/verdocs-web-sdk/p-3832868c.entry.js +2 -0
  34. package/dist/verdocs-web-sdk/p-3832868c.entry.js.map +1 -0
  35. package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
  36. package/dist/verdocs-web-sdk/p-BEzGtFgy.system.js.map +1 -0
  37. package/dist/verdocs-web-sdk/p-CCpu7MXO.system.js.map +1 -0
  38. package/dist/verdocs-web-sdk/p-c67b23fc.system.entry.js +2 -0
  39. package/dist/verdocs-web-sdk/p-c67b23fc.system.entry.js.map +1 -0
  40. package/dist/verdocs-web-sdk/p-ec29782b.entry.js +2 -0
  41. package/dist/verdocs-web-sdk/p-ec29782b.entry.js.map +1 -0
  42. package/dist/verdocs-web-sdk/p-fe804f97.system.entry.js +2 -0
  43. package/dist/verdocs-web-sdk/p-fe804f97.system.entry.js.map +1 -0
  44. package/dist/verdocs-web-sdk/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.esm.js.map +1 -1
  45. package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
  46. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/components/p-DSzyP6KP.js.map +0 -1
  49. package/dist/verdocs-web-sdk/p-7a0f0515.entry.js +0 -2
  50. package/dist/verdocs-web-sdk/p-7a0f0515.entry.js.map +0 -1
  51. package/dist/verdocs-web-sdk/p-965a8331.entry.js +0 -2
  52. package/dist/verdocs-web-sdk/p-965a8331.entry.js.map +0 -1
  53. package/dist/verdocs-web-sdk/p-CSd2l4lv.system.js.map +0 -1
  54. package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js +0 -2
  55. package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js.map +0 -1
  56. package/dist/verdocs-web-sdk/p-dx3XIcHV.system.js.map +0 -1
  57. package/dist/verdocs-web-sdk/p-ff5f20c9.system.entry.js +0 -2
  58. package/dist/verdocs-web-sdk/p-ff5f20c9.system.entry.js.map +0 -1
@@ -234,17 +234,30 @@ const VerdocsAdoptSignatureDialog = class {
234
234
  }
235
235
  }
236
236
  async restoreDrawnPreviewsIfNeeded() {
237
+ var _a, _b;
237
238
  // Preserve in-session stroke edits; only restore saved previews when there are no strokes yet.
238
239
  if (this.allSigStrokes.length > 0 || this.allInitialsStrokes.length > 0) {
239
240
  return;
240
241
  }
241
242
  const tasks = [];
242
- if (this.initialSignature && this.signatureElement) {
243
+ // Prefer replaying the saved strokes (faithful + editable). Fall back to the rasterized preview only when no
244
+ // strokes are available, e.g. resuming from a server-stored bitmap in a fresh browser session.
245
+ if (((_a = this.initialSignatureStrokes) === null || _a === void 0 ? void 0 : _a.length) && this.signatureElement) {
246
+ this.allSigStrokes = this.denormalizeStrokes(this.initialSignatureStrokes, this.signatureElement);
247
+ this.hasDrawnSignature = true;
248
+ this.redrawDrawnSignature();
249
+ }
250
+ else if (this.initialSignature && this.signatureElement) {
243
251
  tasks.push(this.drawImageOnCanvas(this.signatureElement, this.initialSignature).then(() => {
244
252
  this.hasDrawnSignature = true;
245
253
  }));
246
254
  }
247
- if (this.initialInitials && this.initialsElement) {
255
+ if (((_b = this.initialInitialsStrokes) === null || _b === void 0 ? void 0 : _b.length) && this.initialsElement) {
256
+ this.allInitialsStrokes = this.denormalizeStrokes(this.initialInitialsStrokes, this.initialsElement);
257
+ this.hasDrawnInitials = true;
258
+ this.redrawDrawnInitials();
259
+ }
260
+ else if (this.initialInitials && this.initialsElement) {
248
261
  tasks.push(this.drawImageOnCanvas(this.initialsElement, this.initialInitials).then(() => {
249
262
  this.hasDrawnInitials = true;
250
263
  }));
@@ -383,7 +396,21 @@ const VerdocsAdoptSignatureDialog = class {
383
396
  e.preventDefault();
384
397
  const signature = this.signatureElement.toDataURL('image/png');
385
398
  const initials = this.initialsElement.toDataURL('image/png');
386
- this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName });
399
+ // Persist the editable source for drawn signatures so a future Edit can replay the exact strokes natively rather
400
+ // than reconstructing them from the bitmap. Typed signatures need no strokes — they re-render from the name.
401
+ const signatureStrokes = this.mode === 'draw' ? this.normalizeStrokes(this.allSigStrokes, this.signatureElement) : [];
402
+ const initialsStrokes = this.mode === 'draw' ? this.normalizeStrokes(this.allInitialsStrokes, this.initialsElement) : [];
403
+ this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName, signatureStrokes, initialsStrokes });
404
+ }
405
+ normalizeStrokes(strokes, canvas) {
406
+ const width = (canvas === null || canvas === void 0 ? void 0 : canvas.width) || 1;
407
+ const height = (canvas === null || canvas === void 0 ? void 0 : canvas.height) || 1;
408
+ return strokes.map(stroke => stroke.map(point => ({ x: point.x / width, y: point.y / height })));
409
+ }
410
+ denormalizeStrokes(strokes, canvas) {
411
+ const width = canvas.width || 1;
412
+ const height = canvas.height || 1;
413
+ return strokes.map(stroke => stroke.map(point => ({ x: point.x * width, y: point.y * height })));
387
414
  }
388
415
  isAdoptButtonDisabled() {
389
416
  switch (this.mode) {
@@ -512,11 +539,11 @@ const VerdocsAdoptSignatureDialog = class {
512
539
  };
513
540
  }
514
541
  render() {
515
- return (h("verdocs-dialog", { key: '3bf57218c88709dcb904ed197ac37551c26c8c37', persistent: true, onExit: () => this.exit.emit() }, h("div", { key: '26bf968eb7e6169e29c11c96806c387fc2891df2', slot: "heading", class: "heading" }, "Adopt Your Signature"), h("div", { key: 'dd9cb18b25d3055cf98a79fca2fe12a7a0f756da', slot: "content", class: "content" }, h("div", { key: 'ff7520ccf2d8e15a72b12aabeba11f785c33a4b1', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), h("div", { key: '428c77e16cfcddf1a202cc9155220fe7899f12e3', class: { type: true, active: this.mode === 'type' } }, h("verdocs-text-input", { key: '3df310a9c55c581350fc5ee5847e768764283ee6', label: "Full Name", value: this.enteredName, disabled: this.nameLocked, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), this.nameLocked && h("div", { key: '060c1edd0986a6be98f9ce68f7b94d562782a3ae', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), h("div", { key: '95b80e7b68150ba7e912176834686b769c1ad74e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), h("div", { key: '8567f38208d1c2130ecacb21a6f09eaa089f6fb4', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: '278fa39a73863c07512b297cdc13d2ad6bc18320', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), h("label", { key: '20ebbd899fa095783e0b9b307e7c5bc6c73585c8' }, "Typed with a keyboard")), h("div", { key: '2aa96af7da2dbff4437f76d3be8c25660a5ae5ec', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: 'e72c8a7350e6a368748746622dfc8382c94bbd7d', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), h("label", { key: '423eff813da06377c1c5d66f8ea813564f40478c' }, "Drawn with touch, mouse, or stylus")), h("div", { key: '013b7108cd626c5ef736520c4e93374205d62ea1', class: "preview-header" }, h("div", { key: '9af65f41a953990c2412b02176e921a60ef191ca', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (h("button", { key: '5e422b7f7ef72fdf50eb7c5e102b9062a6f10e1c', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), h("div", { key: '220cdf4f321aa3a388c9c4f9340d130cb207e7cf', class: "canvas-container signature-container" }, h("div", { key: '0ffa2c39b216ecd3ef76a36122b8d51f6e5a59bb', class: "signing-indicator" }, h("div", { key: 'c295f652022004645377620a49b9314330bbca7c', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: '0b24b19acd68f1e9ab9588f7b0aa3412e571a12d', class: "signing-line" })), h("canvas", { key: '72134d2f592c8f60fab5a90290f15b21e0b3e6aa', ref: el => (this.signatureElement = el),
542
+ return (h("verdocs-dialog", { key: 'ddc22647c01547a474b875c409358e3af2f24e3c', persistent: true, onExit: () => this.exit.emit() }, h("div", { key: 'e8a0089ee73a51008d0aeec9dcc7fca1576104ac', slot: "heading", class: "heading" }, "Adopt Your Signature"), h("div", { key: '2d7c449062e88b4bc25d6762cd6c793992f47f4d', slot: "content", class: "content" }, h("div", { key: 'e8d4ec00383967dc9fe30d773ec2212d93b82975', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), h("div", { key: '0f694d93d6f00feb519841870c0fc6a71194d2ca', class: { type: true, active: this.mode === 'type' } }, h("verdocs-text-input", { key: '0d5513fef5e5572b7f4abf1cbac0a1ca3440463f', label: "Full Name", value: this.enteredName, disabled: this.nameLocked, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), this.nameLocked && h("div", { key: 'e89a2f87dcfad2fe8f8f4d48a24223e6ea17383d', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), h("div", { key: 'd11ea670ee76e772a38455f30f18cbec98fb395a', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), h("div", { key: '3bf1e22f0a9e3bbadd0bf4f0b8a3f1b3896d7315', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: '99eef6a79eea724f2ad8e66b9394dd40bc9acfe0', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), h("label", { key: '04194fdf3a502ffd95b696ed9078ab3982a0caf9' }, "Typed with a keyboard")), h("div", { key: '4e122b72fe041edaf499c5ce9ebabaa5c0883a61', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: '4a4f2b7492cdb8118184347613cd27ab4994b4dd', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), h("label", { key: '86824cda2d7968e30d26426e40f336797776ced2' }, "Drawn with touch, mouse, or stylus")), h("div", { key: '94993f0f41b5099d2e86703e711041939c98eda9', class: "preview-header" }, h("div", { key: '55bad19f2cf23ef7ecb4793f76b95feab654b940', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (h("button", { key: 'ef4713146fca813bef48f537190c438819ff84a2', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), h("div", { key: '1e58344a555fe2e224f159f3ef830d46ef362086', class: "canvas-container signature-container" }, h("div", { key: '16fac93400bd3f53e7420222c6ba062d49b5d665', class: "signing-indicator" }, h("div", { key: 'e094b7097e905fd438cebc0d897faf1746eefcc7', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: 'a67e3effd1f6db780c8a20d31dedd1940e874062', class: "signing-line" })), h("canvas", { key: '5d6c807b860ac53af851dd85cc655aa797ece1ae', ref: el => (this.signatureElement = el),
516
543
  // width="300"
517
- height: "79", class: "signature-canvas", onPointerDown: this.handleSigPointerDown, onPointerMove: this.handleSigPointerMove, onPointerUp: this.handleSigPointerUp, onPointerCancel: this.handleSigPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: '847d54a8a55652ab67a3909d6510a4d587fb9bd8', class: "preview-header" }, h("div", { key: 'e270bb3dc8971ecc816db09ec6d91eb1a6613786', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (h("button", { key: 'be4a46390d14a90f9705f40ff90a920174d58d85', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), h("div", { key: 'a8c2ace5575bf6b95e18e08febbd2dd3876d53c6', class: "canvas-container initials-container" }, h("div", { key: '1cab75d06695c2458452b4adc039f1078959c740', class: "signing-indicator" }, h("div", { key: 'e925e1f10a180aa65953dba5c007f294daf52ad2', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: 'ecd9548ff69aa7ac7241433c1e88e5d66ceb2486', class: "signing-line" })), h("canvas", { key: '46c776d1efcee7e3d5bf5bd4a01db517eb638481', ref: el => (this.initialsElement = el),
544
+ height: "79", class: "signature-canvas", onPointerDown: this.handleSigPointerDown, onPointerMove: this.handleSigPointerMove, onPointerUp: this.handleSigPointerUp, onPointerCancel: this.handleSigPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: '53953056fcc62dc29bc780400bda01c668d8fc48', class: "preview-header" }, h("div", { key: '554d920b0814e1ada74a0a88310d91b93ac08a5a', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (h("button", { key: '16db130dd8bdd452e55269ed0670b3ad4b7520f4', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), h("div", { key: '0e8555d834f009e73b4527b92588d61c4ec20516', class: "canvas-container initials-container" }, h("div", { key: '95292eee946791cc24699d4da2af7df556fd9b34', class: "signing-indicator" }, h("div", { key: 'baba2bc70666d290a93d8c858397da0fa378e65a', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: 'ad97b82227759ec6aeaa6735d4ed6355d2ee62e5', class: "signing-line" })), h("canvas", { key: '988f27616ab5bdf37bfba869c612ce75bcde4bd8', ref: el => (this.initialsElement = el),
518
545
  // width="300"
519
- height: "79", class: "initials-canvas", onPointerDown: this.handleInitialsPointerDown, onPointerMove: this.handleInitialsPointerMove, onPointerUp: this.handleInitialsPointerUp, onPointerCancel: this.handleInitialsPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: '7039cf8e45f20d2c659937b9b637be9ee236b2d7', class: "disclaimer" }, "By clicking \u00ABAdopt Signature\u00BB, I agree that the signature and initials above will be the electronic representation of my signature and initials for all purposes when I use them to sign documents. Applying them to a document is legally equivalent to signing with a pen on paper.")), h("div", { key: '93030327757e8dbb438a9f7c0aa36829e54d1725', class: "footer", slot: "footer" }, h("div", { key: '7138105a5cd87dc3a85058fbfa0bd999a8ff68c5', class: "buttons" }, h("button", { key: '6051baa6bade91f491530b955710ceb672a45547', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), h("button", { key: 'cf3d5ff3b39f6c2b32c29306ca9a1656edb17e29', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
546
+ height: "79", class: "initials-canvas", onPointerDown: this.handleInitialsPointerDown, onPointerMove: this.handleInitialsPointerMove, onPointerUp: this.handleInitialsPointerUp, onPointerCancel: this.handleInitialsPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: 'e1f78a82f1f4418d081efa92a9ddb0440b7c410a', class: "disclaimer" }, "By clicking \u00ABAdopt Signature\u00BB, I agree that the signature and initials above will be the electronic representation of my signature and initials for all purposes when I use them to sign documents. Applying them to a document is legally equivalent to signing with a pen on paper.")), h("div", { key: 'a715ffeab244a8f4c68eeab7e4d605a4b0858139', class: "footer", slot: "footer" }, h("div", { key: 'bd07769e1cb702ee6884c72f5d0a005b1844feea', class: "buttons" }, h("button", { key: 'd2905afb693781de51e0e2131368802284a534df', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), h("button", { key: 'a6a5a42a123357c85c9cea004643e33de9caec05', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
520
547
  }
521
548
  };
522
549
  VerdocsAdoptSignatureDialog.style = verdocsAdoptSignatureDialogCss;
@@ -79,6 +79,8 @@ const VerdocsSign = class {
79
79
  this.signatureAdoptMode = 'type';
80
80
  this.adoptedSignaturePreview = null;
81
81
  this.adoptedInitialsPreview = null;
82
+ this.adoptedSignatureStrokes = null;
83
+ this.adoptedInitialsStrokes = null;
82
84
  this.adoptedName = null;
83
85
  this.skippedFields = [];
84
86
  this.documentsSingularPlural = 'document';
@@ -234,6 +236,8 @@ const VerdocsSign = class {
234
236
  this.signatureAdoptMode = 'type';
235
237
  this.adoptedSignaturePreview = null;
236
238
  this.adoptedInitialsPreview = null;
239
+ this.adoptedSignatureStrokes = null;
240
+ this.adoptedInitialsStrokes = null;
237
241
  this.adoptedName = null;
238
242
  this.submitted = recipient.status === 'submitted';
239
243
  this.loading = false;
@@ -414,6 +418,37 @@ const VerdocsSign = class {
414
418
  getAdoptNameStorageKey(signatureBlockId) {
415
419
  return `verdocs-adopt-name:${signatureBlockId}`;
416
420
  }
421
+ getAdoptStrokesStorageKey(signatureBlockId) {
422
+ return `verdocs-adopt-strokes:${signatureBlockId}`;
423
+ }
424
+ /** Save (or clear) the drawn strokes (normalized 0..1) for a signature/initial block so a later Edit can replay them. */
425
+ persistStrokes(signatureBlockId, strokes) {
426
+ const key = this.getAdoptStrokesStorageKey(signatureBlockId);
427
+ if (strokes && strokes.length > 0) {
428
+ sessionStorage.setItem(key, JSON.stringify(strokes));
429
+ }
430
+ else {
431
+ // Typed signatures (or cleared drawings) have no strokes — make sure a stale entry doesn't linger.
432
+ sessionStorage.removeItem(key);
433
+ }
434
+ }
435
+ /** Read previously saved drawn strokes (normalized 0..1) for a signature/initial block, if any. */
436
+ readStoredStrokes(signatureBlockId) {
437
+ if (!signatureBlockId) {
438
+ return null;
439
+ }
440
+ const raw = sessionStorage.getItem(this.getAdoptStrokesStorageKey(signatureBlockId));
441
+ if (!raw) {
442
+ return null;
443
+ }
444
+ try {
445
+ const parsed = JSON.parse(raw);
446
+ return Array.isArray(parsed) ? parsed : null;
447
+ }
448
+ catch (_a) {
449
+ return null;
450
+ }
451
+ }
417
452
  /**
418
453
  * Restore adopted signature/initial previews and mode from applied fields or session storage.
419
454
  * Clearing a field only removes the stamp from that field — the adopted block still exists.
@@ -437,6 +472,16 @@ const VerdocsSign = class {
437
472
  if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
438
473
  this.initialId = initialsField.settings.initial_id;
439
474
  }
475
+ // Restore the editable stroke source (if previously saved this session) so re-opening the dialog replays the exact
476
+ // hand-drawn signature/initials instead of falling back to the rasterized bitmap.
477
+ const storedSignatureStrokes = this.readStoredStrokes(this.signatureId);
478
+ if (storedSignatureStrokes) {
479
+ this.adoptedSignatureStrokes = storedSignatureStrokes;
480
+ }
481
+ const storedInitialsStrokes = this.readStoredStrokes(this.initialId);
482
+ if (storedInitialsStrokes) {
483
+ this.adoptedInitialsStrokes = storedInitialsStrokes;
484
+ }
440
485
  const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
441
486
  if (modeSourceId && this.adoptedSignaturePreview) {
442
487
  const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
@@ -1078,7 +1123,7 @@ const VerdocsSign = class {
1078
1123
  });
1079
1124
  }
1080
1125
  render() {
1081
- var _a, _b, _c, _d;
1126
+ var _a, _b, _c, _d, _e, _f;
1082
1127
  if (this.showLoadError) {
1083
1128
  return (h(Host, null, h("verdocs-ok-dialog", { heading: "Unable to Start Signing", message: `Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.`, buttonLabel: "OK", onNext: () => {
1084
1129
  window.location.reload();
@@ -1228,12 +1273,15 @@ const VerdocsSign = class {
1228
1273
  } })), this.showDone && (h("verdocs-ok-dialog", { heading: "You're Done!", message: `You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the completed document and certificate attached.`, hideCloseButton: true, onNext: () => {
1229
1274
  this.showDone = false;
1230
1275
  this.isDone = true;
1231
- } })), this.adoptingSignature && (h("verdocs-adopt-signature-dialog", { name: formatFullName(this.recipient), nameLocked: !!((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.name_locked), initialEnteredName: (_b = this.adoptedName) !== null && _b !== void 0 ? _b : undefined, initialMode: this.adoptedSignaturePreview ? this.signatureAdoptMode : undefined, initialSignature: (_c = this.adoptedSignaturePreview) !== null && _c !== void 0 ? _c : undefined, initialInitials: (_d = this.adoptedInitialsPreview) !== null && _d !== void 0 ? _d : undefined, onNext: async (e) => {
1276
+ } })), this.adoptingSignature && (h("verdocs-adopt-signature-dialog", { name: formatFullName(this.recipient), nameLocked: !!((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.name_locked), initialEnteredName: (_b = this.adoptedName) !== null && _b !== void 0 ? _b : undefined, initialMode: this.adoptedSignaturePreview ? this.signatureAdoptMode : undefined, initialSignature: (_c = this.adoptedSignaturePreview) !== null && _c !== void 0 ? _c : undefined, initialInitials: (_d = this.adoptedInitialsPreview) !== null && _d !== void 0 ? _d : undefined, initialSignatureStrokes: (_e = this.adoptedSignatureStrokes) !== null && _e !== void 0 ? _e : undefined, initialInitialsStrokes: (_f = this.adoptedInitialsStrokes) !== null && _f !== void 0 ? _f : undefined, onNext: async (e) => {
1277
+ var _a, _b;
1232
1278
  console.log('[SIGN] Adopting signature/initials block', e.detail);
1233
1279
  this.showSpinner = true;
1234
1280
  this.signatureAdoptMode = e.detail.mode;
1235
1281
  this.adoptedSignaturePreview = e.detail.signature;
1236
1282
  this.adoptedInitialsPreview = e.detail.initials;
1283
+ this.adoptedSignatureStrokes = ((_a = e.detail.signatureStrokes) === null || _a === void 0 ? void 0 : _a.length) ? e.detail.signatureStrokes : null;
1284
+ this.adoptedInitialsStrokes = ((_b = e.detail.initialsStrokes) === null || _b === void 0 ? void 0 : _b.length) ? e.detail.initialsStrokes : null;
1237
1285
  this.adoptedName = e.detail.name;
1238
1286
  // These arrive as base-64 encoded data URLs
1239
1287
  const signatureBlob = await (await fetch(e.detail.signature)).blob();
@@ -1243,11 +1291,13 @@ const VerdocsSign = class {
1243
1291
  this.signatureId = sigResult.id;
1244
1292
  sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
1245
1293
  sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
1294
+ this.persistStrokes(sigResult.id, e.detail.signatureStrokes);
1246
1295
  const initResult = await createInitials(this.endpoint, 'initial', initialsBlob);
1247
1296
  console.log('[SIGN] Created initials', initResult);
1248
1297
  this.initialId = initResult.id;
1249
1298
  sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
1250
1299
  sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
1300
+ this.persistStrokes(initResult.id, e.detail.initialsStrokes);
1251
1301
  this.showSpinner = false;
1252
1302
  this.adoptingSignature = false;
1253
1303
  this.markEnvelopeStarted();