@hubsync/esign-web-sdk 6.9.43 → 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 +35 -8
  4. package/dist/cjs/verdocs-sign.cjs.entry.js +106 -6
  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 +108 -13
  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 +109 -6
  10. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  11. package/dist/components/{p-BUE7R0tf.js → p-DFsjkMkI.js} +40 -10
  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 +110 -7
  15. package/dist/components/verdocs-sign.js.map +1 -1
  16. package/dist/custom-elements.json +5 -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 +35 -8
  20. package/dist/esm/verdocs-sign.entry.js +106 -6
  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 +35 -3
  31. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +22 -0
  32. package/dist/types/components.d.ts +43 -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-BUE7R0tf.js.map +0 -1
  49. package/dist/verdocs-web-sdk/p-32af0c78.entry.js +0 -2
  50. package/dist/verdocs-web-sdk/p-32af0c78.entry.js.map +0 -1
  51. package/dist/verdocs-web-sdk/p-64c0f4e1.system.entry.js +0 -2
  52. package/dist/verdocs-web-sdk/p-64c0f4e1.system.entry.js.map +0 -1
  53. package/dist/verdocs-web-sdk/p-DL_q7a6L.system.js.map +0 -1
  54. package/dist/verdocs-web-sdk/p-DyUrM6Ex.system.js.map +0 -1
  55. package/dist/verdocs-web-sdk/p-b8966f51.entry.js +0 -2
  56. package/dist/verdocs-web-sdk/p-b8966f51.entry.js.map +0 -1
  57. package/dist/verdocs-web-sdk/p-e13491c4.system.entry.js +0 -2
  58. package/dist/verdocs-web-sdk/p-e13491c4.system.entry.js.map +0 -1
@@ -168,8 +168,8 @@ const VerdocsAdoptSignatureDialog = class {
168
168
  };
169
169
  }
