@verdocs/web-sdk 1.12.0 → 1.12.1

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 (30) hide show
  1. package/dist/cjs/verdocs-build.cjs.entry.js +1 -9
  2. package/dist/cjs/verdocs-send.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-template-create_2.cjs.entry.js +19 -10
  4. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +1 -9
  5. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +1 -1
  6. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +19 -10
  7. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.stories.js +2 -2
  8. package/dist/components/verdocs-build.js +1 -9
  9. package/dist/components/verdocs-send.js +1 -1
  10. package/dist/components/verdocs-template-fields2.js +19 -10
  11. package/dist/docs.json +1 -1
  12. package/dist/esm/verdocs-build.entry.js +1 -9
  13. package/dist/esm/verdocs-send.entry.js +1 -1
  14. package/dist/esm/verdocs-template-create_2.entry.js +19 -10
  15. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  16. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  17. package/dist/esm-es5/verdocs-template-create_2.entry.js +1 -1
  18. package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +0 -2
  19. package/dist/typings.d.ts +4 -0
  20. package/dist/verdocs-web-sdk/{p-70a6176e.entry.js → p-07d519e8.entry.js} +1 -1
  21. package/dist/verdocs-web-sdk/p-2ac6b090.entry.js +1 -0
  22. package/dist/verdocs-web-sdk/{p-3903c3c0.system.entry.js → p-619f9cc7.system.entry.js} +1 -1
  23. package/dist/verdocs-web-sdk/p-7e6d7c07.system.js +1 -1
  24. package/dist/verdocs-web-sdk/{p-2a5c1eb7.entry.js → p-95171474.entry.js} +1 -1
  25. package/dist/verdocs-web-sdk/{p-64841d89.system.entry.js → p-a2c3458c.system.entry.js} +1 -1
  26. package/dist/verdocs-web-sdk/p-e897e87a.system.entry.js +1 -0
  27. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/verdocs-web-sdk/p-75e8cb42.entry.js +0 -1
  30. package/dist/verdocs-web-sdk/p-ecd33c4e.system.entry.js +0 -1
@@ -56,19 +56,11 @@ const VerdocsBuild = class {
56
56
  this.step = 'fields';
57
57
  // this.step = 'properties';
58
58
  }
59
- handlePropertiesUpdated(e) {
60
- console.log('updated', e.detail);
61
- this.step = 'recipients';
62
- }
63
- handleRecipientsUpdated(e) {
64
- console.log('updated', e.detail);
65
- this.step = 'fields';
66
- }
67
59
  render() {
68
60
  if (!this.endpoint.session) {
69
61
  return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
70
62
  }
71
- return (index.h(index.Host, null, this.step === 'create' && index.h("verdocs-template-create", { onCancel: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && index.h("verdocs-template-fields", { onCancel: e => this.handleCancel(e), onNext: e => this.handleCancel(e) })));
63
+ return (index.h(index.Host, null, this.step === 'create' && index.h("verdocs-template-create", { onExit: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && index.h("verdocs-template-fields", null)));
72
64
  }
73
65
  };
74
66
  VerdocsBuild.style = verdocsBuildCss;
@@ -115,7 +115,7 @@ const VerdocsSend = class {
115
115
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
116
116
  return (index.h(index.Host, { class: {} }, 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")), this.levels.map(level => (index.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
117
117
  var _a, _b, _c;
118
- return (index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-contact-picker", { onCancel: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
118
+ return (index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
119
119
  })))), index.h("div", { class: `level level-done` }, this.getLevelIcon(this.levels.length), index.h("div", { class: "complete" }, "Signing Complete"))), index.h("div", { class: "buttons" }, index.h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned, onClick: e => this.handleSend(e) }))));
120
120
  }
121
121
  };
@@ -115,20 +115,24 @@ const iconRadio = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24
115
115
  const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';
116
116
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';
117
117
  const iconInitial = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
118
- const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
118
+ const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="none"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
119
119
  const iconBarsDown = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';
