@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
@@ -170,8 +170,8 @@ const VerdocsAdoptSignatureDialog = class {
170
170
  };
171
171
  }
172
172
  componentWillLoad() {
173
- this.enteredName = this.name;
174
- this.computeEnteredInitials(this.name);
173
+ this.enteredName = this.initialEnteredName || this.name;
174
+ this.computeEnteredInitials(this.enteredName);
175
175
  if (this.initialMode) {
176
176
  this.mode = this.initialMode;
177
177
  }
@@ -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 });
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: '43e4a40803e7cf511bed41328fd48a54da571f23', persistent: true, onExit: () => this.exit.emit() }, index.h("div", { key: '462e271fe1390006727a0daa1a47de9b359af39c', slot: "heading", class: "heading" }, "Adopt Your Signature"), index.h("div", { key: '3617b310cba6e6defdd6a01bb3c16dd08db81c29', slot: "content", class: "content" }, index.h("div", { key: '4365227155f52f36c6421b1ff1cc6dcb2ea4fa6e', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), index.h("div", { key: 'a768ae444c23e06b58a477e7f3654d128e5d1a6a', class: { type: true, active: this.mode === 'type' } }, index.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 && index.h("div", { key: '45875c35eeaf050b2de2cc313f6275460fd96e0a', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), index.h("div", { key: 'cc6b9a9072ab0069fbf58ff0395311c93283fb7e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), index.h("div", { key: '19034c3e2232c832ad4b0032d47e0940fa52c8d2', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: 'c2f084d61633dbbd8aed7b6e3b941e19a953ccab', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), index.h("label", { key: 'e1f22d03c316ad2c9fae0d80f81965557c0fbce6' }, "Typed with a keyboard")), index.h("div", { key: '9c343a3b9a3a551806d86f7c33496f856e50fe99', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: '7e411e25456464390b028237cce9dcace361b7cf', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), index.h("label", { key: '9a707c87cf4229a6a8831adfeced815ce098180b' }, "Drawn with touch, mouse, or stylus")), index.h("div", { key: 'aa35cc9591db961dbff6cd26127ccfff96f225d0', class: "preview-header" }, index.h("div", { key: '4144d977477a558f1785d8f77072d83e8832841b', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (index.h("button", { key: '3b687ce578839aefc9447357f61c46ecf783500a', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), index.h("div", { key: '306bad99deb8abf8c071d45146f6bbb63c8ca8f4', class: "canvas-container signature-container" }, index.h("div", { key: 'e5538c0694e4c32d63d0d2169938aa55f0a282c1', class: "signing-indicator" }, index.h("div", { key: 'd1b5f38019d723b90d95c5ad23219ed4f38a4248', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: 'd2f2693b3fdd9feeb6ce7ab8ef006ede715217ab', class: "signing-line" })), index.h("canvas", { key: '59aa5a8bc5a588bd7fe08bafd43f06394ed35128', 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: '86a97be28c467678bd34e455412877ff55de26c2', class: "preview-header" }, index.h("div", { key: '0a605a59765dbb1f7ee15aa17bc3b4547983c747', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (index.h("button", { key: '2426ed63c75312a999a9c12653dd75afe844fa07', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), index.h("div", { key: 'fa2c72403a43dfdd6a5f237fa3a21f048ceb517b', class: "canvas-container initials-container" }, index.h("div", { key: '4e1fbf7d941fcb46c363a35cd238c03d5cc75491', class: "signing-indicator" }, index.h("div", { key: 'c52486f29337d6b9027b32ea103e86c45904749e', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: '6fa97d0d887d543f696de750db82b1a034bcb2b6', class: "signing-line" })), index.h("canvas", { key: '062e4e8da832b9d0f1a5af24a76188d3a9164ad4', 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: '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.")), index.h("div", { key: '33058008d0000a073a43abae0246effa3970a52d', class: "footer", slot: "footer" }, index.h("div", { key: '3f6ea8bbca9a5eb9fab950a2a4d3d2e135698f56', class: "buttons" }, index.h("button", { key: '94512ed74ce791505f8e949f818ab7cac907271f', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), index.h("button", { key: '085af06c8d1671b0533a6f2b49891fcefe3697a9', 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,9 @@ 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;
86
+ this.adoptedName = null;
84
87
  this.skippedFields = [];
85
88
  this.documentsSingularPlural = 'document';
86
89
  this.authStep = null;
@@ -235,6 +238,9 @@ const VerdocsSign = class {
235
238
  this.signatureAdoptMode = 'type';
236
239
  this.adoptedSignaturePreview = null;
237
240
  this.adoptedInitialsPreview = null;
241
+ this.adoptedSignatureStrokes = null;
242
+ this.adoptedInitialsStrokes = null;
243
+ this.adoptedName = null;
238
244
  this.submitted = recipient.status === 'submitted';
239
245
  this.loading = false;
240
246
  this.isDone = this.submitted;
@@ -405,6 +411,91 @@ const VerdocsSign = class {
405
411
  }
406
412
  });
407
413
  }
414
+ toDataUrl(value) {
415
+ return value.startsWith('data:') ? value : `data:image/png;base64,${value}`;
416
+ }
417
+ getAdoptModeStorageKey(signatureBlockId) {
418
+ return `verdocs-adopt-mode:${signatureBlockId}`;
419
+ }
420
+ getAdoptNameStorageKey(signatureBlockId) {
421
+ return `verdocs-adopt-name:${signatureBlockId}`;
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
+ }
454
+ /**
455
+ * Restore adopted signature/initial previews and mode from applied fields or session storage.
456
+ * Clearing a field only removes the stamp from that field — the adopted block still exists.
457
+ */
458
+ hydrateAdoptedSignatureState(triggerField) {
459
+ var _a, _b, _c, _d, _e;
460
+ const fields = this.getRecipientFields();
461
+ const signatureField = (triggerField === null || triggerField === void 0 ? void 0 : triggerField.type) === 'signature'
462
+ ? triggerField
463
+ : 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); });
464
+ 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); });
465
+ if ((_a = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _a === void 0 ? void 0 : _a.base64) {
466
+ this.adoptedSignaturePreview = this.toDataUrl(signatureField.settings.base64);
467
+ }
468
+ if ((_b = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _b === void 0 ? void 0 : _b.base64) {
469
+ this.adoptedInitialsPreview = this.toDataUrl(initialsField.settings.base64);
470
+ }
471
+ if ((_c = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _c === void 0 ? void 0 : _c.signature_id) {
472
+ this.signatureId = signatureField.settings.signature_id;
473
+ }
474
+ if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
475
+ this.initialId = initialsField.settings.initial_id;
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
+ }
487
+ const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
488
+ if (modeSourceId && this.adoptedSignaturePreview) {
489
+ const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
490
+ if (storedMode === 'draw' || storedMode === 'type') {
491
+ this.signatureAdoptMode = storedMode;
492
+ }
493
+ const storedName = sessionStorage.getItem(this.getAdoptNameStorageKey(modeSourceId));
494
+ if (storedName) {
495
+ this.adoptedName = storedName;
496
+ }
497
+ }
498
+ }
408
499
  getStartedKey() {
409
500
  var _a;
410
501
  return `${this.envelopeId}:${((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.role_name) || ''}`;
@@ -569,10 +660,6 @@ const VerdocsSign = class {
569
660
  }
570
661
  if (e.detail === null) {
571
662
  console.log('[SIGN] Clearing signature');
572
- this.signatureId = null;
573
- this.adoptedSignaturePreview = null;
574
- this.adoptedInitialsPreview = null;
575
- this.signatureAdoptMode = 'type';
576
663
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
577
664
  this.updateRecipientFieldValue(field.name, updateResult);
578
665
  if (field.required)
@@ -584,6 +671,7 @@ const VerdocsSign = class {
584
671
  console.log('[SIGN] Reusing signature', this.signatureId);
585
672
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
586
673
  this.updateRecipientFieldValue(field.name, updateResult);
674
+ this.hydrateAdoptedSignatureState(field);
587
675
  this.focusNextFieldAfter(field);
588
676
  return;
589
677
  }
@@ -593,6 +681,7 @@ const VerdocsSign = class {
593
681
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
594
682
  this.signatureId = e.detail;
595
683
  this.updateRecipientFieldValue(field.name, updateResult);
684
+ this.hydrateAdoptedSignatureState(field);
596
685
  this.focusNextFieldAfter(field);
597
686
  return;
598
687
  }
@@ -950,6 +1039,7 @@ const VerdocsSign = class {
950
1039
  });
951
1040
  el.addEventListener('adopt', () => {
952
1041
  this.focusedField = field.name;
1042
+ this.hydrateAdoptedSignatureState(field);
953
1043
  this.updateAllFlags();
954
1044
  this.adoptingSignature = true;
955
1045
  });
@@ -1035,7 +1125,7 @@ const VerdocsSign = class {
1035
1125
  });
1036
1126
  }
