@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.
- package/dist/cjs/loader.cjs.js +1 -1
- 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
- package/dist/cjs/verdocs-adopt-signature-dialog_8.cjs.entry.js +79 -18
- package/dist/cjs/verdocs-sign.cjs.entry.js +65 -3
- package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.js +157 -20
- package/dist/collection/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +69 -3
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/components/{p-Dpuy1yah.js → p-DSzyP6KP.js} +85 -20
- package/dist/components/p-DSzyP6KP.js.map +1 -0
- package/dist/components/verdocs-adopt-signature-dialog.js +1 -1
- package/dist/components/verdocs-sign.js +70 -4
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/custom-elements.json +24 -0
- package/dist/esm/loader.js +1 -1
- 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
- package/dist/esm/verdocs-adopt-signature-dialog_8.entry.js +79 -18
- package/dist/esm/verdocs-sign.entry.js +65 -3
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- 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
- package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/dialogs/verdocs-adopt-signature-dialog/verdocs-adopt-signature-dialog.d.ts +22 -0
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +12 -0
- package/dist/types/components.d.ts +34 -2
- package/dist/verdocs-web-sdk/p-7a0f0515.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-7a0f0515.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-965a8331.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-965a8331.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/p-CSd2l4lv.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-cbae68bb.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-dx3XIcHV.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-ff5f20c9.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-ff5f20c9.system.entry.js.map +1 -0
- 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
- package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-Dpuy1yah.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3c6e0a1f.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-3c6e0a1f.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-521b0c66.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-521b0c66.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-6f4a8d69.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-6f4a8d69.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-7c5d6848.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-7c5d6848.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-B0Zty-s5.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-TlalAeRR.system.js.map +0 -1
|
@@ -168,8 +168,11 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
componentWillLoad() {
|
|
171
|
-
this.enteredName = this.name;
|
|
172
|
-
this.computeEnteredInitials(this.
|
|
171
|
+
this.enteredName = this.initialEnteredName || this.name;
|
|
172
|
+
this.computeEnteredInitials(this.enteredName);
|
|
173
|
+
if (this.initialMode) {
|
|
174
|
+
this.mode = this.initialMode;
|
|
175
|
+
}
|
|
173
176
|
const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
|
|
174
177
|
ds.load().then(font => {
|
|
175
178
|
document.fonts.add(font);
|
|
@@ -177,24 +180,82 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
177
180
|
});
|
|
178
181
|
}
|
|
179
182
|
componentDidLoad() {
|
|
180
|
-
this.drawSignatureText();
|
|
181
|
-
this.drawInitialsText();
|
|
182
183
|
this.setupSignatureCanvas();
|
|
183
184
|
this.setupInitialsCanvas();
|
|
185
|
+
void this.loadExistingPreviews();
|
|
184
186
|
}
|
|
185
187
|
componentDidUpdate() {
|
|
186
|
-
this.drawSignatureText();
|
|
187
|
-
this.drawInitialsText();
|
|
188
188
|
this.setupSignatureCanvas();
|
|
189
189
|
this.setupInitialsCanvas();
|
|
190
|
+
if (this.mode === 'type') {
|
|
191
|
+
this.drawSignatureText();
|
|
192
|
+
this.drawInitialsText();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
190
195
|
// Redraw drawn signature when in draw mode
|
|
191
|
-
if (this.
|
|
196
|
+
if (this.allSigStrokes.length > 0) {
|
|
192
197
|
this.redrawDrawnSignature();
|
|
193
198
|
}
|
|
194
|
-
if (this.
|
|
199
|
+
if (this.allInitialsStrokes.length > 0) {
|
|
195
200
|
this.redrawDrawnInitials();
|
|
196
201
|
}
|
|
197
202
|
}
|
|
203
|
+
drawImageOnCanvas(canvas, dataUrl) {
|
|
204
|
+
return new Promise((resolve, reject) => {
|
|
205
|
+
const image = new Image();
|
|
206
|
+
image.onload = () => {
|
|
207
|
+
const context = canvas.getContext('2d');
|
|
208
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
209
|
+
const padding = 24;
|
|
210
|
+
const scale = Math.min((canvas.width - padding) / image.width, (canvas.height - padding) / image.height, 1);
|
|
211
|
+
const width = image.width * scale;
|
|
212
|
+
const height = image.height * scale;
|
|
213
|
+
const x = (canvas.width - width) / 2;
|
|
214
|
+
const y = (canvas.height - height) / 2;
|
|
215
|
+
context.drawImage(image, x, y, width, height);
|
|
216
|
+
resolve();
|
|
217
|
+
};
|
|
218
|
+
image.onerror = () => reject(new Error('Unable to load signature preview'));
|
|
219
|
+
image.src = dataUrl;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async loadExistingPreviews() {
|
|
223
|
+
if (this.mode === 'draw') {
|
|
224
|
+
await this.restoreDrawnPreviewsIfNeeded();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.drawSignatureText();
|
|
228
|
+
this.drawInitialsText();
|
|
229
|
+
}
|
|
230
|
+
setMode(mode) {
|
|
231
|
+
this.mode = mode;
|
|
232
|
+
if (mode === 'draw') {
|
|
233
|
+
void this.restoreDrawnPreviewsIfNeeded();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async restoreDrawnPreviewsIfNeeded() {
|
|
237
|
+
// Preserve in-session stroke edits; only restore saved previews when there are no strokes yet.
|
|
238
|
+
if (this.allSigStrokes.length > 0 || this.allInitialsStrokes.length > 0) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const tasks = [];
|
|
242
|
+
if (this.initialSignature && this.signatureElement) {
|
|
243
|
+
tasks.push(this.drawImageOnCanvas(this.signatureElement, this.initialSignature).then(() => {
|
|
244
|
+
this.hasDrawnSignature = true;
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
if (this.initialInitials && this.initialsElement) {
|
|
248
|
+
tasks.push(this.drawImageOnCanvas(this.initialsElement, this.initialInitials).then(() => {
|
|
249
|
+
this.hasDrawnInitials = true;
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
if (tasks.length === 0) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
await Promise.all(tasks);
|
|
256
|
+
this.setupSignatureCanvas();
|
|
257
|
+
this.setupInitialsCanvas();
|
|
258
|
+
}
|
|
198
259
|
drawSignatureText() {
|
|
199
260
|
if (!this.signatureElement || this.mode !== 'type') {
|
|
200
261
|
return;
|
|
@@ -322,7 +383,7 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
322
383
|
e.preventDefault();
|
|
323
384
|
const signature = this.signatureElement.toDataURL('image/png');
|
|
324
385
|
const initials = this.initialsElement.toDataURL('image/png');
|
|
325
|
-
this.next.emit({ signature, initials });
|
|
386
|
+
this.next.emit({ signature, initials, mode: this.mode, name: this.enteredName });
|
|
326
387
|
}
|
|
327
388
|
isAdoptButtonDisabled() {
|
|
328
389
|
switch (this.mode) {
|
|
@@ -330,8 +391,8 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
330
391
|
// Disable if no name has been entered
|
|
331
392
|
return !this.enteredName || this.enteredName.trim().length === 0;
|
|
332
393
|
case 'draw':
|
|
333
|
-
// Disable if nothing has been drawn
|
|
334
|
-
return
|
|
394
|
+
// Disable if nothing has been drawn or restored from a previous adoption
|
|
395
|
+
return !this.hasDrawnSignature || !this.hasDrawnInitials;
|
|
335
396
|
default:
|
|
336
397
|
return true;
|
|
337
398
|
}
|
|
@@ -352,8 +413,8 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
352
413
|
this.sigDrawingContext.lineWidth = 2;
|
|
353
414
|
this.sigDrawingContext.lineCap = 'round';
|
|
354
415
|
this.sigDrawingContext.lineJoin = 'round';
|
|
355
|
-
// Clear canvas only if there are no existing strokes
|
|
356
|
-
if (this.allSigStrokes.length === 0) {
|
|
416
|
+
// Clear canvas only if there are no existing strokes or restored previews
|
|
417
|
+
if (this.allSigStrokes.length === 0 && !this.hasDrawnSignature) {
|
|
357
418
|
this.sigDrawingContext.clearRect(0, 0, this.signatureElement.width, this.signatureElement.height);
|
|
358
419
|
}
|
|
359
420
|
}
|
|
@@ -382,8 +443,8 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
382
443
|
this.initialsDrawingContext.lineWidth = 2;
|
|
383
444
|
this.initialsDrawingContext.lineCap = 'round';
|
|
384
445
|
this.initialsDrawingContext.lineJoin = 'round';
|
|
385
|
-
// Clear canvas only if there are no existing strokes
|
|
386
|
-
if (this.allInitialsStrokes.length === 0) {
|
|
446
|
+
// Clear canvas only if there are no existing strokes or restored previews
|
|
447
|
+
if (this.allInitialsStrokes.length === 0 && !this.hasDrawnInitials) {
|
|
387
448
|
this.initialsDrawingContext.clearRect(0, 0, this.initialsElement.width, this.initialsElement.height);
|
|
388
449
|
}
|
|
389
450
|
}
|
|
@@ -451,11 +512,11 @@ const VerdocsAdoptSignatureDialog = class {
|
|
|
451
512
|
};
|
|
452
513
|
}
|
|
453
514
|
render() {
|
|
454
|
-
return (h("verdocs-dialog", { key: '
|
|
515
|
+
return (h("verdocs-dialog", { key: '3bf57218c88709dcb904ed197ac37551c26c8c37', persistent: true, onExit: () => this.exit.emit() }, h("div", { key: '26bf968eb7e6169e29c11c96806c387fc2891df2', slot: "heading", class: "heading" }, "Adopt Your Signature"), h("div", { key: 'dd9cb18b25d3055cf98a79fca2fe12a7a0f756da', slot: "content", class: "content" }, h("div", { key: 'ff7520ccf2d8e15a72b12aabeba11f785c33a4b1', style: { fontWeight: '300', color: '#242424', fontSize: '13px' } }, "Confirm your name, initials, and signature."), h("div", { key: '428c77e16cfcddf1a202cc9155220fe7899f12e3', class: { type: true, active: this.mode === 'type' } }, h("verdocs-text-input", { key: '3df310a9c55c581350fc5ee5847e768764283ee6', label: "Full Name", value: this.enteredName, disabled: this.nameLocked, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), this.nameLocked && h("div", { key: '060c1edd0986a6be98f9ce68f7b94d562782a3ae', class: "name-locked-hint" }, "Your name has been set by the sender and cannot be changed.")), h("div", { key: '95b80e7b68150ba7e912176834686b769c1ad74e', style: { fontWeight: '400', color: '#242424', fontSize: '13px' } }, "Select a signature style"), h("div", { key: '8567f38208d1c2130ecacb21a6f09eaa089f6fb4', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: '278fa39a73863c07512b297cdc13d2ad6bc18320', checked: this.mode === 'type', value: "type", name: "mode", onClick: () => this.setMode('type') }), h("label", { key: '20ebbd899fa095783e0b9b307e7c5bc6c73585c8' }, "Typed with a keyboard")), h("div", { key: '2aa96af7da2dbff4437f76d3be8c25660a5ae5ec', style: { display: 'flex', flexDirection: 'row', gap: '10px', marginBottom: '6px', alignItems: 'center', fontSize: '13px' } }, h("verdocs-radio-button", { key: 'e72c8a7350e6a368748746622dfc8382c94bbd7d', checked: this.mode === 'draw', value: "draw", name: "mode", onClick: () => this.setMode('draw') }), h("label", { key: '423eff813da06377c1c5d66f8ea813564f40478c' }, "Drawn with touch, mouse, or stylus")), h("div", { key: '013b7108cd626c5ef736520c4e93374205d62ea1', class: "preview-header" }, h("div", { key: '9af65f41a953990c2412b02176e921a60ef191ca', style: { fontSize: '13px', fontWeight: '400' } }, "Signature Preview"), this.mode === 'draw' && (h("button", { key: '5e422b7f7ef72fdf50eb7c5e102b9062a6f10e1c', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'signature'), disabled: !this.hasDrawnSignature }, "Clear"))), h("div", { key: '220cdf4f321aa3a388c9c4f9340d130cb207e7cf', class: "canvas-container signature-container" }, h("div", { key: '0ffa2c39b216ecd3ef76a36122b8d51f6e5a59bb', class: "signing-indicator" }, h("div", { key: 'c295f652022004645377620a49b9314330bbca7c', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: '0b24b19acd68f1e9ab9588f7b0aa3412e571a12d', class: "signing-line" })), h("canvas", { key: '72134d2f592c8f60fab5a90290f15b21e0b3e6aa', ref: el => (this.signatureElement = el),
|
|
455
516
|
// width="300"
|
|
456
|
-
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: '
|
|
517
|
+
height: "79", class: "signature-canvas", onPointerDown: this.handleSigPointerDown, onPointerMove: this.handleSigPointerMove, onPointerUp: this.handleSigPointerUp, onPointerCancel: this.handleSigPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: '847d54a8a55652ab67a3909d6510a4d587fb9bd8', class: "preview-header" }, h("div", { key: 'e270bb3dc8971ecc816db09ec6d91eb1a6613786', style: { fontSize: '13px', fontWeight: '400' } }, "Initials Preview"), this.mode === 'draw' && (h("button", { key: 'be4a46390d14a90f9705f40ff90a920174d58d85', class: "clear-button-text", onClick: e => this.handleClearDrawing(e, 'initials'), disabled: !this.hasDrawnInitials }, "Clear"))), h("div", { key: 'a8c2ace5575bf6b95e18e08febbd2dd3876d53c6', class: "canvas-container initials-container" }, h("div", { key: '1cab75d06695c2458452b4adc039f1078959c740', class: "signing-indicator" }, h("div", { key: 'e925e1f10a180aa65953dba5c007f294daf52ad2', class: "x-icon", innerHTML: SignatureXIcon }), h("div", { key: 'ecd9548ff69aa7ac7241433c1e88e5d66ceb2486', class: "signing-line" })), h("canvas", { key: '46c776d1efcee7e3d5bf5bd4a01db517eb638481', ref: el => (this.initialsElement = el),
|
|
457
518
|
// width="300"
|
|
458
|
-
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: '
|
|
519
|
+
height: "79", class: "initials-canvas", onPointerDown: this.handleInitialsPointerDown, onPointerMove: this.handleInitialsPointerMove, onPointerUp: this.handleInitialsPointerUp, onPointerCancel: this.handleInitialsPointerCancel, style: { touchAction: 'none', cursor: 'crosshair' } })), h("div", { key: '7039cf8e45f20d2c659937b9b637be9ee236b2d7', class: "disclaimer" }, "By clicking \u00ABAdopt Signature\u00BB, I agree that the signature and initials above will be the electronic representation of my signature and initials for all purposes when I use them to sign documents. Applying them to a document is legally equivalent to signing with a pen on paper.")), h("div", { key: '93030327757e8dbb438a9f7c0aa36829e54d1725', class: "footer", slot: "footer" }, h("div", { key: '7138105a5cd87dc3a85058fbfa0bd999a8ff68c5', class: "buttons" }, h("button", { key: '6051baa6bade91f491530b955710ceb672a45547', class: "cancel", onClick: e => this.handleCancel(e) }, "Cancel"), h("button", { key: 'cf3d5ff3b39f6c2b32c29306ca9a1656edb17e29', class: "proceed", onClick: e => this.handleAdopt(e), disabled: this.isAdoptButtonDisabled() }, "Adopt & Sign")))));
|
|
459
520
|
}
|
|
460
521
|
};
|
|
461
522
|
VerdocsAdoptSignatureDialog.style = verdocsAdoptSignatureDialogCss;
|
|
@@ -76,6 +76,10 @@ const VerdocsSign = class {
|
|
|
76
76
|
this.agreed = false;
|
|
77
77
|
this.signatureId = null;
|
|
78
78
|
this.initialId = null;
|
|
79
|
+
this.signatureAdoptMode = 'type';
|
|
80
|
+
this.adoptedSignaturePreview = null;
|
|
81
|
+
this.adoptedInitialsPreview = null;
|
|
82
|
+
this.adoptedName = null;
|
|
79
83
|
this.skippedFields = [];
|
|
80
84
|
this.documentsSingularPlural = 'document';
|
|
81
85
|
this.authStep = null;
|
|
@@ -227,6 +231,10 @@ const VerdocsSign = class {
|
|
|
227
231
|
// to adopt at least once per session so the signing flow is explicit after removing the up-front progress dialog.
|
|
228
232
|
this.signatureId = null;
|
|
229
233
|
this.initialId = null;
|
|
234
|
+
this.signatureAdoptMode = 'type';
|
|
235
|
+
this.adoptedSignaturePreview = null;
|
|
236
|
+
this.adoptedInitialsPreview = null;
|
|
237
|
+
this.adoptedName = null;
|
|
230
238
|
this.submitted = recipient.status === 'submitted';
|
|
231
239
|
this.loading = false;
|
|
232
240
|
this.isDone = this.submitted;
|
|
@@ -397,6 +405,50 @@ const VerdocsSign = class {
|
|
|
397
405
|
}
|
|
398
406
|
});
|
|
399
407
|
}
|
|
408
|
+
toDataUrl(value) {
|
|
409
|
+
return value.startsWith('data:') ? value : `data:image/png;base64,${value}`;
|
|
410
|
+
}
|
|
411
|
+
getAdoptModeStorageKey(signatureBlockId) {
|
|
412
|
+
return `verdocs-adopt-mode:${signatureBlockId}`;
|
|
413
|
+
}
|
|
414
|
+
getAdoptNameStorageKey(signatureBlockId) {
|
|
415
|
+
return `verdocs-adopt-name:${signatureBlockId}`;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Restore adopted signature/initial previews and mode from applied fields or session storage.
|
|
419
|
+
* Clearing a field only removes the stamp from that field — the adopted block still exists.
|
|
420
|
+
*/
|
|
421
|
+
hydrateAdoptedSignatureState(triggerField) {
|
|
422
|
+
var _a, _b, _c, _d, _e;
|
|
423
|
+
const fields = this.getRecipientFields();
|
|
424
|
+
const signatureField = (triggerField === null || triggerField === void 0 ? void 0 : triggerField.type) === 'signature'
|
|
425
|
+
? triggerField
|
|
426
|
+
: 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); });
|
|
427
|
+
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); });
|
|
428
|
+
if ((_a = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _a === void 0 ? void 0 : _a.base64) {
|
|
429
|
+
this.adoptedSignaturePreview = this.toDataUrl(signatureField.settings.base64);
|
|
430
|
+
}
|
|
431
|
+
if ((_b = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _b === void 0 ? void 0 : _b.base64) {
|
|
432
|
+
this.adoptedInitialsPreview = this.toDataUrl(initialsField.settings.base64);
|
|
433
|
+
}
|
|
434
|
+
if ((_c = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _c === void 0 ? void 0 : _c.signature_id) {
|
|
435
|
+
this.signatureId = signatureField.settings.signature_id;
|
|
436
|
+
}
|
|
437
|
+
if ((_d = initialsField === null || initialsField === void 0 ? void 0 : initialsField.settings) === null || _d === void 0 ? void 0 : _d.initial_id) {
|
|
438
|
+
this.initialId = initialsField.settings.initial_id;
|
|
439
|
+
}
|
|
440
|
+
const modeSourceId = this.signatureId || ((_e = signatureField === null || signatureField === void 0 ? void 0 : signatureField.settings) === null || _e === void 0 ? void 0 : _e.signature_id);
|
|
441
|
+
if (modeSourceId && this.adoptedSignaturePreview) {
|
|
442
|
+
const storedMode = sessionStorage.getItem(this.getAdoptModeStorageKey(modeSourceId));
|
|
443
|
+
if (storedMode === 'draw' || storedMode === 'type') {
|
|
444
|
+
this.signatureAdoptMode = storedMode;
|
|
445
|
+
}
|
|
446
|
+
const storedName = sessionStorage.getItem(this.getAdoptNameStorageKey(modeSourceId));
|
|
447
|
+
if (storedName) {
|
|
448
|
+
this.adoptedName = storedName;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
400
452
|
getStartedKey() {
|
|
401
453
|
var _a;
|
|
402
454
|
return `${this.envelopeId}:${((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.role_name) || ''}`;
|
|
@@ -561,7 +613,6 @@ const VerdocsSign = class {
|
|
|
561
613
|
}
|
|
562
614
|
if (e.detail === null) {
|
|
563
615
|
console.log('[SIGN] Clearing signature');
|
|
564
|
-
this.signatureId = null;
|
|
565
616
|
const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, null, false);
|
|
566
617
|
this.updateRecipientFieldValue(field.name, updateResult);
|
|
567
618
|
if (field.required)
|
|
@@ -573,6 +624,7 @@ const VerdocsSign = class {
|
|
|
573
624
|
console.log('[SIGN] Reusing signature', this.signatureId);
|
|
574
625
|
const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
|
|
575
626
|
this.updateRecipientFieldValue(field.name, updateResult);
|
|
627
|
+
this.hydrateAdoptedSignatureState(field);
|
|
576
628
|
this.focusNextFieldAfter(field);
|
|
577
629
|
return;
|
|
578
630
|
}
|
|
@@ -582,6 +634,7 @@ const VerdocsSign = class {
|
|
|
582
634
|
const updateResult = await updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, e.detail, false);
|
|
583
635
|
this.signatureId = e.detail;
|
|
584
636
|
this.updateRecipientFieldValue(field.name, updateResult);
|
|
637
|
+
this.hydrateAdoptedSignatureState(field);
|
|
585
638
|
this.focusNextFieldAfter(field);
|
|
586
639
|
return;
|
|
587
640
|
}
|
|
@@ -939,6 +992,7 @@ const VerdocsSign = class {
|
|
|
939
992
|
});
|
|
940
993
|
el.addEventListener('adopt', () => {
|
|
941
994
|
this.focusedField = field.name;
|
|
995
|
+
this.hydrateAdoptedSignatureState(field);
|
|
942
996
|
this.updateAllFlags();
|
|
943
997
|
this.adoptingSignature = true;
|
|
944
998
|
});
|
|
@@ -1024,7 +1078,7 @@ const VerdocsSign = class {
|
|
|
1024
1078
|
});
|
|
1025
1079
|
}
|
|
1026
1080
|
render() {
|
|
1027
|
-
var _a;
|
|
1081
|
+
var _a, _b, _c, _d;
|
|
1028
1082
|
if (this.showLoadError) {
|
|
1029
1083
|
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: () => {
|
|
1030
1084
|
window.location.reload();
|
|
@@ -1174,18 +1228,26 @@ const VerdocsSign = class {
|
|
|
1174
1228
|
} })), 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: () => {
|
|
1175
1229
|
this.showDone = false;
|
|
1176
1230
|
this.isDone = true;
|
|
1177
|
-
} })), this.adoptingSignature && (h("verdocs-adopt-signature-dialog", { name: formatFullName(this.recipient), nameLocked: !!((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.name_locked), onNext: async (e) => {
|
|
1231
|
+
} })), this.adoptingSignature && (h("verdocs-adopt-signature-dialog", { name: formatFullName(this.recipient), nameLocked: !!((_a = this.recipient) === null || _a === void 0 ? void 0 : _a.name_locked), initialEnteredName: (_b = this.adoptedName) !== null && _b !== void 0 ? _b : undefined, initialMode: this.adoptedSignaturePreview ? this.signatureAdoptMode : undefined, initialSignature: (_c = this.adoptedSignaturePreview) !== null && _c !== void 0 ? _c : undefined, initialInitials: (_d = this.adoptedInitialsPreview) !== null && _d !== void 0 ? _d : undefined, onNext: async (e) => {
|
|
1178
1232
|
console.log('[SIGN] Adopting signature/initials block', e.detail);
|
|
1179
1233
|
this.showSpinner = true;
|
|
1234
|
+
this.signatureAdoptMode = e.detail.mode;
|
|
1235
|
+
this.adoptedSignaturePreview = e.detail.signature;
|
|
1236
|
+
this.adoptedInitialsPreview = e.detail.initials;
|
|
1237
|
+
this.adoptedName = e.detail.name;
|
|
1180
1238
|
// These arrive as base-64 encoded data URLs
|
|
1181
1239
|
const signatureBlob = await (await fetch(e.detail.signature)).blob();
|
|
1182
1240
|
const initialsBlob = await (await fetch(e.detail.initials)).blob();
|
|
1183
1241
|
const sigResult = await createSignature(this.endpoint, 'signature', signatureBlob);
|
|
1184
1242
|
console.log('[SIGN] Created signature', sigResult);
|
|
1185
1243
|
this.signatureId = sigResult.id;
|
|
1244
|
+
sessionStorage.setItem(this.getAdoptModeStorageKey(sigResult.id), e.detail.mode);
|
|
1245
|
+
sessionStorage.setItem(this.getAdoptNameStorageKey(sigResult.id), e.detail.name);
|
|
1186
1246
|
const initResult = await createInitials(this.endpoint, 'initial', initialsBlob);
|
|
1187
1247
|
console.log('[SIGN] Created initials', initResult);
|
|
1188
1248
|
this.initialId = initResult.id;
|
|
1249
|
+
sessionStorage.setItem(this.getAdoptModeStorageKey(initResult.id), e.detail.mode);
|
|
1250
|
+
sessionStorage.setItem(this.getAdoptNameStorageKey(initResult.id), e.detail.name);
|
|
1189
1251
|
this.showSpinner = false;
|
|
1190
1252
|
this.adoptingSignature = false;
|
|
1191
1253
|
this.markEnvelopeStarted();
|