@verdocs/web-sdk 2.3.45 → 2.3.46

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.
@@ -617,11 +617,11 @@ const VerdocsTemplateRoles = class {
617
617
  this.templateStore = ts;
618
618
  this.roleStore = TemplateRoleStore.getTemplateRoleStore(this.templateId);
619
619
  console.log('RS', (_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state);
620
+ this.loading = false;
620
621
  this.roleStore.onChange('roles', roles => {
621
622
  var _a;
622
623
  console.log('[ROLES] Roles changed', { roles });
623
624
  (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles });
624
- this.loading = false;
625
625
  });
626
626
  })
627
627
  .catch(e => {
@@ -794,18 +794,19 @@ const VerdocsTemplateRoles = class {
794
794
  this.callCreateRole(name, sequence, order);
795
795
  }
796
796
  render() {
797
- var _a, _b, _c;
797
+ var _a, _b, _c, _d;
798
798
  if (!this.endpoint.session) {
799
799
  return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
800
800
  }
801
801
  if (this.loading || !((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
802
+ console.log('Loading', this.loading, (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state.isLoaded);
802
803
  return (index.h(index.Host, { class: "loading" }, index.h("verdocs-loader", null)));
803
804
  }
804
805
  console.log('Rendering roles', this.roleStore.get('roles'));
805
806
  const roleNames = this.getRoleNames();
806
807
  const sequences = this.getSequenceNumbers();
807
808
  console.log('Rendering', roleNames, sequences);
808
- return (index.h(index.Host, null, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("h5", null, "Roles and Workflow"), index.h("div", { class: "participants" }, index.h("div", { class: "left-line" }), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: startIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "sender" }, index.h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.sender], ' ', index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingSenderDialog = true), "aria-role": "button" })))), index.h("div", { class: "row add-sequence", "data-sequence": 0 }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (index.h(index.Fragment, null, index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: stepIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
809
+ return (index.h(index.Host, null, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("h5", null, "Roles and Workflow"), index.h("div", { class: "participants" }, index.h("div", { class: "left-line" }), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: startIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "sender" }, index.h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.sender], ' ', index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingSenderDialog = true), "aria-role": "button" })))), index.h("div", { class: "row add-sequence", "data-sequence": 0 }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (index.h(index.Fragment, null, index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: stepIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
809
810
  const unknown = !role.email;
810
811
  return unknown ? (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(TemplateRoleStore.getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { borderColor: Colors.getRGBA(TemplateRoleStore.getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
811
812
  }), index.h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (index.h("div", { class: "row add-sequence", "data-sequence": sequence }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step"))))))), index.h("div", { class: "row", "data-sequence": sequences.length + 1 }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: doneIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (index.h("div", { class: "empty" }, "You must add at least one Role before proceeding.", index.h("br", null), " Click the ", index.h("span", { innerHTML: plusIcon }), " Add button above to get started.")), index.h("div", { class: "buttons" }, index.h("div", { class: "flex-fill" }), index.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), index.h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (index.h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
@@ -54,11 +54,11 @@ export class VerdocsTemplateRoles {
54
54
  this.templateStore = ts;
55
55
  this.roleStore = getTemplateRoleStore(this.templateId);
56
56
  console.log('RS', (_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state);
57
+ this.loading = false;
57
58
  this.roleStore.onChange('roles', roles => {
58
59
  var _a;
59
60
  console.log('[ROLES] Roles changed', { roles });
60
61
  (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles });
61
- this.loading = false;
62
62
  });
63
63
  })
64
64
  .catch(e => {
@@ -231,18 +231,19 @@ export class VerdocsTemplateRoles {
231
231
  this.callCreateRole(name, sequence, order);
232
232
  }
233
233
  render() {
234
- var _a, _b, _c;
234
+ var _a, _b, _c, _d;
235
235
  if (!this.endpoint.session) {
236
236
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
237
237
  }
238
238
  if (this.loading || !((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
239
+ console.log('Loading', this.loading, (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state.isLoaded);
239
240
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
240
241
  }
241
242
  console.log('Rendering roles', this.roleStore.get('roles'));
242
243
  const roleNames = this.getRoleNames();
243
244
  const sequences = this.getSequenceNumbers();
244
245
  console.log('Rendering', roleNames, sequences);
245
- return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
246
+ return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
246
247
  const unknown = !role.email;
247
248
  return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, 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 }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_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 })));
248
249
  }), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-roles" }, 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": sequences.length + 1 }, h("div", { class: "row-roles" }, h("div", { class: "icon", innerHTML: plusIcon }), h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-roles" }, 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: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
@@ -69,11 +69,11 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class extends HTML
69
69
  this.templateStore = ts;
70
70
  this.roleStore = getTemplateRoleStore(this.templateId);
71
71
  console.log('RS', (_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state);
72
+ this.loading = false;
72
73
  this.roleStore.onChange('roles', roles => {
73
74
  var _a;
74
75
  console.log('[ROLES] Roles changed', { roles });
75
76
  (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles });
76
- this.loading = false;
77
77
  });
78
78
  })
79
79
  .catch(e => {
@@ -246,18 +246,19 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class extends HTML
246
246
  this.callCreateRole(name, sequence, order);
247
247
  }
248
248
  render() {
249
- var _a, _b, _c;
249
+ var _a, _b, _c, _d;
250
250
  if (!this.endpoint.session) {
251
251
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
252
252
  }
253
253
  if (this.loading || !((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
254
+ console.log('Loading', this.loading, (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state.isLoaded);
254
255
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
255
256
  }
256
257
  console.log('Rendering roles', this.roleStore.get('roles'));
257
258
  const roleNames = this.getRoleNames();
258
259
  const sequences = this.getSequenceNumbers();
259
260
  console.log('Rendering', roleNames, sequences);
260
- return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
261
+ return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
261
262
  const unknown = !role.email;
262
263
  return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, 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 }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_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 })));
263
264
  }), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-roles" }, 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": sequences.length + 1 }, h("div", { class: "row-roles" }, h("div", { class: "icon", innerHTML: plusIcon }), h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-roles" }, 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: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-01-18T03:18:49",
2
+ "timestamp": "2024-01-18T03:42:26",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.20.0",
@@ -613,11 +613,11 @@ const VerdocsTemplateRoles = class {
613
613
  this.templateStore = ts;
614
614
  this.roleStore = getTemplateRoleStore(this.templateId);
615
615
  console.log('RS', (_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state);
616
+ this.loading = false;
616
617
  this.roleStore.onChange('roles', roles => {
617
618
  var _a;
618
619
  console.log('[ROLES] Roles changed', { roles });
619
620
  (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles });
620
- this.loading = false;
621
621
  });
622
622
  })
