@verdocs/web-sdk 2.3.22 → 2.3.24
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/{TemplateStore-6a75cdac.js → TemplateStore-079a1f85.js} +22 -0
- package/dist/cjs/ipc-test.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +7 -3
- package/dist/cjs/verdocs-portal_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_8.cjs.entry.js +2 -3
- package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +134 -163
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +29 -2
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +2 -3
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +21 -23
- package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.js +46 -44
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +78 -104
- package/dist/collection/utils/TemplateRoleStore.js +19 -0
- package/dist/collection/utils/TemplateStore.js +4 -1
- package/dist/components/TemplateStore.js +21 -1
- package/dist/components/verdocs-build.js +6 -2
- package/dist/components/verdocs-preview2.js +1 -2
- package/dist/components/verdocs-template-fields2.js +21 -24
- package/dist/components/verdocs-template-role-properties2.js +46 -45
- package/dist/components/verdocs-template-roles2.js +74 -101
- package/dist/docs.json +16 -7
- package/dist/esm/{TemplateStore-3994341c.js → TemplateStore-1ee18675.js} +21 -1
- package/dist/esm/ipc-test.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +7 -3
- package/dist/esm/verdocs-portal_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_8.entry.js +2 -3
- package/dist/esm/verdocs-template-fields_4.entry.js +135 -164
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/TemplateStore-1ee18675.js +1 -0
- package/dist/esm-es5/ipc-test.entry.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-portal_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +11 -1
- package/dist/types/components/embeds/verdocs-preview/verdocs-preview.d.ts +1 -1
- package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +3 -2
- package/dist/types/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.d.ts +7 -3
- package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +13 -10
- package/dist/types/components.d.ts +8 -4
- package/dist/types/utils/TemplateRoleStore.d.ts +6 -0
- package/dist/verdocs-web-sdk/p-00e49c36.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-0bfc239a.system.js +1 -0
- package/dist/verdocs-web-sdk/p-2720068f.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-4fc74ab1.js +1 -0
- package/dist/verdocs-web-sdk/{p-07f0bcae.entry.js → p-5361ee8f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-6ada9427.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-7f2f79fa.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-929760fd.system.entry.js → p-9f46a6a9.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-040620ca.system.entry.js → p-b54467df.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-b86c345f.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-8f8db3aa.entry.js → p-cb429454.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e080e371.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/TemplateStore-3994341c.js +0 -1
- package/dist/verdocs-web-sdk/p-1780a4f1.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-66d58683.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-79fcaf1e.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-88c64957.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-a98b0097.system.js +0 -1
- package/dist/verdocs-web-sdk/p-d1837af9.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-d5e27c32.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-fc2454b0.js +0 -1
@@ -5,8 +5,8 @@ import { V as VerdocsEndpoint, T as TemplateSenderTypes, u as updateTemplate } f
|
|
5
5
|
import { u as updateField, c as createField } from './Fields-c82e6df3.js';
|
6
6
|
import { i as integerSequence } from './Primitives-8fe93caf.js';
|
7
7
|
import { b as getRoleIndex, r as renderDocumentField, f as updateCssTransform, h as defaultWidth, i as defaultHeight } from './utils-f76f3448.js';
|
8
|
-
import { c as
|
9
|
-
import { g as
|
8
|
+
import { g as getTemplateStore, b as getTemplateRoleStore, a as getRoleNames, c as createTemplateRoleStore } from './TemplateStore-1ee18675.js';
|
9
|
+
import { g as getTemplateFieldStore } from './TemplateFieldStore-295f240e.js';
|
10
10
|
import { S as SDKError } from './errors-9b5498c8.js';
|
11
11
|
import { g as getRGBA } from './Colors-1b298092.js';
|
12
12
|
import './_commonjsHelpers-8a9f3b18.js';
|
@@ -75,6 +75,7 @@ const VerdocsTemplateFields = class {
|
|
75
75
|
this.pageHeights = {};
|
76
76
|
this.templateStore = null;
|
77
77
|
this.fieldStore = null;
|
78
|
+
this.roleStore = null;
|
78
79
|
this.cachedPageInfo = {};
|
79
80
|
this.endpoint = VerdocsEndpoint.getDefault();
|
80
81
|
this.templateId = null;
|
@@ -82,7 +83,6 @@ const VerdocsTemplateFields = class {
|
|
82
83
|
this.placing = null;
|
83
84
|
this.showMustSelectRole = false;
|
84
85
|
this.selectedRoleName = '';
|
85
|
-
this.rerender = 1;
|
86
86
|
}
|
87
87
|
async componentWillLoad() {
|
88
88
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -97,7 +97,8 @@ const VerdocsTemplateFields = class {
|
|
97
97
|
return;
|
98
98
|
}
|
99
99
|
this.templateStore = await getTemplateStore(this.endpoint, this.templateId, false);
|
100
|
-
this.fieldStore =
|
100
|
+
this.fieldStore = getTemplateFieldStore(this.templateId);
|
101
|
+
this.roleStore = getTemplateRoleStore(this.templateId);
|
101
102
|
this.selectedRoleName = ((_d = (_c = (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.roles) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.name) || '';
|
102
103
|
}
|
103
104
|
catch (e) {
|
@@ -116,10 +117,10 @@ const VerdocsTemplateFields = class {
|
|
116
117
|
}
|
117
118
|
}
|
118
119
|
componentWillUpdate() {
|
119
|
-
var _a, _b, _c, _d
|
120
|
+
var _a, _b, _c, _d;
|
120
121
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
121
|
-
if (!this.selectedRoleName || !(
|
122
|
-
this.selectedRoleName = ((
|
122
|
+
if (!this.selectedRoleName || !Object.values(this.roleStore).find(role => role && role.name === this.selectedRoleName)) {
|
123
|
+
this.selectedRoleName = ((_d = (_c = (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.roles) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.name) || '';
|
123
124
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
124
125
|
}
|
125
126
|
}
|
@@ -131,7 +132,6 @@ const VerdocsTemplateFields = class {
|
|
131
132
|
}
|
132
133
|
async handleFieldChange(field, e, optionId) {
|
133
134
|
console.log('[FIELDS] handleFieldChange', field, e, optionId);
|
134
|
-
this.rerender++;
|
135
135
|
}
|
136
136
|
handleFieldSettingsChange(pageInfo, field, el, newFieldData, oldName) {
|
137
137
|
var _a, _b;
|
@@ -142,8 +142,6 @@ const VerdocsTemplateFields = class {
|
|
142
142
|
this.selectedRoleName = field.role_name;
|
143
143
|
el.setAttribute('roleindex', getRoleIndex(getRoleNames(this.templateStore), field.role_name));
|
144
144
|
el.field = this.fieldStore.get(field.name);
|
145
|
-
this.rerender++;
|
146
|
-
el.setAttribute('rerender', this.rerender);
|
147
145
|
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state, event: 'updated-field' });
|
148
146
|
// We do this to avoid dupes if the field gets renamed.
|
149
147
|
if (field.name !== oldName) {
|
@@ -160,15 +158,12 @@ const VerdocsTemplateFields = class {
|
|
160
158
|
this.reRenderField(field, pageInfo.pageNumber);
|
161
159
|
}
|
162
160
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
163
|
-
// console.log('afa', field);
|
164
161
|
el.addEventListener('input', e => this.handleFieldChange(field, e));
|
165
162
|
el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, el, e.detail.field, e.detail.fieldName));
|
166
|
-
// el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, roleIndex, el, e.detail.field));
|
167
163
|
el.addEventListener('deleted', () => {
|
168
164
|
var _a, _b;
|
169
165
|
console.log('[FIELDS] Deleted', this, field);
|
170
166
|
el.remove();
|
171
|
-
this.rerender++;
|
172
167
|
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state, event: 'updated-field' });
|
173
168
|
});
|
174
169
|
el.setAttribute('templateid', this.templateId);
|
@@ -184,7 +179,10 @@ const VerdocsTemplateFields = class {
|
|
184
179
|
// console.log('[FIELDS] Page rendered', pageInfo.pageNumber, pageInfo);
|
185
180
|
this.cachedPageInfo[pageInfo.pageNumber] = pageInfo;
|
186
181
|
this.pageHeights[pageInfo.pageNumber] = pageInfo.naturalHeight;
|
187
|
-
|
182
|
+
// Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.
|
183
|
+
// See https://github.com/ionic-team/stencil-store/issues/23
|
184
|
+
const fields = Object.values(this.fieldStore.state).filter((field) => field && field.page_sequence === pageInfo.pageNumber);
|
185
|
+
console.log('[FIELDS] Page rendered', pageInfo, fields);
|
188
186
|
fields.forEach((field) => this.reRenderField(field, pageInfo.pageNumber));
|
189
187
|
}
|
190
188
|
reRenderField(field, pageNumber) {
|
@@ -281,7 +279,7 @@ const VerdocsTemplateFields = class {
|
|
281
279
|
do {
|
282
280
|
fieldName = `${type}P${pageNumber}-${i}`;
|
283
281
|
i++;
|
284
|
-
} while (Object.values(this.fieldStore.state).some(field => field.name === fieldName));
|
282
|
+
} while (Object.values(this.fieldStore.state).some(field => field && field.name === fieldName));
|
285
283
|
return fieldName;
|
286
284
|
}
|
287
285
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|
@@ -393,7 +391,7 @@ const VerdocsTemplateFields = class {
|
|
393
391
|
}
|
394
392
|
}
|
395
393
|
render() {
|
396
|
-
var _a, _b, _c
|
394
|
+
var _a, _b, _c;
|
397
395
|
if (!this.endpoint.session) {
|
398
396
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
399
397
|
}
|
@@ -401,10 +399,10 @@ const VerdocsTemplateFields = class {
|
|
401
399
|
if (!((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
|
402
400
|
return (h(Host, null, h("verdocs-loader", null)));
|
403
401
|
}
|
404
|
-
const selectableRoles = (
|
405
|
-
|
406
|
-
|
407
|
-
|
402
|
+
const selectableRoles = Object.values(this.roleStore)
|
403
|
+
.filter(role => role !== undefined)
|
404
|
+
.map(role => ({ value: role.name, label: role.name }));
|
405
|
+
return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, onSubmit: () => { } }, h("div", { id: "verdocs-template-fields-toolbar" }, h("div", { class: "add-for" }, "Add field:"), h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
|
408
406
|
// We ignore empty-tooltip entries because they're separators
|
409
407
|
if (option.tooltip) {
|
410
408
|
// We require a role to be selected first
|
@@ -415,13 +413,13 @@ const VerdocsTemplateFields = class {
|
|
415
413
|
this.showMustSelectRole = true;
|
416
414
|
}
|
417
415
|
}
|
418
|
-
} })))), h("div", { class: "pages" }, (((
|
416
|
+
} })))), h("div", { class: "pages" }, (((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.template_documents) || []).map(document => {
|
419
417
|
const pageNumbers = integerSequence(1, document.page_numbers);
|
420
418
|
return pageNumbers.map(page => (h("verdocs-template-document-page", { templateId: this.templateId, documentId: document.id, pageNumber: page, virtualWidth: 612, virtualHeight: 792, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
|
421
419
|
{ name: 'page', type: 'canvas' },
|
422
420
|
{ name: 'controls', type: 'div' },
|
423
421
|
] })));
|
424
|
-
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: (
|
422
|
+
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: Object.keys(this.roleStore).length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
|
425
423
|
}
|
426
424
|
};
|
427
425
|
VerdocsTemplateFields.style = verdocsTemplateFieldsCss;
|
@@ -435,7 +433,9 @@ const VerdocsTemplateRoleProperties = class {
|
|
435
433
|
this.close = createEvent(this, "close", 7);
|
436
434
|
this.delete = createEvent(this, "delete", 7);
|
437
435
|
this.sdkError = createEvent(this, "sdkError", 7);
|
438
|
-
this.
|
436
|
+
this.templateStore = null;
|
437
|
+
this.fieldStore = null;
|
438
|
+
this.roleStore = null;
|
439
439
|
this.endpoint = VerdocsEndpoint.getDefault();
|
440
440
|
this.templateId = '';
|
441
441
|
this.roleName = '';
|
@@ -444,13 +444,13 @@ const VerdocsTemplateRoleProperties = class {
|
|
444
444
|
this.saving = false;
|
445
445
|
this.name = '';
|
446
446
|
this.type = 'signer';
|
447
|
-
this.
|
447
|
+
this.full_name = '';
|
448
448
|
this.email = '';
|
449
449
|
this.phone = '';
|
450
|
-
this.
|
450
|
+
this.delegator = false;
|
451
451
|
}
|
452
452
|
async componentWillLoad() {
|
453
|
-
var _a, _b, _c
|
453
|
+
var _a, _b, _c;
|
454
454
|
try {
|
455
455
|
this.endpoint.loadSession();
|
456
456
|
if (!this.templateId) {
|
@@ -461,29 +461,39 @@ const VerdocsTemplateRoleProperties = class {
|
|
461
461
|
console.log('[ROLE_PROPERTIES] Unable to start builder session, must be authenticated');
|
462
462
|
return;
|
463
463
|
}
|
464
|
-
this.
|
465
|
-
|
464
|
+
this.templateStore = await getTemplateStore(this.endpoint, this.templateId, false);
|
465
|
+
this.fieldStore = getTemplateFieldStore(this.templateId);
|
466
|
+
this.roleStore = createTemplateRoleStore(this.templateStore.state);
|
467
|
+
const editingRole = this.roleStore.get(this.roleName);
|
466
468
|
if (editingRole) {
|
467
469
|
this.name = editingRole.name;
|
468
470
|
this.type = editingRole.type;
|
469
|
-
this.
|
471
|
+
this.full_name = editingRole.full_name;
|
470
472
|
this.email = editingRole.email;
|
471
473
|
this.phone = editingRole.phone;
|
472
|
-
this.
|
473
|
-
console.log('[
|
474
|
+
this.delegator = editingRole.delegator;
|
475
|
+
console.log('[ROLE_PROPERTIES] Editing role', editingRole);
|
474
476
|
}
|
475
477
|
}
|
476
478
|
catch (e) {
|
477
|
-
console.log('[
|
478
|
-
(
|
479
|
+
console.log('[ROLE_PROPERTIES Error with preview session', e);
|
480
|
+
(_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));
|
479
481
|
}
|
480
482
|
}
|
481
483
|
handleCancel(e) {
|
482
|
-
var _a
|
484
|
+
var _a;
|
483
485
|
e.stopPropagation();
|
484
|
-
|
486
|
+
const editingRole = this.roleStore.get(this.roleName);
|
487
|
+
if (editingRole) {
|
488
|
+
this.name = editingRole.name;
|
489
|
+
this.type = editingRole.type;
|
490
|
+
this.full_name = editingRole.full_name;
|
491
|
+
this.email = editingRole.email;
|
492
|
+
this.phone = editingRole.phone;
|
493
|
+
this.delegator = editingRole.delegator;
|
494
|
+
}
|
485
495
|
this.dirty = false;
|
486
|
-
(
|
496
|
+
(_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
|
487
497
|
}
|
488
498
|
async handleSave(e) {
|
489
499
|
e.stopPropagation();
|
@@ -491,35 +501,24 @@ const VerdocsTemplateRoleProperties = class {
|
|
491
501
|
updateRole(this.endpoint, this.templateId, this.roleName, {
|
492
502
|
name: this.name,
|
493
503
|
type: this.type,
|
494
|
-
full_name: this.
|
504
|
+
full_name: this.full_name,
|
495
505
|
email: this.email,
|
496
506
|
phone: this.phone,
|
497
|
-
delegator: this.
|
507
|
+
delegator: this.delegator,
|
498
508
|
})
|
499
509
|
.then(async (r) => {
|
500
510
|
var _a;
|
501
511
|
console.log('[ROLE_PROPERTIES] Update result', r);
|
502
512
|
this.saving = false;
|
503
513
|
this.dirty = false;
|
504
|
-
this.
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
// newRoles.forEach(role => {
|
509
|
-
// if (role.name === this.roleName) {
|
510
|
-
// role.name = this.name;
|
511
|
-
// role.type = this.type;
|
512
|
-
// role.full_name = this.fullName;
|
513
|
-
// role.email = this.email;
|
514
|
-
// role.phone = this.phone;
|
515
|
-
// role.delegator = this.allowDelegation;
|
516
|
-
// }
|
517
|
-
// });
|
518
|
-
// this.store.state.roles = newRoles;
|
514
|
+
this.roleStore.set(r.name, r);
|
515
|
+
if (this.roleName !== r.name) {
|
516
|
+
this.roleStore.set(this.roleName, undefined);
|
517
|
+
}
|
519
518
|
(_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
|
520
519
|
})
|
521
520
|
.catch(e => {
|
522
|
-
console.log('Update error', e);
|
521
|
+
console.log('[ROLE_PROPERTIES Update error', e);
|
523
522
|
this.saving = false;
|
524
523
|
});
|
525
524
|
}
|
@@ -529,20 +528,19 @@ const VerdocsTemplateRoleProperties = class {
|
|
529
528
|
deleteRole(this.endpoint, this.templateId, this.roleName)
|
530
529
|
.then(r => {
|
531
530
|
var _a;
|
532
|
-
|
533
|
-
this.store.state.roles = [...this.store.state.roles.filter(role => role.name !== this.roleName)];
|
531
|
+
delete this.roleStore.state[r.name];
|
534
532
|
(_a = this.delete) === null || _a === void 0 ? void 0 : _a.emit({ templateId: this.templateId, roleName: this.roleName });
|
535
533
|
})
|
536
534
|
.catch(e => {
|
537
|
-
console.log('Deletion error', e);
|
535
|
+
console.log('[ROLE_PROPERTIES Deletion error', e);
|
538
536
|
});
|
539
537
|
}
|
540
538
|
}
|
541
539
|
render() {
|
542
|
-
const hasFields = (this.
|
543
|
-
return (h(Host, null, h("div", { class: "background-overlay", onClick: e => this.handleCancel(e) }, h("div", { class: "dialog" }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("verdocs-text-input", { id: "verdocs-
|
540
|
+
const hasFields = Object.values(this.fieldStore).findIndex(field => field.role_name === this.roleName) !== -1;
|
541
|
+
return (h(Host, null, h("div", { class: "background-overlay", onClick: e => this.handleCancel(e) }, h("div", { class: "dialog" }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("verdocs-text-input", { id: "verdocs-role-name", label: "Role Name", value: this.name, autocomplete: "off", disabled: hasFields, helpText: hasFields
|
544
542
|
? 'This role has fields assigned and can no longer be renamed.'
|
545
|
-
: 'A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.', placeholder: "
|
543
|
+
: 'A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.', placeholder: "Role Name...", onInput: (e) => {
|
546
544
|
this.name = e.target.value;
|
547
545
|
this.dirty = true;
|
548
546
|
} }), h("div", { class: "row" }, h("div", { class: "input-label" }, "Type:"), h("verdocs-select-input", { value: this.type, options: [
|
@@ -552,8 +550,8 @@ const VerdocsTemplateRoleProperties = class {
|
|
552
550
|
], onInput: (e) => {
|
553
551
|
this.type = e.target.value;
|
554
552
|
this.dirty = true;
|
555
|
-
} }), 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.
|
556
|
-
this.
|
553
|
+
} }), 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: (e) => {
|
554
|
+
this.full_name = e.target.value;
|
557
555
|
this.dirty = true;
|
558
556
|
} }), 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: (e) => {
|
559
557
|
this.email = e.target.value;
|
@@ -561,8 +559,8 @@ const VerdocsTemplateRoleProperties = class {
|
|
561
559
|
} }), 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: (e) => {
|
562
560
|
this.phone = e.target.value;
|
563
561
|
this.dirty = true;
|
564
|
-
} }), h("div", { class: "row" }, h("div", { class: "input-label" }, "May Delegate:"), h("div", { class: "checkbox-wrapper" }, h("verdocs-checkbox", { checked: this.
|
565
|
-
this.
|
562
|
+
} }), h("div", { class: "row" }, h("div", { class: "input-label" }, "May Delegate:"), h("div", { class: "checkbox-wrapper" }, h("verdocs-checkbox", { checked: this.delegator, onInput: (e) => {
|
563
|
+
this.delegator = e.target.checked;
|
566
564
|
this.dirty = true;
|
567
565
|
} })), 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: e => this.handleDelete(e), innerHTML: TrashIcon }), h("div", { style: { flex: '1' } }), h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled: !this.dirty, onClick: e => this.handleSave(e) })))))));
|
568
566
|
}
|
@@ -592,9 +590,9 @@ const VerdocsTemplateRoles = class {
|
|
592
590
|
this.next = createEvent(this, "next", 7);
|
593
591
|
this.exit = createEvent(this, "exit", 7);
|
594
592
|
this.sdkError = createEvent(this, "sdkError", 7);
|
595
|
-
this.
|
596
|
-
this.
|
597
|
-
this.
|
593
|
+
this.rolesUpdated = createEvent(this, "rolesUpdated", 7);
|
594
|
+
this.templateStore = null;
|
595
|
+
this.roleStore = null;
|
598
596
|
this.endpoint = VerdocsEndpoint.getDefault();
|
599
597
|
this.templateId = '';
|
600
598
|
this.showingRoleDialog = null;
|
@@ -613,18 +611,14 @@ const VerdocsTemplateRoles = class {
|
|
613
611
|
console.log('[ROLES] Unable to start builder session, must be authenticated');
|
614
612
|
return;
|
615
613
|
}
|
616
|
-
await this.
|
614
|
+
this.templateStore = await getTemplateStore(this.endpoint, this.templateId, false);
|
615
|
+
this.roleStore = getTemplateRoleStore(this.templateId);
|
617
616
|
}
|
618
617
|
catch (e) {
|
619
618
|
console.log('[FIELDS] Error with preview session', e);
|
620
619
|
(_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));
|
621
620
|
}
|
622
621
|
}
|
623
|
-
async reloadStore() {
|
624
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
625
|
-
this.sortTemplateRoles();
|
626
|
-
this.renumberTemplateRoles();
|
627
|
-
}
|
628
622
|
componentDidRender() {
|
629
623
|
interact_min.dynamicDrop(true);
|
630
624
|
interact_min('.recipient').draggable({
|
@@ -634,64 +628,45 @@ const VerdocsTemplateRoles = class {
|
|
634
628
|
this.el.classList.add('dragging');
|
635
629
|
}.bind(this),
|
636
630
|
move: function handleMove(e) {
|
637
|
-
const oldX = +(e.target.getAttribute('
|
638
|
-
const oldY = +(e.target.getAttribute('
|
631
|
+
const oldX = +(e.target.getAttribute('dX') || 0);
|
632
|
+
const oldY = +(e.target.getAttribute('dY') || 0);
|
633
|
+
const sequence = +(e.target.dataset['sequence'] || 0);
|
639
634
|
const newX = e.dx + oldX;
|
640
635
|
const newY = e.dy + oldY;
|
641
|
-
e.target.setAttribute('
|
642
|
-
e.target.setAttribute('
|
643
|
-
e.target.
|
636
|
+
e.target.setAttribute('dX', newX);
|
637
|
+
e.target.setAttribute('dY', newY);
|
638
|
+
const rect = e.target.getBoundingClientRect();
|
639
|
+
// Note: I never did figure out exactly why this is, but if we don't offset the transform
|
640
|
+
// the dragged item is offset from the mouse cursor quite a bit.
|
641
|
+
e.target.style.transform = `translate(${newX + 80}px, ${newY - rect.height * sequence}px)`;
|
644
642
|
}.bind(this),
|
645
643
|
end: function handleEnd(e) {
|
646
644
|
e.target.classList.remove('dragging');
|
647
645
|
this.el.classList.remove('dragging');
|
648
646
|
// console.log('end', event);
|
649
|
-
e.target.
|
650
|
-
e.target.
|
651
|
-
e.target.style.transform =
|
647
|
+
e.target.removeAttribute('dX');
|
648
|
+
e.target.removeAttribute('dY');
|
649
|
+
e.target.style.transform = null;
|
652
650
|
}.bind(this),
|
653
651
|
},
|
654
652
|
});
|
655
653
|
interact_min('.dropzone').dropzone({
|
656
654
|
overlap: 0.05,
|
657
|
-
ondrop: function handleDrop(event) {
|
658
|
-
var _a
|
655
|
+
ondrop: async function handleDrop(event) {
|
656
|
+
var _a;
|
659
657
|
event.target.classList.remove('active');
|
660
|
-
// target will be the recipient e.g. <div class="recipient" data-rolename="Buyer" />
|
661
|
-
// relatedTarget will be the drop zone, e.g. <div class="dropzone" data-order="2" data-sequence="1" />
|
662
|
-
// console.log(event.relatedTarget, ' was dropped into ', event.target);
|
663
|
-
// We don't use the role's own order, we rely on the fact that we sorted earlier on the order field. Many legacy
|
664
|
-
// records don't have order fields yet - they're all 1. That doesn't hurt the sort but it would hurt us here if it
|
665
|
-
// went 1..1..1 instead of 1..2..3. By using half values here it's easier to handle the drop event later. We don't
|
666
|
-
// need to do a fancy find/arraymove dance. We just set the dropped element to the half value, sort the result,
|
667
|
-
// then do a final renumber. It's not expensive to do because most flows are typically a small handful (e.g. 1-4)
|
668
|
-
// recipients. They never have hundreds.
|
669
658
|
const roleName = event.relatedTarget.dataset.rolename;
|
670
659
|
const targetSequence = +event.target.dataset.sequence;
|
671
660
|
const targetOrder = +event.target.dataset.order;
|
672
|
-
const changingRole =
|
661
|
+
const changingRole = this.roleStore.get(roleName);
|
673
662
|
if (changingRole) {
|
674
663
|
// To handle the renumbering, we update the role being moved to the new values, which will be some half-interval e.g.
|
675
|
-
// sequence 1.5 order 1. Then we
|
676
|
-
changingRole
|
677
|
-
changingRole.
|
678
|
-
this.
|
679
|
-
this.
|
680
|
-
this.
|
681
|
-
// We have to update ALL the roles to be sure each gets new proper sequence/order numbers assigned.
|
682
|
-
// TODO: We could optimize this by tracking "dirty" states and only update the roles that have changed. But it's a LOT more
|
683
|
-
// code to do right, and since most workflows will typically only have 2-4 recipients max, it may not be worth it.
|
684
|
-
Promise.all((_e = (_d = this.store) === null || _d === void 0 ? void 0 : _d.state) === null || _e === void 0 ? void 0 : _e.roles.map(role => updateRole(this.endpoint, this.templateId, role.name, {
|
685
|
-
sequence: role.sequence,
|
686
|
-
order: role.order,
|
687
|
-
})))
|
688
|
-
.then(() => {
|
689
|
-
var _a, _b;
|
690
|
-
console.log('[ROLES] Updated roles');
|
691
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated-role', endpoint: this.endpoint, template: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state });
|
692
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
693
|
-
})
|
694
|
-
.catch(e => console.log('[ROLES] Role updates failed', e));
|
664
|
+
// sequence 1.5 order 1. Then we sort/renumber the roles at each level to determine their final ordering values.
|
665
|
+
const newRole = { ...changingRole, sequence: targetSequence, order: targetOrder };
|
666
|
+
this.roleStore.set(changingRole.name, newRole);
|
667
|
+
await this.renumberTemplateRoles();
|
668
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
669
|
+
console.log('[ROLES] Updated roles', this.getSortedRoles());
|
695
670
|
}
|
696
671
|
}.bind(this),
|
697
672
|
ondropactivate: e => {
|
@@ -716,50 +691,60 @@ const VerdocsTemplateRoles = class {
|
|
716
691
|
var _a;
|
717
692
|
(_a = this.next) === null || _a === void 0 ? void 0 : _a.emit();
|
718
693
|
}
|
719
|
-
|
720
|
-
|
721
|
-
|
694
|
+
getSortedRoles() {
|
695
|
+
return Object.values(this.roleStore.state)
|
696
|
+
.filter(role => role !== undefined)
|
697
|
+
.sort((a, b) => {
|
722
698
|
return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;
|
723
699
|
});
|
724
700
|
}
|
725
|
-
|
726
|
-
|
727
|
-
this.
|
728
|
-
|
729
|
-
|
730
|
-
this.sequences.push(role.sequence);
|
701
|
+
getSequenceNumbers() {
|
702
|
+
const sequences = [];
|
703
|
+
this.getSortedRoles().forEach(role => {
|
704
|
+
if (!sequences.includes(role.sequence)) {
|
705
|
+
sequences.push(role.sequence);
|
731
706
|
}
|
732
707
|
});
|
708
|
+
return sequences.sort((a, b) => a - b);
|
709
|
+
}
|
710
|
+
getRoleNames() {
|
711
|
+
const roles = this.getSortedRoles();
|
712
|
+
return roles.map(role => role.name);
|
713
|
+
}
|
714
|
+
getRolesAtSequence(sequence) {
|
715
|
+
// Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.
|
716
|
+
// See https://github.com/ionic-team/stencil-store/issues/23
|
717
|
+
return Object.values(this.roleStore.state).filter(role => role && role.sequence === sequence);
|
733
718
|
}
|
719
|
+
// When the user drags a role around, we handle placement "between" items by assigning it a half-order number
|
720
|
+
// 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.
|
721
|
+
// Then we re-sort the list of roles and renumber them.
|
734
722
|
renumberTemplateRoles() {
|
735
|
-
//
|
736
|
-
this.extractSequenceNumbers();
|
737
|
-
// We need to renumber each role only ONE TIME
|
723
|
+
// Avoid dupe renumber attempts
|
738
724
|
const renumbered = [];
|
739
725
|
// If the user dragged an entry from below a row to above it, we end up here like [1,0]. Make sure it's [0,1] for the next operation.
|
740
|
-
|
741
|
-
this.
|
742
|
-
|
743
|
-
(_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.roles.filter(role => role.sequence === originalSequence).forEach((role, newOrderIndex) => {
|
726
|
+
const renumberRequests = [];
|
727
|
+
this.getSequenceNumbers().forEach((originalSequence, newSequenceIndex) => {
|
728
|
+
this.getRolesAtSequence(originalSequence).forEach((role, newOrderIndex) => {
|
744
729
|
if (!renumbered.includes(role.name)) {
|
745
730
|
role.sequence = newSequenceIndex + 1;
|
746
731
|
role.order = newOrderIndex + 1;
|
747
732
|
renumbered.push(role.name);
|
733
|
+
renumberRequests.push(updateRole(this.endpoint, this.templateId, role.name, { sequence: role.sequence, order: role.order }));
|
748
734
|
}
|
749
735
|
});
|
750
736
|
});
|
751
|
-
|
752
|
-
this.extractSequenceNumbers();
|
737
|
+
return Promise.all(renumberRequests);
|
753
738
|
}
|
754
739
|
// Look for name conflicts, because they're UGC and can be anything, regardless of order.
|
755
740
|
getNextRoleName() {
|
756
|
-
var _a
|
741
|
+
var _a;
|
757
742
|
let name = '';
|
758
|
-
let nextNumber = (
|
743
|
+
let nextNumber = Object.keys(this.roleStore).length;
|
759
744
|
do {
|
760
745
|
nextNumber++;
|
761
746
|
name = `Recipient ${nextNumber}`;
|
762
|
-
} while (!name || ((
|
747
|
+
} while (!name || Object.values((_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state).some(role => role && role.name === name));
|
763
748
|
return name;
|
764
749
|
}
|
765
750
|
callCreateRole(name, sequence, order) {
|
@@ -776,25 +761,19 @@ const VerdocsTemplateRoles = class {
|
|
776
761
|
delegator: false,
|
777
762
|
})
|
778
763
|
.then(async (r) => {
|
779
|
-
var _a
|
764
|
+
var _a;
|
780
765
|
console.log('[ROLES] Created role', r);
|
781
|
-
this.
|
782
|
-
this.
|
783
|
-
this.
|
784
|
-
// this.store.state.roles = [...this.store?.state.roles, r];
|
785
|
-
// this.renumberTemplateRoles();
|
786
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'created-role', endpoint: this.endpoint, template: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state });
|
787
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
766
|
+
this.roleStore.set(r.name, r);
|
767
|
+
await this.renumberTemplateRoles();
|
768
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
788
769
|
})
|
789
770
|
.catch(e => {
|
790
771
|
console.log('[ROLES] Error creating role', e);
|
791
772
|
});
|
792
773
|
}
|
793
774
|
handleAddRole(e, sequence) {
|
794
|
-
var _a;
|
795
775
|
e.stopPropagation();
|
796
|
-
|
797
|
-
const order = ((_a = this.store) === null || _a === void 0 ? void 0 : _a.state.roles.filter(role => role.sequence === sequence).length) + 1;
|
776
|
+
const order = this.getRolesAtSequence(sequence).length + 1;
|
798
777
|
const name = this.getNextRoleName();
|
799
778
|
this.callCreateRole(name, sequence, order);
|
800
779
|
}
|
@@ -805,33 +784,25 @@ const VerdocsTemplateRoles = class {
|
|
805
784
|
this.callCreateRole(name, sequence, order);
|
806
785
|
}
|
807
786
|
render() {
|
808
|
-
var _a, _b, _c
|
809
|
-
console.log('[ROLES] Rendering');
|
787
|
+
var _a, _b, _c;
|
810
788
|
if (!this.endpoint.session) {
|
811
789
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
812
790
|
}
|
813
|
-
if (!((_a = this.
|
791
|
+
if (!((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
|
814
792
|
return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
|
815
793
|
}
|
816
|
-
const roleNames =
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.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 })));
|
823
|
-
}), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), this.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"))))));
|
824
|
-
}), h("div", { class: "row", "data-sequence": this.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, this.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: () => {
|
794
|
+
const roleNames = this.getRoleNames();
|
795
|
+
const sequences = this.getSequenceNumbers();
|
796
|
+
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 => {
|
797
|
+
const unknown = !role.email;
|
798
|
+
return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name, "data-sequence": sequence }, 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(roleNames, role.name)) }, "data-rolename": role.name, "data-sequence": sequence }, 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 })));
|
799
|
+
}), 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: () => {
|
825
800
|
this.showingRoleDialog = null;
|
826
|
-
// this.forceRerender++;
|
827
801
|
}, onDelete: async () => {
|
828
|
-
var _a
|
829
|
-
await getTemplateStore(this.endpoint, this.templateId, false);
|
830
|
-
this.renumberTemplateRoles();
|
802
|
+
var _a;
|
831
803
|
this.showingRoleDialog = null;
|
832
|
-
|
833
|
-
(_a = this.
|
834
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
804
|
+
await this.renumberTemplateRoles();
|
805
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
835
806
|
} })), this.showingSenderDialog && h("verdocs-template-sender", { endpoint: this.endpoint, templateId: this.templateId, onClose: () => (this.showingSenderDialog = false) })));
|
836
807
|
}
|
837
808
|
get el() { return getElement(this); }
|