@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.
Files changed (32) hide show
  1. package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +10 -6
  2. package/dist/cjs/verdocs-preview_9.cjs.entry.js +9 -6
  3. package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
  4. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +11 -8
  5. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +2 -2
  6. package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js +11 -7
  7. package/dist/components/verdocs-contact-picker2.js +11 -7
  8. package/dist/components/verdocs-send2.js +11 -8
  9. package/dist/components/verdocs-sign.js +2 -2
  10. package/dist/esm/verdocs-contact-picker_2.entry.js +11 -7
  11. package/dist/esm/verdocs-preview_9.entry.js +10 -7
  12. package/dist/esm/verdocs-sign.entry.js +2 -2
  13. package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
  14. package/dist/esm-es5/verdocs-preview_9.entry.js +1 -1
  15. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  16. package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +2 -1
  17. package/dist/types/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.d.ts +1 -1
  18. package/dist/types/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.d.ts +1 -0
  19. package/dist/verdocs-web-sdk/p-18b2b2ab.entry.js +1 -0
  20. package/dist/verdocs-web-sdk/p-1e8c7927.entry.js +1 -0
  21. package/dist/verdocs-web-sdk/p-267df026.system.js +1 -1
  22. package/dist/verdocs-web-sdk/p-458eda56.system.entry.js +1 -0
  23. package/dist/verdocs-web-sdk/{p-fd5ffce4.system.entry.js → p-937e21ca.system.entry.js} +1 -1
  24. package/dist/verdocs-web-sdk/p-97fa9395.entry.js +1 -0
  25. package/dist/verdocs-web-sdk/p-e7b20fdc.system.entry.js +1 -0
  26. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  27. package/package.json +4 -4
  28. package/dist/verdocs-web-sdk/p-0f677e5a.system.entry.js +0 -1
  29. package/dist/verdocs-web-sdk/p-28684a2b.entry.js +0 -1
  30. package/dist/verdocs-web-sdk/p-3912a575.entry.js +0 -1
  31. package/dist/verdocs-web-sdk/p-80635ee9.entry.js +0 -1
  32. 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
