@hubsync/esign-web-sdk 6.9.42 → 6.9.44

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 +79 -18
  4. package/dist/cjs/verdocs-sign.cjs.entry.js +65 -3
  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 +157 -20
  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 +69 -3
  10. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  11. package/dist/components/{p-Dpuy1yah.js → p-DSzyP6KP.js} +85 -20
  12. package/dist/components/p-DSzyP6KP.js.map +1 -0
  13. package/dist/components/verdocs-adopt-signature-dialog.js +1 -1
  14. package/dist/components/verdocs-sign.js +70 -4
  15. package/dist/components/verdocs-sign.js.map +1 -1
  16. package/dist/custom-elements.json +24 -0
  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 +79 -18
  20. package/dist/esm/verdocs-sign.entry.js +65 -3
  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 +22 -0
  31. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +12 -0
  32. package/dist/types/components.d.ts +34 -2
  33. package/dist/verdocs-web-sdk/p-7a0f0515.entry.js +2 -0
  34. package/dist/verdocs-web-sdk/p-7a0f0515.entry.js.map +1 -0
  35. package/dist/verdocs-web-sdk/p-965a8331.entry.js +2 -0
  36. package/dist/verdocs-web-sdk/p-965a8331.entry.js.map +1 -0
  37. package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
  38. package/dist/verdocs-web-sdk/p-CSd2l4lv.system.js.map +1 -0
  39. package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js +2 -0
  40. package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js.map +1 -0
  41. package/dist/verdocs-web-sdk/p-dx3XIcHV.system.js.map +1 -0
  42. package/dist/verdocs-web-sdk/p-ff5f20c9.system.entry.js +2 -0
  43. package/dist/verdocs-web-sdk/p-ff5f20c9.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-Dpuy1yah.js.map +0 -1
  49. package/dist/verdocs-web-sdk/p-3c6e0a1f.entry.js +0 -2
  50. package/dist/verdocs-web-sdk/p-3c6e0a1f.entry.js.map +0 -1
  51. package/dist/verdocs-web-sdk/p-521b0c66.entry.js +0 -2
  52. package/dist/verdocs-web-sdk/p-521b0c66.entry.js.map +0 -1
  53. package/dist/verdocs-web-sdk/p-6f4a8d69.system.entry.js +0 -2
  54. package/dist/verdocs-web-sdk/p-6f4a8d69.system.entry.js.map +0 -1
  55. package/dist/verdocs-web-sdk/p-7c5d6848.system.entry.js +0 -2
  56. package/dist/verdocs-web-sdk/p-7c5d6848.system.entry.js.map +0 -1
  57. package/dist/verdocs-web-sdk/p-B0Zty-s5.system.js.map +0 -1
  58. package/dist/verdocs-web-sdk/p-TlalAeRR.system.js.map +0 -1
@@ -170,8 +170,11 @@ 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
+ if (this.initialMode) {
176
+ this.mode = this.initialMode;
177
+ }
175
178
  const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
176
179
  ds.load().then(font => {
177
180
  document.fonts.add(font);
@@ -179,24 +182,82 @@ const VerdocsAdoptSignatureDialog = class {
179
182
  });
180
183
  }
181
184
  componentDidLoad() {
182
- this.drawSignatureText();
183
- this.drawInitialsText();
184
185
  this.setupSignatureCanvas();
185
186
  this.setupInitialsCanvas();
187
+ void this.loadExistingPreviews();
186
188
  }