120
+ const separator = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';
120
121
  const menuOptions = [
121
- // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
122
- { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
123
- { id: 'date', tooltip: 'Date', icon: iconDatepicker },
124
- { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
125
- { id: 'initial', tooltip: 'Initials', icon: iconInitial },
126
- // {id: 'payment', tooltip: 'Payment', icon: 'P'},
127
- { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
128
122
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
129
- { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
123
+ { id: 'initial', tooltip: 'Initials', icon: iconInitial },
124
+ { id: 'sep1', tooltip: '', icon: separator },
130
125
  { id: 'textbox', tooltip: 'Text Box', icon: iconSingleline },
126
+ { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
127
+ { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
128
+ { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
129
+ { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
130
+ { id: 'sep2', tooltip: '', icon: separator },
131
+ { id: 'date', tooltip: 'Date', icon: iconDatepicker },
131
132
  { id: 'timestamp', tooltip: 'Timestamp', icon: iconClock },
133
+ // {id: 'sep3', tooltip: '', icon: separator},
134
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
135
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
132
136
  ];
133
137
  const VerdocsTemplateFields = class {
134
138
  constructor(hostRef) {
@@ -372,7 +376,12 @@ const VerdocsTemplateFields = class {
372
376
  pages.sort((a, b) => a.sequence - b.sequence);
373
377
  return (index.h(index.Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
374
378
  console.log('onSubmit');
375
- } }, index.h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (index.h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => (this.placing = option.id) })))), index.h("div", { class: "pages" }, pages.map(page => {
379
+ } }, index.h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (index.h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
380
+ if (option.tooltip) {
381
+ // We have empty tooltips on the separators, quick hack...
382
+ this.placing = option.id;
383
+ }
384
+ } })))), index.h("div", { class: "pages" }, pages.map(page => {
376
385
  return (index.h("verdocs-template-document-page", { templateId: page.template_id, documentId: page.document_id, pageNumber: page.sequence, virtualWidth: 612, virtualHeight: 792, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
377
386
  { name: 'page', type: 'canvas' },
378
387
  { name: 'controls', type: 'div' },
@@ -45,19 +45,11 @@ export class VerdocsBuild {
45
45
  this.step = 'fields';
46
46
  // this.step = 'properties';
47
47
  }
48
- handlePropertiesUpdated(e) {
49
- console.log('updated', e.detail);
50
- this.step = 'recipients';
51
- }
52
- handleRecipientsUpdated(e) {
53
- console.log('updated', e.detail);
54
- this.step = 'fields';
55
- }
56
48
  render() {
57
49
  if (!this.endpoint.session) {
58
50
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
59
51
  }
60
- return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onCancel: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", { onCancel: e => this.handleCancel(e), onNext: e => this.handleCancel(e) })));
52
+ return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onExit: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", null)));
61
53
  }
62
54
  static get is() { return "verdocs-build"; }
63
55
  static get originalStyleUrls() {
@@ -104,7 +104,7 @@ export class VerdocsSend {
104
104
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
105
105
  return (h(Host, { class: {} }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
106
106
  var _a, _b, _c;
107
- return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onCancel: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
107
+ return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
108
108
  })))), h("div", { class: `level level-done` }, this.getLevelIcon(this.levels.length), h("div", { class: "complete" }, "Signing Complete"))), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned, onClick: e => this.handleSend(e) }))));
109
109
  }
110
110
  static get is() { return "verdocs-send"; }
@@ -13,20 +13,24 @@ const iconRadio = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24
13
13
  const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';
14
14
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';
15
15
  const iconInitial = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
16
- const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
16
+ const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="none"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
17
17
  const iconBarsDown = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';
18
+ const separator = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';
18
19
  const menuOptions = [
19
- // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
20
- { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
21
- { id: 'date', tooltip: 'Date', icon: iconDatepicker },
22
- { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
23
- { id: 'initial', tooltip: 'Initials', icon: iconInitial },
24
- // {id: 'payment', tooltip: 'Payment', icon: 'P'},
25
- { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
26
20
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
27
- { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
21
+ { id: 'initial', tooltip: 'Initials', icon: iconInitial },
22
+ { id: 'sep1', tooltip: '', icon: separator },
28
23
  { id: 'textbox', tooltip: 'Text Box', icon: iconSingleline },
24
+ { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
25
+ { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
26
+ { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
27
+ { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
28
+ { id: 'sep2', tooltip: '', icon: separator },
29
+ { id: 'date', tooltip: 'Date', icon: iconDatepicker },
29
30
  { id: 'timestamp', tooltip: 'Timestamp', icon: iconClock },
31
+ // {id: 'sep3', tooltip: '', icon: separator},
32
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
33
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
30
34
  ];
31
35
  /**
32
36
  * Displays a builder experience for laying out fields in a template. Note that this experience requires a large display area to
@@ -271,7 +275,12 @@ export class VerdocsTemplateFields {
271
275
  pages.sort((a, b) => a.sequence - b.sequence);
272
276
  return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
273
277
  console.log('onSubmit');
274
- } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => (this.placing = option.id) })))), h("div", { class: "pages" }, pages.map(page => {
278
+ } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
279
+ if (option.tooltip) {
280
+ // We have empty tooltips on the separators, quick hack...
281
+ this.placing = option.id;
282
+ }
283
+ } })))), h("div", { class: "pages" }, pages.map(page => {
275
284
  return (h("verdocs-template-document-page", { templateId: page.template_id, documentId: page.document_id, pageNumber: page.sequence, virtualWidth: 612, virtualHeight: 792, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
276
285
  { name: 'page', type: 'canvas' },
277
286
  { name: 'controls', type: 'div' },
@@ -3,8 +3,8 @@ export default {
3
3
  title: 'Templates/Fields',
4
4
  component: 'verdocs-template-fields',
5
5
  args: {
6
- templateId: 'ea7a792f-7e46-4662-a0ff-db6bd389306e',
7
- // templateId: 'd2338742-f3a1-465b-8592-806587413cc1',
6
+ // templateId: 'ea7a792f-7e46-4662-a0ff-db6bd389306e',
7
+ templateId: 'd2338742-f3a1-465b-8592-806587413cc1',
8
8
  },
9
9
  argTypes: {},
10
10
  parameters: {
@@ -55,19 +55,11 @@ const VerdocsBuild$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
55
55
  this.step = 'fields';
56
56
  // this.step = 'properties';
57
57
  }
58
- handlePropertiesUpdated(e) {
59
- console.log('updated', e.detail);
60
- this.step = 'recipients';
61
- }
62
- handleRecipientsUpdated(e) {
63
- console.log('updated', e.detail);
64
- this.step = 'fields';
65
- }
66
58
  render() {
67
59
  if (!this.endpoint.session) {
68
60
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
69
61
  }
70
- return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onCancel: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", { onCancel: e => this.handleCancel(e), onNext: e => this.handleCancel(e) })));
62
+ return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onExit: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", null)));
71
63
  }
72
64
  static get style() { return verdocsBuildCss; }
73
65
  }, [0, "verdocs-build", {
@@ -108,7 +108,7 @@ const VerdocsSend$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
108
108
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
109
109
  return (h(Host, { class: {} }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
110
110
  var _a, _b, _c;
111
- return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onCancel: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
111
+ return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
112
112
  })))), h("div", { class: `level level-done` }, this.getLevelIcon(this.levels.length), h("div", { class: "complete" }, "Signing Complete"))), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned, onClick: e => this.handleSend(e) }))));
113
113
  }
114
114
  static get style() { return verdocsSendCss; }
@@ -20,20 +20,24 @@ const iconRadio = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24
20
20
  const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';
21
21
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';
22
22
  const iconInitial = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
23
- const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
23
+ const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="none"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
24
24
  const iconBarsDown = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';
25
+ const separator = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';
25
26
  const menuOptions = [
26
- // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
27
- { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
28
- { id: 'date', tooltip: 'Date', icon: iconDatepicker },
29
- { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
30
- { id: 'initial', tooltip: 'Initials', icon: iconInitial },
31
- // {id: 'payment', tooltip: 'Payment', icon: 'P'},
32
- { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
33
27
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
34
- { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
28
+ { id: 'initial', tooltip: 'Initials', icon: iconInitial },
29
+ { id: 'sep1', tooltip: '', icon: separator },
35
30
  { id: 'textbox', tooltip: 'Text Box', icon: iconSingleline },
31
+ { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
32
+ { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
33
+ { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
34
+ { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
35
+ { id: 'sep2', tooltip: '', icon: separator },
36
+ { id: 'date', tooltip: 'Date', icon: iconDatepicker },
36
37
  { id: 'timestamp', tooltip: 'Timestamp', icon: iconClock },
38
+ // {id: 'sep3', tooltip: '', icon: separator},
39
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
40
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
37
41
  ];
38
42
  const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
39
43
  constructor() {
@@ -278,7 +282,12 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
278
282
  pages.sort((a, b) => a.sequence - b.sequence);
279
283
  return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
280
284
  console.log('onSubmit');
281
- } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => (this.placing = option.id) })))), h("div", { class: "pages" }, pages.map(page => {
285
+ } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
286
+ if (option.tooltip) {
287
+ // We have empty tooltips on the separators, quick hack...
288
+ this.placing = option.id;
289
+ }
290
+ } })))), h("div", { class: "pages" }, pages.map(page => {
282
291
  return (h("verdocs-template-document-page", { templateId: page.template_id, documentId: page.document_id, pageNumber: page.sequence, virtualWidth: 612, virtualHeight: 792, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
283
292
  { name: 'page', type: 'canvas' },
284
293
  { name: 'controls', type: 'div' },
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-03-01T16:58:46",
2
+ "timestamp": "2023-03-02T16:36:27",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.20.0",
@@ -52,19 +52,11 @@ const VerdocsBuild = class {
52
52
  this.step = 'fields';
53
53
  // this.step = 'properties';
54
54
  }
55
- handlePropertiesUpdated(e) {
56
- console.log('updated', e.detail);
57
- this.step = 'recipients';
58
- }
59
- handleRecipientsUpdated(e) {
60
- console.log('updated', e.detail);
61
- this.step = 'fields';
62
- }
63
55
  render() {
64
56
  if (!this.endpoint.session) {
65
57
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
66
58
  }
67
- return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onCancel: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", { onCancel: e => this.handleCancel(e), onNext: e => this.handleCancel(e) })));
59
+ return (h(Host, null, this.step === 'create' && h("verdocs-template-create", { onExit: e => this.handleCancel(e), onNext: e => this.handleTemplateCreated(e) }), this.step === 'fields' && h("verdocs-template-fields", null)));
68
60
  }
69
61
  };
70
62
  VerdocsBuild.style = verdocsBuildCss;
@@ -111,7 +111,7 @@ const VerdocsSend = class {
111
111
  const allRolesAssigned = rolesAssigned.length >= roleNames.length;
112
112
  return (h(Host, { class: {} }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), this.levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.rolesAtLevel[level].map(role => {
113
113
  var _a, _b, _c;
114
- return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onCancel: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
114
+ return (h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, onClick: e => this.handleClickRole(e, role) }, (_b = (_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.full_name) !== null && _b !== void 0 ? _b : role.name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_c = this.rolesCompleted[role.id]) !== null && _c !== void 0 ? _c : role, onSearchContacts: e => console.log('Search', e.detail) }))));
115
115
  })))), h("div", { class: `level level-done` }, this.getLevelIcon(this.levels.length), h("div", { class: "complete" }, "Signing Complete"))), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned, onClick: e => this.handleSend(e) }))));
116
116
  }
117
117
  };
@@ -111,20 +111,24 @@ const iconRadio = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24
111
111
  const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';
112
112
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';
113
113
  const iconInitial = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
114
- const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
114
+ const iconClock = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="none"><path fill="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
115
115
  const iconBarsDown = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';
116
+ const separator = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';
116
117
  const menuOptions = [
117
- // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
118
- { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
119
- { id: 'date', tooltip: 'Date', icon: iconDatepicker },
120
- { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
121
- { id: 'initial', tooltip: 'Initials', icon: iconInitial },
122
- // {id: 'payment', tooltip: 'Payment', icon: 'P'},
123
- { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
124
118
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
125
- { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
119
+ { id: 'initial', tooltip: 'Initials', icon: iconInitial },
120
+ { id: 'sep1', tooltip: '', icon: separator },
126
121
  { id: 'textbox', tooltip: 'Text Box', icon: iconSingleline },
122
+ { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
123
+ { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
124
+ { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
125
+ { id: 'dropdown', tooltip: 'Dropdown', icon: iconBarsDown },
126
+ { id: 'sep2', tooltip: '', icon: separator },
127
+ { id: 'date', tooltip: 'Date', icon: iconDatepicker },
127
128
  { id: 'timestamp', tooltip: 'Timestamp', icon: iconClock },
129
+ // {id: 'sep3', tooltip: '', icon: separator},
130
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
131
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
128
132
  ];
129
133
  const VerdocsTemplateFields = class {
130
134
  constructor(hostRef) {
@@ -368,7 +372,12 @@ const VerdocsTemplateFields = class {
368
372
  pages.sort((a, b) => a.sequence - b.sequence);
369
373
  return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
370
374
  console.log('onSubmit');
371
- } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => (this.placing = option.id) })))), h("div", { class: "pages" }, pages.map(page => {
375
+ } }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
376
+ if (option.tooltip) {
377
+ // We have empty tooltips on the separators, quick hack...
378
+ this.placing = option.id;
379
+ }
380
+ } })))), h("div", { class: "pages" }, pages.map(page => {
372
381
  return (h("verdocs-template-document-page", { templateId: page.template_id, documentId: page.document_id, pageNumber: page.sequence, virtualWidth: 612, virtualHeight: 792, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
373
382
  { name: 'page', type: 'canvas' },
374
383
  { name: 'controls', type: 'div' },
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,o){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function i(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):r(e.value).then(i,a)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,r,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:n.label++;return{value:i[1],done:false};case 5:n.label++;r=i[1];i=[0];continue;case 7:i=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){n=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){n.label=i[1];break}if(i[0]===6&&n.label<s[1]){n.label=s[1];s=i;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(i);break}if(s[2])n.ops.pop();n.trys.pop();continue}i=t.call(e,n)}catch(e){i=[6,e];r=0}finally{o=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e64d45e2.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-d50a8d28.js";import{l as loadTemplate}from"./Templates-f8a6628a.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Token-54690789.js";import"./Templates-8e4ab976.js";import"./templateStore-5cb73464.js";import"./index-24fd1580.js";import"./Primitives-054bc6e5.js";var verdocsBuildCss='verdocs-build{display:-ms-flexbox;display:flex;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}';var VerdocsBuild=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.fields=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="create";this.pdfUrl=null;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(r){switch(r.label){case 0:this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[BUILD] No template ID specified, showing upload option");this.step="create";return[2]}r.label=1;case 1:r.trys.push([1,3,,4]);console.log("[BUILD] Loading template ".concat(this.templateId));return[4,loadTemplate(this.endpoint,this.templateId)];case 2:r.sent();this.step="fields";return[3,4];case 3:o=r.sent();console.log("[BUILD] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(n=o.response)===null||n===void 0?void 0:n.data));return[3,4];case 4:return[2]}}))}))};e.prototype.handleCancel=function(e){console.log("Cancel",e.detail);this.step=""};e.prototype.handleTemplateCreated=function(e){console.log("Created",e.detail);this.step="fields"};e.prototype.handlePropertiesUpdated=function(e){console.log("updated",e.detail);this.step="recipients"};e.prototype.handleRecipientsUpdated=function(e){console.log("updated",e.detail);this.step="fields"};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}return h(Host,null,this.step==="create"&&h("verdocs-template-create",{onCancel:function(t){return e.handleCancel(t)},onNext:function(t){return e.handleTemplateCreated(t)}}),this.step==="fields"&&h("verdocs-template-fields",{onCancel:function(t){return e.handleCancel(t)},onNext:function(t){return e.handleCancel(t)}}))};return e}();VerdocsBuild.style=verdocsBuildCss;export{VerdocsBuild as verdocs_build};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function i(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):o(e.value).then(i,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=i[0]&2?o["return"]:i[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;if(o=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:n.label++;return{value:i[1],done:false};case 5:n.label++;o=i[1];i=[0];continue;case 7:i=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){n=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){n.label=i[1];break}if(i[0]===6&&n.label<s[1]){n.label=s[1];s=i;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(i);break}if(s[2])n.ops.pop();n.trys.pop();continue}i=t.call(e,n)}catch(e){i=[6,e];o=0}finally{r=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e64d45e2.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-d50a8d28.js";import{l as loadTemplate}from"./Templates-f8a6628a.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Token-54690789.js";import"./Templates-8e4ab976.js";import"./templateStore-5cb73464.js";import"./index-24fd1580.js";import"./Primitives-054bc6e5.js";var verdocsBuildCss='verdocs-build{display:-ms-flexbox;display:flex;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}';var VerdocsBuild=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.fields=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="create";this.pdfUrl=null;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,r;return __generator(this,(function(o){switch(o.label){case 0:this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[BUILD] No template ID specified, showing upload option");this.step="create";return[2]}o.label=1;case 1:o.trys.push([1,3,,4]);console.log("[BUILD] Loading template ".concat(this.templateId));return[4,loadTemplate(this.endpoint,this.templateId)];case 2:o.sent();this.step="fields";return[3,4];case 3:r=o.sent();console.log("[BUILD] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data));return[3,4];case 4:return[2]}}))}))};e.prototype.handleCancel=function(e){console.log("Cancel",e.detail);this.step=""};e.prototype.handleTemplateCreated=function(e){console.log("Created",e.detail);this.step="fields"};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}return h(Host,null,this.step==="create"&&h("verdocs-template-create",{onExit:function(t){return e.handleCancel(t)},onNext:function(t){return e.handleTemplateCreated(t)}}),this.step==="fields"&&h("verdocs-template-fields",null))};return e}();VerdocsBuild.style=verdocsBuildCss;export{VerdocsBuild as verdocs_build};
@@ -1 +1 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,o,n){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,s){function r(e){try{a(n.next(e))}catch(e){s(e)}}function l(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?o(e.value):i(e.value).then(r,l)}a((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function l(e){return function(t){return a([e,t])}}function a(r){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,i&&(s=r[0]&2?i["return"]:r[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;if(i=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:o.label++;return{value:r[1],done:false};case 5:o.label++;i=r[1];r=[0];continue;case 7:r=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){o=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(r[0]===6&&o.label<s[1]){o.label=s[1];s=r;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(r);break}if(s[2])o.ops.pop();o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e];i=0}finally{n=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e64d45e2.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-d50a8d28.js";import{i as isValidEmail,a as isValidPhone}from"./Validators-f110bae2.js";import{g as getRGBA}from"./Colors-1b298092.js";import{s as state}from"./templateStore-5cb73464.js";import{l as loadTemplate}from"./Templates-f8a6628a.js";import{a as getRoleIndex}from"./utils-e9a6b9e4.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Token-54690789.js";import"./index-24fd1580.js";import"./Primitives-054bc6e5.js";import"./Templates-8e4ab976.js";import"./Envelopes-eb3eef02.js";import"./Files-70a192df.js";import"./index-d264c496.js";var verdocsSendCss='verdocs-send{display:-ms-flexbox;display:flex;padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid #97979744}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:#00000089}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var 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>';var 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>';var 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>';var doneIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.send=createEvent(this,"send",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.levels=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.rolesAtLevel={};this.showPickerForId="";this.sessionContacts=[];this.rolesCompleted={}}e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,n,i,s,r,l;return __generator(this,(function(a){switch(a.label){case 0:s=this.endpoint.loadSession();if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}a.label=1;case 1:a.trys.push([1,3,,4]);console.log("[SEND] Loading template ".concat(this.templateId));return[4,loadTemplate(this.endpoint,this.templateId)];case 2:a.sent();if((e=state.template)===null||e===void 0?void 0:e.roles){r={};this.rolesCompleted={};state.template.roles.forEach((function(e){var t=e.sequence-1;r[t]||(r[t]=[]);var o="r-".concat(t,"-").concat(r[t].length);r[t].push(__assign(__assign({},e),{id:o}))}));this.rolesAtLevel=r;this.levels=Object.keys(r).map((function(e){return+e}));this.levels.sort((function(e,t){return e-t}))}return[3,4];case 3:l=a.sent();console.log("[SEND] Error loading template",l);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError(l.message,(o=l.response)===null||o===void 0?void 0:o.status,(n=l.response)===null||n===void 0?void 0:n.data));return[3,4];case 4:if((i=s.session)===null||i===void 0?void 0:i.profile){this.sessionContacts.push({id:s.session.profile.id,name:"".concat(s.session.profile.first_name," ").concat(s.session.profile.last_name),email:s.session.profile.email,phone:s.session.profile.phone})}return[2]}}))}))};e.prototype.getLevelIcon=function(e){if(e<0){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e>=this.levels.length){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t;e.stopPropagation();(t=this.send)===null||t===void 0?void 0:t.emit({roles:Object.values(this.rolesCompleted),name:state.template.name,template_id:this.templateId})};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t=state.template.roles.map((function(e){return e.name}))||[];var o=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)||isValidPhone(e.phone)}));var n=o.length>=t.length;return h(Host,{class:{}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon(-1),h("div",{class:"complete"},"Send Envelope")),this.levels.map((function(o){return h("div",{class:"level level-".concat(o)},e.getLevelIcon(o),e.rolesAtLevel[o].map((function(o){var n,i,s;return h("div",{class:"recipient",style:{backgroundColor:getRGBA(getRoleIndex(t,o.name))},onClick:function(t){return e.handleClickRole(t,o)}},(i=(n=e.rolesCompleted[o.id])===null||n===void 0?void 0:n.full_name)!==null&&i!==void 0?i:o.name,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===o.id&&h("verdocs-contact-picker",{onCancel:function(){return e.showPickerForId=""},onNext:function(t){return e.handleSelectContact(t,o)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[o.id])!==null&&s!==void 0?s:o,onSearchContacts:function(e){return console.log("Search",e.detail)}}))})))})),h("div",{class:"level level-done"},this.getLevelIcon(this.levels.length),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)}}),h("verdocs-button",{label:"Send",size:"small",disabled:!n,onClick:function(t){return e.handleSend(t)}})))};return e}();VerdocsSend.style=verdocsSendCss;export{VerdocsSend as verdocs_send};
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,o,n){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,s){function r(e){try{a(n.next(e))}catch(e){s(e)}}function l(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?o(e.value):i(e.value).then(r,l)}a((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function l(e){return function(t){return a([e,t])}}function a(r){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,i&&(s=r[0]&2?i["return"]:r[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;if(i=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:o.label++;return{value:r[1],done:false};case 5:o.label++;i=r[1];r=[0];continue;case 7:r=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){o=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(r[0]===6&&o.label<s[1]){o.label=s[1];s=r;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(r);break}if(s[2])o.ops.pop();o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e];i=0}finally{n=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e64d45e2.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-d50a8d28.js";import{i as isValidEmail,a as isValidPhone}from"./Validators-f110bae2.js";import{g as getRGBA}from"./Colors-1b298092.js";import{s as state}from"./templateStore-5cb73464.js";import{l as loadTemplate}from"./Templates-f8a6628a.js";import{a as getRoleIndex}from"./utils-e9a6b9e4.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Token-54690789.js";import"./index-24fd1580.js";import"./Primitives-054bc6e5.js";import"./Templates-8e4ab976.js";import"./Envelopes-eb3eef02.js";import"./Files-70a192df.js";import"./index-d264c496.js";var verdocsSendCss='verdocs-send{display:-ms-flexbox;display:flex;padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid #97979744}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:#00000089}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var 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>';var 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>';var 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>';var doneIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.send=createEvent(this,"send",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.levels=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.rolesAtLevel={};this.showPickerForId="";this.sessionContacts=[];this.rolesCompleted={}}e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,n,i,s,r,l;return __generator(this,(function(a){switch(a.label){case 0:s=this.endpoint.loadSession();if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}a.label=1;case 1:a.trys.push([1,3,,4]);console.log("[SEND] Loading template ".concat(this.templateId));return[4,loadTemplate(this.endpoint,this.templateId)];case 2:a.sent();if((e=state.template)===null||e===void 0?void 0:e.roles){r={};this.rolesCompleted={};state.template.roles.forEach((function(e){var t=e.sequence-1;r[t]||(r[t]=[]);var o="r-".concat(t,"-").concat(r[t].length);r[t].push(__assign(__assign({},e),{id:o}))}));this.rolesAtLevel=r;this.levels=Object.keys(r).map((function(e){return+e}));this.levels.sort((function(e,t){return e-t}))}return[3,4];case 3:l=a.sent();console.log("[SEND] Error loading template",l);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError(l.message,(o=l.response)===null||o===void 0?void 0:o.status,(n=l.response)===null||n===void 0?void 0:n.data));return[3,4];case 4:if((i=s.session)===null||i===void 0?void 0:i.profile){this.sessionContacts.push({id:s.session.profile.id,name:"".concat(s.session.profile.first_name," ").concat(s.session.profile.last_name),email:s.session.profile.email,phone:s.session.profile.phone})}return[2]}}))}))};e.prototype.getLevelIcon=function(e){if(e<0){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e>=this.levels.length){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t;e.stopPropagation();(t=this.send)===null||t===void 0?void 0:t.emit({roles:Object.values(this.rolesCompleted),name:state.template.name,template_id:this.templateId})};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t=state.template.roles.map((function(e){return e.name}))||[];var o=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)||isValidPhone(e.phone)}));var n=o.length>=t.length;return h(Host,{class:{}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon(-1),h("div",{class:"complete"},"Send Envelope")),this.levels.map((function(o){return h("div",{class:"level level-".concat(o)},e.getLevelIcon(o),e.rolesAtLevel[o].map((function(o){var n,i,s;return h("div",{class:"recipient",style:{backgroundColor:getRGBA(getRoleIndex(t,o.name))},onClick:function(t){return e.handleClickRole(t,o)}},(i=(n=e.rolesCompleted[o.id])===null||n===void 0?void 0:n.full_name)!==null&&i!==void 0?i:o.name,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===o.id&&h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(t){return e.handleSelectContact(t,o)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[o.id])!==null&&s!==void 0?s:o,onSearchContacts:function(e){return console.log("Search",e.detail)}}))})))})),h("div",{class:"level level-done"},this.getLevelIcon(this.levels.length),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)}}),h("verdocs-button",{label:"Send",size:"small",disabled:!n,onClick:function(t){return e.handleSend(t)}})))};return e}();VerdocsSend.style=verdocsSendCss;export{VerdocsSend as verdocs_send};