1037
1127
  render() {
1038
- var _a, _b, _c;
1128
+ var _a, _b, _c, _d, _e, _f;
1039
1129
  if (this.showLoadError) {
1040
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: () => {
1041
1131
  window.location.reload();
@@ -1185,21 +1275,31 @@ const VerdocsSign = class {
1185
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: () => {
1186
1276
  this.showDone = false;
1187
1277
  this.isDone = true;
1188
- } })), 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), 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) => {
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;
1189
1280
  console.log('[SIGN] Adopting signature/initials block', e.detail);
1190
1281
  this.showSpinner = true;
1191
1282
  this.signatureAdoptMode = e.detail.mode;
1192
1283
  this.adoptedSignaturePreview = e.detail.signature;
1193
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;
1287
+ this.adoptedName = e.detail.name;
1194
1288
  // These arrive as base-64 encoded data URLs
1195
1289
  const signatureBlob = await (await fetch(e.detail.signature)).blob();
1196
1290
  const initialsBlob = await (await fetch(e.detail.initials)).blob();
1197
1291
  const sigResult = await jsSdk.createSignature(this.endpoint, 'signature', signatureBlob);
1198
1292
  console.log('[SIGN] Created signature', sigResult);
1199
1293
  this.signatureId = sigResult.id;
1294
+ sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
1295
+ sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
1296
+ this.persistStrokes(sigResult.id, e.detail.signatureStrokes);
1200
1297
  const initResult = await jsSdk.createInitials(this.endpoint, 'initial', initialsBlob);
1201
1298
  console.log('[SIGN] Created initials', initResult);
1202
1299
  this.initialId = initResult.id;
1300
+ sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
1301
+ sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
1302
+ this.persistStrokes(initResult.id, e.detail.initialsStrokes);
1203
1303
  this.showSpinner = false;
1204
1304
  this.adoptingSignature = false;
1205
1305
  this.markEnvelopeStarted();