170
170
  componentWillLoad() {
171
- this.enteredName = this.name;
172
- this.computeEnteredInitials(this.name);
171
+ this.enteredName = this.initialEnteredName || this.name;
172
+ this.computeEnteredInitials(this.enteredName);
173
173
  if (this.initialMode) {
174
174
  this.mode = this.initialMode;
175
175
  }
@@ -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 });
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: '43e4a40803e7cf511bed41328fd48a54da571f23', persistent: true, onExit: () => this.exit.emit() }, h("div", { key: '462e271fe1390006727a0daa1a47de9b359af39c', slot: "heading", class: "heading" }, "Adopt Your Signature"), h("div", { key: '3617b310cba6e6defdd6a01bb3c16dd08db81c29', slot: "content", class: "content" }, h("div", { key: '4365227155f52f36c6421b1ff1cc6dcb2ea4fa6e', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), h("div", { key: 'a768ae444c23e06b58a477e7f3654d128e5d1a6a', class: { type: true, active: this.mode === 'type' } }, h("verdocs-text-input", { key: 'dd3ba8e3b0994ed84148d890b6fba81c8554f70e', label: "Full Name", value: this.enteredName, disabled: this.nameLocked, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), this.nameLocked && h("div", { key: '45875c35eeaf050b2de2cc313f6275460fd96e0a', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), h("div", { key: 'cc6b9a9072ab0069fbf58ff0395311c93283fb7e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), h("div", { key: '19034c3e2232c832ad4b0032d47e0940fa52c8d2', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: 'c2f084d61633dbbd8aed7b6e3b941e19a953ccab', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), h("label", { key: 'e1f22d03c316ad2c9fae0d80f81965557c0fbce6' }, "Typed with a keyboard")), h("div", { key: '9c343a3b9a3a551806d86f7c33496f856e50fe99', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: '7e411e25456464390b028237cce9dcace361b7cf', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), h("label", { key: '9a707c87cf4229a6a8831adfeced815ce098180b' }, "Drawn with touch, mouse, or stylus")), h("div", { key: 'aa35cc9591db961dbff6cd26127ccfff96f225d0', class: "preview-header" }, h("div", { key: '4144d977477a558f1785d8f77072d83e8832841b', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (h("button", { key: '3b687ce578839aefc9447357f61c46ecf783500a', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), h("div", { key: '306bad99deb8abf8c071d45146f6bbb63c8ca8f4', class: "canvas-container signature-container" }, h("div", { key: 'e5538c0694e4c32d63d0d2169938aa55f0a282c1', class: "signing-indicator" }, h("div", { key: 'd1b5f38019d723b90d95c5ad23219ed4f38a4248', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: 'd2f2693b3fdd9feeb6ce7ab8ef006ede715217ab', class: "signing-line" })), h("canvas", { key: '59aa5a8bc5a588bd7fe08bafd43f06394ed35128', 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: '86a97be28c467678bd34e455412877ff55de26c2', class: "preview-header" }, h("div", { key: '0a605a59765dbb1f7ee15aa17bc3b4547983c747', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (h("button", { key: '2426ed63c75312a999a9c12653dd75afe844fa07', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), h("div", { key: 'fa2c72403a43dfdd6a5f237fa3a21f048ceb517b', class: "canvas-container initials-container" }, h("div", { key: '4e1fbf7d941fcb46c363a35cd238c03d5cc75491', class: "signing-indicator" }, h("div", { key: 'c52486f29337d6b9027b32ea103e86c45904749e', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: '6fa97d0d887d543f696de750db82b1a034bcb2b6', class: "signing-line" })), h("canvas", { key: '062e4e8da832b9d0f1a5af24a76188d3a9164ad4', 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: 'f589d9624ff808b4179c55fad6ca1ef27b79f553', 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: '33058008d0000a073a43abae0246effa3970a52d', class: "footer", slot: "footer" }, h("div", { key: '3f6ea8bbca9a5eb9fab950a2a4d3d2e135698f56', class: "buttons" }, h("button", { key: '94512ed74ce791505f8e949f818ab7cac907271f', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), h("button", { key: '085af06c8d1671b0533a6f2b49891fcefe3697a9', 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,9 @@ 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;
84
+ this.adoptedName = null;
82
85
  this.skippedFields = [];
83
86
  this.documentsSingularPlural = 'document';
84
87
  this.authStep = null;
@@ -233,6 +236,9 @@ const VerdocsSign = class {
233
236
  this.signatureAdoptMode = 'type';
234
237
  this.adoptedSignaturePreview = null;
235
238
  this.adoptedInitialsPreview = null;
239
+ this.adoptedSignatureStrokes = null;
240
+ this.adoptedInitialsStrokes = null;
241
+ this.adoptedName = null;
236
242
  this.submitted = recipient.status === 'submitted';
237
243
  this.loading = false;
238
244
  this.isDone = this.submitted;
@@ -403,6 +409,91 @@ const VerdocsSign = class {
403
409
  }
404
410
  });
405
411
  }
412
+ toDataUrl(value) {
413
+ return value.startsWith('data:') ? value : `data:image/png;base64,${value}`;
414
+ }
415
+ getAdoptModeStorageKey(signatureBlockId) {
416
+ return `verdocs-adopt-mode:${signatureBlockId}`;
417
+ }
418
+ getAdoptNameStorageKey(signatureBlockId) {
419
+ return `verdocs-adopt-name:${signatureBlockId}`;
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
+ }
452
+ /**
453
+ * Restore adopted signature/initial previews and mode from applied fields or session storage.
454
+ * Clearing a field only removes the stamp from that field — the adopted block still exists.
455
+ */
456
+ hydrateAdoptedSignatureState(triggerField) {
457
+ var _a, _b, _c, _d, _e;
458
+ const fields = this.getRecipientFields();
459
+ const signatureField = (triggerField === null || triggerField === void 0 ? void 0 : triggerField.type) === 'signature'
460
+ ? triggerField
461
+ : fields.find(f => { var _a, _b; return f.type === 'signature' && ((_a = f.settings) === null || _a === void 0 ? void 0 : _a.base64) && ((_b = f.settings) === null || _b === void 0 ? void 0 : _b.signature_id); });
462
+ const initialsField = fields.find(f => { var _a, _b; return f.type === 'initial' && ((_a = f.settings) === null || _a === void 0 ? void 0 : _a.base64) && ((_b = f.settings) === null || _b === void 0 ? void 0 : _b.initial_id); });
463
+ if ((_a = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _a === void 0 ? void 0 : _a.base64) {
464
+ this.adoptedSignaturePreview = this.toDataUrl(signatureField.settings.base64);
465
+ }
466
+ if ((_b = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _b === void 0 ? void 0 : _b.base64) {
467
+ this.adoptedInitialsPreview = this.toDataUrl(initialsField.settings.base64);
468
+ }
469
+ if ((_c = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _c === void 0 ? void 0 : _c.signature_id) {
470
+ this.signatureId = signatureField.settings.signature_id;
471
+ }
472
+ if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
473
+ this.initialId = initialsField.settings.initial_id;
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
+ }
485
+ const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
486
+ if (modeSourceId && this.adoptedSignaturePreview) {
487
+ const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
488
+ if (storedMode === 'draw' || storedMode === 'type') {
489
+ this.signatureAdoptMode = storedMode;
490
+ }
491
+ const storedName = sessionStorage.getItem(this.getAdoptNameStorageKey(modeSourceId));
492
+ if (storedName) {
493
+ this.adoptedName = storedName;
494
+ }
495
+ }
496
+ }
406
497
  getStartedKey() {
407
498
  var _a;
408
499
  return `${this.envelopeId}:${((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.role_name) || ''}`;
@@ -567,10 +658,6 @@ const VerdocsSign = class {
567
658
  }
568
659
  if (e.detail === null) {
569
660
  console.log('[SIGN] Clearing signature');
570
- this.signatureId = null;
571
- this.adoptedSignaturePreview = null;
572
- this.adoptedInitialsPreview = null;
573
- this.signatureAdoptMode = 'type';
574
661
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
575
662
  this.updateRecipientFieldValue(field.name, updateResult);
576
663
  if (field.required)
@@ -582,6 +669,7 @@ const VerdocsSign = class {
582
669
  console.log('[SIGN] Reusing signature', this.signatureId);
583
670
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
584
671
  this.updateRecipientFieldValue(field.name, updateResult);
672
+ this.hydrateAdoptedSignatureState(field);
585
673
  this.focusNextFieldAfter(field);
586
674
  return;
587
675
  }
@@ -591,6 +679,7 @@ const VerdocsSign = class {
591
679
  const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
592
680
  this.signatureId = e.detail;
593
681
  this.updateRecipientFieldValue(field.name, updateResult);
682
+ this.hydrateAdoptedSignatureState(field);
594
683
  this.focusNextFieldAfter(field);
595
684
  return;
596
685
  }
@@ -948,6 +1037,7 @@ const VerdocsSign = class {
948
1037
  });
949
1038
  el.addEventListener('adopt', () => {
950
1039
  this.focusedField = field.name;
1040
+ this.hydrateAdoptedSignatureState(field);
951
1041
  this.updateAllFlags();
952
1042
  this.adoptingSignature = true;
953
1043
  });
@@ -1033,7 +1123,7 @@ const VerdocsSign = class {
1033
1123
  });
1034
1124
  }
1035
1125
  render() {
1036
- var _a, _b, _c;
1126
+ var _a, _b, _c, _d, _e, _f;
1037
1127
  if (this.showLoadError) {
1038
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: () => {
1039
1129
  window.location.reload();
@@ -1183,21 +1273,31 @@ const VerdocsSign = class {
1183
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: () => {
1184
1274
  this.showDone = false;
1185
1275
  this.isDone = true;
1186
- } })), this.adoptingSignature && (h("verdocs-adopt-signature-dialog", { name: formatFullName(this.recipient), nameLocked: !!((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.name_locked), initialMode: this.adoptedSignaturePreview ? this.signatureAdoptMode : undefined, initialSignature: (_b = this.adoptedSignaturePreview) !== null && _b !== void 0 ? _b : undefined, initialInitials: (_c = this.adoptedInitialsPreview) !== null && _c !== void 0 ? _c : 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;
1187
1278
  console.log('[SIGN] Adopting signature/initials block', e.detail);
1188
1279
  this.showSpinner = true;
1189
1280
  this.signatureAdoptMode = e.detail.mode;
1190
1281
  this.adoptedSignaturePreview = e.detail.signature;
1191
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;
1285
+ this.adoptedName = e.detail.name;
1192
1286
  // These arrive as base-64 encoded data URLs
1193
1287
  const signatureBlob = await (await fetch(e.detail.signature)).blob();
1194
1288
  const initialsBlob = await (await fetch(e.detail.initials)).blob();
1195
1289
  const sigResult = await createSignature(this.endpoint, 'signature', signatureBlob);
1196
1290
  console.log('[SIGN] Created signature', sigResult);
1197
1291
  this.signatureId = sigResult.id;
1292
+ sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
1293
+ sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
1294
+ this.persistStrokes(sigResult.id, e.detail.signatureStrokes);
1198
1295
  const initResult = await createInitials(this.endpoint, 'initial', initialsBlob);
1199
1296
  console.log('[SIGN] Created initials', initResult);
1200
1297
  this.initialId = initResult.id;
1298
+ sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
1299
+ sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
1300
+ this.persistStrokes(initResult.id, e.detail.initialsStrokes);
1201
1301
  this.showSpinner = false;
1202
1302
  this.adoptingSignature = false;
1203
1303
  this.markEnvelopeStarted();