@verdocs/web-sdk 6.5.0-beta.10 → 6.5.0-beta.11
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/index-CQ5bTnED.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{verdocs-field-attachment_13.cjs.entry.js → verdocs-field-attachment_11.cjs.entry.js} +14 -623
- package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +229 -0
- package/dist/cjs/verdocs-initial-dialog.entry.cjs.js.map +1 -0
- package/dist/cjs/verdocs-sign.cjs.entry.js +72 -5
- package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +355 -0
- package/dist/cjs/verdocs-signature-dialog.entry.cjs.js.map +1 -0
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +72 -5
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +17 -26
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +32 -26
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js.map +1 -1
- package/dist/components/{p-CYoBhLFP.js → p-B4XIUesD.js} +42 -54
- package/dist/components/p-B4XIUesD.js.map +1 -0
- package/dist/components/{p-DjOK66Dt.js → p-BoIZ0eWm.js} +43 -55
- package/dist/components/p-BoIZ0eWm.js.map +1 -0
- package/dist/components/{p-BxnX5zPJ.js → p-BzCNCMTQ.js} +24 -53
- package/dist/components/p-BzCNCMTQ.js.map +1 -0
- package/dist/components/{p-DKJPJj6P.js → p-CaA92LBj.js} +43 -55
- package/dist/components/p-CaA92LBj.js.map +1 -0
- package/dist/components/{p-Bygkg9Ho.js → p-DlWkjPea.js} +17 -41
- package/dist/components/p-DlWkjPea.js.map +1 -0
- package/dist/components/verdocs-build.js +56 -68
- package/dist/components/verdocs-build.js.map +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-initial-dialog.js +263 -1
- package/dist/components/verdocs-initial-dialog.js.map +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-sign.js +72 -5
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-signature-dialog.js +393 -1
- package/dist/components/verdocs-signature-dialog.js.map +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/esm/index-BIRwgFLv.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{verdocs-field-attachment_13.entry.js → verdocs-field-attachment_11.entry.js} +15 -622
- package/dist/{components/p-Daqfz15U.js → esm/verdocs-initial-dialog.entry.js} +8 -49
- package/dist/esm/verdocs-initial-dialog.entry.js.map +1 -0
- package/dist/esm/verdocs-sign.entry.js +72 -5
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/{components/p-0L80sqd9.js → esm/verdocs-signature-dialog.entry.js} +8 -53
- package/dist/esm/verdocs-signature-dialog.entry.js.map +1 -0
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/index-BIRwgFLv.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js +2 -0
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-initial-dialog.entry.js +2 -0
- package/dist/esm-es5/verdocs-initial-dialog.entry.js.map +1 -0
- 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-signature-dialog.entry.js +2 -0
- package/dist/esm-es5/verdocs-signature-dialog.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +1 -4
- package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +2 -4
- package/dist/types/components.d.ts +10 -8
- package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-2fb3119a.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-2fb3119a.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-36659fcd.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-36659fcd.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-5d720de7.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-5d720de7.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/p-BYyqNgjP.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-D2FLn0Fu.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DQr2_l0b.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-c7243201.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c7243201.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-u99GfztJ.system.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-initial-dialog.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-signature-dialog.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-0L80sqd9.js.map +0 -1
- package/dist/components/p-BxnX5zPJ.js.map +0 -1
- package/dist/components/p-Bygkg9Ho.js.map +0 -1
- package/dist/components/p-CYoBhLFP.js.map +0 -1
- package/dist/components/p-DKJPJj6P.js.map +0 -1
- package/dist/components/p-Daqfz15U.js.map +0 -1
- package/dist/components/p-DjOK66Dt.js.map +0 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +0 -2
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-198d3577.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-198d3577.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-644689ce.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-644689ce.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-BBoL1FXa.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DSPz-5FG.system.js.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CQ5bTnED.js');
|
|
4
|
+
|
|
5
|
+
const verdocsInitialDialogCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-initial-dialog{font-family:\"Inter\", \"Barlow\", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-initial-dialog .dialog{width:100%;max-width:340px;border-radius:4px;overflow:hidden;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);background:#f9f9f9}verdocs-initial-dialog .heading{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:20px 20px 0 20px;line-height:28px;font-size:20px;font-weight:500}verdocs-initial-dialog .content{font-size:14px;padding:20px}verdocs-initial-dialog .buttons{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center}verdocs-initial-dialog .buttons verdocs-button{margin-left:16px}verdocs-initial-dialog canvas{background:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 auto;width:300px;height:79px;max-width:100%;-webkit-box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275);box-shadow:0 0 6px 0 rgba(0, 0, 0, 0.1215686275)}verdocs-initial-dialog .disclaimer{text-align:justify;padding:8px 0;font-size:11px;line-height:14px;color:rgba(0, 0, 0, 0.54)}verdocs-initial-dialog .as-shown{font-size:11px;margin:4px 0 20px 4px;color:rgba(0, 0, 0, 0.54)}verdocs-initial-dialog .tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-initial-dialog .tabs .tab{padding:8px 15px;cursor:pointer}verdocs-initial-dialog .tabs .tab.active{border-bottom:2px solid #cccccc}verdocs-initial-dialog .tabs .tab:hover{color:#55bc81}";
|
|
6
|
+
|
|
7
|
+
const VerdocsInitialDialog = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.next = index.createEvent(this, "next");
|
|
11
|
+
this.exit = index.createEvent(this, "exit");
|
|
12
|
+
/**
|
|
13
|
+
* Initial signature text
|
|
14
|
+
*/
|
|
15
|
+
this.initials = '';
|
|
16
|
+
this.fontLoaded = false;
|
|
17
|
+
this.enteredInitials = '';
|
|
18
|
+
this.mode = 'type';
|
|
19
|
+
}
|
|
20
|
+
componentWillLoad() {
|
|
21
|
+
this.enteredInitials = this.initials.toUpperCase();
|
|
22
|
+
const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');
|
|
23
|
+
ds.load().then(font => {
|
|
24
|
+
document.fonts.add(font);
|
|
25
|
+
this.fontLoaded = true;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
this.redrawSignature();
|
|
30
|
+
}
|
|
31
|
+
componentDidUpdate() {
|
|
32
|
+
this.redrawSignature();
|
|
33
|
+
}
|
|
34
|
+
redrawSignature() {
|
|
35
|
+
if (!this.canvasElement) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const canvasWidth = this.canvasElement.width;
|
|
39
|
+
const context = this.canvasElement.getContext('2d');
|
|
40
|
+
context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
|
|
41
|
+
let fontSize = 100;
|
|
42
|
+
do {
|
|
43
|
+
fontSize -= 2;
|
|
44
|
+
context.font = `${fontSize}px Dancing Script`;
|
|
45
|
+
} while (context.measureText(this.enteredInitials).width > canvasWidth - 32); // 32px padding each side
|
|
46
|
+
context.textAlign = 'center';
|
|
47
|
+
context.textBaseline = 'middle';
|
|
48
|
+
context.font = `${fontSize}px Dancing Script`;
|
|
49
|
+
context.fillText(this.enteredInitials, this.canvasElement.width / 2, this.canvasElement.height / 2);
|
|
50
|
+
}
|
|
51
|
+
handleNameChange(e) {
|
|
52
|
+
this.enteredInitials = e.target.value;
|
|
53
|
+
}
|
|
54
|
+
handleCancel(e) {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
this.exit.emit();
|
|
58
|
+
}
|
|
59
|
+
handleAdopt(e) {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
const data = this.canvasElement.toDataURL('image/png');
|
|
63
|
+
this.next.emit(data);
|
|
64
|
+
}
|
|
65
|
+
/*
|
|
66
|
+
selColor(hex: string) {
|
|
67
|
+
this.color = hex;
|
|
68
|
+
this.animateDraw();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
stopDraw() {
|
|
72
|
+
this.paint = false;
|
|
73
|
+
this.adoptedAndSigned = !this.hasSignature();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
draw(e) {
|
|
77
|
+
this.paint = true;
|
|
78
|
+
this.addPoints(e, false);
|
|
79
|
+
this.animateDraw();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
recordPoints(e) {
|
|
83
|
+
if (this.paint) {
|
|
84
|
+
this.addPoints(e, true);
|
|
85
|
+
this.animateDraw();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
animateDraw() {
|
|
90
|
+
this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
|
|
91
|
+
|
|
92
|
+
this.canvas.strokeStyle = this.color || '#000000';
|
|
93
|
+
this.canvas.lineJoin = 'round';
|
|
94
|
+
this.canvas.lineWidth = 3;
|
|
95
|
+
|
|
96
|
+
for (let i = 0; i < this.points.length; i++) {
|
|
97
|
+
this.canvas.beginPath();
|
|
98
|
+
if (this.points[i].drag && i) {
|
|
99
|
+
this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);
|
|
100
|
+
// this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);
|
|
101
|
+
} else {
|
|
102
|
+
this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);
|
|
103
|
+
// this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.canvas.lineTo(this.points[i].x, this.points[i].y);
|
|
107
|
+
this.canvas.closePath();
|
|
108
|
+
this.canvas.stroke();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
drawCurve(color: string, curve: number) {
|
|
113
|
+
this.canvas.beginPath();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
addPoints(e, drag: boolean) {
|
|
119
|
+
if (window) {
|
|
120
|
+
let x;
|
|
121
|
+
let y;
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
if (e.touches && e.touches.length > 0) {
|
|
124
|
+
x = e.touches[0].clientX;
|
|
125
|
+
} else {
|
|
126
|
+
x = e.clientX;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (e.touches && e.touches.length > 0) {
|
|
130
|
+
y = e.touches[0].clientY;
|
|
131
|
+
} else {
|
|
132
|
+
y = e.clientY;
|
|
133
|
+
}
|
|
134
|
+
const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();
|
|
135
|
+
this.points.push({
|
|
136
|
+
x: x - rect.left,
|
|
137
|
+
y: y - rect.top,
|
|
138
|
+
drag: drag
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
clearPad() {
|
|
144
|
+
this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);
|
|
145
|
+
this.points = [];
|
|
146
|
+
this.adoptedAndSigned = !this.hasSignature();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async adoptAndSign() {
|
|
150
|
+
try {
|
|
151
|
+
this.adoptedAndSigned = true;
|
|
152
|
+
await this.updateFullName();
|
|
153
|
+
await this.captureSignatureFromCanvas();
|
|
154
|
+
const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';
|
|
155
|
+
this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));
|
|
156
|
+
this.handleMode();
|
|
157
|
+
} catch (err) {
|
|
158
|
+
this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
handleMode() {
|
|
163
|
+
let currentField;
|
|
164
|
+
switch (this.mode) {
|
|
165
|
+
case 'signerview':
|
|
166
|
+
if (this.signatureMode === 'Signature') {
|
|
167
|
+
this.signatureService.postSignatureBlob().then(result => {
|
|
168
|
+
if (result && result.id && result.url) {
|
|
169
|
+
currentField = this.signatureService.currField;
|
|
170
|
+
this.signatureService.updateSigned(currentField.fName, true);
|
|
171
|
+
this.signatureService.toggleSig(false);
|
|
172
|
+
this.signatureService.setSignatureId(result.id);
|
|
173
|
+
this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {
|
|
174
|
+
this.eventTracker.createEvent({
|
|
175
|
+
category: 'verdoc',
|
|
176
|
+
action: 'verdoc signed',
|
|
177
|
+
label: `verdoc id: ${this.envelopeId}`
|
|
178
|
+
})
|
|
179
|
+
if (res && res.settings) {
|
|
180
|
+
this.signatureService.setSignatureData(res.settings.base64);
|
|
181
|
+
this.signatureService.setSignatureId(res.settings.signature_id);
|
|
182
|
+
}
|
|
183
|
+
this.snackbarService.dismiss();
|
|
184
|
+
this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });
|
|
185
|
+
}).catch(err => {
|
|
186
|
+
this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {
|
|
187
|
+
duration: 3000
|
|
188
|
+
});
|
|
189
|
+
this.adoptedAndSigned = false;
|
|
190
|
+
return err;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
this.signatureService.postInitialBlob().then(result => {
|
|
196
|
+
if (result && result.id && result.url) {
|
|
197
|
+
currentField = this.signatureService.currField;
|
|
198
|
+
this.signatureService.updateInitialed(currentField.fName, true);
|
|
199
|
+
this.signatureService.setInitialId(result.id);
|
|
200
|
+
this.signatureService.toggleSig(false);
|
|
201
|
+
this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {
|
|
202
|
+
if (res && res.settings) {
|
|
203
|
+
this.signatureService.setInitialData(res.settings.base64);
|
|
204
|
+
this.signatureService.setInitialId(res.settings.initial_id);
|
|
205
|
+
}
|
|
206
|
+
this.snackbarService.dismiss();
|
|
207
|
+
this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });
|
|
208
|
+
}).catch(err => {
|
|
209
|
+
this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {
|
|
210
|
+
duration: 3000
|
|
211
|
+
});
|
|
212
|
+
this.adoptedAndSigned = false;
|
|
213
|
+
return err;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
*/
|
|
222
|
+
render() {
|
|
223
|
+
return (index.h(index.Host, { key: 'adf8b7f3191850b40c865196d5a435e9d85ef28a', onClick: e => this.handleCancel(e) }, index.h("div", { key: 'c80e81a5ff5a686cbab68b9ac0fa23dd61d9ee32', class: "dialog" }, index.h("div", { key: '622d2ebd26b3ac4003add36dc40c9eef54fb95bc', class: "heading" }, "Create Your Initial"), index.h("div", { key: '8179e48c368a5831b395a01ea6e6dbf19377e3f3', class: "content" }, index.h("verdocs-text-input", { key: 'c5696ad5ab2fc4a703b596d12029e95dcad099b6', placeholder: "Initials...", label: "Initials", value: this.enteredInitials, onInput: e => this.handleNameChange(e), onClick: e => e.stopPropagation() }), index.h("div", { key: 'a63b403893d70267d94e4029b72a54e50ccc56ae', class: "as-shown" }, "As shown on driver's license or govt. ID card."), this.fontLoaded ? index.h("canvas", { ref: el => (this.canvasElement = el) }) : index.h("div", { style: { display: 'none' } }), index.h("div", { key: '917afd9ece52ed0716f06d5fb8cc1167644f015d', class: "disclaimer" }, "By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents, including legally binding contracts \u2014 just the same as a pen-and-paper signature or initial."), index.h("div", { key: 'b76005f2943578684934f6e5299d1bcf0bb5f705', class: "buttons" }, index.h("verdocs-button", { key: '5b9a99183f1f31d940a6a22cf4167c84f93d2284', label: "CANCEL", size: "normal", variant: "outline", onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { key: 'e9dbfe8255870db5ff0b5f2aee3d9a3c1e48b702', label: "Adopt & Sign", size: "normal", onClick: e => this.handleAdopt(e) }))))));
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
VerdocsInitialDialog.style = verdocsInitialDialogCss;
|
|
227
|
+
|
|
228
|
+
exports.verdocs_initial_dialog = VerdocsInitialDialog;
|
|
229
|
+
//# sourceMappingURL=verdocs-initial-dialog.entry.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdocs-initial-dialog.entry.cjs.js","sources":["src/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.scss?tag=verdocs-initial-dialog","src/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-initial-dialog {\n font-family: $primary-font;\n box-sizing: border-box;\n position: fixed;\n z-index: 10000;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #0000007f;\n\n .dialog {\n width: 100%;\n max-width: 340px;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 3px 3px 5px 1px rgba(40, 40, 40, 0.4);\n background: $dialog-bg;\n }\n\n .heading {\n display: flex;\n flex-direction: row;\n padding: 20px 20px 0 20px;\n line-height: 28px;\n font-size: 20px;\n font-weight: 500;\n }\n\n .content {\n font-size: 14px;\n padding: 20px;\n }\n\n .buttons {\n display: flex;\n margin: 20px 0 0 0;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n\n verdocs-button {\n margin-left: 16px;\n }\n }\n\n canvas {\n background: #fff;\n box-sizing: border-box;\n margin: 0 auto;\n width: 300px;\n // TODO: The original app had an aspect ratio of (80 / 305) * (signatureBodyWidth - 20)\n height: 79px;\n max-width: 100%;\n box-shadow: 0 0 6px 0 #0000001f;\n }\n\n .disclaimer {\n text-align: justify;\n padding: 8px 0;\n font-size: 11px;\n line-height: 14px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .as-shown {\n font-size: 11px;\n margin: 4px 0 20px 4px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .tabs {\n display: flex;\n flex-direction: row;\n\n .tab {\n padding: 8px 15px;\n cursor: pointer;\n\n &.active {\n border-bottom: 2px solid $light-border-color;\n }\n\n &:hover {\n color: $primary-color;\n }\n }\n }\n}\n","import {Component, Prop, Host, h, Event, EventEmitter, State} from '@stencil/core';\n\n/**\n * Display a dialog that allows the user to specify an initials image, either by using a signature-font-generated image\n * based on their full name, or by hand-drawing their initials with a mouse or tablet.\n */\n@Component({\n tag: 'verdocs-initial-dialog',\n styleUrl: 'verdocs-initial-dialog.scss',\n})\nexport class VerdocsInitialDialog {\n private canvasElement?: HTMLCanvasElement;\n\n /**\n * Initial signature text\n */\n @Prop() initials: string = '';\n\n /**\n * Fired when the user completes the dialog and clicks Adopt. The event detail will contain a base64-encoded string\n * representation of the initials adopted.\n */\n @Event({composed: true}) next: EventEmitter<string>;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n @State() fontLoaded = false;\n\n @State() enteredInitials: string = '';\n\n @State() mode: string = 'type';\n\n componentWillLoad() {\n this.enteredInitials = this.initials.toUpperCase();\n\n const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');\n ds.load().then(font => {\n document.fonts.add(font);\n this.fontLoaded = true;\n });\n }\n\n componentDidLoad() {\n this.redrawSignature();\n }\n\n componentDidUpdate() {\n this.redrawSignature();\n }\n\n redrawSignature() {\n if (!this.canvasElement) {\n return;\n }\n\n const canvasWidth = this.canvasElement.width;\n\n const context = this.canvasElement.getContext('2d');\n context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);\n\n let fontSize = 100;\n do {\n fontSize -= 2;\n context.font = `${fontSize}px Dancing Script`;\n } while (context.measureText(this.enteredInitials).width > canvasWidth - 32); // 32px padding each side\n\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n context.font = `${fontSize}px Dancing Script`;\n context.fillText(this.enteredInitials, this.canvasElement.width / 2, this.canvasElement.height / 2);\n }\n\n handleNameChange(e: any) {\n this.enteredInitials = e.target.value;\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n e.preventDefault();\n this.exit.emit();\n }\n\n handleAdopt(e: any) {\n e.stopPropagation();\n e.preventDefault();\n const data = this.canvasElement.toDataURL('image/png');\n this.next.emit(data);\n }\n\n /*\n selColor(hex: string) {\n this.color = hex;\n this.animateDraw();\n }\n\n stopDraw() {\n this.paint = false;\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n draw(e) {\n this.paint = true;\n this.addPoints(e, false);\n this.animateDraw();\n }\n\n recordPoints(e) {\n if (this.paint) {\n this.addPoints(e, true);\n this.animateDraw();\n }\n }\n\n animateDraw() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n\n this.canvas.strokeStyle = this.color || '#000000';\n this.canvas.lineJoin = 'round';\n this.canvas.lineWidth = 3;\n\n for (let i = 0; i < this.points.length; i++) {\n this.canvas.beginPath();\n if (this.points[i].drag && i) {\n this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);\n // this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);\n } else {\n this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);\n // this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);\n }\n\n this.canvas.lineTo(this.points[i].x, this.points[i].y);\n this.canvas.closePath();\n this.canvas.stroke();\n }\n }\n\n drawCurve(color: string, curve: number) {\n this.canvas.beginPath();\n }\n\n\n\n addPoints(e, drag: boolean) {\n if (window) {\n let x;\n let y;\n e.preventDefault();\n if (e.touches && e.touches.length > 0) {\n x = e.touches[0].clientX;\n } else {\n x = e.clientX;\n }\n\n if (e.touches && e.touches.length > 0) {\n y = e.touches[0].clientY;\n } else {\n y = e.clientY;\n }\n const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();\n this.points.push({\n x: x - rect.left,\n y: y - rect.top,\n drag: drag\n });\n }\n }\n\n clearPad() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n this.points = [];\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n async adoptAndSign() {\n try {\n this.adoptedAndSigned = true;\n await this.updateFullName();\n await this.captureSignatureFromCanvas();\n const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';\n this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));\n this.handleMode();\n } catch (err) {\n this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));\n }\n }\n\n handleMode() {\n let currentField;\n switch (this.mode) {\n case 'signerview':\n if (this.signatureMode === 'Signature') {\n this.signatureService.postSignatureBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateSigned(currentField.fName, true);\n this.signatureService.toggleSig(false);\n this.signatureService.setSignatureId(result.id);\n this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {\n this.eventTracker.createEvent({\n category: 'verdoc',\n action: 'verdoc signed',\n label: `verdoc id: ${this.envelopeId}`\n })\n if (res && res.settings) {\n this.signatureService.setSignatureData(res.settings.base64);\n this.signatureService.setSignatureId(res.settings.signature_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n } else {\n this.signatureService.postInitialBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateInitialed(currentField.fName, true);\n this.signatureService.setInitialId(result.id);\n this.signatureService.toggleSig(false);\n this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {\n if (res && res.settings) {\n this.signatureService.setInitialData(res.settings.base64);\n this.signatureService.setInitialId(res.settings.initial_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n }\n break;\n }\n }\n */\n\n render() {\n return (\n <Host onClick={e => this.handleCancel(e)}>\n <div class=\"dialog\">\n <div class=\"heading\">Create Your Initial</div>\n\n <div class=\"content\">\n <verdocs-text-input\n placeholder=\"Initials...\"\n label=\"Initials\"\n value={this.enteredInitials}\n onInput={e => this.handleNameChange(e)}\n onClick={e => e.stopPropagation()}\n />\n <div class=\"as-shown\">As shown on driver's license or govt. ID card.</div>\n\n {/*<div class=\"tabs\">*/}\n {/* <div class={{tab: true, active: this.mode === 'type'}} onClick={() => (this.mode = 'type')}>*/}\n {/* Type*/}\n {/* </div>*/}\n {/* <div class={{tab: true, active: this.mode === 'draw'}} onClick={() => (this.mode = 'draw')}>*/}\n {/* Draw*/}\n {/* </div>*/}\n {/*</div>*/}\n\n {this.fontLoaded ? <canvas ref={el => (this.canvasElement = el as HTMLCanvasElement)} /> : <div style={{display: 'none'}} />}\n\n <div class=\"disclaimer\">\n By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents,\n including legally binding contracts — just the same as a pen-and-paper signature or initial.\n </div>\n\n <div class=\"buttons\">\n <verdocs-button label=\"CANCEL\" size=\"normal\" variant=\"outline\" onClick={e => this.handleCancel(e)} />\n <verdocs-button label=\"Adopt & Sign\" size=\"normal\" onClick={e => this.handleAdopt(e)} />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"names":["h","Host"],"mappings":"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"}
|
|
@@ -11,6 +11,29 @@ require('./Types-RUyU-svM.js');
|
|
|
11
11
|
|
|
12
12
|
const verdocsSignCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;min-height:700px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f5f5f5;font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", sans-serif)}verdocs-sign verdocs-button>button.standard{background:#2a63f6}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;padding-right:140px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign>.document .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;max-width:1028px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-sign>.document .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-sign>.document .document-separator:first-child{margin-top:0}verdocs-sign .signed-document-container{width:64%;margin-left:260px}@media (max-width: 600px){verdocs-sign .signed-document-container{width:100%;margin-left:0}verdocs-sign>.document{padding-right:15px}verdocs-sign .verdocs-flag-instance{display:none !important}}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{max-width:360px;width:50%;font-size:16px;background:white;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#4c56cb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400;padding:0 10px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Helper to generate a human-readable label for a field.
|
|
16
|
+
*/
|
|
17
|
+
const getFieldLabel = (field) => {
|
|
18
|
+
if (!field)
|
|
19
|
+
return '';
|
|
20
|
+
const typeMap = {
|
|
21
|
+
signature: 'Signature',
|
|
22
|
+
initial: 'Initials',
|
|
23
|
+
date: 'Date',
|
|
24
|
+
textbox: 'Text Field',
|
|
25
|
+
checkbox: 'Checkbox',
|
|
26
|
+
radio: 'Radio Button',
|
|
27
|
+
dropdown: 'Dropdown',
|
|
28
|
+
attachment: 'Attachment',
|
|
29
|
+
payment: 'Payment',
|
|
30
|
+
};
|
|
31
|
+
const typeName = typeMap[field.type] || 'Field';
|
|
32
|
+
if (field.required) {
|
|
33
|
+
return `Required ${typeName}*`;
|
|
34
|
+
}
|
|
35
|
+
return `Optional ${typeName}`;
|
|
36
|
+
};
|
|
14
37
|
const VerdocsSign = class {
|
|
15
38
|
constructor(hostRef) {
|
|
16
39
|
index.registerInstance(this, hostRef);
|
|
@@ -95,6 +118,12 @@ const VerdocsSign = class {
|
|
|
95
118
|
// session and might have a different "view" of the envelope.
|
|
96
119
|
const response = await jsSdk.startSigningSession(this.endpoint, this.envelopeId, this.roleId, this.inviteCode);
|
|
97
120
|
this.processAuthResponse(response);
|
|
121
|
+
const fillable = this.getSortedFillableFields();
|
|
122
|
+
if (fillable.length > 0) {
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
this.focusedField = fillable[0].name;
|
|
125
|
+
}, 500);
|
|
126
|
+
}
|
|
98
127
|
}
|
|
99
128
|
catch (e) {
|
|
100
129
|
console.log('[SIGN] Error with signing session', e);
|
|
@@ -430,6 +459,7 @@ const VerdocsSign = class {
|
|
|
430
459
|
// Find and focus the next incomplete field (that is fillable)
|
|
431
460
|
const emptyFields = this.getSortedFillableFields().filter(field => field.required && !jsSdk.isFieldFilled(field, this.getRecipientFields()));
|
|
432
461
|
jsSdk.sortFields(emptyFields);
|
|
462
|
+
console.log('[SIGN] Pending fields', emptyFields.map(f => `${f.name} (${f.type}) req=${f.required}`));
|
|
433
463
|
// If everything required is filled, try optional fields?
|
|
434
464
|
// The previous logic only looked for required fields for "Next".
|
|
435
465
|
// If we want "Fill or Skip", we should probably look for ANY unfilled field if we want to guide them to optionals too.
|
|
@@ -487,7 +517,14 @@ const VerdocsSign = class {
|
|
|
487
517
|
// Remove existing flags
|
|
488
518
|
const existingFlags = controlsDiv.querySelectorAll('.verdocs-flag-instance');
|
|
489
519
|
existingFlags.forEach(el => el.remove());
|
|
490
|
-
|
|
520
|
+
let nextField = this.getNextRequiredField();
|
|
521
|
+
const focusedFieldObj = this.getRecipientFields().find(f => f.name === this.focusedField);
|
|
522
|
+
// If the currently focused field is unfilled, we should point the flag to IT, not the next one.
|
|
523
|
+
// getNextRequiredField() is designed for the "Next" button (skipping current), but the visual flag
|
|
524
|
+
// should guide the user to the current task if it's incomplete.
|
|
525
|
+
if (focusedFieldObj && !jsSdk.isFieldFilled(focusedFieldObj, this.getRecipientFields())) {
|
|
526
|
+
nextField = focusedFieldObj;
|
|
527
|
+
}
|
|
491
528
|
if (nextField && nextField.page === pageInfo.pageNumber && nextField.document_id === pageInfo.documentId) {
|
|
492
529
|
const variant = 'fill';
|
|
493
530
|
let label = 'FILL';
|
|
@@ -674,6 +711,10 @@ const VerdocsSign = class {
|
|
|
674
711
|
el.addEventListener('fieldChange', e => {
|
|
675
712
|
this.handleFieldChange(field, e).finally(() => this.checkRecipientFields());
|
|
676
713
|
});
|
|
714
|
+
el.addEventListener('adopt', () => {
|
|
715
|
+
this.focusedField = field.name;
|
|
716
|
+
this.adoptingSignature = true;
|
|
717
|
+
});
|
|
677
718
|
el.setAttribute('templateid', this.envelope.template_id);
|
|
678
719
|
el.setAttribute('fieldname', field.name);
|
|
679
720
|
el.setAttribute('page', pageInfo.pageNumber);
|
|
@@ -742,15 +783,16 @@ const VerdocsSign = class {
|
|
|
742
783
|
this.processAuthResponse(r);
|
|
743
784
|
})
|
|
744
785
|
.catch(e => {
|
|
745
|
-
var _a, _b, _c, _d, _e;
|
|
786
|
+
var _a, _b, _c, _d, _e, _f;
|
|
746
787
|
console.log('[SIGN] Error submitting authentication step', e);
|
|
747
|
-
|
|
788
|
+
console.log((_a = e.response) === null || _a === void 0 ? void 0 : _a.data);
|
|
789
|
+
if ((_d = (_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === null || _d === void 0 ? void 0 : _d.includes('failed')) {
|
|
748
790
|
this.fatalErrorHeader = 'Recipient Verification Failed';
|
|
749
791
|
this.fatalErrorMessage = 'We were unable to verify your identity. The sender has been notified.';
|
|
750
792
|
this.isDone = true;
|
|
751
793
|
}
|
|
752
794
|
else {
|
|
753
|
-
Toast.VerdocsToast(((
|
|
795
|
+
Toast.VerdocsToast(((_f = (_e = e.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.error) || 'Unable to verify your identity. Please try again.', { style: 'error' });
|
|
754
796
|
}
|
|
755
797
|
});
|
|
756
798
|
}
|
|
@@ -864,7 +906,16 @@ const VerdocsSign = class {
|
|
|
864
906
|
: console.log('[SIGN] All field valid');
|
|
865
907
|
return (index.h(index.Host, null, index.h("div", { id: "verdocs-sign-header" }, index.h("div", { class: "inner" }, index.h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }), !this.finishLater && index.h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel, disabled: !this.agreed || this.submitting, onClick: () => this.handleNext() }), index.h("div", { style: { marginLeft: '10px' } }), index.h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), (() => {
|
|
866
908
|
const focusedFieldObj = this.getSortedFillableFields().find(f => f.name === this.focusedField);
|
|
867
|
-
|
|
909
|
+
const currentIndex = this.getSortedFillableFields().findIndex(f => f.name === this.focusedField) + 1;
|
|
910
|
+
const totalFields = this.getSortedFillableFields().length;
|
|
911
|
+
let mode = 'start';
|
|
912
|
+
if (this.nextSubmits) {
|
|
913
|
+
mode = 'completed';
|
|
914
|
+
}
|
|
915
|
+
else if (this.signatureId || this.initialId) {
|
|
916
|
+
mode = 'signing';
|
|
917
|
+
}
|
|
918
|
+
return (index.h("verdocs-signing-progress", { mode: mode, current: Math.max(1, currentIndex), total: totalFields, fieldLabel: getFieldLabel(focusedFieldObj), fieldCompleted: focusedFieldObj ? !!jsSdk.isFieldFilled(focusedFieldObj, this.getRecipientFields()) : false, onStarted: () => {
|
|
868
919
|
this.adoptingSignature = true;
|
|
869
920
|
// this.handleNext();
|
|
870
921
|
}, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }));
|
|
@@ -905,6 +956,22 @@ const VerdocsSign = class {
|
|
|
905
956
|
this.initialId = initResult.id;
|
|
906
957
|
this.showSpinner = false;
|
|
907
958
|
this.adoptingSignature = false;
|
|
959
|
+
// If we have a focused field, we should auto-apply the new signature/initials to it
|
|
960
|
+
if (this.focusedField) {
|
|
961
|
+
const field = this.getRecipientFields().find(f => f.name === this.focusedField);
|
|
962
|
+
if (field && !jsSdk.isFieldFilled(field, this.getRecipientFields())) {
|
|
963
|
+
console.log('[SIGN] Auto-applying adopted signature to focused field', field.name);
|
|
964
|
+
if (field.type === 'signature') {
|
|
965
|
+
const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.signatureId, false);
|
|
966
|
+
this.updateRecipientFieldValue(field.name, updateResult);
|
|
967
|
+
}
|
|
968
|
+
else if (field.type === 'initial') {
|
|
969
|
+
const updateResult = await jsSdk.updateEnvelopeField(this.endpoint, this.envelopeId, this.roleId, field.name, this.initialId, false);
|
|
970
|
+
this.updateRecipientFieldValue(field.name, updateResult);
|
|
971
|
+
}
|
|
972
|
+
this.checkRecipientFields();
|
|
973
|
+
}
|
|
974
|
+
}
|
|
908
975
|
}, onExit: () => (this.adoptingSignature = false) })), (this.submitting || this.showSpinner) && (index.h("verdocs-portal", null, index.h("div", { class: "spinner-overlay" }, index.h("verdocs-spinner", null)))), !this.loading && !this.isDone && (index.h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, isDone: this.isDone, onAskQuestion: (e) => {
|
|
909
976
|
jsSdk.askQuestion(this.endpoint, this.envelopeId, this.roleId, { question: e.detail.question })
|
|
910
977
|
.then(() => Toast.VerdocsToast('Your question has been sent.', { style: 'success' }))
|