@verdocs/web-sdk 5.0.15 → 5.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +14 -15
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +1 -7
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +13 -14
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map +1 -1
- package/dist/components/{p-365da85d.js → p-78043e4b.js} +15 -16
- package/dist/components/p-78043e4b.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/custom-elements.json +2156 -0
- package/dist/esm/verdocs-preview_6.entry.js +14 -15
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-5b8306f7.system.entry.js → p-99d5305a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-99d5305a.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-da8389c3.entry.js → p-d8d279a8.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-d8d279a8.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-365da85d.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5b8306f7.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-da8389c3.entry.js.map +0 -1
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css
CHANGED
@@ -175,14 +175,8 @@ verdocs-template-roles .empty svg {
|
|
175
175
|
margin-bottom: 2px;
|
176
176
|
display: inline-block;
|
177
177
|
}
|
178
|
-
verdocs-template-roles
|
179
|
-
verdocs-template-roles.dragging .roles .sequence.add-sequence .add-step-label {
|
180
|
-
display: none;
|
181
|
-
}
|
182
|
-
verdocs-template-roles.dragging .roles .sequence.add-sequence .sequence-roles {
|
178
|
+
verdocs-template-roles .sequence-roles {
|
183
179
|
display: flex;
|
184
|
-
min-width: 150px;
|
185
|
-
background: #e0e0e0;
|
186
180
|
}
|
187
181
|
verdocs-template-roles ::placeholder {
|
188
182
|
color: #aaaaaa;
|
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js
CHANGED
@@ -43,6 +43,7 @@ export class VerdocsTemplateRoles {
|
|
43
43
|
async componentWillLoad() {
|
44
44
|
var _a, _b, _c;
|
45
45
|
try {
|
46
|
+
VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');
|
46
47
|
this.endpoint.loadSession();
|
47
48
|
if (!this.templateId) {
|
48
49
|
console.log(`[ROLES] Missing required template ID ${this.templateId}`);
|
@@ -55,7 +56,7 @@ export class VerdocsTemplateRoles {
|
|
55
56
|
this.listenToTemplate();
|
56
57
|
}
|
57
58
|
catch (e) {
|
58
|
-
console.log('[
|
59
|
+
console.log('[ROLES] Error with preview session', e);
|
59
60
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
60
61
|
}
|
61
62
|
}
|
@@ -76,7 +77,7 @@ export class VerdocsTemplateRoles {
|
|
76
77
|
});
|
77
78
|
}
|
78
79
|
});
|
79
|
-
const el = document.getElementById(`verdocs-roles-sequence
|
80
|
+
const el = document.getElementById(`verdocs-roles-sequence-add-target`);
|
80
81
|
if (el) {
|
81
82
|
new Sortable(el, {
|
82
83
|
group: 'roles',
|
@@ -90,20 +91,22 @@ export class VerdocsTemplateRoles {
|
|
90
91
|
}
|
91
92
|
}
|
92
93
|
handleMoveEnd(evt) {
|
93
|
-
const fromSeq = +evt.from.
|
94
|
-
const toSeq = +evt.to.
|
94
|
+
const fromSeq = +evt.from.dataset.sequence;
|
95
|
+
const toSeq = +evt.to.dataset.sequence;
|
95
96
|
const fromIndex = +evt.oldIndex + 1;
|
96
97
|
const toIndex = +evt.newIndex + 1;
|
97
|
-
|
98
|
+
console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);
|
98
99
|
const sortableRoles = {};
|
99
100
|
const sequenceNumbers = this.getSequenceNumbers();
|
100
101
|
sequenceNumbers.forEach(sequence => {
|
101
|
-
|
102
|
+
const ras = this.getRolesAtSequence(sequence);
|
103
|
+
sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));
|
102
104
|
});
|
103
105
|
// We might be adding a new sequence number now. Make sure we have an array to drop
|
104
106
|
// the record into.
|
105
|
-
sortableRoles[sequenceNumbers.length + 1] = [];
|
107
|
+
sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];
|
106
108
|
const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];
|
109
|
+
sortableRoles[toSeq] || (sortableRoles[toSeq] = []);
|
107
110
|
sortableRoles[toSeq].splice(toIndex - 1, 0, role);
|
108
111
|
const renumberRequests = [];
|
109
112
|
Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {
|
@@ -111,8 +114,6 @@ export class VerdocsTemplateRoles {
|
|
111
114
|
if (!role) {
|
112
115
|
return;
|
113
116
|
}
|
114
|
-
console.log('Evaluating role 1', index, role);
|
115
|
-
console.log('Evaluating role 2', role.name, role.sequence, role.order);
|
116
117
|
const targetOrder = +index + 1;
|
117
118
|
if (role.sequence !== +targetSeq || role.order !== targetOrder) {
|
118
119
|
role.sequence = +targetSeq;
|
@@ -174,7 +175,6 @@ export class VerdocsTemplateRoles {
|
|
174
175
|
const sortableRoles = {};
|
175
176
|
const renumberRequests = [];
|
176
177
|
const sequenceNumbers = this.getSequenceNumbers();
|
177
|
-
console.log('Sorting sequences', sequenceNumbers);
|
178
178
|
(sequenceNumbers || []).forEach(targetSeq => {
|
179
179
|
(sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {
|
180
180
|
const targetOrder = +targetOrderMinusOne + 1;
|
@@ -188,7 +188,6 @@ export class VerdocsTemplateRoles {
|
|
188
188
|
}
|
189
189
|
});
|
190
190
|
});
|
191
|
-
console.log('Sortable Roles', sortableRoles);
|
192
191
|
console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);
|
193
192
|
await Promise.all(renumberRequests).then(async () => {
|
194
193
|
// When renumbering, we don't try to update the store for every individual item
|
@@ -269,12 +268,12 @@ export class VerdocsTemplateRoles {
|
|
269
268
|
console.log('[ROLES] Rendering', this.template.roles.map(r => ({ name: r.name, sequence: r.sequence, order: r.order })));
|
270
269
|
const roleNames = this.getRoleNames();
|
271
270
|
const sequences = this.getSequenceNumbers();
|
272
|
-
|
271
|
+
const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;
|
273
272
|
// style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}
|
274
|
-
return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map(sequence => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" },
|
273
|
+
return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
|
275
274
|
const unknown = !role.email || !role.first_name || !role.last_name;
|
276
275
|
return unknown ? (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, role.name), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, formatFullName(role)), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
|
277
|
-
})), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence
|
276
|
+
})), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-add-target`, "data-sequence": nextSequence }), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, nextSequence) }))), 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-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
278
277
|
var _a;
|
279
278
|
(_a = document.getElementById('verdocs-menu-panel-overlay')) === null || _a === void 0 ? void 0 : _a.remove();
|
280
279
|
this.showingRoleDialog = null;
|
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs-template-roles.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAoB,kBAAkB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACvI,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,YAAY,GAChB,myCAAmyC,CAAC;AAEtyC,MAAM,QAAQ,GAAG,mOAAmO,CAAC;AAErP,MAAM,UAAU,GACd,qWAAqW,CAAC;AAExW,MAAM,YAAY,GAAG,yVAAyV,CAAC;AAE/W,MAAM,MAAM,GAAG,sRAAsR,CAAC;AAEtS;;GAEG;AAMH,MAAM,OAAO,oBAAoB;;QACvB,uBAAkB,GAAG,IAAI,CAAC;wBAQE,eAAe,CAAC,UAAU,EAAE;0BAKnC,EAAE;iCAuBa,IAAI;sBAC9B,IAAI;wBAEF,KAAK;uBACN,IAAI;wBACe,IAAI;;IAE1C,oBAAoB;QAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAA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CAAC,0CAAE,MAAM,EAAE,CAAC;wBAChE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;oBAChC,CAAC,EACD,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;wBAC9B,+EAA+E;wBAC/E,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;wBACnC,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<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>';\n\nconst 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>`;\n\nconst iconSigner =\n '<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>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><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>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><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>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[FIELDS] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n componentDidRender() {\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-${sequenceNumbers.length + 1}`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.id.split('-').pop();\n const toSeq = +evt.to.id.split('-').pop();\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n // console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<number, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n sortableRoles[sequence] = JSON.parse(JSON.stringify(this.getRolesAtSequence(sequence)));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers.length + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n console.log('Evaluating role 1', index, role);\n console.log('Evaluating role 2', role.name, role.sequence, role.order);\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);\n return Promise.all(renumberRequests).then(async () => {\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n });\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n console.log('Sorting sequences', sequenceNumbers);\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log('Sortable Roles', sortableRoles);\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n\n console.log('Rendering sequences', sequences, roleNames);\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map(sequence => (\n <div class=\"sequence\">\n <div class=\"sequence-label no-drag\">{sequence}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div\n class=\"role\"\n // style={{borderColor: getRGBA(getRoleIndex(this.template, role.name))}}\n data-rolename={role.name}\n data-sequence={sequence}\n data-order={role.order}\n >\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequence)} />\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequences.length + 1}`} data-sequence={sequences.length + 1}>\n {/*<div class=\"role-name add-step-label\">Add Step.</div>*/}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequences.length + 1)} />\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs-template-roles.tsx"],"names":[],"mappings":"AAAA,OA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AAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<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>';\n\nconst 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>`;\n\nconst iconSigner =\n '<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>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><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>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><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>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[ROLES] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n componentDidRender() {\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-add-target`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.dataset.sequence;\n const toSeq = +evt.to.dataset.sequence;\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<string, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n const ras = this.getRolesAtSequence(sequence);\n\n sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq] ||= [];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);\n return Promise.all(renumberRequests).then(async () => {\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n });\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map((sequence, index) => (\n <div class=\"sequence\">\n <div class=\"sequence-label no-drag\">{index + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div\n class=\"role\"\n // style={{borderColor: getRGBA(getRoleIndex(this.template, role.name))}}\n data-rolename={role.name}\n data-sequence={sequence}\n data-order={role.order}\n >\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequence)} />\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-add-target`} data-sequence={nextSequence} />\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, nextSequence)} />\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
|
@@ -2676,7 +2676,7 @@ _extends(Remove, {
|
|
2676
2676
|
Sortable.mount(new AutoScrollPlugin());
|
2677
2677
|
Sortable.mount(Remove, Revert);
|
2678
2678
|
|
2679
|
-
const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}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 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.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}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 .row.add-sequence{display:-ms-flexbox;display:flex}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:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles
|
2679
|
+
const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}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 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.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}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 .row.add-sequence{display:-ms-flexbox;display:flex}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:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex}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}";
|
2680
2680
|
const VerdocsTemplateRolesStyle0 = verdocsTemplateRolesCss;
|
2681
2681
|
|
2682
2682
|
const 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>';
|
@@ -2722,6 +2722,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2722
2722
|
async componentWillLoad() {
|
2723
2723
|
var _a, _b, _c;
|
2724
2724
|
try {
|
2725
|
+
VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');
|
2725
2726
|
this.endpoint.loadSession();
|
2726
2727
|
if (!this.templateId) {
|
2727
2728
|
console.log(`[ROLES] Missing required template ID ${this.templateId}`);
|
@@ -2734,7 +2735,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2734
2735
|
this.listenToTemplate();
|
2735
2736
|
}
|
2736
2737
|
catch (e) {
|
2737
|
-
console.log('[
|
2738
|
+
console.log('[ROLES] Error with preview session', e);
|
2738
2739
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
2739
2740
|
}
|
2740
2741
|
}
|
@@ -2755,7 +2756,7 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2755
2756
|
});
|
2756
2757
|
}
|
2757
2758
|
});
|
2758
|
-
const el = document.getElementById(`verdocs-roles-sequence
|
2759
|
+
const el = document.getElementById(`verdocs-roles-sequence-add-target`);
|
2759
2760
|
if (el) {
|
2760
2761
|
new Sortable(el, {
|
2761
2762
|
group: 'roles',
|
@@ -2769,20 +2770,22 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2769
2770
|
}
|
2770
2771
|
}
|
2771
2772
|
handleMoveEnd(evt) {
|
2772
|
-
const fromSeq = +evt.from.
|
2773
|
-
const toSeq = +evt.to.
|
2773
|
+
const fromSeq = +evt.from.dataset.sequence;
|
2774
|
+
const toSeq = +evt.to.dataset.sequence;
|
2774
2775
|
const fromIndex = +evt.oldIndex + 1;
|
2775
2776
|
const toIndex = +evt.newIndex + 1;
|
2776
|
-
|
2777
|
+
console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);
|
2777
2778
|
const sortableRoles = {};
|
2778
2779
|
const sequenceNumbers = this.getSequenceNumbers();
|
2779
2780
|
sequenceNumbers.forEach(sequence => {
|
2780
|
-
|
2781
|
+
const ras = this.getRolesAtSequence(sequence);
|
2782
|
+
sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));
|
2781
2783
|
});
|
2782
2784
|
// We might be adding a new sequence number now. Make sure we have an array to drop
|
2783
2785
|
// the record into.
|
2784
|
-
sortableRoles[sequenceNumbers.length + 1] = [];
|
2786
|
+
sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];
|
2785
2787
|
const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];
|
2788
|
+
sortableRoles[toSeq] || (sortableRoles[toSeq] = []);
|
2786
2789
|
sortableRoles[toSeq].splice(toIndex - 1, 0, role);
|
2787
2790
|
const renumberRequests = [];
|
2788
2791
|
Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {
|
@@ -2790,8 +2793,6 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2790
2793
|
if (!role) {
|
2791
2794
|
return;
|
2792
2795
|
}
|
2793
|
-
console.log('Evaluating role 1', index, role);
|
2794
|
-
console.log('Evaluating role 2', role.name, role.sequence, role.order);
|
2795
2796
|
const targetOrder = +index + 1;
|
2796
2797
|
if (role.sequence !== +targetSeq || role.order !== targetOrder) {
|
2797
2798
|
role.sequence = +targetSeq;
|
@@ -2853,7 +2854,6 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2853
2854
|
const sortableRoles = {};
|
2854
2855
|
const renumberRequests = [];
|
2855
2856
|
const sequenceNumbers = this.getSequenceNumbers();
|
2856
|
-
console.log('Sorting sequences', sequenceNumbers);
|
2857
2857
|
(sequenceNumbers || []).forEach(targetSeq => {
|
2858
2858
|
(sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {
|
2859
2859
|
const targetOrder = +targetOrderMinusOne + 1;
|
@@ -2867,7 +2867,6 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2867
2867
|
}
|
2868
2868
|
});
|
2869
2869
|
});
|
2870
|
-
console.log('Sortable Roles', sortableRoles);
|
2871
2870
|
console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);
|
2872
2871
|
await Promise.all(renumberRequests).then(async () => {
|
2873
2872
|
// When renumbering, we don't try to update the store for every individual item
|
@@ -2948,12 +2947,12 @@ const VerdocsTemplateRoles = /*@__PURE__*/ proxyCustomElement(class VerdocsTempl
|
|
2948
2947
|
console.log('[ROLES] Rendering', this.template.roles.map(r => ({ name: r.name, sequence: r.sequence, order: r.order })));
|
2949
2948
|
const roleNames = this.getRoleNames();
|
2950
2949
|
const sequences = this.getSequenceNumbers();
|
2951
|
-
|
2950
|
+
const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;
|
2952
2951
|
// style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}
|
2953
|
-
return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map(sequence => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" },
|
2952
|
+
return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
|
2954
2953
|
const unknown = !role.email || !role.first_name || !role.last_name;
|
2955
2954
|
return unknown ? (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, role.name), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, formatFullName(role)), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
|
2956
|
-
})), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence
|
2955
|
+
})), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-add-target`, "data-sequence": nextSequence }), h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, nextSequence) }))), 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-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
2957
2956
|
var _a;
|
2958
2957
|
(_a = document.getElementById('verdocs-menu-panel-overlay')) === null || _a === void 0 ? void 0 : _a.remove();
|
2959
2958
|
this.showingRoleDialog = null;
|
@@ -3032,4 +3031,4 @@ function defineCustomElement() {
|
|
3032
3031
|
|
3033
3032
|
export { VerdocsTemplateRoles as V, defineCustomElement as d };
|
3034
3033
|
|
3035
|
-
//# sourceMappingURL=p-
|
3034
|
+
//# sourceMappingURL=p-78043e4b.js.map
|