@verdocs/web-sdk 1.11.0 → 1.11.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 (121) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/verdocs-checkbox_4.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-field-checkbox.cjs.entry.js +5 -1
  4. package/dist/cjs/verdocs-field-date.cjs.entry.js +5 -1
  5. package/dist/cjs/verdocs-field-initial.cjs.entry.js +5 -1
  6. package/dist/cjs/verdocs-field-radio-button.cjs.entry.js +5 -1
  7. package/dist/cjs/verdocs-field-signature.cjs.entry.js +5 -1
  8. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +5 -1
  9. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +5 -1
  10. package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +5 -1
  11. package/dist/cjs/verdocs-template-attachments.cjs.entry.js +3 -0
  12. package/dist/cjs/verdocs-template-create_2.cjs.entry.js +7 -4
  13. package/dist/cjs/verdocs-template-name.cjs.entry.js +3 -4
  14. package/dist/cjs/verdocs-template-recipients.cjs.entry.js +42 -8
  15. package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
  16. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  17. package/dist/collection/components/elements/verdocs-component-error/verdocs-component-error.css +2 -0
  18. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +1 -1
  19. package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js +5 -1
  20. package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +5 -1
  21. package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +5 -1
  22. package/dist/collection/components/fields/verdocs-field-radio-button-group/verdocs-field-radio-button.js +5 -1
  23. package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +5 -1
  24. package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +5 -1
  25. package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +5 -1
  26. package/dist/collection/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.js +5 -1
  27. package/dist/collection/components/templates/verdocs-template-attachments/verdocs-template-attachments.js +3 -0
  28. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +9 -5
  29. package/dist/collection/components/templates/verdocs-template-name/verdocs-template-name.js +3 -4
  30. package/dist/collection/components/templates/verdocs-template-recipients/verdocs-template-recipients.css +16 -0
  31. package/dist/collection/components/templates/verdocs-template-recipients/verdocs-template-recipients.js +41 -7
  32. package/dist/components/verdocs-component-error2.js +1 -1
  33. package/dist/components/verdocs-field-checkbox.js +5 -1
  34. package/dist/components/verdocs-field-date.js +5 -1
  35. package/dist/components/verdocs-field-initial.js +5 -1
  36. package/dist/components/verdocs-field-radio-button.js +5 -1
  37. package/dist/components/verdocs-field-signature.js +5 -1
  38. package/dist/components/verdocs-field-textarea.js +5 -1
  39. package/dist/components/verdocs-field-textbox.js +5 -1
  40. package/dist/components/verdocs-field-timestamp.js +5 -1
  41. package/dist/components/verdocs-template-attachments.js +10 -1
  42. package/dist/components/verdocs-template-fields2.js +9 -5
  43. package/dist/components/verdocs-template-name.js +11 -6
  44. package/dist/components/verdocs-template-recipients.js +52 -12
  45. package/dist/components/verdocs-view2.js +1 -1
  46. package/dist/docs.json +19 -1
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm/verdocs-checkbox_4.entry.js +1 -1
  49. package/dist/esm/verdocs-field-checkbox.entry.js +5 -1
  50. package/dist/esm/verdocs-field-date.entry.js +5 -1
  51. package/dist/esm/verdocs-field-initial.entry.js +5 -1
  52. package/dist/esm/verdocs-field-radio-button.entry.js +5 -1
  53. package/dist/esm/verdocs-field-signature.entry.js +5 -1
  54. package/dist/esm/verdocs-field-textarea.entry.js +5 -1
  55. package/dist/esm/verdocs-field-textbox.entry.js +5 -1
  56. package/dist/esm/verdocs-field-timestamp.entry.js +5 -1
  57. package/dist/esm/verdocs-template-attachments.entry.js +3 -0
  58. package/dist/esm/verdocs-template-create_2.entry.js +7 -4
  59. package/dist/esm/verdocs-template-name.entry.js +3 -4
  60. package/dist/esm/verdocs-template-recipients.entry.js +43 -9
  61. package/dist/esm/verdocs-view.entry.js +1 -1
  62. package/dist/esm/verdocs-web-sdk.js +1 -1
  63. package/dist/esm-es5/loader.js +1 -1
  64. package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -1
  65. package/dist/esm-es5/verdocs-field-checkbox.entry.js +1 -1
  66. package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
  67. package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
  68. package/dist/esm-es5/verdocs-field-radio-button.entry.js +1 -1
  69. package/dist/esm-es5/verdocs-field-signature.entry.js +1 -1
  70. package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
  71. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  72. package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
  73. package/dist/esm-es5/verdocs-template-attachments.entry.js +1 -1
  74. package/dist/esm-es5/verdocs-template-create_2.entry.js +1 -1
  75. package/dist/esm-es5/verdocs-template-name.entry.js +1 -1
  76. package/dist/esm-es5/verdocs-template-recipients.entry.js +1 -1
  77. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  78. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  79. package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +1 -0
  80. package/dist/types/components/templates/verdocs-template-recipients/verdocs-template-recipients.d.ts +2 -0
  81. package/dist/verdocs-web-sdk/{p-64f197a8.system.entry.js → p-0c393c2b.system.entry.js} +1 -1
  82. package/dist/verdocs-web-sdk/{p-af2957cc.system.entry.js → p-0d7db907.system.entry.js} +1 -1
  83. package/dist/verdocs-web-sdk/p-113a45d3.entry.js +1 -0
  84. package/dist/verdocs-web-sdk/{p-2faa3f2e.system.entry.js → p-127a569c.system.entry.js} +1 -1
  85. package/dist/verdocs-web-sdk/{p-caaf2702.system.entry.js → p-1fe9560f.system.entry.js} +1 -1
  86. package/dist/verdocs-web-sdk/p-28620067.system.entry.js +1 -0
  87. package/dist/verdocs-web-sdk/p-4086a15a.entry.js +1 -0
  88. package/dist/verdocs-web-sdk/{p-6d295ee1.system.entry.js → p-41122f38.system.entry.js} +1 -1
  89. package/dist/verdocs-web-sdk/p-56196fad.entry.js +1 -0
  90. package/dist/verdocs-web-sdk/{p-e58ab5ca.entry.js → p-5dc58d34.entry.js} +1 -1
  91. package/dist/verdocs-web-sdk/{p-7149f974.system.entry.js → p-5fda1fe8.system.entry.js} +1 -1
  92. package/dist/verdocs-web-sdk/{p-7a26ed4a.entry.js → p-68eb0ad8.entry.js} +1 -1
  93. package/dist/verdocs-web-sdk/{p-9dfcc6d4.system.entry.js → p-6c231fe6.system.entry.js} +1 -1
  94. package/dist/verdocs-web-sdk/{p-32f9b201.system.entry.js → p-7d8de5d6.system.entry.js} +1 -1
  95. package/dist/verdocs-web-sdk/p-8a430554.entry.js +1 -0
  96. package/dist/verdocs-web-sdk/p-8e5065af.entry.js +1 -0
  97. package/dist/verdocs-web-sdk/p-8ff15619.entry.js +1 -0
  98. package/dist/verdocs-web-sdk/{p-695c2ea8.entry.js → p-b225dcfb.entry.js} +1 -1
  99. package/dist/verdocs-web-sdk/{p-cdff8cba.system.entry.js → p-b430f3d0.system.entry.js} +1 -1
  100. package/dist/verdocs-web-sdk/{p-d06946ca.entry.js → p-bc24fcdc.entry.js} +1 -1
  101. package/dist/verdocs-web-sdk/p-bde3d383.system.entry.js +1 -0
  102. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
  103. package/dist/verdocs-web-sdk/{p-bea9fe06.system.entry.js → p-c6406e1d.system.entry.js} +1 -1
  104. package/dist/verdocs-web-sdk/{p-19763c4d.system.entry.js → p-cf27d3ce.system.entry.js} +1 -1
  105. package/dist/verdocs-web-sdk/{p-6d84b99c.entry.js → p-d78594bb.entry.js} +1 -1
  106. package/dist/verdocs-web-sdk/{p-cb006a7e.entry.js → p-e079768b.entry.js} +1 -1
  107. package/dist/verdocs-web-sdk/{p-5ced004c.entry.js → p-e53a7969.entry.js} +1 -1
  108. package/dist/verdocs-web-sdk/p-e65ec569.system.entry.js +1 -0
  109. package/dist/verdocs-web-sdk/{p-68743993.entry.js → p-ec913a97.entry.js} +1 -1
  110. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  111. package/package.json +1 -1
  112. package/dist/custom-elements.json +0 -1361
  113. package/dist/verdocs-web-sdk/p-00307be5.system.entry.js +0 -1
  114. package/dist/verdocs-web-sdk/p-29df733a.system.entry.js +0 -1
  115. package/dist/verdocs-web-sdk/p-3bed244c.system.entry.js +0 -1
  116. package/dist/verdocs-web-sdk/p-4e521971.entry.js +0 -1
  117. package/dist/verdocs-web-sdk/p-587f4405.entry.js +0 -1
  118. package/dist/verdocs-web-sdk/p-5d29152f.entry.js +0 -1
  119. package/dist/verdocs-web-sdk/p-b3fd9575.entry.js +0 -1
  120. package/dist/verdocs-web-sdk/p-c9eb3771.entry.js +0 -1
  121. package/dist/verdocs-web-sdk/p-dd06fb2a.entry.js +0 -1
