@verdocs/web-sdk 4.2.138 → 4.2.140
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/verdocs-contact-picker_2.cjs.entry.js +10 -6
- package/dist/cjs/verdocs-preview_9.cjs.entry.js +9 -6
- package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +11 -8
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +2 -2
- package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js +11 -7
- package/dist/components/verdocs-contact-picker2.js +11 -7
- package/dist/components/verdocs-send2.js +11 -8
- package/dist/components/verdocs-sign.js +2 -2
- package/dist/esm/verdocs-contact-picker_2.entry.js +11 -7
- package/dist/esm/verdocs-preview_9.entry.js +10 -7
- package/dist/esm/verdocs-sign.entry.js +2 -2
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_9.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +2 -1
- package/dist/types/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.d.ts +1 -1
- package/dist/types/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.d.ts +1 -0
- package/dist/verdocs-web-sdk/p-18b2b2ab.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-1e8c7927.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-267df026.system.js +1 -1
- package/dist/verdocs-web-sdk/p-458eda56.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-fd5ffce4.system.entry.js → p-937e21ca.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-97fa9395.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e7b20fdc.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +4 -4
- package/dist/verdocs-web-sdk/p-0f677e5a.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-28684a2b.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-3912a575.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-80635ee9.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-a6be54b0.system.entry.js +0 -1
@@ -106,15 +106,19 @@ const VerdocsContactPicker = class {
|
|
106
106
|
// The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them
|
107
107
|
// and show a duplicate autocomplete picker on top of our own.
|
108
108
|
render() {
|
109
|
-
|
109
|
+
// TODO: Re-activate this one SMS is re-enabled
|
110
|
+
// const hasBasics = this.first_name && this.last_name && (isValidEmail(this.email) || isValidPhone(this.phone));
|
111
|
+
const hasBasics = this.first_name && this.last_name && jsSdk.isValidEmail(this.email);
|
110
112
|
const hasKbaRequirements = !this.kba_method || (this.kba_method === 'pin' && this.kba_pin) || (this.kba_method === 'identity' && this.zip);
|
111
113
|
const canSubmit = hasBasics && hasKbaRequirements;
|
112
|
-
return (index.h("form", { key: '
|
114
|
+
return (index.h("form", { key: 'ac497c45c40d7ed22d7f3e8b0c022bb000ba5d9f', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("div", { key: '8b858443d6b0ce08b53ec248ec016cd4c1abff91', class: "row" }, index.h("label", { key: '894dff4bd6734e07513a674dfd5e6ae075258a71', htmlFor: this.nameFieldId }, "Name:"), index.h("div", { key: '8f11b864815f4b22bc27fb9497c4a3a45514ff63', class: "names-row" }, index.h("input", { key: '2012ff376bee8b61d08656c430e56c537c6ec2e9', id: this.firstNameFieldId, name: this.firstNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.first_name, placeholder: "First...", onFocus: () => { var _a; return (this.showSuggestions = ((_a = this.contactSuggestions) === null || _a === void 0 ? void 0 : _a.length) > 0); }, onInput: e => this.handleFirstNameChange(e) }), index.h("input", { key: '31e7c09b4e7ba0d9b952329a925a2e96012ba32a', id: this.lastNameFieldId, name: this.lastNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.last_name, placeholder: "Last...", onFocus: () => (this.showSuggestions = false), onInput: e => this.handleLastNameChange(e) })), this.showSuggestions && (index.h("div", { key: 'f179ec1c0ca6fb570bbdf26d9e647cd13a992139', class: "dropdown" }, this.contactSuggestions
|
113
115
|
.filter(suggestion => !this.first_name || suggestion.first_name.toLowerCase().includes(this.first_name.toLowerCase()))
|
114
116
|
.map(suggestion => {
|
115
117
|
var _a;
|
116
118
|
return (index.h("div", { key: (_a = suggestion.id) !== null && _a !== void 0 ? _a : suggestion.email, class: "suggestion", onClick: e => this.handleSelectSuggestion(e, suggestion) }, suggestion.picture ? index.h("img", { alt: "Avatar", class: "avatar", src: suggestion.picture }) : index.h("div", { class: "avatar", innerHTML: addrBookIcon }), index.h("div", { class: "details" }, index.h("div", { class: "name" }, jsSdk.formatFullName(suggestion)), suggestion.email && index.h("div", { class: "destination" }, suggestion.email), suggestion.phone && index.h("div", { class: "destination" }, suggestion.phone))));
|
117
|
-
})))), index.h("div", { key: '
|
119
|
+
})))), index.h("div", { key: '3373a462ee3e69d997a841fa0b244e548d1c0e3a', class: "row" }, index.h("label", { key: 'f8860a8fb9c6733a3d782325b04e58be65fd55e5', htmlFor: this.emailFieldId }, "Email:"), index.h("input", { key: '478d60f899f8f0951764ef2a049c0e200e5e764a', id: this.emailFieldId, name: this.emailFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.email, placeholder: "Email address...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.email = e.target.value) })), index.h("div", { key: '8ef1b72ce461d00993e369dc7005485dfa7479ea', class: "row" }, index.h("label", { key: 'dfbfc89ac11b4265dcdfe208cfa6272c51378ff4', htmlFor: this.phoneFieldId }, "Phone:"), index.h("input", { key: 'c49f4e0c2fad08ded0be201c56f3033b57569ae9', id: this.phoneFieldId, name: this.phoneFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.phone, placeholder: "Phone (SMS)...", onFocus: () => (this.showSuggestions = false), onInput: (e) => {
|
120
|
+
this.phone = utils.convertToE164(e.target.value);
|
121
|
+
} })), this.showKba && (index.h(index.Fragment, { key: 'f20803d8a91d8fe4d3e80a996e05609334b1fc63' }, index.h("div", { key: '7eaffb6e155a39e396240815167fd9028d88f594', class: "kba-row" }, index.h("label", { key: '7369126fb396b09408a0b7b52167e2b5377718d5' }, "KBA:"), index.h("verdocs-select-input", { key: '876420a587fa61b45a882cae0c3b07a4d746de4e', value: this.kba_method, onInput: (e) => {
|
118
122
|
this.kba_method = e.target.value;
|
119
123
|
this.zip = '';
|
120
124
|
this.kba_pin = '';
|
@@ -122,7 +126,7 @@ const VerdocsContactPicker = class {
|
|
122
126
|
{ label: 'None', value: '' },
|
123
127
|
{ label: 'PIN Code', value: 'pin' },
|
124
128
|
{ label: 'Full Verification', value: 'identity' },
|
125
|
-
] }), index.h("div", { key: '
|
129
|
+
] }), index.h("div", { key: '9882f4052c4ed7c1519ac16f4aa887654a2fa9df', style: { flex: '1' } }), index.h("verdocs-help-icon", { key: 'cece16cdbcddfd61acbdebaf8506de14d86e2735', text: "Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature." })), this.kba_method === 'pin' && (index.h("div", { key: 'f8d1b4060415b706ce6dc41af1681b5fb578801e', class: "row pin-code" }, index.h("input", { key: 'a4631db4a4f8d4fb19fdbc3fae7ab6e72ba960b2', id: "verdocs-pin-code", name: "verdocs-pin-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.kba_pin, placeholder: "PIN Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.kba_pin = e.target.value) }))), this.kba_method === 'identity' && (index.h("div", { key: '7089bcc65028634e993bcee9b488c015771ae18e', class: "row zip-code" }, index.h("input", { key: '27dd173d1c2b5bad25d81a1a584d3fe8b273b383', id: "verdocs-zip-code", name: "verdocs-zip-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.zip, placeholder: "Zip Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.zip = e.target.value) }))))), this.showMessage && (index.h("div", { key: 'f4d1e8940b6a38131b4dddd12f0d2198ed72a510', class: "row message" }, index.h("label", { key: 'e85ef31b8e9fa8a55291f3b938105bc71ae1af7c', htmlFor: "verdocs-contact-picker-message" }, "Message:"), index.h("input", { key: 'd5db9fe70914891ecb387992dc9511facacff22d', id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.message, placeholder: "Message shown in invitation...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }))), index.h("div", { key: '4bea6011ba9bca1235910bb7c03c13516360a117', class: "buttons" }, index.h("verdocs-toggle-button", { key: '988bb21d4bc07c717d448f58c78e96d52ff9488c', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
|
126
130
|
this.showKba = e.detail.active;
|
127
131
|
if (!e.detail.active) {
|
128
132
|
this.kba_pin = '';
|
@@ -130,10 +134,10 @@ const VerdocsContactPicker = class {
|
|
130
134
|
this.zip = '';
|
131
135
|
}
|
132
136
|
this.showSuggestions = false;
|
133
|
-
} }), index.h("verdocs-toggle-button", { key: '
|
137
|
+
} }), index.h("verdocs-toggle-button", { key: '5db03c19e9847453bc45ec14033f9391beb4de18', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
|
134
138
|
this.showMessage = e.detail.active;
|
135
139
|
this.showSuggestions = false;
|
136
|
-
} }), index.h("div", { key: '
|
140
|
+
} }), index.h("div", { key: '34c811113655950d04dc339d4ea8faeb1a9d46ca', class: "flex-fill" }), index.h("verdocs-button", { key: 'f85404fbb9deffd6a5a81816cfd12ccaf52cf619', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { key: 'f75dafadb24638f5322de5a9a9cbd15b51a6c81f', label: "OK", size: "small", disabled: !canSubmit, onClick: !canSubmit ? () => { } : e => this.handleSubmit(e) }))));
|
137
141
|
}
|
138
142
|
};
|
139
143
|
VerdocsContactPicker.style = VerdocsContactPickerStyle0;
|
@@ -202,7 +202,9 @@ const VerdocsSend = class {
|
|
202
202
|
rolesAtLevel[level] || (rolesAtLevel[level] = []);
|
203
203
|
const id = `r-${level}-${rolesAtLevel[level].length}`;
|
204
204
|
rolesAtLevel[level].push({ ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name });
|
205
|
-
|
205
|
+
// TODO: Re-activate once SMS is re-enabled
|
206
|
+
// if (role.first_name && (isValidEmail(role.email) || isValidPhone(role.phone))) {
|
207
|
+
if (role.first_name && jsSdk.isValidEmail(role.email)) {
|
206
208
|
this.rolesCompleted[id] = { ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name };
|
207
209
|
}
|
208
210
|
});
|
@@ -264,11 +266,10 @@ const VerdocsSend = class {
|
|
264
266
|
template_id: this.templateId,
|
265
267
|
name: ((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name) || '',
|
266
268
|
environment: this.environment,
|
267
|
-
// TODO: Make optional in the SDK
|
268
269
|
initial_reminder: 0,
|
269
270
|
followup_reminders: 0,
|
270
271
|
recipients: Object.values(this.rolesCompleted),
|
271
|
-
// TODO
|
272
|
+
// TODO: Pre-filled fields support
|
272
273
|
fields: [],
|
273
274
|
};
|
274
275
|
console.log('[SEND] Creating envelope', details);
|
@@ -284,7 +285,7 @@ const VerdocsSend = class {
|
|
284
285
|
.catch(e => {
|
285
286
|
var _a, _b, _c;
|
286
287
|
console.log('Send error', e);
|
287
|
-
Toast.VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.
|
288
|
+
Toast.VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || 'Error creating envelope, please try again later.');
|
288
289
|
this.sending = false;
|
289
290
|
(_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
|
290
291
|
});
|
@@ -301,9 +302,11 @@ const VerdocsSend = class {
|
|
301
302
|
}
|
302
303
|
const levels = this.getLevels();
|
303
304
|
const roleNames = TemplateRoleStore.getRoleNames(this.roleStore);
|
304
|
-
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => jsSdk.isValidEmail(recipient.email)
|
305
|
+
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => jsSdk.isValidEmail(recipient.email));
|
306
|
+
// TODO: Reactivate once SMS is re-enabled
|
307
|
+
// const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
|
305
308
|
const allRolesAssigned = rolesAssigned.length >= roleNames.length;
|
306
|
-
console.log('[SEND] Roles completed', this.rolesCompleted);
|
309
|
+
// console.log('[SEND] Roles completed', this.rolesCompleted);
|
307
310
|
return (index.h(index.Host, { class: { sendable: (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable } }, index.h("div", { class: "recipients" }, index.h("div", { class: "left-line" }), index.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index.h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (index.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
308
311
|
var _a, _b, _c, _d;
|
309
312
|
const unknown = !role.email;
|
@@ -314,6 +314,7 @@ const VerdocsSign = class {
|
|
314
314
|
isFieldFilled(field) {
|
315
315
|
const { value = '' } = field;
|
316
316
|
switch (field.type) {
|
317
|
+
case 'textarea':
|
317
318
|
case 'textbox':
|
318
319
|
switch (field.validator || '') {
|
319
320
|
case 'email':
|
@@ -330,9 +331,8 @@ const VerdocsSign = class {
|
|
330
331
|
// Timestamp fields get automatically filled when the envelope is submitted.
|
331
332
|
case 'timestamp':
|
332
333
|
return true;
|
333
|
-
case 'textarea':
|
334
334
|
case 'date':
|
335
|
-
return value
|
335
|
+
return !!value;
|
336
336
|
case 'attachment':
|
337
337
|
return value === 'attached';
|
338
338
|
case 'dropdown':
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
2
|
-
import { createEnvelope, formatFullName, getOrganizationContacts, getRGBA, isValidEmail,
|
2
|
+
import { createEnvelope, formatFullName, getOrganizationContacts, getRGBA, isValidEmail, VerdocsEndpoint } from "@verdocs/js-sdk";
|
3
3
|
import { getRoleIndex, getRoleNames, getTemplateRoleStore } from "../../../utils/TemplateRoleStore";
|
4
4
|
import { getTemplateStore } from "../../../utils/TemplateStore";
|
5
|
-
import { SDKError } from "../../../utils/errors";
|
6
5
|
import { VerdocsToast } from "../../../utils/Toast";
|
6
|
+
import { SDKError } from "../../../utils/errors";
|
7
7
|
const editIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';
|
8
8
|
const startIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';
|
9
9
|
const stepIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';
|
@@ -115,7 +115,9 @@ export class VerdocsSend {
|
|
115
115
|
rolesAtLevel[level] || (rolesAtLevel[level] = []);
|
116
116
|
const id = `r-${level}-${rolesAtLevel[level].length}`;
|
117
117
|
rolesAtLevel[level].push({ ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name });
|
118
|
-
|
118
|
+
// TODO: Re-activate once SMS is re-enabled
|
119
|
+
// if (role.first_name && (isValidEmail(role.email) || isValidPhone(role.phone))) {
|
120
|
+
if (role.first_name && isValidEmail(role.email)) {
|
119
121
|
this.rolesCompleted[id] = { ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name };
|
120
122
|
}
|
121
123
|
});
|
@@ -177,11 +179,10 @@ export class VerdocsSend {
|
|
177
179
|
template_id: this.templateId,
|
178
180
|
name: ((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name) || '',
|
179
181
|
environment: this.environment,
|
180
|
-
// TODO: Make optional in the SDK
|
181
182
|
initial_reminder: 0,
|
182
183
|
followup_reminders: 0,
|
183
184
|
recipients: Object.values(this.rolesCompleted),
|
184
|
-
// TODO
|
185
|
+
// TODO: Pre-filled fields support
|
185
186
|
fields: [],
|
186
187
|
};
|
187
188
|
console.log('[SEND] Creating envelope', details);
|
@@ -197,7 +198,7 @@ export class VerdocsSend {
|
|
197
198
|
.catch(e => {
|
198
199
|
var _a, _b, _c;
|
199
200
|
console.log('Send error', e);
|
200
|
-
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.
|
201
|
+
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || 'Error creating envelope, please try again later.');
|
201
202
|
this.sending = false;
|
202
203
|
(_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
|
203
204
|
});
|
@@ -214,9 +215,11 @@ export class VerdocsSend {
|
|
214
215
|
}
|
215
216
|
const levels = this.getLevels();
|
216
217
|
const roleNames = getRoleNames(this.roleStore);
|
217
|
-
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email)
|
218
|
+
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email));
|
219
|
+
// TODO: Reactivate once SMS is re-enabled
|
220
|
+
// const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
|
218
221
|
const allRolesAssigned = rolesAssigned.length >= roleNames.length;
|
219
|
-
console.log('[SEND] Roles completed', this.rolesCompleted);
|
222
|
+
// console.log('[SEND] Roles completed', this.rolesCompleted);
|
220
223
|
return (h(Host, { class: { sendable: (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
221
224
|
var _a, _b, _c, _d;
|
222
225
|
const unknown = !role.email;
|
@@ -318,6 +318,7 @@ export class VerdocsSign {
|
|
318
318
|
isFieldFilled(field) {
|
319
319
|
const { value = '' } = field;
|
320
320
|
switch (field.type) {
|
321
|
+
case 'textarea':
|
321
322
|
case 'textbox':
|
322
323
|
switch (field.validator || '') {
|
323
324
|
case 'email':
|
@@ -334,9 +335,8 @@ export class VerdocsSign {
|
|
334
335
|
// Timestamp fields get automatically filled when the envelope is submitted.
|
335
336
|
case 'timestamp':
|
336
337
|
return true;
|
337
|
-
case 'textarea':
|
338
338
|
case 'date':
|
339
|
-
return value
|
339
|
+
return !!value;
|
340
340
|
case 'attachment':
|
341
341
|
return value === 'attached';
|
342
342
|
case 'dropdown':
|
package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { formatFullName, VerdocsEndpoint } from "@verdocs/js-sdk";
|
2
1
|
import { h, Fragment } from "@stencil/core";
|
2
|
+
import { formatFullName, isValidEmail, VerdocsEndpoint } from "@verdocs/js-sdk";
|
3
3
|
import { convertToE164 } from "../../../utils/utils";
|
4
4
|
const messageIcon = '<svg focusable="false" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"></path></svg>';
|
5
5
|
// const delegateIcon =
|
@@ -108,15 +108,19 @@ export class VerdocsContactPicker {
|
|
108
108
|
// The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them
|
109
109
|
// and show a duplicate autocomplete picker on top of our own.
|
110
110
|
render() {
|
111
|
-
|
111
|
+
// TODO: Re-activate this one SMS is re-enabled
|
112
|
+
// const hasBasics = this.first_name && this.last_name && (isValidEmail(this.email) || isValidPhone(this.phone));
|
113
|
+
const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);
|
112
114
|
const hasKbaRequirements = !this.kba_method || (this.kba_method === 'pin' && this.kba_pin) || (this.kba_method === 'identity' && this.zip);
|
113
115
|
const canSubmit = hasBasics && hasKbaRequirements;
|
114
|
-
return (h("form", { key: '
|
116
|
+
return (h("form", { key: 'ac497c45c40d7ed22d7f3e8b0c022bb000ba5d9f', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '8b858443d6b0ce08b53ec248ec016cd4c1abff91', class: "row" }, h("label", { key: '894dff4bd6734e07513a674dfd5e6ae075258a71', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '8f11b864815f4b22bc27fb9497c4a3a45514ff63', class: "names-row" }, h("input", { key: '2012ff376bee8b61d08656c430e56c537c6ec2e9', id: this.firstNameFieldId, name: this.firstNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.first_name, placeholder: "First...", onFocus: () => { var _a; return (this.showSuggestions = ((_a = this.contactSuggestions) === null || _a === void 0 ? void 0 : _a.length) > 0); }, onInput: e => this.handleFirstNameChange(e) }), h("input", { key: '31e7c09b4e7ba0d9b952329a925a2e96012ba32a', id: this.lastNameFieldId, name: this.lastNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.last_name, placeholder: "Last...", onFocus: () => (this.showSuggestions = false), onInput: e => this.handleLastNameChange(e) })), this.showSuggestions && (h("div", { key: 'f179ec1c0ca6fb570bbdf26d9e647cd13a992139', class: "dropdown" }, this.contactSuggestions
|
115
117
|
.filter(suggestion => !this.first_name || suggestion.first_name.toLowerCase().includes(this.first_name.toLowerCase()))
|
116
118
|
.map(suggestion => {
|
117
119
|
var _a;
|
118
120
|
return (h("div", { key: (_a = suggestion.id) !== null && _a !== void 0 ? _a : suggestion.email, class: "suggestion", onClick: e => this.handleSelectSuggestion(e, suggestion) }, suggestion.picture ? h("img", { alt: "Avatar", class: "avatar", src: suggestion.picture }) : h("div", { class: "avatar", innerHTML: addrBookIcon }), h("div", { class: "details" }, h("div", { class: "name" }, formatFullName(suggestion)), suggestion.email && h("div", { class: "destination" }, suggestion.email), suggestion.phone && h("div", { class: "destination" }, suggestion.phone))));
|
119
|
-
})))), h("div", { key: '
|
121
|
+
})))), h("div", { key: '3373a462ee3e69d997a841fa0b244e548d1c0e3a', class: "row" }, h("label", { key: 'f8860a8fb9c6733a3d782325b04e58be65fd55e5', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '478d60f899f8f0951764ef2a049c0e200e5e764a', id: this.emailFieldId, name: this.emailFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.email, placeholder: "Email address...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.email = e.target.value) })), h("div", { key: '8ef1b72ce461d00993e369dc7005485dfa7479ea', class: "row" }, h("label", { key: 'dfbfc89ac11b4265dcdfe208cfa6272c51378ff4', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: 'c49f4e0c2fad08ded0be201c56f3033b57569ae9', id: this.phoneFieldId, name: this.phoneFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.phone, placeholder: "Phone (SMS)...", onFocus: () => (this.showSuggestions = false), onInput: (e) => {
|
122
|
+
this.phone = convertToE164(e.target.value);
|
123
|
+
} })), this.showKba && (h(Fragment, { key: 'f20803d8a91d8fe4d3e80a996e05609334b1fc63' }, h("div", { key: '7eaffb6e155a39e396240815167fd9028d88f594', class: "kba-row" }, h("label", { key: '7369126fb396b09408a0b7b52167e2b5377718d5' }, "KBA:"), h("verdocs-select-input", { key: '876420a587fa61b45a882cae0c3b07a4d746de4e', value: this.kba_method, onInput: (e) => {
|
120
124
|
this.kba_method = e.target.value;
|
121
125
|
this.zip = '';
|
122
126
|
this.kba_pin = '';
|
@@ -124,7 +128,7 @@ export class VerdocsContactPicker {
|
|
124
128
|
{ label: 'None', value: '' },
|
125
129
|
{ label: 'PIN Code', value: 'pin' },
|
126
130
|
{ label: 'Full Verification', value: 'identity' },
|
127
|
-
] }), h("div", { key: '
|
131
|
+
] }), h("div", { key: '9882f4052c4ed7c1519ac16f4aa887654a2fa9df', style: { flex: '1' } }), h("verdocs-help-icon", { key: 'cece16cdbcddfd61acbdebaf8506de14d86e2735', text: "Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature." })), this.kba_method === 'pin' && (h("div", { key: 'f8d1b4060415b706ce6dc41af1681b5fb578801e', class: "row pin-code" }, h("input", { key: 'a4631db4a4f8d4fb19fdbc3fae7ab6e72ba960b2', id: "verdocs-pin-code", name: "verdocs-pin-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.kba_pin, placeholder: "PIN Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.kba_pin = e.target.value) }))), this.kba_method === 'identity' && (h("div", { key: '7089bcc65028634e993bcee9b488c015771ae18e', class: "row zip-code" }, h("input", { key: '27dd173d1c2b5bad25d81a1a584d3fe8b273b383', id: "verdocs-zip-code", name: "verdocs-zip-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.zip, placeholder: "Zip Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.zip = e.target.value) }))))), this.showMessage && (h("div", { key: 'f4d1e8940b6a38131b4dddd12f0d2198ed72a510', class: "row message" }, h("label", { key: 'e85ef31b8e9fa8a55291f3b938105bc71ae1af7c', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'd5db9fe70914891ecb387992dc9511facacff22d', id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.message, placeholder: "Message shown in invitation...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }))), h("div", { key: '4bea6011ba9bca1235910bb7c03c13516360a117', class: "buttons" }, h("verdocs-toggle-button", { key: '988bb21d4bc07c717d448f58c78e96d52ff9488c', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
|
128
132
|
this.showKba = e.detail.active;
|
129
133
|
if (!e.detail.active) {
|
130
134
|
this.kba_pin = '';
|
@@ -132,10 +136,10 @@ export class VerdocsContactPicker {
|
|
132
136
|
this.zip = '';
|
133
137
|
}
|
134
138
|
this.showSuggestions = false;
|
135
|
-
} }), h("verdocs-toggle-button", { key: '
|
139
|
+
} }), h("verdocs-toggle-button", { key: '5db03c19e9847453bc45ec14033f9391beb4de18', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
|
136
140
|
this.showMessage = e.detail.active;
|
137
141
|
this.showSuggestions = false;
|
138
|
-
} }), h("div", { key: '
|
142
|
+
} }), h("div", { key: '34c811113655950d04dc339d4ea8faeb1a9d46ca', class: "flex-fill" }), h("verdocs-button", { key: 'f85404fbb9deffd6a5a81816cfd12ccaf52cf619', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'f75dafadb24638f5322de5a9a9cbd15b51a6c81f', label: "OK", size: "small", disabled: !canSubmit, onClick: !canSubmit ? () => { } : e => this.handleSubmit(e) }))));
|
139
143
|
}
|
140
144
|
static get is() { return "verdocs-contact-picker"; }
|
141
145
|
static get originalStyleUrls() {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
2
|
-
import { VerdocsEndpoint, formatFullName } from '@verdocs/js-sdk';
|
2
|
+
import { VerdocsEndpoint, formatFullName, isValidEmail } from '@verdocs/js-sdk';
|
3
3
|
import { c as convertToE164 } from './utils.js';
|
4
4
|
import { d as defineCustomElement$4 } from './verdocs-button2.js';
|
5
5
|
import { d as defineCustomElement$3 } from './verdocs-help-icon2.js';
|
@@ -104,15 +104,19 @@ const VerdocsContactPicker = /*@__PURE__*/ proxyCustomElement(class VerdocsConta
|
|
104
104
|
// The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them
|
105
105
|
// and show a duplicate autocomplete picker on top of our own.
|
106
106
|
render() {
|
107
|
-
|
107
|
+
// TODO: Re-activate this one SMS is re-enabled
|
108
|
+
// const hasBasics = this.first_name && this.last_name && (isValidEmail(this.email) || isValidPhone(this.phone));
|
109
|
+
const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);
|
108
110
|
const hasKbaRequirements = !this.kba_method || (this.kba_method === 'pin' && this.kba_pin) || (this.kba_method === 'identity' && this.zip);
|
109
111
|
const canSubmit = hasBasics && hasKbaRequirements;
|
110
|
-
return (h("form", { key: '
|
112
|
+
return (h("form", { key: 'ac497c45c40d7ed22d7f3e8b0c022bb000ba5d9f', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '8b858443d6b0ce08b53ec248ec016cd4c1abff91', class: "row" }, h("label", { key: '894dff4bd6734e07513a674dfd5e6ae075258a71', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '8f11b864815f4b22bc27fb9497c4a3a45514ff63', class: "names-row" }, h("input", { key: '2012ff376bee8b61d08656c430e56c537c6ec2e9', id: this.firstNameFieldId, name: this.firstNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.first_name, placeholder: "First...", onFocus: () => { var _a; return (this.showSuggestions = ((_a = this.contactSuggestions) === null || _a === void 0 ? void 0 : _a.length) > 0); }, onInput: e => this.handleFirstNameChange(e) }), h("input", { key: '31e7c09b4e7ba0d9b952329a925a2e96012ba32a', id: this.lastNameFieldId, name: this.lastNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.last_name, placeholder: "Last...", onFocus: () => (this.showSuggestions = false), onInput: e => this.handleLastNameChange(e) })), this.showSuggestions && (h("div", { key: 'f179ec1c0ca6fb570bbdf26d9e647cd13a992139', class: "dropdown" }, this.contactSuggestions
|
111
113
|
.filter(suggestion => !this.first_name || suggestion.first_name.toLowerCase().includes(this.first_name.toLowerCase()))
|
112
114
|
.map(suggestion => {
|
113
115
|
var _a;
|
114
116
|
return (h("div", { key: (_a = suggestion.id) !== null && _a !== void 0 ? _a : suggestion.email, class: "suggestion", onClick: e => this.handleSelectSuggestion(e, suggestion) }, suggestion.picture ? h("img", { alt: "Avatar", class: "avatar", src: suggestion.picture }) : h("div", { class: "avatar", innerHTML: addrBookIcon }), h("div", { class: "details" }, h("div", { class: "name" }, formatFullName(suggestion)), suggestion.email && h("div", { class: "destination" }, suggestion.email), suggestion.phone && h("div", { class: "destination" }, suggestion.phone))));
|
115
|
-
})))), h("div", { key: '
|
117
|
+
})))), h("div", { key: '3373a462ee3e69d997a841fa0b244e548d1c0e3a', class: "row" }, h("label", { key: 'f8860a8fb9c6733a3d782325b04e58be65fd55e5', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '478d60f899f8f0951764ef2a049c0e200e5e764a', id: this.emailFieldId, name: this.emailFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.email, placeholder: "Email address...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.email = e.target.value) })), h("div", { key: '8ef1b72ce461d00993e369dc7005485dfa7479ea', class: "row" }, h("label", { key: 'dfbfc89ac11b4265dcdfe208cfa6272c51378ff4', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: 'c49f4e0c2fad08ded0be201c56f3033b57569ae9', id: this.phoneFieldId, name: this.phoneFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.phone, placeholder: "Phone (SMS)...", onFocus: () => (this.showSuggestions = false), onInput: (e) => {
|
118
|
+
this.phone = convertToE164(e.target.value);
|
119
|
+
} })), this.showKba && (h(Fragment, { key: 'f20803d8a91d8fe4d3e80a996e05609334b1fc63' }, h("div", { key: '7eaffb6e155a39e396240815167fd9028d88f594', class: "kba-row" }, h("label", { key: '7369126fb396b09408a0b7b52167e2b5377718d5' }, "KBA:"), h("verdocs-select-input", { key: '876420a587fa61b45a882cae0c3b07a4d746de4e', value: this.kba_method, onInput: (e) => {
|
116
120
|
this.kba_method = e.target.value;
|
117
121
|
this.zip = '';
|
118
122
|
this.kba_pin = '';
|
@@ -120,7 +124,7 @@ const VerdocsContactPicker = /*@__PURE__*/ proxyCustomElement(class VerdocsConta
|
|
120
124
|
{ label: 'None', value: '' },
|
121
125
|
{ label: 'PIN Code', value: 'pin' },
|
122
126
|
{ label: 'Full Verification', value: 'identity' },
|
123
|
-
] }), h("div", { key: '
|
127
|
+
] }), h("div", { key: '9882f4052c4ed7c1519ac16f4aa887654a2fa9df', style: { flex: '1' } }), h("verdocs-help-icon", { key: 'cece16cdbcddfd61acbdebaf8506de14d86e2735', text: "Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature." })), this.kba_method === 'pin' && (h("div", { key: 'f8d1b4060415b706ce6dc41af1681b5fb578801e', class: "row pin-code" }, h("input", { key: 'a4631db4a4f8d4fb19fdbc3fae7ab6e72ba960b2', id: "verdocs-pin-code", name: "verdocs-pin-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.kba_pin, placeholder: "PIN Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.kba_pin = e.target.value) }))), this.kba_method === 'identity' && (h("div", { key: '7089bcc65028634e993bcee9b488c015771ae18e', class: "row zip-code" }, h("input", { key: '27dd173d1c2b5bad25d81a1a584d3fe8b273b383', id: "verdocs-zip-code", name: "verdocs-zip-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.zip, placeholder: "Zip Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.zip = e.target.value) }))))), this.showMessage && (h("div", { key: 'f4d1e8940b6a38131b4dddd12f0d2198ed72a510', class: "row message" }, h("label", { key: 'e85ef31b8e9fa8a55291f3b938105bc71ae1af7c', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'd5db9fe70914891ecb387992dc9511facacff22d', id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.message, placeholder: "Message shown in invitation...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }))), h("div", { key: '4bea6011ba9bca1235910bb7c03c13516360a117', class: "buttons" }, h("verdocs-toggle-button", { key: '988bb21d4bc07c717d448f58c78e96d52ff9488c', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
|
124
128
|
this.showKba = e.detail.active;
|
125
129
|
if (!e.detail.active) {
|
126
130
|
this.kba_pin = '';
|
@@ -128,10 +132,10 @@ const VerdocsContactPicker = /*@__PURE__*/ proxyCustomElement(class VerdocsConta
|
|
128
132
|
this.zip = '';
|
129
133
|
}
|
130
134
|
this.showSuggestions = false;
|
131
|
-
} }), h("verdocs-toggle-button", { key: '
|
135
|
+
} }), h("verdocs-toggle-button", { key: '5db03c19e9847453bc45ec14033f9391beb4de18', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
|
132
136
|
this.showMessage = e.detail.active;
|
133
137
|
this.showSuggestions = false;
|
134
|
-
} }), h("div", { key: '
|
138
|
+
} }), h("div", { key: '34c811113655950d04dc339d4ea8faeb1a9d46ca', class: "flex-fill" }), h("verdocs-button", { key: 'f85404fbb9deffd6a5a81816cfd12ccaf52cf619', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'f75dafadb24638f5322de5a9a9cbd15b51a6c81f', label: "OK", size: "small", disabled: !canSubmit, onClick: !canSubmit ? () => { } : e => this.handleSubmit(e) }))));
|
135
139
|
}
|
136
140
|
static get style() { return VerdocsContactPickerStyle0; }
|
137
141
|
}, [0, "verdocs-contact-picker", {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { VerdocsEndpoint, getOrganizationContacts,
|
2
|
+
import { VerdocsEndpoint, getOrganizationContacts, isValidEmail, createEnvelope, getRGBA, formatFullName } from '@verdocs/js-sdk';
|
3
3
|
import { g as getTemplateRoleStore, b as getRoleNames, a as getRoleIndex } from './TemplateRoleStore.js';
|
4
4
|
import { g as getTemplateStore } from './TemplateStore.js';
|
5
|
-
import { S as SDKError } from './errors.js';
|
6
5
|
import { V as VerdocsToast } from './Toast.js';
|
6
|
+
import { S as SDKError } from './errors.js';
|
7
7
|
import { d as defineCustomElement$8 } from './verdocs-button2.js';
|
8
8
|
import { d as defineCustomElement$7 } from './verdocs-component-error2.js';
|
9
9
|
import { d as defineCustomElement$6 } from './verdocs-contact-picker2.js';
|
@@ -117,7 +117,9 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class VerdocsSend extends H
|
|
117
117
|
rolesAtLevel[level] || (rolesAtLevel[level] = []);
|
118
118
|
const id = `r-${level}-${rolesAtLevel[level].length}`;
|
119
119
|
rolesAtLevel[level].push({ ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name });
|
120
|
-
|
120
|
+
// TODO: Re-activate once SMS is re-enabled
|
121
|
+
// if (role.first_name && (isValidEmail(role.email) || isValidPhone(role.phone))) {
|
122
|
+
if (role.first_name && isValidEmail(role.email)) {
|
121
123
|
this.rolesCompleted[id] = { ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name };
|
122
124
|
}
|
123
125
|
});
|
@@ -179,11 +181,10 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class VerdocsSend extends H
|
|
179
181
|
template_id: this.templateId,
|
180
182
|
name: ((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name) || '',
|
181
183
|
environment: this.environment,
|
182
|
-
// TODO: Make optional in the SDK
|
183
184
|
initial_reminder: 0,
|
184
185
|
followup_reminders: 0,
|
185
186
|
recipients: Object.values(this.rolesCompleted),
|
186
|
-
// TODO
|
187
|
+
// TODO: Pre-filled fields support
|
187
188
|
fields: [],
|
188
189
|
};
|
189
190
|
console.log('[SEND] Creating envelope', details);
|
@@ -199,7 +200,7 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class VerdocsSend extends H
|
|
199
200
|
.catch(e => {
|
200
201
|
var _a, _b, _c;
|
201
202
|
console.log('Send error', e);
|
202
|
-
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.
|
203
|
+
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || 'Error creating envelope, please try again later.');
|
203
204
|
this.sending = false;
|
204
205
|
(_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
|
205
206
|
});
|
@@ -216,9 +217,11 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class VerdocsSend extends H
|
|
216
217
|
}
|
217
218
|
const levels = this.getLevels();
|
218
219
|
const roleNames = getRoleNames(this.roleStore);
|
219
|
-
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email)
|
220
|
+
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email));
|
221
|
+
// TODO: Reactivate once SMS is re-enabled
|
222
|
+
// const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
|
220
223
|
const allRolesAssigned = rolesAssigned.length >= roleNames.length;
|
221
|
-
console.log('[SEND] Roles completed', this.rolesCompleted);
|
224
|
+
// console.log('[SEND] Roles completed', this.rolesCompleted);
|
222
225
|
return (h(Host, { class: { sendable: (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
223
226
|
var _a, _b, _c, _d;
|
224
227
|
const unknown = !role.email;
|
@@ -317,6 +317,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
317
317
|
isFieldFilled(field) {
|
318
318
|
const { value = '' } = field;
|
319
319
|
switch (field.type) {
|
320
|
+
case 'textarea':
|
320
321
|
case 'textbox':
|
321
322
|
switch (field.validator || '') {
|
322
323
|
case 'email':
|
@@ -333,9 +334,8 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
333
334
|
// Timestamp fields get automatically filled when the envelope is submitted.
|
334
335
|
case 'timestamp':
|
335
336
|
return true;
|
336
|
-
case 'textarea':
|
337
337
|
case 'date':
|
338
|
-
return value
|
338
|
+
return !!value;
|
339
339
|
case 'attachment':
|
340
340
|
return value === 'attached';
|
341
341
|
case 'dropdown':
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a68c7262.js';
|
2
|
-
import { VerdocsEndpoint, formatFullName } from '@verdocs/js-sdk';
|
2
|
+
import { VerdocsEndpoint, formatFullName, isValidEmail } from '@verdocs/js-sdk';
|
3
3
|
import { f as convertToE164 } from './utils-6ecd6558.js';
|
4
4
|
import './_commonjsHelpers-bdec4bbd.js';
|
5
5
|
import './Types-95d86a44.js';
|
@@ -102,15 +102,19 @@ const VerdocsContactPicker = class {
|
|
102
102
|
// The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them
|
103
103
|
// and show a duplicate autocomplete picker on top of our own.
|
104
104
|
render() {
|
105
|
-
|
105
|
+
// TODO: Re-activate this one SMS is re-enabled
|
106
|
+
// const hasBasics = this.first_name && this.last_name && (isValidEmail(this.email) || isValidPhone(this.phone));
|
107
|
+
const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);
|
106
108
|
const hasKbaRequirements = !this.kba_method || (this.kba_method === 'pin' && this.kba_pin) || (this.kba_method === 'identity' && this.zip);
|
107
109
|
const canSubmit = hasBasics && hasKbaRequirements;
|
108
|
-
return (h("form", { key: '
|
110
|
+
return (h("form", { key: 'ac497c45c40d7ed22d7f3e8b0c022bb000ba5d9f', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '8b858443d6b0ce08b53ec248ec016cd4c1abff91', class: "row" }, h("label", { key: '894dff4bd6734e07513a674dfd5e6ae075258a71', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '8f11b864815f4b22bc27fb9497c4a3a45514ff63', class: "names-row" }, h("input", { key: '2012ff376bee8b61d08656c430e56c537c6ec2e9', id: this.firstNameFieldId, name: this.firstNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.first_name, placeholder: "First...", onFocus: () => { var _a; return (this.showSuggestions = ((_a = this.contactSuggestions) === null || _a === void 0 ? void 0 : _a.length) > 0); }, onInput: e => this.handleFirstNameChange(e) }), h("input", { key: '31e7c09b4e7ba0d9b952329a925a2e96012ba32a', id: this.lastNameFieldId, name: this.lastNameFieldId, type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.last_name, placeholder: "Last...", onFocus: () => (this.showSuggestions = false), onInput: e => this.handleLastNameChange(e) })), this.showSuggestions && (h("div", { key: 'f179ec1c0ca6fb570bbdf26d9e647cd13a992139', class: "dropdown" }, this.contactSuggestions
|
109
111
|
.filter(suggestion => !this.first_name || suggestion.first_name.toLowerCase().includes(this.first_name.toLowerCase()))
|
110
112
|
.map(suggestion => {
|
111
113
|
var _a;
|
112
114
|
return (h("div", { key: (_a = suggestion.id) !== null && _a !== void 0 ? _a : suggestion.email, class: "suggestion", onClick: e => this.handleSelectSuggestion(e, suggestion) }, suggestion.picture ? h("img", { alt: "Avatar", class: "avatar", src: suggestion.picture }) : h("div", { class: "avatar", innerHTML: addrBookIcon }), h("div", { class: "details" }, h("div", { class: "name" }, formatFullName(suggestion)), suggestion.email && h("div", { class: "destination" }, suggestion.email), suggestion.phone && h("div", { class: "destination" }, suggestion.phone))));
|
113
|
-
})))), h("div", { key: '
|
115
|
+
})))), h("div", { key: '3373a462ee3e69d997a841fa0b244e548d1c0e3a', class: "row" }, h("label", { key: 'f8860a8fb9c6733a3d782325b04e58be65fd55e5', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '478d60f899f8f0951764ef2a049c0e200e5e764a', id: this.emailFieldId, name: this.emailFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.email, placeholder: "Email address...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.email = e.target.value) })), h("div", { key: '8ef1b72ce461d00993e369dc7005485dfa7479ea', class: "row" }, h("label", { key: 'dfbfc89ac11b4265dcdfe208cfa6272c51378ff4', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: 'c49f4e0c2fad08ded0be201c56f3033b57569ae9', id: this.phoneFieldId, name: this.phoneFieldId, type: "text", "data-lpignore": "true", autoComplete: "blocked", value: this.phone, placeholder: "Phone (SMS)...", onFocus: () => (this.showSuggestions = false), onInput: (e) => {
|
116
|
+
this.phone = convertToE164(e.target.value);
|
117
|
+
} })), this.showKba && (h(Fragment, { key: 'f20803d8a91d8fe4d3e80a996e05609334b1fc63' }, h("div", { key: '7eaffb6e155a39e396240815167fd9028d88f594', class: "kba-row" }, h("label", { key: '7369126fb396b09408a0b7b52167e2b5377718d5' }, "KBA:"), h("verdocs-select-input", { key: '876420a587fa61b45a882cae0c3b07a4d746de4e', value: this.kba_method, onInput: (e) => {
|
114
118
|
this.kba_method = e.target.value;
|
115
119
|
this.zip = '';
|
116
120
|
this.kba_pin = '';
|
@@ -118,7 +122,7 @@ const VerdocsContactPicker = class {
|
|
118
122
|
{ label: 'None', value: '' },
|
119
123
|
{ label: 'PIN Code', value: 'pin' },
|
120
124
|
{ label: 'Full Verification', value: 'identity' },
|
121
|
-
] }), h("div", { key: '
|
125
|
+
] }), h("div", { key: '9882f4052c4ed7c1519ac16f4aa887654a2fa9df', style: { flex: '1' } }), h("verdocs-help-icon", { key: 'cece16cdbcddfd61acbdebaf8506de14d86e2735', text: "Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature." })), this.kba_method === 'pin' && (h("div", { key: 'f8d1b4060415b706ce6dc41af1681b5fb578801e', class: "row pin-code" }, h("input", { key: 'a4631db4a4f8d4fb19fdbc3fae7ab6e72ba960b2', id: "verdocs-pin-code", name: "verdocs-pin-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.kba_pin, placeholder: "PIN Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.kba_pin = e.target.value) }))), this.kba_method === 'identity' && (h("div", { key: '7089bcc65028634e993bcee9b488c015771ae18e', class: "row zip-code" }, h("input", { key: '27dd173d1c2b5bad25d81a1a584d3fe8b273b383', id: "verdocs-zip-code", name: "verdocs-zip-code", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.zip, placeholder: "Zip Code...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.zip = e.target.value) }))))), this.showMessage && (h("div", { key: 'f4d1e8940b6a38131b4dddd12f0d2198ed72a510', class: "row message" }, h("label", { key: 'e85ef31b8e9fa8a55291f3b938105bc71ae1af7c', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'd5db9fe70914891ecb387992dc9511facacff22d', id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", type: "text", "data-lpignore": "true", autocomplete: "blocked", value: this.message, placeholder: "Message shown in invitation...", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }))), h("div", { key: '4bea6011ba9bca1235910bb7c03c13516360a117', class: "buttons" }, h("verdocs-toggle-button", { key: '988bb21d4bc07c717d448f58c78e96d52ff9488c', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
|
122
126
|
this.showKba = e.detail.active;
|
123
127
|
if (!e.detail.active) {
|
124
128
|
this.kba_pin = '';
|
@@ -126,10 +130,10 @@ const VerdocsContactPicker = class {
|
|
126
130
|
this.zip = '';
|
127
131
|
}
|
128
132
|
this.showSuggestions = false;
|
129
|
-
} }), h("verdocs-toggle-button", { key: '
|
133
|
+
} }), h("verdocs-toggle-button", { key: '5db03c19e9847453bc45ec14033f9391beb4de18', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
|
130
134
|
this.showMessage = e.detail.active;
|
131
135
|
this.showSuggestions = false;
|
132
|
-
} }), h("div", { key: '
|
136
|
+
} }), h("div", { key: '34c811113655950d04dc339d4ea8faeb1a9d46ca', class: "flex-fill" }), h("verdocs-button", { key: 'f85404fbb9deffd6a5a81816cfd12ccaf52cf619', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'f75dafadb24638f5322de5a9a9cbd15b51a6c81f', label: "OK", size: "small", disabled: !canSubmit, onClick: !canSubmit ? () => { } : e => this.handleSubmit(e) }))));
|
133
137
|
}
|
134
138
|
};
|
135
139
|
VerdocsContactPicker.style = VerdocsContactPickerStyle0;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment, g as getElement } from './index-a68c7262.js';
|
2
|
-
import { VerdocsEndpoint, integerSequence, getOrganizationContacts,
|
2
|
+
import { VerdocsEndpoint, integerSequence, getOrganizationContacts, isValidEmail, createEnvelope, getRGBA, formatFullName, createTemplateDocument, deleteTemplateDocument, createTemplate, updateField, createField, updateTemplate, updateTemplateRole, createTemplateRole } from '@verdocs/js-sdk';
|
3
3
|
import { g as getTemplateFieldStore, u as updateStoreField } from './TemplateFieldStore-68bf6acd.js';
|
4
4
|
import { g as getTemplateRoleStore, b as getRoleNames, a as getRoleIndex, u as updateStoreRole } from './TemplateRoleStore-6d1bec83.js';
|
5
5
|
import { g as getTemplateStore } from './TemplateStore-8151aa18.js';
|
@@ -198,7 +198,9 @@ const VerdocsSend = class {
|
|
198
198
|
rolesAtLevel[level] || (rolesAtLevel[level] = []);
|
199
199
|
const id = `r-${level}-${rolesAtLevel[level].length}`;
|
200
200
|
rolesAtLevel[level].push({ ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name });
|
201
|
-
|
201
|
+
// TODO: Re-activate once SMS is re-enabled
|
202
|
+
// if (role.first_name && (isValidEmail(role.email) || isValidPhone(role.phone))) {
|
203
|
+
if (role.first_name && isValidEmail(role.email)) {
|
202
204
|
this.rolesCompleted[id] = { ...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name };
|
203
205
|
}
|
204
206
|
});
|
@@ -260,11 +262,10 @@ const VerdocsSend = class {
|
|
260
262
|
template_id: this.templateId,
|
261
263
|
name: ((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.name) || '',
|
262
264
|
environment: this.environment,
|
263
|
-
// TODO: Make optional in the SDK
|
264
265
|
initial_reminder: 0,
|
265
266
|
followup_reminders: 0,
|
266
267
|
recipients: Object.values(this.rolesCompleted),
|
267
|
-
// TODO
|
268
|
+
// TODO: Pre-filled fields support
|
268
269
|
fields: [],
|
269
270
|
};
|
270
271
|
console.log('[SEND] Creating envelope', details);
|
@@ -280,7 +281,7 @@ const VerdocsSend = class {
|
|
280
281
|
.catch(e => {
|
281
282
|
var _a, _b, _c;
|
282
283
|
console.log('Send error', e);
|
283
|
-
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.
|
284
|
+
VerdocsToast(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || 'Error creating envelope, please try again later.');
|
284
285
|
this.sending = false;
|
285
286
|
(_c = this.sendingEnvelope) === null || _c === void 0 ? void 0 : _c.emit({ sending: false });
|
286
287
|
});
|
@@ -297,9 +298,11 @@ const VerdocsSend = class {
|
|
297
298
|
}
|
298
299
|
const levels = this.getLevels();
|
299
300
|
const roleNames = getRoleNames(this.roleStore);
|
300
|
-
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email)
|
301
|
+
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email));
|
302
|
+
// TODO: Reactivate once SMS is re-enabled
|
303
|
+
// const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
|
301
304
|
const allRolesAssigned = rolesAssigned.length >= roleNames.length;
|
302
|
-
console.log('[SEND] Roles completed', this.rolesCompleted);
|
305
|
+
// console.log('[SEND] Roles completed', this.rolesCompleted);
|
303
306
|
return (h(Host, { class: { sendable: (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
304
307
|
var _a, _b, _c, _d;
|
305
308
|
const unknown = !role.email;
|