@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
@@ -9,8 +9,8 @@ const VerdocsEndpoint = require('./VerdocsEndpoint-8f298664.js');
|
|
9
9
|
const Fields = require('./Fields-705a2168.js');
|
10
10
|
const Primitives = require('./Primitives-a59870a2.js');
|
11
11
|
const utils = require('./utils-aeaf4a31.js');
|
12
|
+
const TemplateStore = require('./TemplateStore-079a1f85.js');
|
12
13
|
const TemplateFieldStore = require('./TemplateFieldStore-40e85b9d.js');
|
13
|
-
const TemplateStore = require('./TemplateStore-6a75cdac.js');
|
14
14
|
const errors = require('./errors-0396da3d.js');
|
15
15
|
const Colors = require('./Colors-e809dcc9.js');
|
16
16
|
require('./_commonjsHelpers-1fbbf0eb.js');
|
@@ -79,6 +79,7 @@ const VerdocsTemplateFields = class {
|
|
79
79
|
this.pageHeights = {};
|
80
80
|
this.templateStore = null;
|
81
81
|
this.fieldStore = null;
|
82
|
+
this.roleStore = null;
|
82
83
|
this.cachedPageInfo = {};
|
83
84
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
84
85
|
this.templateId = null;
|
@@ -86,7 +87,6 @@ const VerdocsTemplateFields = class {
|
|
86
87
|
this.placing = null;
|
87
88
|
this.showMustSelectRole = false;
|
88
89
|
this.selectedRoleName = '';
|
89
|
-
this.rerender = 1;
|
90
90
|
}
|
91
91
|
async componentWillLoad() {
|
92
92
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -101,7 +101,8 @@ const VerdocsTemplateFields = class {
|
|
101
101
|
return;
|
102
102
|
}
|
103
103
|
this.templateStore = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
104
|
-
this.fieldStore = TemplateFieldStore.
|
104
|
+
this.fieldStore = TemplateFieldStore.getTemplateFieldStore(this.templateId);
|
105
|
+
this.roleStore = TemplateStore.getTemplateRoleStore(this.templateId);
|
105
106
|
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) || '';
|
106
107
|
}
|
107
108
|
catch (e) {
|
@@ -120,10 +121,10 @@ const VerdocsTemplateFields = class {
|
|
120
121
|
}
|
121
122
|
}
|
122
123
|
componentWillUpdate() {
|
123
|
-
var _a, _b, _c, _d
|
124
|
+
var _a, _b, _c, _d;
|
124
125
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
125
|
-
if (!this.selectedRoleName || !(
|
126
|
-
this.selectedRoleName = ((
|
126
|
+
if (!this.selectedRoleName || !Object.values(this.roleStore).find(role => role && role.name === this.selectedRoleName)) {
|
127
|
+
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) || '';
|
127
128
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
128
129
|
}
|
129
130
|
}
|
@@ -135,7 +136,6 @@ const VerdocsTemplateFields = class {
|
|
135
136
|
}
|
136
137
|
async handleFieldChange(field, e, optionId) {
|
137
138
|
console.log('[FIELDS] handleFieldChange', field, e, optionId);
|
138
|
-
this.rerender++;
|
139
139
|
}
|
140
140
|
handleFieldSettingsChange(pageInfo, field, el, newFieldData, oldName) {
|
141
141
|
var _a, _b;
|
@@ -146,8 +146,6 @@ const VerdocsTemplateFields = class {
|
|
146
146
|
this.selectedRoleName = field.role_name;
|
147
147
|
el.setAttribute('roleindex', utils.getRoleIndex(TemplateStore.getRoleNames(this.templateStore), field.role_name));
|
148
148
|
el.field = this.fieldStore.get(field.name);
|
149
|
-
this.rerender++;
|
150
|
-
el.setAttribute('rerender', this.rerender);
|
151
149
|
(_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' });
|
152
150
|
// We do this to avoid dupes if the field gets renamed.
|
153
151
|
if (field.name !== oldName) {
|
@@ -164,15 +162,12 @@ const VerdocsTemplateFields = class {
|
|
164
162
|
this.reRenderField(field, pageInfo.pageNumber);
|
165
163
|
}
|
166
164
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
167
|
-
// console.log('afa', field);
|
168
165
|
el.addEventListener('input', e => this.handleFieldChange(field, e));
|
169
166
|
el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, el, e.detail.field, e.detail.fieldName));
|
170
|
-
// el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, roleIndex, el, e.detail.field));
|
171
167
|
el.addEventListener('deleted', () => {
|
172
168
|
var _a, _b;
|
173
169
|
console.log('[FIELDS] Deleted', this, field);
|
174
170
|
el.remove();
|
175
|
-
this.rerender++;
|
176
171
|
(_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' });
|
177
172
|
});
|
178
173
|
el.setAttribute('templateid', this.templateId);
|
@@ -188,7 +183,10 @@ const VerdocsTemplateFields = class {
|
|
188
183
|
// console.log('[FIELDS] Page rendered', pageInfo.pageNumber, pageInfo);
|
189
184
|
this.cachedPageInfo[pageInfo.pageNumber] = pageInfo;
|
190
185
|
this.pageHeights[pageInfo.pageNumber] = pageInfo.naturalHeight;
|
191
|
-
|
186
|
+
// Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.
|
187
|
+
// See https://github.com/ionic-team/stencil-store/issues/23
|
188
|
+
const fields = Object.values(this.fieldStore.state).filter((field) => field && field.page_sequence === pageInfo.pageNumber);
|
189
|
+
console.log('[FIELDS] Page rendered', pageInfo, fields);
|
192
190
|
fields.forEach((field) => this.reRenderField(field, pageInfo.pageNumber));
|
193
191
|
}
|
194
192
|
reRenderField(field, pageNumber) {
|
@@ -285,7 +283,7 @@ const VerdocsTemplateFields = class {
|
|
285
283
|
do {
|
286
284
|
fieldName = `${type}P${pageNumber}-${i}`;
|
287
285
|
i++;
|
288
|
-
} while (Object.values(this.fieldStore.state).some(field => field.name === fieldName));
|
286
|
+
} while (Object.values(this.fieldStore.state).some(field => field && field.name === fieldName));
|
289
287
|
return fieldName;
|
290
288
|
}
|
291
289
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|
@@ -397,7 +395,7 @@ const VerdocsTemplateFields = class {
|
|
397
395
|
}
|
398
396
|
}
|
399
397
|
render() {
|
400
|
-
var _a, _b, _c
|
398
|
+
var _a, _b, _c;
|
401
399
|
if (!this.endpoint.session) {
|
402
400
|
return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
403
401
|
}
|
@@ -405,10 +403,10 @@ const VerdocsTemplateFields = class {
|
|
405
403
|
if (!((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
|
406
404
|
return (index.h(index.Host, null, index.h("verdocs-loader", null)));
|
407
405
|
}
|
408
|
-
const selectableRoles = (
|
409
|
-
|
410
|
-
|
411
|
-
|
406
|
+
const selectableRoles = Object.values(this.roleStore)
|
407
|
+
.filter(role => role !== undefined)
|
408
|
+
.map(role => ({ value: role.name, label: role.name }));
|
409
|
+
return (index.h(index.Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, onSubmit: () => { } }, index.h("div", { id: "verdocs-template-fields-toolbar" }, index.h("div", { class: "add-for" }, "Add field:"), index.h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (index.h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
|
412
410
|
// We ignore empty-tooltip entries because they're separators
|
413
411
|
if (option.tooltip) {
|
414
412
|
// We require a role to be selected first
|
@@ -419,13 +417,13 @@ const VerdocsTemplateFields = class {
|
|
419
417
|
this.showMustSelectRole = true;
|
420
418
|
}
|
421
419
|
}
|
422
|
-
} })))), index.h("div", { class: "pages" }, (((
|
420
|
+
} })))), index.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 => {
|
423
421
|
const pageNumbers = Primitives.integerSequence(1, document.page_numbers);
|
424
422
|
return pageNumbers.map(page => (index.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: [
|
425
423
|
{ name: 'page', type: 'canvas' },
|
426
424
|
{ name: 'controls', type: 'div' },
|
427
425
|
] })));
|
428
|
-
})), this.showMustSelectRole && (index.h("verdocs-ok-dialog", { heading: "Unable to add field", message: (
|
426
|
+
})), this.showMustSelectRole && (index.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) }))));
|
429
427
|
}
|
430
428
|
};
|
431
429
|
VerdocsTemplateFields.style = verdocsTemplateFieldsCss;
|
@@ -439,7 +437,9 @@ const VerdocsTemplateRoleProperties = class {
|
|
439
437
|
this.close = index.createEvent(this, "close", 7);
|
440
438
|
this.delete = index.createEvent(this, "delete", 7);
|
441
439
|
this.sdkError = index.createEvent(this, "sdkError", 7);
|
442
|
-
this.
|
440
|
+
this.templateStore = null;
|
441
|
+
this.fieldStore = null;
|
442
|
+
this.roleStore = null;
|
443
443
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
444
444
|
this.templateId = '';
|
445
445
|
this.roleName = '';
|
@@ -448,13 +448,13 @@ const VerdocsTemplateRoleProperties = class {
|
|
448
448
|
this.saving = false;
|
449
449
|
this.name = '';
|
450
450
|
this.type = 'signer';
|
451
|
-
this.
|
451
|
+
this.full_name = '';
|
452
452
|
this.email = '';
|
453
453
|
this.phone = '';
|
454
|
-
this.
|
454
|
+
this.delegator = false;
|
455
455
|
}
|
456
456
|
async componentWillLoad() {
|
457
|
-
var _a, _b, _c
|
457
|
+
var _a, _b, _c;
|
458
458
|
try {
|
459
459
|
this.endpoint.loadSession();
|
460
460
|
if (!this.templateId) {
|
@@ -465,29 +465,39 @@ const VerdocsTemplateRoleProperties = class {
|
|
465
465
|
console.log('[ROLE_PROPERTIES] Unable to start builder session, must be authenticated');
|
466
466
|
return;
|
467
467
|
}
|
468
|
-
this.
|
469
|
-
|
468
|
+
this.templateStore = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
469
|
+
this.fieldStore = TemplateFieldStore.getTemplateFieldStore(this.templateId);
|
470
|
+
this.roleStore = TemplateStore.createTemplateRoleStore(this.templateStore.state);
|
471
|
+
const editingRole = this.roleStore.get(this.roleName);
|
470
472
|
if (editingRole) {
|
471
473
|
this.name = editingRole.name;
|
472
474
|
this.type = editingRole.type;
|
473
|
-
this.
|
475
|
+
this.full_name = editingRole.full_name;
|
474
476
|
this.email = editingRole.email;
|
475
477
|
this.phone = editingRole.phone;
|
476
|
-
this.
|
477
|
-
console.log('[
|
478
|
+
this.delegator = editingRole.delegator;
|
479
|
+
console.log('[ROLE_PROPERTIES] Editing role', editingRole);
|
478
480
|
}
|
479
481
|
}
|
480
482
|
catch (e) {
|
481
|
-
console.log('[
|
482
|
-
(
|
483
|
+
console.log('[ROLE_PROPERTIES Error with preview session', e);
|
484
|
+
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new errors.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));
|
483
485
|
}
|
484
486
|
}
|
485
487
|
handleCancel(e) {
|
486
|
-
var _a
|
488
|
+
var _a;
|
487
489
|
e.stopPropagation();
|
488
|
-
|
490
|
+
const editingRole = this.roleStore.get(this.roleName);
|
491
|
+
if (editingRole) {
|
492
|
+
this.name = editingRole.name;
|
493
|
+
this.type = editingRole.type;
|
494
|
+
this.full_name = editingRole.full_name;
|
495
|
+
this.email = editingRole.email;
|
496
|
+
this.phone = editingRole.phone;
|
497
|
+
this.delegator = editingRole.delegator;
|
498
|
+
}
|
489
499
|
this.dirty = false;
|
490
|
-
(
|
500
|
+
(_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
|
491
501
|
}
|
492
502
|
async handleSave(e) {
|
493
503
|
e.stopPropagation();
|
@@ -495,35 +505,24 @@ const VerdocsTemplateRoleProperties = class {
|
|
495
505
|
updateRole(this.endpoint, this.templateId, this.roleName, {
|
496
506
|
name: this.name,
|
497
507
|
type: this.type,
|
498
|
-
full_name: this.
|
508
|
+
full_name: this.full_name,
|
499
509
|
email: this.email,
|
500
510
|
phone: this.phone,
|
501
|
-
delegator: this.
|
511
|
+
delegator: this.delegator,
|
502
512
|
})
|
503
513
|
.then(async (r) => {
|
504
514
|
var _a;
|
505
515
|
console.log('[ROLE_PROPERTIES] Update result', r);
|
506
516
|
this.saving = false;
|
507
517
|
this.dirty = false;
|
508
|
-
this.
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
// newRoles.forEach(role => {
|
513
|
-
// if (role.name === this.roleName) {
|
514
|
-
// role.name = this.name;
|
515
|
-
// role.type = this.type;
|
516
|
-
// role.full_name = this.fullName;
|
517
|
-
// role.email = this.email;
|
518
|
-
// role.phone = this.phone;
|
519
|
-
// role.delegator = this.allowDelegation;
|
520
|
-
// }
|
521
|
-
// });
|
522
|
-
// this.store.state.roles = newRoles;
|
518
|
+
this.roleStore.set(r.name, r);
|
519
|
+
if (this.roleName !== r.name) {
|
520
|
+
this.roleStore.set(this.roleName, undefined);
|
521
|
+
}
|
523
522
|
(_a = this.close) === null || _a === void 0 ? void 0 : _a.emit();
|
524
523
|
})
|
525
524
|
.catch(e => {
|
526
|
-
console.log('Update error', e);
|
525
|
+
console.log('[ROLE_PROPERTIES Update error', e);
|
527
526
|
this.saving = false;
|
528
527
|
});
|
529
528
|
}
|
@@ -533,20 +532,19 @@ const VerdocsTemplateRoleProperties = class {
|
|
533
532
|
deleteRole(this.endpoint, this.templateId, this.roleName)
|
534
533
|
.then(r => {
|
535
534
|
var _a;
|
536
|
-
|
537
|
-
this.store.state.roles = [...this.store.state.roles.filter(role => role.name !== this.roleName)];
|
535
|
+
delete this.roleStore.state[r.name];
|
538
536
|
(_a = this.delete) === null || _a === void 0 ? void 0 : _a.emit({ templateId: this.templateId, roleName: this.roleName });
|
539
537
|
})
|
540
538
|
.catch(e => {
|
541
|
-
console.log('Deletion error', e);
|
539
|
+
console.log('[ROLE_PROPERTIES Deletion error', e);
|
542
540
|
});
|
543
541
|
}
|
544
542
|
}
|
545
543
|
render() {
|
546
|
-
const hasFields = (this.
|
547
|
-
return (index.h(index.Host, null, index.h("div", { class: "background-overlay", onClick: e => this.handleCancel(e) }, index.h("div", { class: "dialog" }, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("verdocs-text-input", { id: "verdocs-
|
544
|
+
const hasFields = Object.values(this.fieldStore).findIndex(field => field.role_name === this.roleName) !== -1;
|
545
|
+
return (index.h(index.Host, null, index.h("div", { class: "background-overlay", onClick: e => this.handleCancel(e) }, index.h("div", { class: "dialog" }, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("verdocs-text-input", { id: "verdocs-role-name", label: "Role Name", value: this.name, autocomplete: "off", disabled: hasFields, helpText: hasFields
|
548
546
|
? 'This role has fields assigned and can no longer be renamed.'
|
549
|
-
: 'A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.', placeholder: "
|
547
|
+
: 'A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.', placeholder: "Role Name...", onInput: (e) => {
|
550
548
|
this.name = e.target.value;
|
551
549
|
this.dirty = true;
|
552
550
|
} }), index.h("div", { class: "row" }, index.h("div", { class: "input-label" }, "Type:"), index.h("verdocs-select-input", { value: this.type, options: [
|
@@ -556,8 +554,8 @@ const VerdocsTemplateRoleProperties = class {
|
|
556
554
|
], onInput: (e) => {
|
557
555
|
this.type = e.target.value;
|
558
556
|
this.dirty = true;
|
559
|
-
} }), index.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." })), index.h("verdocs-text-input", { id: "verdocs-recipient-email", label: "Full Name", value: this.
|
560
|
-
this.
|
557
|
+
} }), index.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." })), index.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) => {
|
558
|
+
this.full_name = e.target.value;
|
561
559
|
this.dirty = true;
|
562
560
|
} }), index.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) => {
|
563
561
|
this.email = e.target.value;
|
@@ -565,8 +563,8 @@ const VerdocsTemplateRoleProperties = class {
|
|
565
563
|
} }), index.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) => {
|
566
564
|
this.phone = e.target.value;
|
567
565
|
this.dirty = true;
|
568
|
-
} }), index.h("div", { class: "row" }, index.h("div", { class: "input-label" }, "May Delegate:"), index.h("div", { class: "checkbox-wrapper" }, index.h("verdocs-checkbox", { checked: this.
|
569
|
-
this.
|
566
|
+
} }), index.h("div", { class: "row" }, index.h("div", { class: "input-label" }, "May Delegate:"), index.h("div", { class: "checkbox-wrapper" }, index.h("verdocs-checkbox", { checked: this.delegator, onInput: (e) => {
|
567
|
+
this.delegator = e.target.checked;
|
570
568
|
this.dirty = true;
|
571
569
|
} })), index.h("verdocs-help-icon", { text: "If enabled, this recipient may delegate their actions to another individual." })), index.h("div", { class: "buttons" }, index.h("button", { class: "delete-button", disabled: this.dirty, onClick: e => this.handleDelete(e), innerHTML: TrashIcon }), index.h("div", { style: { flex: '1' } }), index.h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), index.h("verdocs-button", { size: "small", label: "Save", disabled: !this.dirty, onClick: e => this.handleSave(e) })))))));
|
572
570
|
}
|
@@ -596,9 +594,9 @@ const VerdocsTemplateRoles = class {
|
|
596
594
|
this.next = index.createEvent(this, "next", 7);
|
597
595
|
this.exit = index.createEvent(this, "exit", 7);
|
598
596
|
this.sdkError = index.createEvent(this, "sdkError", 7);
|
599
|
-
this.
|
600
|
-
this.
|
601
|
-
this.
|
597
|
+
this.rolesUpdated = index.createEvent(this, "rolesUpdated", 7);
|
598
|
+
this.templateStore = null;
|
599
|
+
this.roleStore = null;
|
602
600
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
603
601
|
this.templateId = '';
|
604
602
|
this.showingRoleDialog = null;
|
@@ -617,18 +615,14 @@ const VerdocsTemplateRoles = class {
|
|
617
615
|
console.log('[ROLES] Unable to start builder session, must be authenticated');
|
618
616
|
return;
|
619
617
|
}
|
620
|
-
await this.
|
618
|
+
this.templateStore = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
619
|
+
this.roleStore = TemplateStore.getTemplateRoleStore(this.templateId);
|
621
620
|
}
|
622
621
|
catch (e) {
|
623
622
|
console.log('[FIELDS] Error with preview session', e);
|
624
623
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new errors.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));
|
625
624
|
}
|
626
625
|
}
|
627
|
-
async reloadStore() {
|
628
|
-
this.store = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
629
|
-
this.sortTemplateRoles();
|
630
|
-
this.renumberTemplateRoles();
|
631
|
-
}
|
632
626
|
componentDidRender() {
|
633
627
|
interact_min.interact_min.dynamicDrop(true);
|
634
628
|
interact_min.interact_min('.recipient').draggable({
|
@@ -638,64 +632,45 @@ const VerdocsTemplateRoles = class {
|
|
638
632
|
this.el.classList.add('dragging');
|
639
633
|
}.bind(this),
|
640
634
|
move: function handleMove(e) {
|
641
|
-
const oldX = +(e.target.getAttribute('
|
642
|
-
const oldY = +(e.target.getAttribute('
|
635
|
+
const oldX = +(e.target.getAttribute('dX') || 0);
|
636
|
+
const oldY = +(e.target.getAttribute('dY') || 0);
|
637
|
+
const sequence = +(e.target.dataset['sequence'] || 0);
|
643
638
|
const newX = e.dx + oldX;
|
644
639
|
const newY = e.dy + oldY;
|
645
|
-
e.target.setAttribute('
|
646
|
-
e.target.setAttribute('
|
647
|
-
e.target.
|
640
|
+
e.target.setAttribute('dX', newX);
|
641
|
+
e.target.setAttribute('dY', newY);
|
642
|
+
const rect = e.target.getBoundingClientRect();
|
643
|
+
// Note: I never did figure out exactly why this is, but if we don't offset the transform
|
644
|
+
// the dragged item is offset from the mouse cursor quite a bit.
|
645
|
+
e.target.style.transform = `translate(${newX + 80}px, ${newY - rect.height * sequence}px)`;
|
648
646
|
}.bind(this),
|
649
647
|
end: function handleEnd(e) {
|
650
648
|
e.target.classList.remove('dragging');
|
651
649
|
this.el.classList.remove('dragging');
|
652
650
|
// console.log('end', event);
|
653
|
-
e.target.
|
654
|
-
e.target.
|
655
|
-
e.target.style.transform =
|
651
|
+
e.target.removeAttribute('dX');
|
652
|
+
e.target.removeAttribute('dY');
|
653
|
+
e.target.style.transform = null;
|
656
654
|
}.bind(this),
|
657
655
|
},
|
658
656
|
});
|
659
657
|
interact_min.interact_min('.dropzone').dropzone({
|
660
658
|
overlap: 0.05,
|
661
|
-
ondrop: function handleDrop(event) {
|
662
|
-
var _a
|
659
|
+
ondrop: async function handleDrop(event) {
|
660
|
+
var _a;
|
663
661
|
event.target.classList.remove('active');
|
664
|
-
// target will be the recipient e.g. <div class="recipient" data-rolename="Buyer" />
|
665
|
-
// relatedTarget will be the drop zone, e.g. <div class="dropzone" data-order="2" data-sequence="1" />
|
666
|
-
// console.log(event.relatedTarget, ' was dropped into ', event.target);
|
667
|
-
// We don't use the role's own order, we rely on the fact that we sorted earlier on the order field. Many legacy
|
668
|
-
// 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
|
669
|
-
// 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
|
670
|
-
// need to do a fancy find/arraymove dance. We just set the dropped element to the half value, sort the result,
|
671
|
-
// then do a final renumber. It's not expensive to do because most flows are typically a small handful (e.g. 1-4)
|
672
|
-
// recipients. They never have hundreds.
|
673
662
|
const roleName = event.relatedTarget.dataset.rolename;
|
674
663
|
const targetSequence = +event.target.dataset.sequence;
|
675
664
|
const targetOrder = +event.target.dataset.order;
|
676
|
-
const changingRole =
|
665
|
+
const changingRole = this.roleStore.get(roleName);
|
677
666
|
if (changingRole) {
|
678
667
|
// To handle the renumbering, we update the role being moved to the new values, which will be some half-interval e.g.
|
679
|
-
// sequence 1.5 order 1. Then we
|
680
|
-
changingRole
|
681
|
-
changingRole.
|
682
|
-
this.
|
683
|
-
this.
|
684
|
-
this.
|
685
|
-
// We have to update ALL the roles to be sure each gets new proper sequence/order numbers assigned.
|
686
|
-
// TODO: We could optimize this by tracking "dirty" states and only update the roles that have changed. But it's a LOT more
|
687
|
-
// code to do right, and since most workflows will typically only have 2-4 recipients max, it may not be worth it.
|
688
|
-
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, {
|
689
|
-
sequence: role.sequence,
|
690
|
-
order: role.order,
|
691
|
-
})))
|
692
|
-
.then(() => {
|
693
|
-
var _a, _b;
|
694
|
-
console.log('[ROLES] Updated roles');
|
695
|
-
(_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 });
|
696
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
697
|
-
})
|
698
|
-
.catch(e => console.log('[ROLES] Role updates failed', e));
|
668
|
+
// sequence 1.5 order 1. Then we sort/renumber the roles at each level to determine their final ordering values.
|
669
|
+
const newRole = { ...changingRole, sequence: targetSequence, order: targetOrder };
|
670
|
+
this.roleStore.set(changingRole.name, newRole);
|
671
|
+
await this.renumberTemplateRoles();
|
672
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
673
|
+
console.log('[ROLES] Updated roles', this.getSortedRoles());
|
699
674
|
}
|
700
675
|
}.bind(this),
|
701
676
|
ondropactivate: e => {
|
@@ -720,50 +695,60 @@ const VerdocsTemplateRoles = class {
|
|
720
695
|
var _a;
|
721
696
|
(_a = this.next) === null || _a === void 0 ? void 0 : _a.emit();
|
722
697
|
}
|
723
|
-
|
724
|
-
|
725
|
-
|
698
|
+
getSortedRoles() {
|
699
|
+
return Object.values(this.roleStore.state)
|
700
|
+
.filter(role => role !== undefined)
|
701
|
+
.sort((a, b) => {
|
726
702
|
return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;
|
727
703
|
});
|
728
704
|
}
|
729
|
-
|
730
|
-
|
731
|
-
this.
|
732
|
-
|
733
|
-
|
734
|
-
this.sequences.push(role.sequence);
|
705
|
+
getSequenceNumbers() {
|
706
|
+
const sequences = [];
|
707
|
+
this.getSortedRoles().forEach(role => {
|
708
|
+
if (!sequences.includes(role.sequence)) {
|
709
|
+
sequences.push(role.sequence);
|
735
710
|
}
|
736
711
|
});
|
712
|
+
return sequences.sort((a, b) => a - b);
|
713
|
+
}
|
714
|
+
getRoleNames() {
|
715
|
+
const roles = this.getSortedRoles();
|
716
|
+
return roles.map(role => role.name);
|
717
|
+
}
|
718
|
+
getRolesAtSequence(sequence) {
|
719
|
+
// Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.
|
720
|
+
// See https://github.com/ionic-team/stencil-store/issues/23
|
721
|
+
return Object.values(this.roleStore.state).filter(role => role && role.sequence === sequence);
|
737
722
|
}
|
723
|
+
// When the user drags a role around, we handle placement "between" items by assigning it a half-order number
|
724
|
+
// 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.
|
725
|
+
// Then we re-sort the list of roles and renumber them.
|
738
726
|
renumberTemplateRoles() {
|
739
|
-
//
|
740
|
-
this.extractSequenceNumbers();
|
741
|
-
// We need to renumber each role only ONE TIME
|
727
|
+
// Avoid dupe renumber attempts
|
742
728
|
const renumbered = [];
|
743
729
|
// 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.
|
744
|
-
|
745
|
-
this.
|
746
|
-
|
747
|
-
(_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) => {
|
730
|
+
const renumberRequests = [];
|
731
|
+
this.getSequenceNumbers().forEach((originalSequence, newSequenceIndex) => {
|
732
|
+
this.getRolesAtSequence(originalSequence).forEach((role, newOrderIndex) => {
|
748
733
|
if (!renumbered.includes(role.name)) {
|
749
734
|
role.sequence = newSequenceIndex + 1;
|
750
735
|
role.order = newOrderIndex + 1;
|
751
736
|
renumbered.push(role.name);
|
737
|
+
renumberRequests.push(updateRole(this.endpoint, this.templateId, role.name, { sequence: role.sequence, order: role.order }));
|
752
738
|
}
|
753
739
|
});
|
754
740
|
});
|
755
|
-
|
756
|
-
this.extractSequenceNumbers();
|
741
|
+
return Promise.all(renumberRequests);
|
757
742
|
}
|
758
743
|
// Look for name conflicts, because they're UGC and can be anything, regardless of order.
|
759
744
|
getNextRoleName() {
|
760
|
-
var _a
|
745
|
+
var _a;
|
761
746
|
let name = '';
|
762
|
-
let nextNumber = (
|
747
|
+
let nextNumber = Object.keys(this.roleStore).length;
|
763
748
|
do {
|
764
749
|
nextNumber++;
|
765
750
|
name = `Recipient ${nextNumber}`;
|
766
|
-
} while (!name || ((
|
751
|
+
} while (!name || Object.values((_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.state).some(role => role && role.name === name));
|
767
752
|
return name;
|
768
753
|
}
|
769
754
|
callCreateRole(name, sequence, order) {
|
@@ -780,25 +765,19 @@ const VerdocsTemplateRoles = class {
|
|
780
765
|
delegator: false,
|
781
766
|
})
|
782
767
|
.then(async (r) => {
|
783
|
-
var _a
|
768
|
+
var _a;
|
784
769
|
console.log('[ROLES] Created role', r);
|
785
|
-
this.
|
786
|
-
this.
|
787
|
-
this.
|
788
|
-
// this.store.state.roles = [...this.store?.state.roles, r];
|
789
|
-
// this.renumberTemplateRoles();
|
790
|
-
(_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 });
|
791
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
770
|
+
this.roleStore.set(r.name, r);
|
771
|
+
await this.renumberTemplateRoles();
|
772
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
792
773
|
})
|
793
774
|
.catch(e => {
|
794
775
|
console.log('[ROLES] Error creating role', e);
|
795
776
|
});
|
796
777
|
}
|
797
778
|
handleAddRole(e, sequence) {
|
798
|
-
var _a;
|
799
779
|
e.stopPropagation();
|
800
|
-
|
801
|
-
const order = ((_a = this.store) === null || _a === void 0 ? void 0 : _a.state.roles.filter(role => role.sequence === sequence).length) + 1;
|
780
|
+
const order = this.getRolesAtSequence(sequence).length + 1;
|
802
781
|
const name = this.getNextRoleName();
|
803
782
|
this.callCreateRole(name, sequence, order);
|
804
783
|
}
|
@@ -809,33 +788,25 @@ const VerdocsTemplateRoles = class {
|
|
809
788
|
this.callCreateRole(name, sequence, order);
|
810
789
|
}
|
811
790
|
render() {
|
812
|
-
var _a, _b, _c
|
813
|
-
console.log('[ROLES] Rendering');
|
791
|
+
var _a, _b, _c;
|
814
792
|
if (!this.endpoint.session) {
|
815
793
|
return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
816
794
|
}
|
817
|
-
if (!((_a = this.
|
795
|
+
if (!((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
|
818
796
|
return (index.h(index.Host, { class: "loading" }, index.h("verdocs-loader", null)));
|
819
797
|
}
|
820
|
-
const roleNames =
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
return unknown ? (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { borderColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
|
827
|
-
}), index.h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), this.sequences.length > 0 && (index.h("div", { class: "row add-sequence", "data-sequence": sequence }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step"))))));
|
828
|
-
}), index.h("div", { class: "row", "data-sequence": this.sequences.length + 1 }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, this.sequences.length + 1) }))), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: doneIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (index.h("div", { class: "empty" }, "You must add at least one Role before proceeding.", index.h("br", null), " Click the ", index.h("span", { innerHTML: plusIcon }), " Add button above to get started.")), index.h("div", { class: "buttons" }, index.h("div", { class: "flex-fill" }), index.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), index.h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (index.h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
798
|
+
const roleNames = this.getRoleNames();
|
799
|
+
const sequences = this.getSequenceNumbers();
|
800
|
+
return (index.h(index.Host, null, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("h5", null, "Roles and Workflow"), index.h("div", { class: "participants" }, index.h("div", { class: "left-line" }), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: startIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "sender" }, index.h("span", { class: "label" }, "Sender:"), " ", senderLabels[(_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.sender], ' ', index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingSenderDialog = true), "aria-role": "button" })))), index.h("div", { class: "row add-sequence", "data-sequence": 0 }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (index.h(index.Fragment, null, index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: stepIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
|
801
|
+
const unknown = !role.email;
|
802
|
+
return unknown ? (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { backgroundColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name, "data-sequence": sequence }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { borderColor: Colors.getRGBA(utils.getRoleIndex(roleNames, role.name)) }, "data-rolename": role.name, "data-sequence": sequence }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.full_name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
|
803
|
+
}), index.h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (index.h("div", { class: "row add-sequence", "data-sequence": sequence }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step"))))))), index.h("div", { class: "row", "data-sequence": sequences.length + 1 }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: doneIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (index.h("div", { class: "empty" }, "You must add at least one Role before proceeding.", index.h("br", null), " Click the ", index.h("span", { innerHTML: plusIcon }), " Add button above to get started.")), index.h("div", { class: "buttons" }, index.h("div", { class: "flex-fill" }), index.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), index.h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (index.h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
829
804
|
this.showingRoleDialog = null;
|
830
|
-
// this.forceRerender++;
|
831
805
|
}, onDelete: async () => {
|
832
|
-
var _a
|
833
|
-
await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
834
|
-
this.renumberTemplateRoles();
|
806
|
+
var _a;
|
835
807
|
this.showingRoleDialog = null;
|
836
|
-
|
837
|
-
(_a = this.
|
838
|
-
this.reloadStore().catch(e => console.log('Unknown error', e));
|
808
|
+
await this.renumberTemplateRoles();
|
809
|
+
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
839
810
|
} })), this.showingSenderDialog && index.h("verdocs-template-sender", { endpoint: this.endpoint, templateId: this.templateId, onClose: () => (this.showingSenderDialog = false) })));
|
840
811
|
}
|
841
812
|
get el() { return index.getElement(this); }
|