@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
@@ -236,17 +236,30 @@ const VerdocsAdoptSignatureDialog = class {
236
236
  }
237
237
  }
238
238
  async restoreDrawnPreviewsIfNeeded() {
239
+ var _a, _b;
239
240
  // Preserve in-session stroke edits; only restore saved previews when there are no strokes yet.
240
241
  if (this.allSigStrokes.length > 0 || this.allInitialsStrokes.length > 0) {
241
242
  return;
242
243
  }
243
244
  const tasks = [];
244
- if (this.initialSignature && this.signatureElement) {
245
+ // Prefer replaying the saved strokes (faithful + editable). Fall back to the rasterized preview only when no
246
+ // strokes are available, e.g. resuming from a server-stored bitmap in a fresh browser session.
247
+ if (((_a = this.initialSignatureStrokes) === null || _a === void 0 ? void 0 : _a.length) && this.signatureElement) {
248
+ this.allSigStrokes = this.denormalizeStrokes(this.initialSignatureStrokes, this.signatureElement);
249
+ this.hasDrawnSignature = true;
250
+ this.redrawDrawnSignature();
251
+ }
252
+ else if (this.initialSignature && this.signatureElement) {
245
253
  tasks.push(this.drawImageOnCanvas(this.signatureElement, this.initialSignature).then(() => {
246
254
  this.hasDrawnSignature = true;
247
255
  }));
248
256
  }
249
- if (this.initialInitials && this.initialsElement) {
257
+ if (((_b = this.initialInitialsStrokes) === null || _b === void 0 ? void 0 : _b.length) && this.initialsElement) {
258
+ this.allInitialsStrokes = this.denormalizeStrokes(this.initialInitialsStrokes, this.initialsElement);
259
+ this.hasDrawnInitials = true;
260
+ this.redrawDrawnInitials();
261
+ }
262
+ else if (this.initialInitials && this.initialsElement) {
250
263
  tasks.push(this.drawImageOnCanvas(this.initialsElement, this.initialInitials).then(() => {
251
264
  this.hasDrawnInitials = true;
252
265
  }));
@@ -385,7 +398,21 @@ const VerdocsAdoptSignatureDialog = class {
385
398
  e.preventDefault();
386
399
  const signature = this.signatureElement.toDataURL('image/png');
387
400
  const initials = this.initialsElement.toDataURL('image/png');
388
- this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName });
401
+ // Persist the editable source for drawn signatures so a future Edit can replay the exact strokes natively rather
402
+ // than reconstructing them from the bitmap. Typed signatures need no strokes — they re-render from the name.
403
+ const signatureStrokes = this.mode === 'draw' ? this.normalizeStrokes(this.allSigStrokes, this.signatureElement) : [];
404
+ const initialsStrokes = this.mode === 'draw' ? this.normalizeStrokes(this.allInitialsStrokes, this.initialsElement) : [];
405
+ this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName, signatureStrokes, initialsStrokes });
406
+ }
407
+ normalizeStrokes(strokes, canvas) {
408
+ const width = (canvas === null || canvas === void 0 ? void 0 : canvas.width) || 1;
409
+ const height = (canvas === null || canvas === void 0 ? void 0 : canvas.height) || 1;
410
+ return strokes.map(stroke => stroke.map(point => ({ x: point.x / width, y: point.y / height })));
411
+ }
412
+ denormalizeStrokes(strokes, canvas) {
413
+ const width = canvas.width || 1;
414
+ const height = canvas.height || 1;
415
+ return strokes.map(stroke => stroke.map(point => ({ x: point.x * width, y: point.y * height })));
389
416
  }