- const hasBasics = this.first_name && this.last_name && (this.email || this.phone);
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: '7294747ca679694dc795001c654c3451602430ea', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("div", { key: '15c6ac1100095543590800d0ab09b6e1fb270d18', class: "row" }, index.h("label", { key: '1b06b8a15f67015eee52012ebf4f179ceb0e0442', htmlFor: this.nameFieldId }, "Name:"), index.h("div", { key: '3578e8898d0d4f62784e46c7be13d38bb017b54d', class: "names-row" }, index.h("input", { key: 'e23199d423f95756526551efc9ee59cc0fac35d7', 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: 'f32adffb0b5de42ced7c866c21d0e316efea6c43', 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: '581c0c9332814b3e9fe2c6a5accc17537eff2527', class: "dropdown" }, this.contactSuggestions
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: '206cac1ceb6f07d79022fdf7157e19f9683ba2cf', class: "row" }, index.h("label", { key: 'a695a0975d7d1786d5e7a61bf31bb6f6c3aeb6f8', htmlFor: this.emailFieldId }, "Email:"), index.h("input", { key: '9f3c8ae1475eda947a2f9ea78de2df3d088058ad', 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: '557cbc19d97671dc89e0e3a94a925f41963924cc', class: "row" }, index.h("label", { key: 'e94c9521ff3e15bdff1c1d00b1039220ace4a15e', htmlFor: this.phoneFieldId }, "Phone:"), index.h("input", { key: '4a32ee79ec7280fccafaab5c20b4de9fbd4a07c6', 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) => utils.convertToE164(e.target.value) })), this.showKba && (index.h(index.Fragment, { key: '85605b9ad8792de727994fce8f571a277781e60e' }, index.h("div", { key: '72f588d9842917bf07a978fa6f22f3e0b2a5d400', class: "kba-row" }, index.h("label", { key: '84b55053d2ba286f3c319e995973c9bba3eca481' }, "KBA:"), index.h("verdocs-select-input", { key: '82aa458e82904711790e814e631061093d0f808b', value: this.kba_method, onInput: (e) => {
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: '473a6afc0526166923ee52dbf3d58ac010417632', style: { flex: '1' } }), index.h("verdocs-help-icon", { key: '19a702f79ee06507a8d7d5df39e7bf143afee1ba', 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: 'd6b40b1635f8b34babad7e5aa5f59c805f498675', class: "row pin-code" }, index.h("input", { key: '5d5b69f18b8d6fc730a25796c4988ca8089f8713', 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: '1fd10328d614a60d046e8e5bb5256b7cedf48031', class: "row zip-code" }, index.h("input", { key: '5bc3fe7cf69208cfdd4ab0471ce50d4ce6488f34', 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: 'a618f1924afbf97051d92cbac1b60fac6b1b41c0', class: "row message" }, index.h("label", { key: '013453934007a7146d4cd1b7216de02f4f592cf8', htmlFor: "verdocs-contact-picker-message" }, "Message:"), index.h("input", { key: 'a7984b0dc78ae4b4aba2dff258ffce6258742049', 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: 'c8c3cdc7b905dda4d430b050a42d12fe5a4330d6', class: "buttons" }, index.h("verdocs-toggle-button", { key: 'ed784a9910c000ca8704a6281dc1851beedbd8cb', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
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: 'b6d705f7d20d22e3f7d97b399096507912f8c11b', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
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: '73db7367acc8b9573bcd51eafc5d5c6c6d09f04c', class: "flex-fill" }), index.h("verdocs-button", { key: '9cf8f79300ed93a65d6e570f87151c131327109b', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { key: 'c4f6732a45409ccc7bd9927c3fd7ab97db8c301d', label: "OK", size: "small", disabled: !canSubmit, onClick: e => this.handleSubmit(e) }))));
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
- if (role.first_name && (role.email || role.phone)) {
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.message) || 'Error creating envelope, please try again later.');
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) || jsSdk.isValidPhone(recipient.phone));
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, isValidPhone, VerdocsEndpoint, } from "@verdocs/js-sdk";
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
- if (role.first_name && (role.email || role.phone)) {
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.message) || 'Error creating envelope, please try again later.');
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) || isValidPhone(recipient.phone));
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':
@@ -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
- const hasBasics = this.first_name && this.last_name && (this.email || this.phone);
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: '7294747ca679694dc795001c654c3451602430ea', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '15c6ac1100095543590800d0ab09b6e1fb270d18', class: "row" }, h("label", { key: '1b06b8a15f67015eee52012ebf4f179ceb0e0442', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '3578e8898d0d4f62784e46c7be13d38bb017b54d', class: "names-row" }, h("input", { key: 'e23199d423f95756526551efc9ee59cc0fac35d7', 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: 'f32adffb0b5de42ced7c866c21d0e316efea6c43', 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: '581c0c9332814b3e9fe2c6a5accc17537eff2527', class: "dropdown" }, this.contactSuggestions
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: '206cac1ceb6f07d79022fdf7157e19f9683ba2cf', class: "row" }, h("label", { key: 'a695a0975d7d1786d5e7a61bf31bb6f6c3aeb6f8', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '9f3c8ae1475eda947a2f9ea78de2df3d088058ad', 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: '557cbc19d97671dc89e0e3a94a925f41963924cc', class: "row" }, h("label", { key: 'e94c9521ff3e15bdff1c1d00b1039220ace4a15e', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: '4a32ee79ec7280fccafaab5c20b4de9fbd4a07c6', 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) => convertToE164(e.target.value) })), this.showKba && (h(Fragment, { key: '85605b9ad8792de727994fce8f571a277781e60e' }, h("div", { key: '72f588d9842917bf07a978fa6f22f3e0b2a5d400', class: "kba-row" }, h("label", { key: '84b55053d2ba286f3c319e995973c9bba3eca481' }, "KBA:"), h("verdocs-select-input", { key: '82aa458e82904711790e814e631061093d0f808b', value: this.kba_method, onInput: (e) => {
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: '473a6afc0526166923ee52dbf3d58ac010417632', style: { flex: '1' } }), h("verdocs-help-icon", { key: '19a702f79ee06507a8d7d5df39e7bf143afee1ba', 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: 'd6b40b1635f8b34babad7e5aa5f59c805f498675', class: "row pin-code" }, h("input", { key: '5d5b69f18b8d6fc730a25796c4988ca8089f8713', 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: '1fd10328d614a60d046e8e5bb5256b7cedf48031', class: "row zip-code" }, h("input", { key: '5bc3fe7cf69208cfdd4ab0471ce50d4ce6488f34', 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: 'a618f1924afbf97051d92cbac1b60fac6b1b41c0', class: "row message" }, h("label", { key: '013453934007a7146d4cd1b7216de02f4f592cf8', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'a7984b0dc78ae4b4aba2dff258ffce6258742049', 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: 'c8c3cdc7b905dda4d430b050a42d12fe5a4330d6', class: "buttons" }, h("verdocs-toggle-button", { key: 'ed784a9910c000ca8704a6281dc1851beedbd8cb', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
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: 'b6d705f7d20d22e3f7d97b399096507912f8c11b', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
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: '73db7367acc8b9573bcd51eafc5d5c6c6d09f04c', class: "flex-fill" }), h("verdocs-button", { key: '9cf8f79300ed93a65d6e570f87151c131327109b', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'c4f6732a45409ccc7bd9927c3fd7ab97db8c301d', label: "OK", size: "small", disabled: !canSubmit, onClick: e => this.handleSubmit(e) }))));
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
- const hasBasics = this.first_name && this.last_name && (this.email || this.phone);
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: '7294747ca679694dc795001c654c3451602430ea', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '15c6ac1100095543590800d0ab09b6e1fb270d18', class: "row" }, h("label", { key: '1b06b8a15f67015eee52012ebf4f179ceb0e0442', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '3578e8898d0d4f62784e46c7be13d38bb017b54d', class: "names-row" }, h("input", { key: 'e23199d423f95756526551efc9ee59cc0fac35d7', 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: 'f32adffb0b5de42ced7c866c21d0e316efea6c43', 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: '581c0c9332814b3e9fe2c6a5accc17537eff2527', class: "dropdown" }, this.contactSuggestions
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: '206cac1ceb6f07d79022fdf7157e19f9683ba2cf', class: "row" }, h("label", { key: 'a695a0975d7d1786d5e7a61bf31bb6f6c3aeb6f8', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '9f3c8ae1475eda947a2f9ea78de2df3d088058ad', 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: '557cbc19d97671dc89e0e3a94a925f41963924cc', class: "row" }, h("label", { key: 'e94c9521ff3e15bdff1c1d00b1039220ace4a15e', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: '4a32ee79ec7280fccafaab5c20b4de9fbd4a07c6', 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) => convertToE164(e.target.value) })), this.showKba && (h(Fragment, { key: '85605b9ad8792de727994fce8f571a277781e60e' }, h("div", { key: '72f588d9842917bf07a978fa6f22f3e0b2a5d400', class: "kba-row" }, h("label", { key: '84b55053d2ba286f3c319e995973c9bba3eca481' }, "KBA:"), h("verdocs-select-input", { key: '82aa458e82904711790e814e631061093d0f808b', value: this.kba_method, onInput: (e) => {
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: '473a6afc0526166923ee52dbf3d58ac010417632', style: { flex: '1' } }), h("verdocs-help-icon", { key: '19a702f79ee06507a8d7d5df39e7bf143afee1ba', 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: 'd6b40b1635f8b34babad7e5aa5f59c805f498675', class: "row pin-code" }, h("input", { key: '5d5b69f18b8d6fc730a25796c4988ca8089f8713', 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: '1fd10328d614a60d046e8e5bb5256b7cedf48031', class: "row zip-code" }, h("input", { key: '5bc3fe7cf69208cfdd4ab0471ce50d4ce6488f34', 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: 'a618f1924afbf97051d92cbac1b60fac6b1b41c0', class: "row message" }, h("label", { key: '013453934007a7146d4cd1b7216de02f4f592cf8', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'a7984b0dc78ae4b4aba2dff258ffce6258742049', 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: 'c8c3cdc7b905dda4d430b050a42d12fe5a4330d6', class: "buttons" }, h("verdocs-toggle-button", { key: 'ed784a9910c000ca8704a6281dc1851beedbd8cb', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
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: 'b6d705f7d20d22e3f7d97b399096507912f8c11b', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
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: '73db7367acc8b9573bcd51eafc5d5c6c6d09f04c', class: "flex-fill" }), h("verdocs-button", { key: '9cf8f79300ed93a65d6e570f87151c131327109b', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'c4f6732a45409ccc7bd9927c3fd7ab97db8c301d', label: "OK", size: "small", disabled: !canSubmit, onClick: e => this.handleSubmit(e) }))));
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, createEnvelope, isValidEmail, isValidPhone, getRGBA, formatFullName } from '@verdocs/js-sdk';
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
- if (role.first_name && (role.email || role.phone)) {
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.message) || 'Error creating envelope, please try again later.');
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) || isValidPhone(recipient.phone));
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
- const hasBasics = this.first_name && this.last_name && (this.email || this.phone);
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: '7294747ca679694dc795001c654c3451602430ea', onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { key: '15c6ac1100095543590800d0ab09b6e1fb270d18', class: "row" }, h("label", { key: '1b06b8a15f67015eee52012ebf4f179ceb0e0442', htmlFor: this.nameFieldId }, "Name:"), h("div", { key: '3578e8898d0d4f62784e46c7be13d38bb017b54d', class: "names-row" }, h("input", { key: 'e23199d423f95756526551efc9ee59cc0fac35d7', 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: 'f32adffb0b5de42ced7c866c21d0e316efea6c43', 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: '581c0c9332814b3e9fe2c6a5accc17537eff2527', class: "dropdown" }, this.contactSuggestions
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: '206cac1ceb6f07d79022fdf7157e19f9683ba2cf', class: "row" }, h("label", { key: 'a695a0975d7d1786d5e7a61bf31bb6f6c3aeb6f8', htmlFor: this.emailFieldId }, "Email:"), h("input", { key: '9f3c8ae1475eda947a2f9ea78de2df3d088058ad', 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: '557cbc19d97671dc89e0e3a94a925f41963924cc', class: "row" }, h("label", { key: 'e94c9521ff3e15bdff1c1d00b1039220ace4a15e', htmlFor: this.phoneFieldId }, "Phone:"), h("input", { key: '4a32ee79ec7280fccafaab5c20b4de9fbd4a07c6', 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) => convertToE164(e.target.value) })), this.showKba && (h(Fragment, { key: '85605b9ad8792de727994fce8f571a277781e60e' }, h("div", { key: '72f588d9842917bf07a978fa6f22f3e0b2a5d400', class: "kba-row" }, h("label", { key: '84b55053d2ba286f3c319e995973c9bba3eca481' }, "KBA:"), h("verdocs-select-input", { key: '82aa458e82904711790e814e631061093d0f808b', value: this.kba_method, onInput: (e) => {
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: '473a6afc0526166923ee52dbf3d58ac010417632', style: { flex: '1' } }), h("verdocs-help-icon", { key: '19a702f79ee06507a8d7d5df39e7bf143afee1ba', 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: 'd6b40b1635f8b34babad7e5aa5f59c805f498675', class: "row pin-code" }, h("input", { key: '5d5b69f18b8d6fc730a25796c4988ca8089f8713', 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: '1fd10328d614a60d046e8e5bb5256b7cedf48031', class: "row zip-code" }, h("input", { key: '5bc3fe7cf69208cfdd4ab0471ce50d4ce6488f34', 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: 'a618f1924afbf97051d92cbac1b60fac6b1b41c0', class: "row message" }, h("label", { key: '013453934007a7146d4cd1b7216de02f4f592cf8', htmlFor: "verdocs-contact-picker-message" }, "Message:"), h("input", { key: 'a7984b0dc78ae4b4aba2dff258ffce6258742049', 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: 'c8c3cdc7b905dda4d430b050a42d12fe5a4330d6', class: "buttons" }, h("verdocs-toggle-button", { key: 'ed784a9910c000ca8704a6281dc1851beedbd8cb', icon: kbaIcon, size: "small", active: this.showKba, onToggle: e => {
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: 'b6d705f7d20d22e3f7d97b399096507912f8c11b', icon: messageIcon, size: "small", active: this.showMessage, onToggle: e => {
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: '73db7367acc8b9573bcd51eafc5d5c6c6d09f04c', class: "flex-fill" }), h("verdocs-button", { key: '9cf8f79300ed93a65d6e570f87151c131327109b', variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { key: 'c4f6732a45409ccc7bd9927c3fd7ab97db8c301d', label: "OK", size: "small", disabled: !canSubmit, onClick: e => this.handleSubmit(e) }))));
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, createEnvelope, isValidEmail, isValidPhone, getRGBA, formatFullName, createTemplateDocument, deleteTemplateDocument, createTemplate, updateField, createField, updateTemplate, updateTemplateRole, createTemplateRole } from '@verdocs/js-sdk';
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
- if (role.first_name && (role.email || role.phone)) {
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.message) || 'Error creating envelope, please try again later.');
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) || isValidPhone(recipient.phone));
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;