@@ -64,7 +64,11 @@ export class VerdocsFieldSignature {
64
64
  if (this.done) {
65
65
  return h(Host, { class: { done: this.done } }, value && h("img", { src: value, alt: "Signature" }));
66
66
  }
67
- return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, value ? h("img", { src: value, alt: "Signature" }) : h("button", { onClick: () => !disabled && this.handleShow() }, "Signature"), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
67
+ return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, value ? h("img", { src: value, alt: "Signature" }) : h("button", { onClick: () => !disabled && this.handleShow() }, "Signature"), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
68
+ var _a;
69
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
70
+ return this.hideSettingsPanel();
71
+ }, onSettingsChanged: e => {
68
72
  var _a;
69
73
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
70
74
  return this.hideSettingsPanel();
@@ -39,7 +39,11 @@ export class VerdocsFieldTextarea {
39
39
  if (this.done) {
40
40
  return h(Host, { class: { done: this.done } }, settings.value);
41
41
  }
42
- return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
42
+ return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
43
+ var _a;
44
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
45
+ return this.hideSettingsPanel();
46
+ }, onSettingsChanged: e => {
43
47
  var _a;
44
48
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
45
49
  return this.hideSettingsPanel();
@@ -40,7 +40,11 @@ export class VerdocsFieldTextbox {
40
40
  if (this.done) {
41
41
  return h(Host, { class: { done: this.done } }, value);
42
42
  }
43
- return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
43
+ return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
44
+ var _a;
45
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
46
+ return this.hideSettingsPanel();
47
+ }, onSettingsChanged: e => {
44
48
  var _a;
45
49
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
46
50
  return this.hideSettingsPanel();
@@ -46,7 +46,11 @@ export class VerdocsFieldTimestamp {
46
46
  return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order,
47
47
  // TODO: It would really make more sense to show the date and time but the default width of 64px for this field
48
48
  // is encoded in a ton of existing entries in the database and is hard to change.
49
- value: formatted, disabled: true, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
49
+ value: formatted, disabled: true, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
50
+ var _a;
51
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
52
+ return this.hideSettingsPanel();
53
+ }, onSettingsChanged: e => {
50
54
  var _a;
51
55
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
52
56
  return this.hideSettingsPanel();
@@ -28,6 +28,9 @@ export class VerdocsTemplateAttachments {
28
28
  }
29
29
  }
30
30
  render() {
31
+ if (!this.endpoint.session) {
32
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
33
+ }
31
34
  if (this.loading) {
32
35
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
33
36
  }
@@ -14,12 +14,12 @@ const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" widt
14
14
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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 d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
16
16
  const menuOptions = [
17
- { id: 'attachment', tooltip: 'Attachment', icon: 'A' },
17
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
18
18
  { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
19
19
  { id: 'date', tooltip: 'Date', icon: iconDatepicker },
20
20
  { id: 'dropdown', tooltip: 'Dropdown', icon: 'O' },
21
21
  { id: 'initial', tooltip: 'Initials', icon: iconInitial },
22
- { id: 'payment', tooltip: 'Payment', icon: 'P' },
22
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
23
23
  { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
24
24
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
25
25
  { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
@@ -38,6 +38,7 @@ export class VerdocsTemplateFields {
38
38
  this.templateId = null;
39
39
  this.placing = null;
40
40
  this.selectedRoleName = '';
41
+ this.rerender = 1;
41
42
  }
42
43
  async componentWillLoad() {
43
44
  var _a, _b, _c, _d, _e, _f;
@@ -72,12 +73,15 @@ export class VerdocsTemplateFields {
72
73
  }
73
74
  async handleFieldChange(field, e, optionId) {
74
75
  console.log('[FIELDS] handleFieldChange', field, e, optionId);
76
+ this.rerender++;
75
77
  }
76
78
  attachFieldAttributes(pageInfo, field, roleIndex, el) {
77
79
  el.addEventListener('input', e => this.handleFieldChange(field, e));
78
80
  el.addEventListener('settingsChanged', () => {
79
81
  var _a;
82
+ console.log('settings changed', this, field);
80
83
  el.setAttribute('roleindex', getRoleIndex(TemplateStore.roleNames, field.role_name));
84
+ this.rerender++;
81
85
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: TemplateStore.template, event: 'updated-field' });
82
86
  });
83
87
  el.setAttribute('roleindex', roleIndex);
@@ -226,7 +230,6 @@ export class VerdocsTemplateFields {
226
230
  }
227
231
  }
228
232
  render() {
229
- console.log('rendering', TemplateStore.updateCount);
230
233
  if (!this.endpoint.session) {
231
234
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
232
235
  }
@@ -236,7 +239,7 @@ export class VerdocsTemplateFields {
236
239
  }
237
240
  const pages = [...TemplateStore.template.pages];
238
241
  pages.sort((a, b) => a.sequence - b.sequence);
239
- return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": TemplateStore.updateCount, onSubmit: () => {
242
+ return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
240
243
  console.log('onSubmit');
241
244
  } }, h("div", { class: "pages" }, pages.map(page => {
242
245
  // console.log('rendering page', page);
@@ -305,7 +308,8 @@ export class VerdocsTemplateFields {
305
308
  static get states() {
306
309
  return {
307
310
  "placing": {},
308
- "selectedRoleName": {}
311
+ "selectedRoleName": {},
312
+ "rerender": {}
309
313
  };
310
314
  }
311
315
  static get events() {
@@ -46,13 +46,12 @@ export class VerdocsTemplateName {
46
46
  (_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
47
47
  }
48
48
  render() {
49
+ if (!this.endpoint.session) {
50
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
51
+ }
49
52
  if (this.loading) {
50
53
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
51
54
  }
52
- // This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
53
- if (!this.endpoint.session || !TemplateStore.template) {
54
- return h(Host, { class: "empty" });
55
- }
56
55
  return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("label", { htmlFor: "verdocs-template-name" }, "Template Name"), h("verdocs-text-input", { id: "verdocs-template-name", value: this.name, autocomplete: "off", placeholder: "Template Name...", onInput: (e) => {
57
56
  this.name = e.target.value;
58
57
  this.dirty = this.name !== TemplateStore.template.name;
@@ -31,6 +31,7 @@ verdocs-template-recipients > form .left-line {
31
31
  verdocs-template-recipients > form .row {
32
32
  display: flex;
33
33
  column-gap: 0;
34
+ min-height: 35px;
34
35
  margin-left: 40px;
35
36
  position: relative;
36
37
  flex-direction: row;
@@ -160,6 +161,21 @@ verdocs-template-recipients .add-role svg {
160
161
  width: 32px;
161
162
  height: 32px;
162
163
  }
164
+ verdocs-template-recipients .add-step {
165
+ margin: 0;
166
+ padding: 0;
167
+ border: none;
168
+ opacity: 0.5;
169
+ cursor: pointer;
170
+ background: none;
171
+ }
172
+ verdocs-template-recipients .add-step:hover {
173
+ opacity: 1;
174
+ }
175
+ verdocs-template-recipients .add-step svg {
176
+ width: 32px;
177
+ height: 32px;
178
+ }
163
179
  verdocs-template-recipients.dragging .add-role {
164
180
  display: none;
165
181
  }
@@ -185,17 +185,47 @@ export class VerdocsTemplateRecipients {
185
185
  // Now re-extract them to get our final result e.g. [1, 2, 3]
186
186
  this.extractSequenceNumbers();
187
187
  }
188
- handleAddRole(e, sequence) {
189
- e.stopPropagation();
190
- // We don't need to look for a unique order number because we're already working with a sorted/renumbered set by now.
191
- const order = TemplateStore.template.roles.filter(role => role.sequence === sequence).length + 1;
192
- // We do need to look for name conflicts because they're UGC and can be anything, regardless of order.
188
+ // Look for name conflicts, because they're UGC and can be anything, regardless of order.
189
+ getNextRecipientName() {
193
190
  let name = '';
194
191
  let nextNumber = TemplateStore.template.roles.length;
195
192
  do {
196
193
  nextNumber++;
197
194
  name = `Recipient ${nextNumber}`;
198
195
  } while (!name || TemplateStore.template.roles.some(role => role.name === name));
196
+ return name;
197
+ }
198
+ handleAddRole(e, sequence) {
199
+ e.stopPropagation();
200
+ // We don't need to look for a unique order number because we're already working with a sorted/renumbered set by now.
201
+ const order = TemplateStore.template.roles.filter(role => role.sequence === sequence).length + 1;
202
+ const name = this.getNextRecipientName();
203
+ console.log('Will create', name, sequence, order);
204
+ createRole(this.endpoint, this.templateId, {
205
+ template_id: this.templateId,
206
+ name,
207
+ full_name: '',
208
+ email: '',
209
+ phone: '',
210
+ sequence,
211
+ order,
212
+ type: 'signer',
213
+ delegator: false,
214
+ })
215
+ .then(r => {
216
+ console.log('Created role', r);
217
+ TemplateStore.template.roles.push(r);
218
+ this.renumberTemplateRoles();
219
+ this.forceRerender++;
220
+ })
221
+ .catch(e => {
222
+ console.log('Error creating role', e);
223
+ });
224
+ }
225
+ handleAddStep(e, sequence) {
226
+ e.stopPropagation();
227
+ const order = 1;
228
+ const name = this.getNextRecipientName();
199
229
  console.log('Will create', name, sequence, order);
200
230
  createRole(this.endpoint, this.templateId, {
201
231
  template_id: this.templateId,
@@ -219,12 +249,16 @@ export class VerdocsTemplateRecipients {
219
249
  });
220
250
  }
221
251
  render() {
222
- const roleNames = TemplateStore.template.roles.map(role => role.name);
252
+ var _a;
253
+ if (!this.endpoint.session) {
254
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
255
+ }
256
+ const roleNames = (((_a = TemplateStore.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.name);
223
257
  return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off", "data-r": this.forceRerender }, h("h5", null, "Roles"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-recipients" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[TemplateStore.template.sender], ' ', h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingSenderDialog = true), "aria-role": "button" })))), h("div", { class: "row add-sequence", "data-sequence": 0 }, h("div", { class: "icon", innerHTML: plusIcon }), h("div", { class: "row-recipients" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), this.sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-recipients" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), TemplateStore.template.roles
224
258
  .filter(role => role.sequence === sequence)
225
259
  .map(role => {
226
260
  return (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
227
- }), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-recipients" }, h("div", { class: "icon", innerHTML: plusIcon }), h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step")))))), this.sequences.length < 1 && (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-recipients" }, h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, 1) }))))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-recipients" }, h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "OK", size: "small", onClick: e => this.handleSubmit(e), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
261
+ }), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-recipients" }, h("div", { class: "icon", innerHTML: plusIcon }), h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step")))))), h("div", { class: "row", "data-sequence": this.sequences.length + 1 }, h("div", { class: "row-recipients" }, h("div", { class: "icon", innerHTML: plusIcon }), h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, this.sequences.length + 1) }))), this.sequences.length < 1 && (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-recipients" }, h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, 1) }))))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-recipients" }, h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "OK", size: "small", onClick: e => this.handleSubmit(e), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
228
262
  this.showingRoleDialog = null;
229
263
  this.forceRerender++;
230
264
  }, onDelete: e => {
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const verdocsComponentErrorCss = "verdocs-component-error{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;padding:15px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-component-error .inner{-ms-flex:1;flex:1;height:300px;display:-ms-flexbox;display:flex;font-size:18px;background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}";
3
+ const verdocsComponentErrorCss = "verdocs-component-error{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;padding:15px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-component-error .inner{-ms-flex:1;flex:1;height:300px;display:-ms-flexbox;display:flex;font-size:18px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 20px;background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}";
4
4
 
5
5
  const VerdocsComponentError = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -49,7 +49,11 @@ const VerdocsFieldCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
49
49
  if (this.done) {
50
50
  return h(Host, { class: { done: this.done } }, option.checked ? '✓' : '☐');
51
51
  }
52
- return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
52
+ return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
53
+ var _a;
54
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
55
+ return this.hideSettingsPanel();
56
+ }, onSettingsChanged: e => {
53
57
  var _a;
54
58
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
55
59
  return this.hideSettingsPanel();
@@ -2621,7 +2621,11 @@ const VerdocsFieldDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
2621
2621
  const formatted = (settings === null || settings === void 0 ? void 0 : settings.result) ? format(new Date(settings === null || settings === void 0 ? void 0 : settings.result), 'MMM d, y') : '';
2622
2622
  return h(Host, { class: { done: this.done } }, formatted);
2623
2623
  }
2624
- return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
2624
+ return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
2625
+ var _a;
2626
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
2627
+ return this.hideSettingsPanel();
2628
+ }, onSettingsChanged: e => {
2625
2629
  var _a;
2626
2630
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
2627
2631
  return this.hideSettingsPanel();
@@ -78,7 +78,11 @@ const VerdocsFieldInitial$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
78
78
  if (this.done) {
79
79
  return h(Host, { class: { done: this.done } }, value && h("img", { src: value, alt: "Initials" }));
80
80
  }
81
- return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, value ? (h("img", { src: value, alt: "Initials" })) : (h("button", { class: {}, onClick: () => !disabled && this.handleShow() }, "Initials")), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
81
+ return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, value ? (h("img", { src: value, alt: "Initials" })) : (h("button", { class: {}, onClick: () => !disabled && this.handleShow() }, "Initials")), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
82
+ var _a;
83
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
84
+ return this.hideSettingsPanel();
85
+ }, onSettingsChanged: e => {
82
86
  var _a;
83
87
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
84
88
  return this.hideSettingsPanel();
@@ -53,7 +53,11 @@ const VerdocsFieldRadioButton$1 = /*@__PURE__*/ proxyCustomElement(class extends
53
53
  if (this.done) {
54
54
  return (h(Host, { class: { done: this.done }, style: { maxWidth: '10px' } }, h("span", { innerHTML: !!option.selected ? RadioIconSelected : RadioIconUnselected })));
55
55
  }
56
- return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", value: option.id, tabIndex: settings.order, name: this.field.name, checked: !!option.selected, disabled: disabled, required: settings.required }), h("label", { htmlFor: id }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
56
+ return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", value: option.id, tabIndex: settings.order, name: this.field.name, checked: !!option.selected, disabled: disabled, required: settings.required }), h("label", { htmlFor: id }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
57
+ var _a;
58
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
59
+ return this.hideSettingsPanel();
60
+ }, onSettingsChanged: e => {
57
61
  var _a;
58
62
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
59
63
  return this.hideSettingsPanel();
@@ -77,7 +77,11 @@ const VerdocsFieldSignature$1 = /*@__PURE__*/ proxyCustomElement(class extends H
77
77
  if (this.done) {
78
78
  return h(Host, { class: { done: this.done } }, value && h("img", { src: value, alt: "Signature" }));
79
79
  }
80
- return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, value ? h("img", { src: value, alt: "Signature" }) : h("button", { onClick: () => !disabled && this.handleShow() }, "Signature"), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
80
+ return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, value ? h("img", { src: value, alt: "Signature" }) : h("button", { onClick: () => !disabled && this.handleShow() }, "Signature"), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
81
+ var _a;
82
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
83
+ return this.hideSettingsPanel();
84
+ }, onSettingsChanged: e => {
81
85
  var _a;
82
86
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
83
87
  return this.hideSettingsPanel();
@@ -50,7 +50,11 @@ const VerdocsFieldTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
50
50
  if (this.done) {
51
51
  return h(Host, { class: { done: this.done } }, settings.value);
52
52
  }
53
- return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
53
+ return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
54
+ var _a;
55
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
56
+ return this.hideSettingsPanel();
57
+ }, onSettingsChanged: e => {
54
58
  var _a;
55
59
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
56
60
  return this.hideSettingsPanel();
@@ -51,7 +51,11 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
51
51
  if (this.done) {
52
52
  return h(Host, { class: { done: this.done } }, value);
53
53
  }
54
- return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
54
+ return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
55
+ var _a;
56
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
57
+ return this.hideSettingsPanel();
58
+ }, onSettingsChanged: e => {
55
59
  var _a;
56
60
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
57
61
  return this.hideSettingsPanel();
@@ -57,7 +57,11 @@ const VerdocsFieldTimestamp$1 = /*@__PURE__*/ proxyCustomElement(class extends H
57
57
  return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order,
58
58
  // TODO: It would really make more sense to show the date and time but the default width of 64px for this field
59
59
  // is encoded in a ton of existing entries in the database and is hard to change.
60
- value: formatted, disabled: true, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onSettingsChanged: e => {
60
+ value: formatted, disabled: true, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("h6", null, "Field Settings"), h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
61
+ var _a;
62
+ (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
63
+ return this.hideSettingsPanel();
64
+ }, onSettingsChanged: e => {
61
65
  var _a;
62
66
  (_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
63
67
  return this.hideSettingsPanel();
@@ -3,6 +3,7 @@ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
3
3
  import { s as state } from './templateStore.js';
4
4
  import { l as loadTemplate } from './Templates.js';
5
5
  import { S as SDKError } from './errors.js';
6
+ import { d as defineCustomElement$3 } from './verdocs-component-error2.js';
6
7
  import { d as defineCustomElement$2 } from './verdocs-loader2.js';
7
8
 
8
9
  const verdocsTemplateAttachmentsCss = "verdocs-template-attachments{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#4c56cb}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b;border:1px solid #cccccc}verdocs-template-attachments svg{width:24px;height:24px;fill:#5c6575;margin:2px 10px 0 0}";
@@ -32,6 +33,9 @@ const VerdocsTemplateAttachments$1 = /*@__PURE__*/ proxyCustomElement(class exte
32
33
  }
33
34
  }
34
35
  render() {
36
+ if (!this.endpoint.session) {
37
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
38
+ }
35
39
  if (this.loading) {
36
40
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
37
41
  }
@@ -51,13 +55,18 @@ function defineCustomElement$1() {
51
55
  if (typeof customElements === "undefined") {
52
56
  return;
53
57
  }
54
- const components = ["verdocs-template-attachments", "verdocs-loader"];
58
+ const components = ["verdocs-template-attachments", "verdocs-component-error", "verdocs-loader"];
55
59
  components.forEach(tagName => { switch (tagName) {
56
60
  case "verdocs-template-attachments":
57
61
  if (!customElements.get(tagName)) {
58
62
  customElements.define(tagName, VerdocsTemplateAttachments$1);
59
63
  }
60
64
  break;
65
+ case "verdocs-component-error":
66
+ if (!customElements.get(tagName)) {
67
+ defineCustomElement$3();
68
+ }
69
+ break;
61
70
  case "verdocs-loader":
62
71
  if (!customElements.get(tagName)) {
63
72
  defineCustomElement$2();
@@ -22,12 +22,12 @@ const iconDatepicker = '<svg xmlns="http://www.w3.org/2000/svg" height="24" widt
22
22
  const iconSignature = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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>';
23
23
  const iconInitial = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';
24
24
  const menuOptions = [
25
- { id: 'attachment', tooltip: 'Attachment', icon: 'A' },
25
+ // {id: 'attachment', tooltip: 'Attachment', icon: 'A'},
26
26
  { id: 'checkbox', tooltip: 'Check Box', icon: iconCheck },
27
27
  { id: 'date', tooltip: 'Date', icon: iconDatepicker },
28
28
  { id: 'dropdown', tooltip: 'Dropdown', icon: 'O' },
29
29
  { id: 'initial', tooltip: 'Initials', icon: iconInitial },
30
- { id: 'payment', tooltip: 'Payment', icon: 'P' },
30
+ // {id: 'payment', tooltip: 'Payment', icon: 'P'},
31
31
  { id: 'radio', tooltip: 'Radio Button', icon: iconRadio },
32
32
  { id: 'signature', tooltip: 'Signature', icon: iconSignature },
33
33
  { id: 'textarea', tooltip: 'Text Area', icon: iconMultiline },
@@ -48,6 +48,7 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
48
48
  this.templateId = null;
49
49
  this.placing = null;
50
50
  this.selectedRoleName = '';
51
+ this.rerender = 1;
51
52
  }
52
53
  async componentWillLoad() {
53
54
  var _a, _b, _c, _d, _e, _f;
@@ -82,12 +83,15 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
82
83
  }
83
84
  async handleFieldChange(field, e, optionId) {
84
85
  console.log('[FIELDS] handleFieldChange', field, e, optionId);
86
+ this.rerender++;
85
87
  }
86
88
  attachFieldAttributes(pageInfo, field, roleIndex, el) {
87
89
  el.addEventListener('input', e => this.handleFieldChange(field, e));
88
90
  el.addEventListener('settingsChanged', () => {
89
91
  var _a;
92
+ console.log('settings changed', this, field);
90
93
  el.setAttribute('roleindex', getRoleIndex(state.roleNames, field.role_name));
94
+ this.rerender++;
91
95
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: state.template, event: 'updated-field' });
92
96
  });
93
97
  el.setAttribute('roleindex', roleIndex);
@@ -236,7 +240,6 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
236
240
  }
237
241
  }
238
242
  render() {
239
- console.log('rendering', state.updateCount);
240
243
  if (!this.endpoint.session) {
241
244
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
242
245
  }
@@ -246,7 +249,7 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
246
249
  }
247
250
  const pages = [...state.template.pages];
248
251
  pages.sort((a, b) => a.sequence - b.sequence);
249
- return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": state.updateCount, onSubmit: () => {
252
+ return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
250
253
  console.log('onSubmit');
251
254
  } }, h("div", { class: "pages" }, pages.map(page => {
252
255
  // console.log('rendering page', page);
@@ -263,7 +266,8 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
263
266
  "endpoint": [16],
264
267
  "templateId": [1, "template-id"],
265
268
  "placing": [32],
266
- "selectedRoleName": [32]
269
+ "selectedRoleName": [32],
270
+ "rerender": [32]
267
271
  }]);
268
272
  function defineCustomElement() {
269
273
  if (typeof customElements === "undefined") {
@@ -4,7 +4,8 @@ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
4
4
  import { s as state } from './templateStore.js';
5
5
  import { l as loadTemplate } from './Templates.js';
6
6
  import { S as SDKError } from './errors.js';
7
- import { d as defineCustomElement$5 } from './verdocs-button2.js';
7
+ import { d as defineCustomElement$6 } from './verdocs-button2.js';
8
+ import { d as defineCustomElement$5 } from './verdocs-component-error2.js';
8
9
  import { d as defineCustomElement$4 } from './verdocs-help-icon2.js';
9
10
  import { d as defineCustomElement$3 } from './verdocs-loader2.js';
10
11
  import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
@@ -54,13 +55,12 @@ const VerdocsTemplateName$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
54
55
  (_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
55
56
  }
56
57
  render() {
58
+ if (!this.endpoint.session) {
59
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
60
+ }
57
61
  if (this.loading) {
58
62
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
59
63
  }
60
- // This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
61
- if (!this.endpoint.session || !state.template) {
62
- return h(Host, { class: "empty" });
63
- }
64
64
  return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("label", { htmlFor: "verdocs-template-name" }, "Template Name"), h("verdocs-text-input", { id: "verdocs-template-name", value: this.name, autocomplete: "off", placeholder: "Template Name...", onInput: (e) => {
65
65
  this.name = e.target.value;
66
66
  this.dirty = this.name !== state.template.name;
@@ -78,7 +78,7 @@ function defineCustomElement$1() {
78
78
  if (typeof customElements === "undefined") {
79
79
  return;
80
80
  }
81
- const components = ["verdocs-template-name", "verdocs-button", "verdocs-help-icon", "verdocs-loader", "verdocs-text-input"];
81
+ const components = ["verdocs-template-name", "verdocs-button", "verdocs-component-error", "verdocs-help-icon", "verdocs-loader", "verdocs-text-input"];
82
82
  components.forEach(tagName => { switch (tagName) {
83
83
  case "verdocs-template-name":
84
84
  if (!customElements.get(tagName)) {
@@ -86,6 +86,11 @@ function defineCustomElement$1() {
86
86
  }
87
87
  break;
88
88
  case "verdocs-button":
89
+ if (!customElements.get(tagName)) {
90
+ defineCustomElement$6();
91
+ }
92
+ break;
93
+ case "verdocs-component-error":
89
94
  if (!customElements.get(tagName)) {
90
95
  defineCustomElement$5();
91
96
  }