623
623
  .catch(e => {
@@ -790,18 +790,19 @@ const VerdocsTemplateRoles = class {
790
790
  this.callCreateRole(name, sequence, order);
791
791
  }
792
792
  render() {
793
- var _a, _b, _c;
793
+ var _a, _b, _c, _d;
794
794
  if (!this.endpoint.session) {
795
795
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
796
796
  }
797
797
  if (this.loading || !((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
798
+ console.log('Loading', this.loading, (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state.isLoaded);
798
799
  return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
799
800
  }
800
801
  console.log('Rendering roles', this.roleStore.get('roles'));
801
802
  const roleNames = this.getRoleNames();
802
803
  const sequences = this.getSequenceNumbers();
803
804
  console.log('Rendering', roleNames, sequences);
804
- return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
805
+ return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.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-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
805
806
  const unknown = !role.email;
806
807
  return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, 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 }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_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 })));
807
808
  }), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-roles" }, 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": sequences.length + 1 }, h("div", { class: "row-roles" }, h("div", { class: "icon", innerHTML: plusIcon }), h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-roles" }, 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: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r["throw"](e))}catch(e){n(e)}}function l(e){e.done?o(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,i,n,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,i&&(n=s[0]&2?i["return"]:s[0]?i["throw"]||((n=i["return"])&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;if(i=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;i=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(n=o.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(s[0]===6&&o.label<n[1]){o.label=n[1];n=s;break}if(n&&o.label<n[2]){o.label=n[2];o.ops.push(s);break}if(n[2])o.ops.pop();o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e];i=0}finally{r=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,o){if(o||arguments.length===2)for(var r=0,i=t.length,n;r<i;r++){if(n||!(r in t)){if(!n)n=Array.prototype.slice.call(t,0,r);n[r]=t[r]}}return e.concat(n||Array.prototype.slice.call(t))};var _f;import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,a as getElement}from"./index-172625c5.js";import{i as interact_min}from"./interact.min-6a7b19a1.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint,T as TemplateSenderTypes,u as updateTemplate}from"./VerdocsEndpoint-56fa3371.js";import{u as updateField,c as createField}from"./Fields-c82e6df3.js";import{i as integerSequence}from"./Primitives-8fe93caf.js";import{g as getTemplateFieldStore,u as updateStoreField}from"./TemplateFieldStore-76da1f7c.js";import{r as renderDocumentField,e as updateCssTransform,f as defaultWidth,h as defaultHeight}from"./utils-d081a2b9.js";import{g as getTemplateRoleStore,c as createTemplateRoleStore,u as updateStoreRole,d as deleteStoreRole,a as getRoleIndex}from"./TemplateRoleStore-8c34bafd.js";import{g as getTemplateStore}from"./TemplateStore-0804c8ee.js";import{S as SDKError}from"./errors-9b5498c8.js";import{g as getRGBA}from"./Colors-1b298092.js";import"./_commonjsHelpers-8a9f3b18.js";import"./index-4439b0d1.js";import"./Envelopes-627c5239.js";import"./Files-70a192df.js";import"./Types-1628dc71.js";import"./index-914ed6f7.js";var createRole=function(e,t,o){return e.api.post("/templates/".concat(t,"/roles"),o).then((function(e){return e.data}))};var updateRole=function(e,t,o,r){return e.api.put("/templates/".concat(t,"/roles/").concat(o),r).then((function(e){return e.data}))};var deleteRole=function(e,t,o){return e.api.delete("/templates/".concat(t,"/roles/").concat(o)).then((function(e){return e.data}))};var verdocsTemplateFieldsCss="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px #0000000f;box-shadow:0 0 10px 5px #0000000f}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' 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'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' 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' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath 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'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var iconTextbox='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var iconTextarea='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var 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>';var 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>';var 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>';var iconTimestamp='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="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>';var 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>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature},{id:"initial",tooltip:"Initials",icon:iconInitial},{id:"sep1",tooltip:"",icon:separator},{id:"textbox",tooltip:"Text Box",icon:iconTextbox},{id:"textarea",tooltip:"Text Area",icon:iconTextarea},{id:"checkbox_group",tooltip:"Check Box",icon:iconCheck},{id:"radio_button_group",tooltip:"Radio Button",icon:iconRadio},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown},{id:"sep2",tooltip:"",icon:separator},{id:"date",tooltip:"Date",icon:iconDatepicker},{id:"timestamp",tooltip:"Timestamp",icon:iconTimestamp}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.templateUpdated=createEvent(this,"templateUpdated",7);this.fieldsUpdated=createEvent(this,"fieldsUpdated",7);this.pageHeights={};this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.cachedPageInfo={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o;var r=this;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}getTemplateStore(this.endpoint,this.templateId,true).then((function(e){var t,o,i,n;r.templateStore=e;console.log("[PREVIEW] Loaded Template Store",e.state);r.fieldStore=getTemplateFieldStore(r.templateId);r.roleStore=getTemplateRoleStore(r.templateId);r.selectedRoleName=((o=(t=r.roleStore.get("roles"))===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.name)||"";console.log("Sel role",r.selectedRoleName);console.log("RS",(i=r.roleStore)===null||i===void 0?void 0:i.state);console.log("FS",(n=r.fieldStore)===null||n===void 0?void 0:n.state);console.log("[PREVIEW] Loaded template",r.templateStore.state,r.roleStore.get("roles"),r.fieldStore.get("fields"));r.loading=false;r.fieldStore.onChange("fields",(function(e){var t;console.log("[FIELDS] Fields changed",{fields:e});(t=r.fieldsUpdated)===null||t===void 0?void 0:t.emit({event:"updated",endpoint:r.endpoint,templateId:r.templateId,fields:e})}))})).catch((function(e){console.log(e)}))}catch(r){console.log("[FIELDS] Error with preview session",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,(o=r.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t;var o=this.roleStore.get("roles");if(!this.selectedRoleName||!o.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((t=o[0])===null||t===void 0?void 0:t.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldChange=function(e,t,o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){console.log("[FIELDS] handleFieldChange",e,t,o);return[2]}))}))};e.prototype.attachFieldAttributes=function(e,t,o){var r=this;o.addEventListener("input",(function(e){return r.handleFieldChange(t,e)}));o.addEventListener("settingsChanged",(function(){var e,t;(e=r.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:r.endpoint,template:(t=r.templateStore)===null||t===void 0?void 0:t.state,event:"added-field"})}));o.addEventListener("deleted",(function(){var e,i;console.log("[FIELDS] Deleted",r,t);o.remove();(e=r.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:r.endpoint,template:(i=r.templateStore)===null||i===void 0?void 0:i.state,event:"updated-field"})}));o.setAttribute("templateid",this.templateId);o.setAttribute("fieldname",t.name);o.setAttribute("pageNumber",e.pageNumber);o.setAttribute("xScale",e.xScale);o.setAttribute("yScale",e.yScale);o.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var o=e.detail;this.cachedPageInfo[o.pageNumber]=o;this.pageHeights[o.pageNumber]=o.naturalHeight;var r=this.fieldStore.get("fields").filter((function(e){return e&&e.page_sequence===o.pageNumber}));console.log("[FIELDS] Page rendered",o,r);r.forEach((function(e){return t.reRenderField(e,o.pageNumber)}))};e.prototype.reRenderField=function(e,t){var o=this;var r=this.cachedPageInfo[t];var i=renderDocumentField(e,r,{disabled:true,editable:true,draggable:true});if(!i){return}if(Array.isArray(i)){i.forEach((function(t){o.attachFieldAttributes(r,e,t);o.makeDraggable(t)}))}else{this.attachFieldAttributes(r,e,i);this.makeDraggable(i)}};e.prototype.makeDraggable=function(e){interact_min(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,o,r,i,n,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);o=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);i=+(e.target.getAttribute("yScale")||1);n=e.dx/r+t;s=e.dy/i+o;e.target.setAttribute("posX",n);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(n,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,o,r,i,n,s,a,l,d,p,c,h,u,m,f,g,v,x,b,w,y,S,E,R,_;return __generator(this,(function(T){switch(T.label){case 0:r=e.target.getAttribute("name");i=+(e.target.getAttribute("option")||"0");n=this.fieldStore.get("fields").find((function(e){return e.name===r}));if(!n){console.log("[FIELDS] Unable to find field",r);return[2]}s=e.target.getAttribute("pageNumber");a=this.cachedPageInfo[s],l=a.naturalWidth,d=l===void 0?612:l,p=a.naturalHeight,c=p===void 0?792:p,h=a.renderedHeight,u=h===void 0?792:h;m=e.target.getBoundingClientRect();f=e.target.parentElement;g=f.getBoundingClientRect();v=n.setting.width||defaultWidth(n.type);x=n.setting.height||defaultHeight(n.type);b=Math.max(m.left-g.left,0);w=Math.max(u-(g.bottom-m.bottom),0);y=this.viewCoordinatesToPageCoordinates(b,w,s,d-v,c-x),S=y.x,E=y.y;switch(n.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":n.setting.x=S;n.setting.y=E;break;case"checkbox_group":case"radio_button_group":{R=n.setting.options[i];if(R){R.x=S;R.y=E}}break}console.log("[FIELDS] Will update",r,E,i,n);return[4,updateField(this.endpoint,this.templateId,r,n)];case 1:_=T.sent();updateStoreField(this.fieldStore,r,_);e.target.removeAttribute("posX");e.target.removeAttribute("posY");console.log("[FIELDS] Updated",r,_);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:(o=this.templateStore)===null||o===void 0?void 0:o.state,event:"updated-field"});return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var o=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(o);o++}while(this.fieldStore.get("fields").some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,o,r,i){var n=this.cachedPageInfo[o],s=n.xScale,a=s===void 0?1:s,l=n.yScale,d=l===void 0?1:l,p=n.renderedHeight,c=p===void 0?792:p;var h=Math.floor(Math.min(e/a,r));var u=Math.floor(Math.min(Math.max(c-t,0)/d,i));return{x:h,y:u}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var o,r,i,n,s,a,l,d,p,c,h,u,m,f,g,v;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];i=e.offsetX;n=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t];d=l.naturalWidth,p=d===void 0?612:d,c=l.naturalHeight,h=c===void 0?792:c;u=this.viewCoordinatesToPageCoordinates(i,n,t,p-s,h-a);m=Math.floor(u.x);f=Math.floor(u.y);g={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:true,page_sequence:t,validator:null,setting:{x:m,y:f},x:m,y:f,tabindex:0,width:s,height:a};console.log("[FIELDS] Will save new field",g);switch(g.type){case"attachment":case"payment":g.setting={x:m,y:f};break;case"initial":case"signature":g.setting={x:m,y:f,result:""};break;case"checkbox_group":g.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:"".concat(g.name,"-1"),value:"Option 1",checked:false,x:m,y:f}]};break;case"date":g.setting={x:m,y:f,width:s,height:a,result:""};break;case"dropdown":g.required=false;g.setting={x:m,y:f,width:s,height:a,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":g.setting={options:[{id:"".concat(g.name,"-1"),value:"Option 1",selected:false,x:m,y:f}]};break;case"textarea":case"textbox":g.setting={x:m,y:f,width:s,height:a,result:"",leading:0,alignment:0,upperCase:false};break;case"timestamp":g.setting={x:m,y:f,width:s,height:a};break}if(g.type==="textarea"){g.setting.leading=16;g.type="textbox"}return[4,createField(this.endpoint,this.templateId,g)];case 1:v=x.sent();console.log("[FIELDS] Saved field",v);this.fieldStore.set("fields",__spreadArray(__spreadArray([],this.fieldStore.get("fields"),true),[v],false));this.placing=null;this.reRenderField(v,t);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:(r=this.templateStore)===null||r===void 0?void 0:r.state,event:"added-field"});x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var o,r,i;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!((o=this.templateStore)===null||o===void 0?void 0:o.state.isLoaded)){return h(Host,null,h("verdocs-loader",null))}var n=this.roleStore.get("roles").map((function(e){return{value:e.name,label:e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((i=(r=this.templateStore)===null||r===void 0?void 0:r.state)===null||i===void 0?void 0:i.template_documents)||[]).map((function(e){var o=integerSequence(1,e.page_numbers);return o.map((function(o){return h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:o,virtualWidth:612,virtualHeight:792,onClick:function(e){return t.handleClickPage(e,o)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:this.roleStore.get("roles").length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;var verdocsTemplateRolePropertiesCss='verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';var TrashIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var VerdocsTemplateRoleProperties=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close",7);this.delete=createEvent(this,"delete",7);this.sdkError=createEvent(this,"sdkError",7);this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.roleName="";this.sender=TemplateSenderTypes.EVERYONE;this.dirty=false;this.saving=false;this.name="";this.type="signer";this.full_name="";this.email="";this.phone="";this.delegator=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r,i,n;var s=this;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLE_PROPERTIES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLE_PROPERTIES] Unable to start builder session, must be authenticated");return[2]}r=this;return[4,getTemplateStore(this.endpoint,this.templateId,false)];case 1:r.templateStore=a.sent();this.fieldStore=getTemplateFieldStore(this.templateId);this.roleStore=createTemplateRoleStore(this.templateStore.state);i=this.roleStore.state.roles.find((function(e){return e.name===s.roleName}));if(i){this.name=i.name;this.type=i.type;this.full_name=i.full_name;this.email=i.email;this.phone=i.phone;this.delegator=i.delegator;console.log("[ROLE_PROPERTIES] Editing role",i)}return[3,3];case 2:n=a.sent();console.log("[ROLE_PROPERTIES Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleCancel=function(e){var t=this;var o;e.stopPropagation();var r=this.roleStore.state.roles.find((function(e){return e.name===t.roleName}));if(r){this.name=r.name;this.type=r.type;this.full_name=r.full_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();this.saving=true;updateRole(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,full_name:this.full_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(o){console.log("[ROLE_PROPERTIES] Update result",e);this.saving=false;this.dirty=false;updateStoreRole(this.roleStore,this.roleName,e);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLE_PROPERTIES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){deleteRole(this.endpoint,this.templateId,this.roleName).then((function(){var e;deleteStoreRole(t.roleStore,t.roleName);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName})})).catch((function(e){console.log("[ROLE_PROPERTIES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t=this.fieldStore.get("fields").some((function(t){return t.role_name===e.roleName}));return h(Host,null,h("div",{class:"background-overlay",onClick:function(t){return e.handleCancel(t)}},h("div",{class:"dialog"},h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("verdocs-text-input",{id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:t,helpText:t?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),h("div",{class:"row"},h("div",{class:"input-label"},"Type:"),h("verdocs-select-input",{value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}}),h("verdocs-help-icon",{text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),h("verdocs-text-input",{id:"verdocs-recipient-email",label:"Full Name",value:this.full_name,autocomplete:"off",helpText:"The recipient's full name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Full Name...",onInput:function(t){e.full_name=t.target.value;e.dirty=true}}),h("verdocs-text-input",{id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),h("verdocs-text-input",{id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}),h("div",{class:"row"},h("div",{class:"input-label"},"May Delegate:"),h("div",{class:"checkbox-wrapper"},h("verdocs-checkbox",{checked:this.delegator,onInput:function(t){e.delegator=t.target.checked;e.dirty=true}})),h("verdocs-help-icon",{text:"If enabled, this recipient may delegate their actions to another individual."})),h("div",{class:"buttons"},h("button",{class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:TrashIcon}),h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:function(t){return e.handleCancel(t)}}),h("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:function(t){return e.handleSave(t)}}))))))};return e}();VerdocsTemplateRoleProperties.style=verdocsTemplateRolePropertiesCss;var verdocsTemplateRolesCss='verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:#654dcb7f;border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:#654dcb7f;-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var senderLabels=(_f={},_f[TemplateSenderTypes.EVERYONE]="Everyone",_f[TemplateSenderTypes.EVERYONE_AS_CREATOR]="Everyone as Me",_f[TemplateSenderTypes.ORGANIZATION_MEMBER]="Organization member",_f[TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR]="Organization Member as Me",_f[TemplateSenderTypes.CREATOR]="Me",_f);var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var startIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><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" fill="#00000089"><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" fill="#00000089"><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 plusIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var iconSigner='<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>';var iconApprover='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var iconCC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var VerdocsTemplateRoles=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.rolesUpdated=createEvent(this,"rolesUpdated",7);this.templateStore=null;this.roleStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.showingRoleDialog=null;this.showingSenderDialog=false;this.sender=null;this.loading=true}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r;var i=this;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}return[4,getTemplateStore(this.endpoint,this.templateId,false).then((function(e){var t;i.templateStore=e;i.roleStore=getTemplateRoleStore(i.templateId);console.log("RS",(t=i.roleStore)===null||t===void 0?void 0:t.state);i.roleStore.onChange("roles",(function(e){var t;console.log("[ROLES] Roles changed",{roles:e});(t=i.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"updated",endpoint:i.endpoint,templateId:i.templateId,roles:e});i.loading=false}))})).catch((function(e){console.log(e)}))];case 1:n.sent();return[3,3];case 2:r=n.sent();console.log("[FIELDS] Error with preview session",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,(o=r.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);interact_min(".recipient").draggable({listeners:{start:function e(t){t.target.classList.add("dragging");this.el.classList.add("dragging")}.bind(this),move:function e(t){var o=+(t.target.getAttribute("dX")||0);var r=+(t.target.getAttribute("dY")||0);var i=+(t.target.dataset["sequence"]||0);var n=+(t.target.dataset["order"]||0);var s=t.dx+o;var a=t.dy+r;t.target.setAttribute("dX",s);t.target.setAttribute("dY",a);var l=t.target.getBoundingClientRect();console.log("w",l.width);t.target.style.transform="translate(".concat(s+l.width-(n+1),"px, ").concat(a-l.height*i,"px)")}.bind(this),end:function e(t){t.target.classList.remove("dragging");this.el.classList.remove("dragging");t.target.removeAttribute("dX");t.target.removeAttribute("dY");t.target.style.transform=null}.bind(this)}});interact_min(".dropzone").dropzone({overlap:.05,ondrop:function e(t){return __awaiter(this,void 0,void 0,(function(){var e,o,r,i;return __generator(this,(function(n){switch(n.label){case 0:console.log("dropped",t.target.classList);t.target.classList.remove("active");o=t.relatedTarget.dataset.rolename;r=+t.target.dataset.sequence;i=+t.target.dataset.order;updateStoreRole(this.roleStore,o,{sequence:r,order:i});return[4,this.renumberTemplateRoles()];case 1:n.sent();console.log("[ROLES] Updated roles",this.getSortedRoles());(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}.bind(this),ondropactivate:function(e){e.target.classList.add("visible")},ondropdeactivate:function(e){e.target.classList.remove("visible")},ondragenter:function(e){e.target.classList.add("active")},ondragleave:function(e){e.target.classList.remove("active")}})};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){return this.roleStore.state.roles.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e=[];this.getSortedRoles().forEach((function(t){if(!e.includes(t.sequence)){e.push(t.sequence)}}));return e.sort((function(e,t){return e-t}))};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){return this.roleStore.state.roles.filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){var e=this;console.log("Renumbering roles",this.getSequenceNumbers(),JSON.stringify(this.roleStore.state));var t=[];var o=[];this.getSequenceNumbers().forEach((function(r,i){e.getRolesAtSequence(r).forEach((function(r,n){if(!t.includes(r.name)){r.sequence=i+1;r.order=n+1;t.push(r.name);o.push(updateRole(e.endpoint,e.templateId,r.name,{sequence:r.sequence,order:r.order}))}}))}));return Promise.all(o)};e.prototype.getNextRoleName=function(){console.log("Getting next role name",JSON.stringify(this.roleStore.state));var e="";var t=Object.keys(this.roleStore.state).length-1;do{t++;e="Recipient ".concat(t)}while(!e||this.roleStore.state.roles.some((function(t){return t&&t.name===e})));return e};e.prototype.callCreateRole=function(e,t,o){var r=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:o});createRole(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,order:o,full_name:"",email:"",phone:"",type:"signer",delegator:false}).then((function(e){return __awaiter(r,void 0,void 0,(function(){var t;return __generator(this,(function(o){switch(o.label){case 0:console.log("[ROLES] Created role",e);this.roleStore.set("roles",__spreadArray(__spreadArray([],this.roleStore.state.roles,true),[e],false));return[4,this.renumberTemplateRoles()];case 1:o.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var o=this.getRolesAtSequence(t).length+1;var r=this.getNextRoleName();this.callCreateRole(r,t,o)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var o=1;var r=this.getNextRoleName();this.callCreateRole(r,t,o)};e.prototype.render=function(){var e=this;var t,o,r;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!((t=this.templateStore)===null||t===void 0?void 0:t.state.isLoaded)){return h(Host,{class:"loading"},h("verdocs-loader",null))}console.log("Rendering roles",this.roleStore.get("roles"));var i=this.getRoleNames();var n=this.getSequenceNumbers();console.log("Rendering",i,n);return h(Host,null,h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Roles and Workflow"),h("div",{class:"participants"},h("div",{class:"left-line"}),h("div",{class:"row"},h("div",{class:"icon",innerHTML:startIcon}),h("div",{class:"row-roles"},h("div",{class:"sender"},h("span",{class:"label"},"Sender:")," ",senderLabels[(r=(o=this.templateStore)===null||o===void 0?void 0:o.state)===null||r===void 0?void 0:r.sender]," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingSenderDialog=true},"aria-role":"button"})))),h("div",{class:"row add-sequence","data-sequence":0},h("div",{class:"icon",innerHTML:plusIcon}),h("div",{class:"row-roles"},h("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),n.map((function(t){return h(Fragment,null,h("div",{class:"row"},h("div",{class:"icon",innerHTML:stepIcon}),h("div",{class:"row-roles"},h("div",{class:"dropzone","data-order":.5,"data-sequence":t}),e.getRolesAtSequence(t).map((function(o){var r=!o.email;return r?h(Fragment,null,h("div",{class:"recipient",style:{backgroundColor:getRGBA(getRoleIndex(e.roleStore,o.name))},"data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}),o.name," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"})),h("div",{class:"dropzone","data-order":o.order+.5,"data-sequence":t})):h(Fragment,null,h("div",{class:"recipient",style:{borderColor:getRGBA(getRoleIndex(e.roleStore,o.name))},"data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}),o.full_name," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"})),h("div",{class:"dropzone","data-order":o.order+.5,"data-sequence":t}))})),h("button",{class:"add-role",innerHTML:plusIcon,onClick:function(o){return e.handleAddRole(o,t)}}))),n.length>0&&h("div",{class:"row add-sequence","data-sequence":t},h("div",{class:"row-roles"},h("div",{class:"icon",innerHTML:plusIcon}),h("div",{class:"dropzone","data-sequence":t+1,"data-order":1},"Add Step"))))})),h("div",{class:"row","data-sequence":n.length+1},h("div",{class:"row-roles"},h("div",{class:"icon",innerHTML:plusIcon}),h("button",{class:"add-step",innerHTML:plusIcon,onClick:function(t){return e.handleAddStep(t,n.length+1)}}))),h("div",{class:"row"},h("div",{class:"icon",innerHTML:doneIcon}),h("div",{class:"row-roles"},h("div",{class:"complete"},"Document Complete")))),i.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:function(){return e.handleCancel()}}),h("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:i.length<1}))),this.showingRoleDialog&&h("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}}),this.showingSenderDialog&&h("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:function(){return e.showingSenderDialog=false}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateRoles.style=verdocsTemplateRolesCss;var verdocsTemplateSenderCss='verdocs-template-sender{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender .background-overlay{position:absolute;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-template-sender .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-sender .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-sender .buttons verdocs-button{margin-left:16px}verdocs-template-sender .options{row-gap:10px}verdocs-template-sender .options .option{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .options .option .description{margin-left:10px}verdocs-template-sender .options .option .description .name{display:inline-block;vertical-align:top;margin-top:4px;margin-right:4px}';var VerdocsTemplateSender=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close",7);this.sdkError=createEvent(this,"sdkError",7);this.store=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.sender=TemplateSenderTypes.EVERYONE;this.saving=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r,i,n,s;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[SENDER] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[SENDER] Unable to start builder session, must be authenticated");return[2]}n=this;return[4,getTemplateStore(this.endpoint,this.templateId,false)];case 1:n.store=a.sent();this.sender=(t=(e=this.store)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.sender;return[3,3];case 2:s=a.sent();console.log("[SENDER] Error with preview session",s);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new SDKError(s.message,(r=s.response)===null||r===void 0?void 0:r.status,(i=s.response)===null||i===void 0?void 0:i.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleClose=function(){this.close.emit()};e.prototype.handleDismiss=function(e){if(e.target.className==="background-overlay"){e.preventDefault();this.handleClose()}};e.prototype.handleSelectSetting=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.saving=true;updateTemplate(this.endpoint,this.templateId,{sender:e}).then((function(o){var r;console.log("Update result",o);if((r=t.store)===null||r===void 0?void 0:r.state){t.store.state.sender=e}t.saving=false;t.sender=e})).catch((function(e){console.log("Error saving",e);t.saving=false}));return[2]}))}))};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"background-overlay",onClick:function(t){return e.handleDismiss(t)}},h("div",{class:"dialog"},h("div",{class:"options"},h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.EVERYONE,checked:this.sender===TemplateSenderTypes.EVERYONE,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.EVERYONE)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone on the Web"),h("verdocs-help-icon",{text:"Anyone can use this template. (Make its visibility is set to to 'Public' or 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.EVERYONE_AS_CREATOR,checked:this.sender===TemplateSenderTypes.EVERYONE_AS_CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.EVERYONE_AS_CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone on the Web as me"),h("verdocs-help-icon",{text:"Anyone can use this template on my behalf. (Make sure its visibility is set to 'Public' or 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.ORGANIZATION_MEMBER,checked:this.sender===TemplateSenderTypes.ORGANIZATION_MEMBER,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.ORGANIZATION_MEMBER)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone in my organization"),h("verdocs-help-icon",{text:"Anyone in my organization can use this template. (Make sure its visibility is set to 'Shared')"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR,checked:this.sender===TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone in my organization as me"),h("verdocs-help-icon",{text:"Anyone in my organization can use this template on my behalf. (Make sure its visibility is set to to 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.CREATOR,checked:this.sender===TemplateSenderTypes.CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Me"),h("verdocs-help-icon",{text:"Only I can use this template."})))),h("div",{class:"buttons"},h("verdocs-button",{label:"Close",onClick:function(){return e.handleClose()}})))))};return e}();VerdocsTemplateSender.style=verdocsTemplateSenderCss;export{VerdocsTemplateFields as verdocs_template_fields,VerdocsTemplateRoleProperties as verdocs_template_role_properties,VerdocsTemplateRoles as verdocs_template_roles,VerdocsTemplateSender as verdocs_template_sender};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,r){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r["throw"](e))}catch(e){n(e)}}function l(e){e.done?o(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,i,n,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,i&&(n=s[0]&2?i["return"]:s[0]?i["throw"]||((n=i["return"])&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;if(i=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;i=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(n=o.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(s[0]===6&&o.label<n[1]){o.label=n[1];n=s;break}if(n&&o.label<n[2]){o.label=n[2];o.ops.push(s);break}if(n[2])o.ops.pop();o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e];i=0}finally{r=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,o){if(o||arguments.length===2)for(var r=0,i=t.length,n;r<i;r++){if(n||!(r in t)){if(!n)n=Array.prototype.slice.call(t,0,r);n[r]=t[r]}}return e.concat(n||Array.prototype.slice.call(t))};var _f;import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,a as getElement}from"./index-172625c5.js";import{i as interact_min}from"./interact.min-6a7b19a1.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint,T as TemplateSenderTypes,u as updateTemplate}from"./VerdocsEndpoint-56fa3371.js";import{u as updateField,c as createField}from"./Fields-c82e6df3.js";import{i as integerSequence}from"./Primitives-8fe93caf.js";import{g as getTemplateFieldStore,u as updateStoreField}from"./TemplateFieldStore-76da1f7c.js";import{r as renderDocumentField,e as updateCssTransform,f as defaultWidth,h as defaultHeight}from"./utils-d081a2b9.js";import{g as getTemplateRoleStore,c as createTemplateRoleStore,u as updateStoreRole,d as deleteStoreRole,a as getRoleIndex}from"./TemplateRoleStore-8c34bafd.js";import{g as getTemplateStore}from"./TemplateStore-0804c8ee.js";import{S as SDKError}from"./errors-9b5498c8.js";import{g as getRGBA}from"./Colors-1b298092.js";import"./_commonjsHelpers-8a9f3b18.js";import"./index-4439b0d1.js";import"./Envelopes-627c5239.js";import"./Files-70a192df.js";import"./Types-1628dc71.js";import"./index-914ed6f7.js";var createRole=function(e,t,o){return e.api.post("/templates/".concat(t,"/roles"),o).then((function(e){return e.data}))};var updateRole=function(e,t,o,r){return e.api.put("/templates/".concat(t,"/roles/").concat(o),r).then((function(e){return e.data}))};var deleteRole=function(e,t,o){return e.api.delete("/templates/".concat(t,"/roles/").concat(o)).then((function(e){return e.data}))};var verdocsTemplateFieldsCss="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px #0000000f;box-shadow:0 0 10px 5px #0000000f}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' 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'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' 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' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath 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'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var iconTextbox='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var iconTextarea='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var 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>';var 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>';var 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>';var iconTimestamp='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="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>';var 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>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature},{id:"initial",tooltip:"Initials",icon:iconInitial},{id:"sep1",tooltip:"",icon:separator},{id:"textbox",tooltip:"Text Box",icon:iconTextbox},{id:"textarea",tooltip:"Text Area",icon:iconTextarea},{id:"checkbox_group",tooltip:"Check Box",icon:iconCheck},{id:"radio_button_group",tooltip:"Radio Button",icon:iconRadio},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown},{id:"sep2",tooltip:"",icon:separator},{id:"date",tooltip:"Date",icon:iconDatepicker},{id:"timestamp",tooltip:"Timestamp",icon:iconTimestamp}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.templateUpdated=createEvent(this,"templateUpdated",7);this.fieldsUpdated=createEvent(this,"fieldsUpdated",7);this.pageHeights={};this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.cachedPageInfo={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o;var r=this;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}getTemplateStore(this.endpoint,this.templateId,true).then((function(e){var t,o,i,n;r.templateStore=e;console.log("[PREVIEW] Loaded Template Store",e.state);r.fieldStore=getTemplateFieldStore(r.templateId);r.roleStore=getTemplateRoleStore(r.templateId);r.selectedRoleName=((o=(t=r.roleStore.get("roles"))===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.name)||"";console.log("Sel role",r.selectedRoleName);console.log("RS",(i=r.roleStore)===null||i===void 0?void 0:i.state);console.log("FS",(n=r.fieldStore)===null||n===void 0?void 0:n.state);console.log("[PREVIEW] Loaded template",r.templateStore.state,r.roleStore.get("roles"),r.fieldStore.get("fields"));r.loading=false;r.fieldStore.onChange("fields",(function(e){var t;console.log("[FIELDS] Fields changed",{fields:e});(t=r.fieldsUpdated)===null||t===void 0?void 0:t.emit({event:"updated",endpoint:r.endpoint,templateId:r.templateId,fields:e})}))})).catch((function(e){console.log(e)}))}catch(r){console.log("[FIELDS] Error with preview session",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,(o=r.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t;var o=this.roleStore.get("roles");if(!this.selectedRoleName||!o.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((t=o[0])===null||t===void 0?void 0:t.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldChange=function(e,t,o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){console.log("[FIELDS] handleFieldChange",e,t,o);return[2]}))}))};e.prototype.attachFieldAttributes=function(e,t,o){var r=this;o.addEventListener("input",(function(e){return r.handleFieldChange(t,e)}));o.addEventListener("settingsChanged",(function(){var e,t;(e=r.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:r.endpoint,template:(t=r.templateStore)===null||t===void 0?void 0:t.state,event:"added-field"})}));o.addEventListener("deleted",(function(){var e,i;console.log("[FIELDS] Deleted",r,t);o.remove();(e=r.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:r.endpoint,template:(i=r.templateStore)===null||i===void 0?void 0:i.state,event:"updated-field"})}));o.setAttribute("templateid",this.templateId);o.setAttribute("fieldname",t.name);o.setAttribute("pageNumber",e.pageNumber);o.setAttribute("xScale",e.xScale);o.setAttribute("yScale",e.yScale);o.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var o=e.detail;this.cachedPageInfo[o.pageNumber]=o;this.pageHeights[o.pageNumber]=o.naturalHeight;var r=this.fieldStore.get("fields").filter((function(e){return e&&e.page_sequence===o.pageNumber}));console.log("[FIELDS] Page rendered",o,r);r.forEach((function(e){return t.reRenderField(e,o.pageNumber)}))};e.prototype.reRenderField=function(e,t){var o=this;var r=this.cachedPageInfo[t];var i=renderDocumentField(e,r,{disabled:true,editable:true,draggable:true});if(!i){return}if(Array.isArray(i)){i.forEach((function(t){o.attachFieldAttributes(r,e,t);o.makeDraggable(t)}))}else{this.attachFieldAttributes(r,e,i);this.makeDraggable(i)}};e.prototype.makeDraggable=function(e){interact_min(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,o,r,i,n,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);o=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);i=+(e.target.getAttribute("yScale")||1);n=e.dx/r+t;s=e.dy/i+o;e.target.setAttribute("posX",n);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(n,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,o,r,i,n,s,a,l,d,p,c,h,u,m,f,g,v,x,b,w,y,S,E,R,_;return __generator(this,(function(T){switch(T.label){case 0:r=e.target.getAttribute("name");i=+(e.target.getAttribute("option")||"0");n=this.fieldStore.get("fields").find((function(e){return e.name===r}));if(!n){console.log("[FIELDS] Unable to find field",r);return[2]}s=e.target.getAttribute("pageNumber");a=this.cachedPageInfo[s],l=a.naturalWidth,d=l===void 0?612:l,p=a.naturalHeight,c=p===void 0?792:p,h=a.renderedHeight,u=h===void 0?792:h;m=e.target.getBoundingClientRect();f=e.target.parentElement;g=f.getBoundingClientRect();v=n.setting.width||defaultWidth(n.type);x=n.setting.height||defaultHeight(n.type);b=Math.max(m.left-g.left,0);w=Math.max(u-(g.bottom-m.bottom),0);y=this.viewCoordinatesToPageCoordinates(b,w,s,d-v,c-x),S=y.x,E=y.y;switch(n.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":n.setting.x=S;n.setting.y=E;break;case"checkbox_group":case"radio_button_group":{R=n.setting.options[i];if(R){R.x=S;R.y=E}}break}console.log("[FIELDS] Will update",r,E,i,n);return[4,updateField(this.endpoint,this.templateId,r,n)];case 1:_=T.sent();updateStoreField(this.fieldStore,r,_);e.target.removeAttribute("posX");e.target.removeAttribute("posY");console.log("[FIELDS] Updated",r,_);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:(o=this.templateStore)===null||o===void 0?void 0:o.state,event:"updated-field"});return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var o=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(o);o++}while(this.fieldStore.get("fields").some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,o,r,i){var n=this.cachedPageInfo[o],s=n.xScale,a=s===void 0?1:s,l=n.yScale,d=l===void 0?1:l,p=n.renderedHeight,c=p===void 0?792:p;var h=Math.floor(Math.min(e/a,r));var u=Math.floor(Math.min(Math.max(c-t,0)/d,i));return{x:h,y:u}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var o,r,i,n,s,a,l,d,p,c,h,u,m,f,g,v;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];i=e.offsetX;n=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t];d=l.naturalWidth,p=d===void 0?612:d,c=l.naturalHeight,h=c===void 0?792:c;u=this.viewCoordinatesToPageCoordinates(i,n,t,p-s,h-a);m=Math.floor(u.x);f=Math.floor(u.y);g={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:true,page_sequence:t,validator:null,setting:{x:m,y:f},x:m,y:f,tabindex:0,width:s,height:a};console.log("[FIELDS] Will save new field",g);switch(g.type){case"attachment":case"payment":g.setting={x:m,y:f};break;case"initial":case"signature":g.setting={x:m,y:f,result:""};break;case"checkbox_group":g.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:"".concat(g.name,"-1"),value:"Option 1",checked:false,x:m,y:f}]};break;case"date":g.setting={x:m,y:f,width:s,height:a,result:""};break;case"dropdown":g.required=false;g.setting={x:m,y:f,width:s,height:a,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":g.setting={options:[{id:"".concat(g.name,"-1"),value:"Option 1",selected:false,x:m,y:f}]};break;case"textarea":case"textbox":g.setting={x:m,y:f,width:s,height:a,result:"",leading:0,alignment:0,upperCase:false};break;case"timestamp":g.setting={x:m,y:f,width:s,height:a};break}if(g.type==="textarea"){g.setting.leading=16;g.type="textbox"}return[4,createField(this.endpoint,this.templateId,g)];case 1:v=x.sent();console.log("[FIELDS] Saved field",v);this.fieldStore.set("fields",__spreadArray(__spreadArray([],this.fieldStore.get("fields"),true),[v],false));this.placing=null;this.reRenderField(v,t);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:(r=this.templateStore)===null||r===void 0?void 0:r.state,event:"added-field"});x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var o,r,i;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!((o=this.templateStore)===null||o===void 0?void 0:o.state.isLoaded)){return h(Host,null,h("verdocs-loader",null))}var n=this.roleStore.get("roles").map((function(e){return{value:e.name,label:e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((i=(r=this.templateStore)===null||r===void 0?void 0:r.state)===null||i===void 0?void 0:i.template_documents)||[]).map((function(e){var o=integerSequence(1,e.page_numbers);return o.map((function(o){return h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:o,virtualWidth:612,virtualHeight:792,onClick:function(e){return t.handleClickPage(e,o)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:this.roleStore.get("roles").length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;var verdocsTemplateRolePropertiesCss='verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';var TrashIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var VerdocsTemplateRoleProperties=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close",7);this.delete=createEvent(this,"delete",7);this.sdkError=createEvent(this,"sdkError",7);this.templateStore=null;this.fieldStore=null;this.roleStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.roleName="";this.sender=TemplateSenderTypes.EVERYONE;this.dirty=false;this.saving=false;this.name="";this.type="signer";this.full_name="";this.email="";this.phone="";this.delegator=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r,i,n;var s=this;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLE_PROPERTIES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLE_PROPERTIES] Unable to start builder session, must be authenticated");return[2]}r=this;return[4,getTemplateStore(this.endpoint,this.templateId,false)];case 1:r.templateStore=a.sent();this.fieldStore=getTemplateFieldStore(this.templateId);this.roleStore=createTemplateRoleStore(this.templateStore.state);i=this.roleStore.state.roles.find((function(e){return e.name===s.roleName}));if(i){this.name=i.name;this.type=i.type;this.full_name=i.full_name;this.email=i.email;this.phone=i.phone;this.delegator=i.delegator;console.log("[ROLE_PROPERTIES] Editing role",i)}return[3,3];case 2:n=a.sent();console.log("[ROLE_PROPERTIES Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleCancel=function(e){var t=this;var o;e.stopPropagation();var r=this.roleStore.state.roles.find((function(e){return e.name===t.roleName}));if(r){this.name=r.name;this.type=r.type;this.full_name=r.full_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();this.saving=true;updateRole(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,full_name:this.full_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(o){console.log("[ROLE_PROPERTIES] Update result",e);this.saving=false;this.dirty=false;updateStoreRole(this.roleStore,this.roleName,e);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLE_PROPERTIES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){deleteRole(this.endpoint,this.templateId,this.roleName).then((function(){var e;deleteStoreRole(t.roleStore,t.roleName);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName})})).catch((function(e){console.log("[ROLE_PROPERTIES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t=this.fieldStore.get("fields").some((function(t){return t.role_name===e.roleName}));return h(Host,null,h("div",{class:"background-overlay",onClick:function(t){return e.handleCancel(t)}},h("div",{class:"dialog"},h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("verdocs-text-input",{id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:t,helpText:t?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),h("div",{class:"row"},h("div",{class:"input-label"},"Type:"),h("verdocs-select-input",{value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}}),h("verdocs-help-icon",{text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),h("verdocs-text-input",{id:"verdocs-recipient-email",label:"Full Name",value:this.full_name,autocomplete:"off",helpText:"The recipient's full name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Full Name...",onInput:function(t){e.full_name=t.target.value;e.dirty=true}}),h("verdocs-text-input",{id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),h("verdocs-text-input",{id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}),h("div",{class:"row"},h("div",{class:"input-label"},"May Delegate:"),h("div",{class:"checkbox-wrapper"},h("verdocs-checkbox",{checked:this.delegator,onInput:function(t){e.delegator=t.target.checked;e.dirty=true}})),h("verdocs-help-icon",{text:"If enabled, this recipient may delegate their actions to another individual."})),h("div",{class:"buttons"},h("button",{class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:TrashIcon}),h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:function(t){return e.handleCancel(t)}}),h("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:function(t){return e.handleSave(t)}}))))))};return e}();VerdocsTemplateRoleProperties.style=verdocsTemplateRolePropertiesCss;var verdocsTemplateRolesCss='verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:#654dcb7f;border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:#654dcb7f;-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var senderLabels=(_f={},_f[TemplateSenderTypes.EVERYONE]="Everyone",_f[TemplateSenderTypes.EVERYONE_AS_CREATOR]="Everyone as Me",_f[TemplateSenderTypes.ORGANIZATION_MEMBER]="Organization member",_f[TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR]="Organization Member as Me",_f[TemplateSenderTypes.CREATOR]="Me",_f);var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var startIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><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" fill="#00000089"><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" fill="#00000089"><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 plusIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var iconSigner='<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>';var iconApprover='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var iconCC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var VerdocsTemplateRoles=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.rolesUpdated=createEvent(this,"rolesUpdated",7);this.templateStore=null;this.roleStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.showingRoleDialog=null;this.showingSenderDialog=false;this.sender=null;this.loading=true}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r;var i=this;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}return[4,getTemplateStore(this.endpoint,this.templateId,false).then((function(e){var t;i.templateStore=e;i.roleStore=getTemplateRoleStore(i.templateId);console.log("RS",(t=i.roleStore)===null||t===void 0?void 0:t.state);i.loading=false;i.roleStore.onChange("roles",(function(e){var t;console.log("[ROLES] Roles changed",{roles:e});(t=i.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"updated",endpoint:i.endpoint,templateId:i.templateId,roles:e})}))})).catch((function(e){console.log(e)}))];case 1:n.sent();return[3,3];case 2:r=n.sent();console.log("[FIELDS] Error with preview session",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,(o=r.response)===null||o===void 0?void 0:o.data));return[3,3];case 3:return[2]}}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);interact_min(".recipient").draggable({listeners:{start:function e(t){t.target.classList.add("dragging");this.el.classList.add("dragging")}.bind(this),move:function e(t){var o=+(t.target.getAttribute("dX")||0);var r=+(t.target.getAttribute("dY")||0);var i=+(t.target.dataset["sequence"]||0);var n=+(t.target.dataset["order"]||0);var s=t.dx+o;var a=t.dy+r;t.target.setAttribute("dX",s);t.target.setAttribute("dY",a);var l=t.target.getBoundingClientRect();console.log("w",l.width);t.target.style.transform="translate(".concat(s+l.width-(n+1),"px, ").concat(a-l.height*i,"px)")}.bind(this),end:function e(t){t.target.classList.remove("dragging");this.el.classList.remove("dragging");t.target.removeAttribute("dX");t.target.removeAttribute("dY");t.target.style.transform=null}.bind(this)}});interact_min(".dropzone").dropzone({overlap:.05,ondrop:function e(t){return __awaiter(this,void 0,void 0,(function(){var e,o,r,i;return __generator(this,(function(n){switch(n.label){case 0:console.log("dropped",t.target.classList);t.target.classList.remove("active");o=t.relatedTarget.dataset.rolename;r=+t.target.dataset.sequence;i=+t.target.dataset.order;updateStoreRole(this.roleStore,o,{sequence:r,order:i});return[4,this.renumberTemplateRoles()];case 1:n.sent();console.log("[ROLES] Updated roles",this.getSortedRoles());(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}.bind(this),ondropactivate:function(e){e.target.classList.add("visible")},ondropdeactivate:function(e){e.target.classList.remove("visible")},ondragenter:function(e){e.target.classList.add("active")},ondragleave:function(e){e.target.classList.remove("active")}})};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){return this.roleStore.state.roles.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e=[];this.getSortedRoles().forEach((function(t){if(!e.includes(t.sequence)){e.push(t.sequence)}}));return e.sort((function(e,t){return e-t}))};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){return this.roleStore.state.roles.filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){var e=this;console.log("Renumbering roles",this.getSequenceNumbers(),JSON.stringify(this.roleStore.state));var t=[];var o=[];this.getSequenceNumbers().forEach((function(r,i){e.getRolesAtSequence(r).forEach((function(r,n){if(!t.includes(r.name)){r.sequence=i+1;r.order=n+1;t.push(r.name);o.push(updateRole(e.endpoint,e.templateId,r.name,{sequence:r.sequence,order:r.order}))}}))}));return Promise.all(o)};e.prototype.getNextRoleName=function(){console.log("Getting next role name",JSON.stringify(this.roleStore.state));var e="";var t=Object.keys(this.roleStore.state).length-1;do{t++;e="Recipient ".concat(t)}while(!e||this.roleStore.state.roles.some((function(t){return t&&t.name===e})));return e};e.prototype.callCreateRole=function(e,t,o){var r=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:o});createRole(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,order:o,full_name:"",email:"",phone:"",type:"signer",delegator:false}).then((function(e){return __awaiter(r,void 0,void 0,(function(){var t;return __generator(this,(function(o){switch(o.label){case 0:console.log("[ROLES] Created role",e);this.roleStore.set("roles",__spreadArray(__spreadArray([],this.roleStore.state.roles,true),[e],false));return[4,this.renumberTemplateRoles()];case 1:o.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var o=this.getRolesAtSequence(t).length+1;var r=this.getNextRoleName();this.callCreateRole(r,t,o)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var o=1;var r=this.getNextRoleName();this.callCreateRole(r,t,o)};e.prototype.render=function(){var e=this;var t,o,r,i;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!((t=this.templateStore)===null||t===void 0?void 0:t.state.isLoaded)){console.log("Loading",this.loading,(o=this.templateStore)===null||o===void 0?void 0:o.state.isLoaded);return h(Host,{class:"loading"},h("verdocs-loader",null))}console.log("Rendering roles",this.roleStore.get("roles"));var n=this.getRoleNames();var s=this.getSequenceNumbers();console.log("Rendering",n,s);return h(Host,null,h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Roles and Workflow"),h("div",{class:"participants"},h("div",{class:"left-line"}),h("div",{class:"row"},h("div",{class:"icon",innerHTML:startIcon}),h("div",{class:"row-roles"},h("div",{class:"sender"},h("span",{class:"label"},"Sender:")," ",senderLabels[(i=(r=this.templateStore)===null||r===void 0?void 0:r.state)===null||i===void 0?void 0:i.sender]," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingSenderDialog=true},"aria-role":"button"})))),h("div",{class:"row add-sequence","data-sequence":0},h("div",{class:"icon",innerHTML:plusIcon}),h("div",{class:"row-roles"},h("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),s.map((function(t){return h(Fragment,null,h("div",{class:"row"},h("div",{class:"icon",innerHTML:stepIcon}),h("div",{class:"row-roles"},h("div",{class:"dropzone","data-order":.5,"data-sequence":t}),e.getRolesAtSequence(t).map((function(o){var r=!o.email;return r?h(Fragment,null,h("div",{class:"recipient",style:{backgroundColor:getRGBA(getRoleIndex(e.roleStore,o.name))},"data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}),o.name," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"})),h("div",{class:"dropzone","data-order":o.order+.5,"data-sequence":t})):h(Fragment,null,h("div",{class:"recipient",style:{borderColor:getRGBA(getRoleIndex(e.roleStore,o.name))},"data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}),o.full_name," ",h("div",{class:"settings-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"})),h("div",{class:"dropzone","data-order":o.order+.5,"data-sequence":t}))})),h("button",{class:"add-role",innerHTML:plusIcon,onClick:function(o){return e.handleAddRole(o,t)}}))),s.length>0&&h("div",{class:"row add-sequence","data-sequence":t},h("div",{class:"row-roles"},h("div",{class:"icon",innerHTML:plusIcon}),h("div",{class:"dropzone","data-sequence":t+1,"data-order":1},"Add Step"))))})),h("div",{class:"row","data-sequence":s.length+1},h("div",{class:"row-roles"},h("div",{class:"icon",innerHTML:plusIcon}),h("button",{class:"add-step",innerHTML:plusIcon,onClick:function(t){return e.handleAddStep(t,s.length+1)}}))),h("div",{class:"row"},h("div",{class:"icon",innerHTML:doneIcon}),h("div",{class:"row-roles"},h("div",{class:"complete"},"Document Complete")))),n.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:function(){return e.handleCancel()}}),h("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:n.length<1}))),this.showingRoleDialog&&h("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}}),this.showingSenderDialog&&h("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:function(){return e.showingSenderDialog=false}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateRoles.style=verdocsTemplateRolesCss;var verdocsTemplateSenderCss='verdocs-template-sender{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-sender .background-overlay{position:absolute;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-template-sender .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-sender .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-sender .buttons verdocs-button{margin-left:16px}verdocs-template-sender .options{row-gap:10px}verdocs-template-sender .options .option{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-sender .options .option .description{margin-left:10px}verdocs-template-sender .options .option .description .name{display:inline-block;vertical-align:top;margin-top:4px;margin-right:4px}';var VerdocsTemplateSender=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close",7);this.sdkError=createEvent(this,"sdkError",7);this.store=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.sender=TemplateSenderTypes.EVERYONE;this.saving=false}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,r,i,n,s;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);this.endpoint.loadSession();if(!this.templateId){console.log("[SENDER] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[SENDER] Unable to start builder session, must be authenticated");return[2]}n=this;return[4,getTemplateStore(this.endpoint,this.templateId,false)];case 1:n.store=a.sent();this.sender=(t=(e=this.store)===null||e===void 0?void 0:e.state)===null||t===void 0?void 0:t.sender;return[3,3];case 2:s=a.sent();console.log("[SENDER] Error with preview session",s);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new SDKError(s.message,(r=s.response)===null||r===void 0?void 0:r.status,(i=s.response)===null||i===void 0?void 0:i.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleClose=function(){this.close.emit()};e.prototype.handleDismiss=function(e){if(e.target.className==="background-overlay"){e.preventDefault();this.handleClose()}};e.prototype.handleSelectSetting=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.saving=true;updateTemplate(this.endpoint,this.templateId,{sender:e}).then((function(o){var r;console.log("Update result",o);if((r=t.store)===null||r===void 0?void 0:r.state){t.store.state.sender=e}t.saving=false;t.sender=e})).catch((function(e){console.log("Error saving",e);t.saving=false}));return[2]}))}))};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"background-overlay",onClick:function(t){return e.handleDismiss(t)}},h("div",{class:"dialog"},h("div",{class:"options"},h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.EVERYONE,checked:this.sender===TemplateSenderTypes.EVERYONE,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.EVERYONE)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone on the Web"),h("verdocs-help-icon",{text:"Anyone can use this template. (Make its visibility is set to to 'Public' or 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.EVERYONE_AS_CREATOR,checked:this.sender===TemplateSenderTypes.EVERYONE_AS_CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.EVERYONE_AS_CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone on the Web as me"),h("verdocs-help-icon",{text:"Anyone can use this template on my behalf. (Make sure its visibility is set to 'Public' or 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.ORGANIZATION_MEMBER,checked:this.sender===TemplateSenderTypes.ORGANIZATION_MEMBER,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.ORGANIZATION_MEMBER)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone in my organization"),h("verdocs-help-icon",{text:"Anyone in my organization can use this template. (Make sure its visibility is set to 'Shared')"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR,checked:this.sender===TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.ORGANIZATION_MEMBER_AS_CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Anyone in my organization as me"),h("verdocs-help-icon",{text:"Anyone in my organization can use this template on my behalf. (Make sure its visibility is set to to 'Shared'.)"}))),h("div",{class:"option"},h("verdocs-radio-button",{name:"template-sender",value:TemplateSenderTypes.CREATOR,checked:this.sender===TemplateSenderTypes.CREATOR,onInput:function(){return e.handleSelectSetting(TemplateSenderTypes.CREATOR)}}),h("div",{class:"description"},h("div",{class:"name"},"Me"),h("verdocs-help-icon",{text:"Only I can use this template."})))),h("div",{class:"buttons"},h("verdocs-button",{label:"Close",onClick:function(){return e.handleClose()}})))))};return e}();VerdocsTemplateSender.style=verdocsTemplateSenderCss;export{VerdocsTemplateFields as verdocs_template_fields,VerdocsTemplateRoleProperties as verdocs_template_role_properties,VerdocsTemplateRoles as verdocs_template_roles,VerdocsTemplateSender as verdocs_template_sender};