187
189
  componentDidUpdate() {
188
- this.drawSignatureText();
189
- this.drawInitialsText();
190
190
  this.setupSignatureCanvas();
191
191
  this.setupInitialsCanvas();
192
+ if (this.mode === 'type') {
193
+ this.drawSignatureText();
194
+ this.drawInitialsText();
195
+ return;
196
+ }
192
197
  // Redraw drawn signature when in draw mode
193
- if (this.mode === 'draw' && this.allSigStrokes.length > 0) {
198
+ if (this.allSigStrokes.length > 0) {
194
199
  this.redrawDrawnSignature();
195
200
  }
196
- if (this.mode === 'draw' && this.allInitialsStrokes.length > 0) {
201
+ if (this.allInitialsStrokes.length > 0) {
197
202
  this.redrawDrawnInitials();
198
203
  }
199
204
  }
205
+ drawImageOnCanvas(canvas, dataUrl) {
206
+ return new Promise((resolve, reject) => {
207
+ const image = new Image();
208
+ image.onload = () => {
209
+ const context = canvas.getContext('2d');
210
+ context.clearRect(0, 0, canvas.width, canvas.height);
211
+ const padding = 24;
212
+ const scale = Math.min((canvas.width - padding) / image.width, (canvas.height - padding) / image.height, 1);
213
+ const width = image.width * scale;
214
+ const height = image.height * scale;
215
+ const x = (canvas.width - width) / 2;
216
+ const y = (canvas.height - height) / 2;
217
+ context.drawImage(image, x, y, width, height);
218
+ resolve();
219
+ };
220
+ image.onerror = () => reject(new Error('Unable to load signature preview'));
221
+ image.src = dataUrl;
222
+ });
223
+ }
224
+ async loadExistingPreviews() {
225
+ if (this.mode === 'draw') {
226
+ await this.restoreDrawnPreviewsIfNeeded();
227
+ return;
228
+ }
229
+ this.drawSignatureText();
230
+ this.drawInitialsText();
231
+ }
232
+ setMode(mode) {
233
+ this.mode = mode;
234
+ if (mode === 'draw') {
235
+ void this.restoreDrawnPreviewsIfNeeded();
236
+ }
237
+ }
238
+ async restoreDrawnPreviewsIfNeeded() {
239
+ // Preserve in-session stroke edits; only restore saved previews when there are no strokes yet.
240
+ if (this.allSigStrokes.length > 0 || this.allInitialsStrokes.length > 0) {
241
+ return;
242
+ }
243
+ const tasks = [];
244
+ if (this.initialSignature && this.signatureElement) {
245
+ tasks.push(this.drawImageOnCanvas(this.signatureElement, this.initialSignature).then(() => {
246
+ this.hasDrawnSignature = true;
247
+ }));
248
+ }
249
+ if (this.initialInitials && this.initialsElement) {
250
+ tasks.push(this.drawImageOnCanvas(this.initialsElement, this.initialInitials).then(() => {
251
+ this.hasDrawnInitials = true;
252
+ }));
253
+ }
254
+ if (tasks.length === 0) {
255
+ return;
256
+ }
257
+ await Promise.all(tasks);
258
+ this.setupSignatureCanvas();
259
+ this.setupInitialsCanvas();
260
+ }
200
261
  drawSignatureText() {
201
262
  if (!this.signatureElement || this.mode !== 'type') {
202
263
  return;
@@ -324,7 +385,7 @@ const VerdocsAdoptSignatureDialog = class {
324
385
  e.preventDefault();
325
386
  const signature = this.signatureElement.toDataURL('image/png');
326
387
  const initials = this.initialsElement.toDataURL('image/png');
327
- this.next.emit({ signature, initials });
388
+ this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName });
328
389
  }
329
390
  isAdoptButtonDisabled() {
330
391
  switch (this.mode) {
@@ -332,8 +393,8 @@ const VerdocsAdoptSignatureDialog = class {
332
393
  // Disable if no name has been entered
333
394
  return !this.enteredName || this.enteredName.trim().length === 0;
334
395
  case 'draw':
335
- // Disable if nothing has been drawn
336
- return (!this.hasDrawnSignature && !this.hasDrawnInitials) || this.allSigStrokes.length === 0 || this.allInitialsStrokes.length === 0;
396
+ // Disable if nothing has been drawn or restored from a previous adoption
397
+ return !this.hasDrawnSignature || !this.hasDrawnInitials;
337
398
  default:
338
399
  return true;
339
400
  }
@@ -354,8 +415,8 @@ const VerdocsAdoptSignatureDialog = class {
354
415
  this.sigDrawingContext.lineWidth = 2;
355
416
  this.sigDrawingContext.lineCap = 'round';
356
417
  this.sigDrawingContext.lineJoin = 'round';
357
- // Clear canvas only if there are no existing strokes
358
- if (this.allSigStrokes.length === 0) {
418
+ // Clear canvas only if there are no existing strokes or restored previews
419
+ if (this.allSigStrokes.length === 0 && !this.hasDrawnSignature) {
359
420
  this.sigDrawingContext.clearRect(0, 0, this.signatureElement.width, this.signatureElement.height);
360
421
  }
361
422
  }
@@ -384,8 +445,8 @@ const VerdocsAdoptSignatureDialog = class {
384
445
  this.initialsDrawingContext.lineWidth = 2;
385
446
  this.initialsDrawingContext.lineCap = 'round';
386
447
  this.initialsDrawingContext.lineJoin = 'round';
387
- // Clear canvas only if there are no existing strokes
388
- if (this.allInitialsStrokes.length === 0) {
448
+ // Clear canvas only if there are no existing strokes or restored previews
449
+ if (this.allInitialsStrokes.length === 0 && !this.hasDrawnInitials) {
389
450
  this.initialsDrawingContext.clearRect(0, 0, this.initialsElement.width, this.initialsElement.height);
390
451
  }
391
452
  }
@@ -453,11 +514,11 @@ const VerdocsAdoptSignatureDialog = class {
453
514
  };
454
515
  }
455
516
  render() {
456
- return (index.h("verdocs-dialog", { key: '2d9f8c2d126b604fe74baf617ad66329cc83d642', persistent: true, onExit: () => this.exit.emit() }, index.h("div", { key: 'b5fe4f88aaec381b9dc44d4368eeb7062408d08f', slot: "heading", class: "heading" }, "Adopt Your Signature"), index.h("div", { key: '02094c09fd6b63f6d1a17f0813850558efc65c3e', slot: "content", class: "content" }, index.h("div", { key: '6b6ec99527de5d4d079b3d3d478581d0a403ec61', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), index.h("div", { key: '5446ee94d3f7d8c5a76bb07be4cb36a4977378ec', class: { type: true, active: this.mode === 'type' } }, index.h("verdocs-text-input", { key: '6efbbb16fc67f5360e3497573b045a9187557b1d', label: "Full Name", value: this.enteredName, disabled: this.nameLocked, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), this.nameLocked && index.h("div", { key: '1bc48daa4d814199d1e399a6ace89a33ec70dfcd', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), index.h("div", { key: '299b6667ff61ebb5bcd38f6e69f793c99073266e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), index.h("div", { key: '50b3b5d6c33790d9702c214f6d4dc536191f3529', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: '1a7aae5b62f11ce35eca59b85e58ce5300991b20', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => (this.mode = 'type') }), index.h("label", { key: '6bc2c033e6a094140186c394772eb8bb4146a59d' }, "Typed with a keyboard")), index.h("div", { key: 'c8eb2d62a274a069507250b0d4599765e0689b4a', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, index.h("verdocs-radio-button", { key: 'a9231341d4896b3e9d2c0cda07b3b47c99aa924a', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => (this.mode = 'draw') }), index.h("label", { key: '08800335d245f80006df2d98427555d8eed12500' }, "Drawn with touch, mouse, or stylus")), index.h("div", { key: '40ede26cbe3aee6ca9efb40137acd423757d09e1', class: "preview-header" }, index.h("div", { key: 'f3ab56d0583310e6957d12a25ee17f60c0833752', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (index.h("button", { key: '671c58fc4ffcf24f63733007bd3e2f9d97089f47', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), index.h("div", { key: '85e6492ae46953eac7ed47bea89e062066c9042e', class: "canvas-container signature-container" }, index.h("div", { key: 'b5d75586aa87a3dda6b15375750f9b7d992d2ad7', class: "signing-indicator" }, index.h("div", { key: '8e25d6232cff112c91bab09710bd068b6f458fb8', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: '351c358e185aa471ba020a5e49a619077e13eaec', class: "signing-line" })), index.h("canvas", { key: 'fb0c2d520f4498581e2457577d673070204b37f1', ref: el => (this.signatureElement = el),
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),
457
518
  // width="300"
458
- 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: 'ffd475d6c1ffdd1b0453a8196fa7edc6fc039649', class: "preview-header" }, index.h("div", { key: '61003eae27592625bab6d2aab282406bbd48fdc3', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (index.h("button", { key: '77350a9062703807f3766f4cf6a1e5e412086ee5', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), index.h("div", { key: '5c8f3a9a62325d915f2461cddc07adca3136799c', class: "canvas-container initials-container" }, index.h("div", { key: '0b37c4ee2ff03d61304a98bc8e284e0546258698', class: "signing-indicator" }, index.h("div", { key: '9f2f39d84a9aeefb48d310f896d223eccfed2ead', class: "x-icon", innerHTML: Icons.SignatureXIcon }), index.h("div", { key: '57120f545d2d07e1fdace87088b6cd3862dd0289', class: "signing-line" })), index.h("canvas", { key: '1b5080f57ec622775cc987229957029a4f1da2f8', ref: el => (this.initialsElement = el),
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),
459
520
  // width="300"
460
- 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: '138d718d6705b3096edf5379aadbccaef54a7bf6', 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: '32d3a076edc5db4dafff0070916278279a362760', class: "footer", slot: "footer" }, index.h("div", { key: 'faf75d8abed2bc9d72aa49055f26619ea3927343', class: "buttons" }, index.h("button", { key: '61a8750afa5c3a298b9dd0d82d05c7e185b29999', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), index.h("button", { key: '040577750135d0bed204f92bad1c5a275d759c08', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
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")))));
461
522
  }
462
523
  };
463
524
  VerdocsAdoptSignatureDialog.style = verdocsAdoptSignatureDialogCss;
@@ -78,6 +78,10 @@ const VerdocsSign = class {
78
78
  this.agreed = false;
79
79
  this.signatureId = null;
80
80
  this.initialId = null;
81
+ this.signatureAdoptMode = 'type';
82
+ this.adoptedSignaturePreview = null;
83
+ this.adoptedInitialsPreview = null;
84
+ this.adoptedName = null;
81
85
  this.skippedFields = [];
82
86
  this.documentsSingularPlural = 'document';
83
87
  this.authStep = null;
@@ -229,6 +233,10 @@ const VerdocsSign = class {
229
233
  // to adopt at least once per session so the signing flow is explicit after removing the up-front progress dialog.
230
234
  this.signatureId = null;
231
235
  this.initialId = null;
236
+ this.signatureAdoptMode = 'type';
237
+ this.adoptedSignaturePreview = null;
238
+ this.adoptedInitialsPreview = null;
239
+ this.adoptedName = null;
232
240
  this.submitted = recipient.status === 'submitted';
233
241
  this.loading = false;
234
242
  this.isDone = this.submitted;
@@ -399,6 +407,50 @@ const VerdocsSign = class {
399
407
  }
400
408
  });
401
409
  }
410
+ toDataUrl(value) {
411
+ return value.startsWith('data:') ? value : `data:image/png;base64,${value}`;
412
+ }
413
+ getAdoptModeStorageKey(signatureBlockId) {
414
+ return `verdocs-adopt-mode:${signatureBlockId}`;
415
+ }
416
+ getAdoptNameStorageKey(signatureBlockId) {
417
+ return `verdocs-adopt-name:${signatureBlockId}`;
418
+ }
419
+ /**
420
+ * Restore adopted signature/initial previews and mode from applied fields or session storage.
421
+ * Clearing a field only removes the stamp from that field — the adopted block still exists.
422
+ */
423
+ hydrateAdoptedSignatureState(triggerField) {
424
+ var _a, _b, _c, _d, _e;
425
+ const fields = this.getRecipientFields();
426
+ const signatureField = (triggerField === null || triggerField === void 0 ? void 0 : triggerField.type) === 'signature'
427
+ ? triggerField
428
+ : 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); });
429
+ 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); });
430
+ if ((_a = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _a === void 0 ? void 0 : _a.base64) {
431
+ this.adoptedSignaturePreview = this.toDataUrl(signatureField.settings.base64);
432
+ }
433
+ if ((_b = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _b === void 0 ? void 0 : _b.base64) {
434
+ this.adoptedInitialsPreview = this.toDataUrl(initialsField.settings.base64);
435
+ }
436
+ if ((_c = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _c === void 0 ? void 0 : _c.signature_id) {
437
+ this.signatureId = signatureField.settings.signature_id;
438
+ }
439
+ if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
440
+ this.initialId = initialsField.settings.initial_id;
441
+ }
442
+ const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
443
+ if (modeSourceId && this.adoptedSignaturePreview) {
444
+ const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
445
+ if (storedMode === 'draw' || storedMode === 'type') {
446
+ this.signatureAdoptMode = storedMode;
447
+ }
448
+ const storedName = sessionStorage.getItem(this.getAdoptNameStorageKey(modeSourceId));
449
+ if (storedName) {
450
+ this.adoptedName = storedName;
451
+ }
452
+ }
453
+ }
402
454
  getStartedKey() {
403
455
  var _a;
404
456
  return `${this.envelopeId}:${((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.role_name) || ''}`;
@@ -563,7 +615,6 @@ const VerdocsSign = class {
563
615
  }
564
616
  if (e.detail === null) {
565
617
  console.log('[SIGN] Clearing signature');
566
- this.signatureId = null;
567
618
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
568
619
  this.updateRecipientFieldValue(field.name, updateResult);
569
620
  if (field.required)
@@ -575,6 +626,7 @@ const VerdocsSign = class {
575
626
  console.log('[SIGN] Reusing signature', this.signatureId);
576
627
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
577
628
  this.updateRecipientFieldValue(field.name, updateResult);
629
+ this.hydrateAdoptedSignatureState(field);
578
630
  this.focusNextFieldAfter(field);
579
631
  return;
580
632
  }
@@ -584,6 +636,7 @@ const VerdocsSign = class {
584
636
  const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
585
637
  this.signatureId = e.detail;
586
638
  this.updateRecipientFieldValue(field.name, updateResult);
639
+ this.hydrateAdoptedSignatureState(field);
587
640
  this.focusNextFieldAfter(field);
588
641
  return;
589
642
  }
@@ -941,6 +994,7 @@ const VerdocsSign = class {
941
994
  });
942
995
  el.addEventListener('adopt', () => {
943
996
  this.focusedField = field.name;
997
+ this.hydrateAdoptedSignatureState(field);
944
998
  this.updateAllFlags();
945
999
  this.adoptingSignature = true;
946
1000
  });
@@ -1026,7 +1080,7 @@ const VerdocsSign = class {
1026
1080
  });
1027
1081
  }
1028
1082
  render() {
1029
- var _a;
1083
+ var _a, _b, _c, _d;
1030
1084
  if (this.showLoadError) {
1031
1085
  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: () => {
1032
1086
  window.location.reload();
@@ -1176,18 +1230,26 @@ const VerdocsSign = class {
1176
1230
  } })), 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: () => {
1177
1231
  this.showDone = false;
1178
1232
  this.isDone = true;
1179
- } })), 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), onNext: async (e) => {
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) => {
1180
1234
  console.log('[SIGN] Adopting signature/initials block', e.detail);
1181
1235
  this.showSpinner = true;
1236
+ this.signatureAdoptMode = e.detail.mode;
1237
+ this.adoptedSignaturePreview = e.detail.signature;
1238
+ this.adoptedInitialsPreview = e.detail.initials;
1239
+ this.adoptedName = e.detail.name;
1182
1240
  // These arrive as base-64 encoded data URLs
1183
1241
  const signatureBlob = await (await fetch(e.detail.signature)).blob();
1184
1242
  const initialsBlob = await (await fetch(e.detail.initials)).blob();
1185
1243
  const sigResult = await jsSdk.createSignature(this.endpoint, 'signature', signatureBlob);
1186
1244
  console.log('[SIGN] Created signature', sigResult);
1187
1245
  this.signatureId = sigResult.id;
1246
+ sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
1247
+ sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
1188
1248
  const initResult = await jsSdk.createInitials(this.endpoint, 'initial', initialsBlob);
1189
1249
  console.log('[SIGN] Created initials', initResult);
1190
1250
  this.initialId = initResult.id;
1251
+ sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
1252
+ sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
1191
1253
  this.showSpinner = false;
1192
1254
  this.adoptingSignature = false;
1193
1255
  this.markEnvelopeStarted();