390
417
  isAdoptButtonDisabled() {
391
418
  switch (this.mode) {
@@ -514,11 +541,11 @@ const VerdocsAdoptSignatureDialog = class {
514
541
  };
515
542
  }
516
543
  render() {
517
- return (index.h("verdocs-dialog", { key: '3bf57218c88709dcb904ed197ac37551c26c8c37', persistent: true, onExit: () => this.exit.emit() }, index.h("div", { key: '26bf968eb7e6169e29c11c96806c387fc2891df2', slot: "heading", class: "heading" }, "Adopt Your Signature"), index.h("div", { key: 'dd9cb18b25d3055cf98a79fca2fe12a7a0f756da', slot: "content", class: "content" }, index.h("div", { key: 'ff7520ccf2d8e15a72b12aabeba11f785c33a4b1', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), index.h("div", { key: '428c77e16cfcddf1a202cc9155220fe7899f12e3', class: { type: true, active: this.mode === 'type' } }, index.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 && index.h("div", { key: '060c1edd0986a6be98f9ce68f7b94d562782a3ae', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), index.h("div", { key: '95b80e7b68150ba7e912176834686b769c1ad74e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), index.h("div", { key: '8567f38208d1c2130ecacb21a6f09eaa089f6fb4', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: '278fa39a73863c07512b297cdc13d2ad6bc18320', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), index.h("label", { key: '20ebbd899fa095783e0b9b307e7c5bc6c73585c8' }, "Typed with a keyboard")), index.h("div", { key: '2aa96af7da2dbff4437f76d3be8c25660a5ae5ec', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: 'e72c8a7350e6a368748746622dfc8382c94bbd7d', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), index.h("label", { key: '423eff813da06377c1c5d66f8ea813564f40478c' }, "Drawn with touch, mouse, or stylus")), index.h("div", { key: '013b7108cd626c5ef736520c4e93374205d62ea1', class: "preview-header" }, index.h("div", { key: '9af65f41a953990c2412b02176e921a60ef191ca', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (index.h("button", { key: '5e422b7f7ef72fdf50eb7c5e102b9062a6f10e1c', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), index.h("div", { key: '220cdf4f321aa3a388c9c4f9340d130cb207e7cf', class: "canvas-container signature-container" }, index.h("div", { key: '0ffa2c39b216ecd3ef76a36122b8d51f6e5a59bb', class: "signing-indicator" }, index.h("div", { key: 'c295f652022004645377620a49b9314330bbca7c', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: '0b24b19acd68f1e9ab9588f7b0aa3412e571a12d', class: "signing-line" })), index.h("canvas", { key: '72134d2f592c8f60fab5a90290f15b21e0b3e6aa', ref: el => (this.signatureElement = el),
544
+ return (index.h("verdocs-dialog", { key: 'ddc22647c01547a474b875c409358e3af2f24e3c', persistent: true, onExit: () => this.exit.emit() }, index.h("div", { key: 'e8a0089ee73a51008d0aeec9dcc7fca1576104ac', slot: "heading", class: "heading" }, "Adopt Your Signature"), index.h("div", { key: '2d7c449062e88b4bc25d6762cd6c793992f47f4d', slot: "content", class: "content" }, index.h("div", { key: 'e8d4ec00383967dc9fe30d773ec2212d93b82975', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), index.h("div", { key: '0f694d93d6f00feb519841870c0fc6a71194d2ca', class: { type: true, active: this.mode === 'type' } }, index.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 && index.h("div", { key: 'e89a2f87dcfad2fe8f8f4d48a24223e6ea17383d', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), index.h("div", { key: 'd11ea670ee76e772a38455f30f18cbec98fb395a', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), index.h("div", { key: '3bf1e22f0a9e3bbadd0bf4f0b8a3f1b3896d7315', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: '99eef6a79eea724f2ad8e66b9394dd40bc9acfe0', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), index.h("label", { key: '04194fdf3a502ffd95b696ed9078ab3982a0caf9' }, "Typed with a keyboard")), index.h("div", { key: '4e122b72fe041edaf499c5ce9ebabaa5c0883a61', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: '4a4f2b7492cdb8118184347613cd27ab4994b4dd', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), index.h("label", { key: '86824cda2d7968e30d26426e40f336797776ced2' }, "Drawn with touch, mouse, or stylus")), index.h("div", { key: '94993f0f41b5099d2e86703e711041939c98eda9', class: "preview-header" }, index.h("div", { key: '55bad19f2cf23ef7ecb4793f76b95feab654b940', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (index.h("button", { key: 'ef4713146fca813bef48f537190c438819ff84a2', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), index.h("div", { key: '1e58344a555fe2e224f159f3ef830d46ef362086', class: "canvas-container signature-container" }, index.h("div", { key: '16fac93400bd3f53e7420222c6ba062d49b5d665', class: "signing-indicator" }, index.h("div", { key: 'e094b7097e905fd438cebc0d897faf1746eefcc7', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: 'a67e3effd1f6db780c8a20d31dedd1940e874062', class: "signing-line" })), index.h("canvas", { key: '5d6c807b860ac53af851dd85cc655aa797ece1ae', ref: el => (this.signatureElement = el),
518
545
  // width="300"
519
- height: "79", class: "signature-canvas", onPointerDown: this.handleSigPointerDown, onPointerMove: this.handleSigPointerMove, onPointerUp: this.handleSigPointerUp, onPointerCancel: this.handleSigPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), index.h("div", { key: '847d54a8a55652ab67a3909d6510a4d587fb9bd8', class: "preview-header" }, index.h("div", { key: 'e270bb3dc8971ecc816db09ec6d91eb1a6613786', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (index.h("button", { key: 'be4a46390d14a90f9705f40ff90a920174d58d85', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), index.h("div", { key: 'a8c2ace5575bf6b95e18e08febbd2dd3876d53c6', class: "canvas-container initials-container" }, index.h("div", { key: '1cab75d06695c2458452b4adc039f1078959c740', class: "signing-indicator" }, index.h("div", { key: 'e925e1f10a180aa65953dba5c007f294daf52ad2', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: 'ecd9548ff69aa7ac7241433c1e88e5d66ceb2486', class: "signing-line" })), index.h("canvas", { key: '46c776d1efcee7e3d5bf5bd4a01db517eb638481', ref: el => (this.initialsElement = el),
546
+ height: "79", class: "signature-canvas", onPointerDown: this.handleSigPointerDown, onPointerMove: this.handleSigPointerMove, onPointerUp: this.handleSigPointerUp, onPointerCancel: this.handleSigPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), index.h("div", { key: '53953056fcc62dc29bc780400bda01c668d8fc48', class: "preview-header" }, index.h("div", { key: '554d920b0814e1ada74a0a88310d91b93ac08a5a', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (index.h("button", { key: '16db130dd8bdd452e55269ed0670b3ad4b7520f4', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), index.h("div", { key: '0e8555d834f009e73b4527b92588d61c4ec20516', class: "canvas-container initials-container" }, index.h("div", { key: '95292eee946791cc24699d4da2af7df556fd9b34', class: "signing-indicator" }, index.h("div", { key: 'baba2bc70666d290a93d8c858397da0fa378e65a', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: 'ad97b82227759ec6aeaa6735d4ed6355d2ee62e5', class: "signing-line" })), index.h("canvas", { key: '988f27616ab5bdf37bfba869c612ce75bcde4bd8', ref: el => (this.initialsElement = el),
520
547
  // width="300"
521
- height: "79", class: "initials-canvas", onPointerDown: this.handleInitialsPointerDown, onPointerMove: this.handleInitialsPointerMove, onPointerUp: this.handleInitialsPointerUp, onPointerCancel: this.handleInitialsPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), index.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.")), index.h("div", { key: '93030327757e8dbb438a9f7c0aa36829e54d1725', class: "footer", slot: "footer" }, index.h("div", { key: '7138105a5cd87dc3a85058fbfa0bd999a8ff68c5', class: "buttons" }, index.h("button", { key: '6051baa6bade91f491530b955710ceb672a45547', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), index.h("button", { key: 'cf3d5ff3b39f6c2b32c29306ca9a1656edb17e29', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
548
+ height: "79", class: "initials-canvas", onPointerDown: this.handleInitialsPointerDown, onPointerMove: this.handleInitialsPointerMove, onPointerUp: this.handleInitialsPointerUp, onPointerCancel: this.handleInitialsPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), index.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.")), index.h("div", { key: 'a715ffeab244a8f4c68eeab7e4d605a4b0858139', class: "footer", slot: "footer" }, index.h("div", { key: 'bd07769e1cb702ee6884c72f5d0a005b1844feea', class: "buttons" }, index.h("button", { key: 'd2905afb693781de51e0e2131368802284a534df', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), index.h("button", { key: 'a6a5a42a123357c85c9cea004643e33de9caec05', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
522
549
  }
523
550
  };
524
551
  VerdocsAdoptSignatureDialog.style = verdocsAdoptSignatureDialogCss;
@@ -81,6 +81,8 @@ const VerdocsSign = class {
81
81
  this.signatureAdoptMode = 'type';
82
82
  this.adoptedSignaturePreview = null;
83
83
  this.adoptedInitialsPreview = null;
84
+ this.adoptedSignatureStrokes = null;
85
+ this.adoptedInitialsStrokes = null;
84
86
  this.adoptedName = null;
85
87
  this.skippedFields = [];
86
88
  this.documentsSingularPlural = 'document';
@@ -236,6 +238,8 @@ const VerdocsSign = class {
236
238
  this.signatureAdoptMode = 'type';
237
239
  this.adoptedSignaturePreview = null;
238
240
  this.adoptedInitialsPreview = null;
241
+ this.adoptedSignatureStrokes = null;
242
+ this.adoptedInitialsStrokes = null;
239
243
  this.adoptedName = null;
240
244
  this.submitted = recipient.status === 'submitted';
241
245
  this.loading = false;
@@ -416,6 +420,37 @@ const VerdocsSign = class {
416
420
  getAdoptNameStorageKey(signatureBlockId) {
417
421
  return `verdocs-adopt-name:${signatureBlockId}`;
418
422
  }
423
+ getAdoptStrokesStorageKey(signatureBlockId) {
424
+ return `verdocs-adopt-strokes:${signatureBlockId}`;
425
+ }
426
+ /** Save (or clear) the drawn strokes (normalized 0..1) for a signature/initial block so a later Edit can replay them. */
427
+ persistStrokes(signatureBlockId, strokes) {
428
+ const key = this.getAdoptStrokesStorageKey(signatureBlockId);
429
+ if (strokes && strokes.length > 0) {
430
+ sessionStorage.setItem(key, JSON.stringify(strokes));
431
+ }
432
+ else {
433
+ // Typed signatures (or cleared drawings) have no strokes — make sure a stale entry doesn't linger.
434
+ sessionStorage.removeItem(key);
435
+ }
436
+ }
437
+ /** Read previously saved drawn strokes (normalized 0..1) for a signature/initial block, if any. */
438
+ readStoredStrokes(signatureBlockId) {
439
+ if (!signatureBlockId) {
440
+ return null;
441
+ }
442
+ const raw = sessionStorage.getItem(this.getAdoptStrokesStorageKey(signatureBlockId));
443
+ if (!raw) {
444
+ return null;
445
+ }
446
+ try {
447
+ const parsed = JSON.parse(raw);
448
+ return Array.isArray(parsed) ? parsed : null;
449
+ }
450
+ catch (_a) {
451
+ return null;
452
+ }
453
+ }
419
454
  /**
420
455
  * Restore adopted signature/initial previews and mode from applied fields or session storage.
421
456
  * Clearing a field only removes the stamp from that field — the adopted block still exists.
@@ -439,6 +474,16 @@ const VerdocsSign = class {
439
474
  if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
440
475
  this.initialId = initialsField.settings.initial_id;
441
476
  }
477
+ // Restore the editable stroke source (if previously saved this session) so re-opening the dialog replays the exact
478
+ // hand-drawn signature/initials instead of falling back to the rasterized bitmap.
479
+ const storedSignatureStrokes = this.readStoredStrokes(this.signatureId);
480
+ if (storedSignatureStrokes) {
481
+ this.adoptedSignatureStrokes = storedSignatureStrokes;
482
+ }
483
+ const storedInitialsStrokes = this.readStoredStrokes(this.initialId);
484
+ if (storedInitialsStrokes) {
485
+ this.adoptedInitialsStrokes = storedInitialsStrokes;
486
+ }
442
487
  const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
443
488
  if (modeSourceId && this.adoptedSignaturePreview) {
444
489
  const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
@@ -1080,7 +1125,7 @@ const VerdocsSign = class {
1080
1125
  });
1081
1126
  }
1082
1127
  render() {
1083
- var _a, _b, _c, _d;
1128
+ var _a, _b, _c, _d, _e, _f;
1084
1129
  if (this.showLoadError) {
1085
1130
  return (index.h(index.Host, null, index.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: () => {
1086
1131
  window.location.reload();
@@ -1230,12 +1275,15 @@ const VerdocsSign = class {
1230
1275
  } })), this.showDone && (index.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: () => {
1231
1276
  this.showDone = false;
1232
1277
  this.isDone = true;
1233
- } })), this.adoptingSignature && (index.h("verdocs-adopt-signature-dialog", { name: jsSdk.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) => {
1278
+ } })), this.adoptingSignature && (index.h("verdocs-adopt-signature-dialog", { name: jsSdk.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) => {
1279
+ var _a, _b;
1234
1280
  console.log('[SIGN] Adopting signature/initials block', e.detail);
1235
1281
  this.showSpinner = true;
1236
1282
  this.signatureAdoptMode = e.detail.mode;
1237
1283
  this.adoptedSignaturePreview = e.detail.signature;
1238
1284
  this.adoptedInitialsPreview = e.detail.initials;
1285
+ this.adoptedSignatureStrokes = ((_a = e.detail.signatureStrokes) === null || _a === void 0 ? void 0 : _a.length) ? e.detail.signatureStrokes : null;
1286
+ this.adoptedInitialsStrokes = ((_b = e.detail.initialsStrokes) === null || _b === void 0 ? void 0 : _b.length) ? e.detail.initialsStrokes : null;
1239
1287
  this.adoptedName = e.detail.name;
1240
1288
  // These arrive as base-64 encoded data URLs
1241
1289
  const signatureBlob = await (await fetch(e.detail.signature)).blob();
@@ -1245,11 +1293,13 @@ const VerdocsSign = class {
1245
1293
  this.signatureId = sigResult.id;
1246
1294
  sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
1247
1295
  sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
1296
+ this.persistStrokes(sigResult.id, e.detail.signatureStrokes);
1248
1297
  const initResult = await jsSdk.createInitials(this.endpoint, 'initial', initialsBlob);
1249
1298
  console.log('[SIGN] Created initials', initResult);
1250
1299
  this.initialId = initResult.id;
1251
1300
  sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
1252
1301
  sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
1302
+ this.persistStrokes(initResult.id, e.detail.initialsStrokes);
1253
1303
  this.showSpinner = false;
1254
1304
  this.adoptingSignature = false;
1255
1305
  this.markEnvelopeStarted();