@verdocs/web-sdk 2.3.15 → 2.3.16
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/TemplateFieldStore-7449e5ff.js +24 -0
- package/dist/cjs/{TemplateStore-17b9fdfe.js → TemplateStore-0074c71d.js} +2 -0
- package/dist/cjs/interact.min-a61b43b3.js +12 -0
- package/dist/cjs/ipc-test.cjs.entry.js +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +2 -1
- package/dist/cjs/verdocs-button-panel_2.cjs.entry.js +60 -43
- package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +11 -2
- package/dist/cjs/verdocs-preview_8.cjs.entry.js +2 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +42 -38
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +1 -1
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +27 -1
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +61 -44
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +40 -36
- package/dist/collection/utils/TemplateFieldStore.js +18 -0
- package/dist/collection/utils/TemplateStore.js +2 -0
- package/dist/components/TemplateStore.js +20 -1
- package/dist/components/interact.min.js +2 -2
- package/dist/components/verdocs-field-textbox.js +10 -1
- package/dist/components/verdocs-preview2.js +1 -1
- package/dist/components/verdocs-sign.js +1 -1
- package/dist/components/verdocs-template-field-properties2.js +61 -45
- package/dist/components/verdocs-template-fields2.js +40 -37
- package/dist/docs.json +18 -1
- package/dist/esm/TemplateFieldStore-4f1b6332.js +21 -0
- package/dist/esm/{TemplateStore-ad77a294.js → TemplateStore-a2ebdaca.js} +2 -0
- package/dist/esm/interact.min-6a7b19a1.js +10 -0
- package/dist/esm/ipc-test.entry.js +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +2 -1
- package/dist/esm/verdocs-button-panel_2.entry.js +60 -43
- package/dist/esm/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +11 -2
- package/dist/esm/verdocs-preview_8.entry.js +2 -1
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm/verdocs-template-fields_4.entry.js +42 -38
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/TemplateFieldStore-4f1b6332.js +1 -0
- package/dist/esm-es5/TemplateStore-a2ebdaca.js +1 -0
- package/dist/esm-es5/interact.min-6a7b19a1.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-button-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.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/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +7 -0
- package/dist/types/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.d.ts +7 -5
- package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +4 -2
- package/dist/types/components.d.ts +8 -0
- package/dist/types/utils/TemplateFieldStore.d.ts +6 -0
- package/dist/types/utils/TemplateStore.d.ts +1 -1
- package/dist/verdocs-web-sdk/p-084c23e4.system.js +1 -0
- package/dist/verdocs-web-sdk/p-12d00a0f.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-b5eb8024.entry.js → p-319c00bd.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-32c40388.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-358aef29.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-3cd0d440.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-429cad70.js +1 -0
- package/dist/verdocs-web-sdk/p-4e74bb3c.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-588d6cea.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-b467d981.system.entry.js → p-5aa77f6d.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-5bf12ef8.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-062ca25f.system.entry.js → p-6685ff29.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-72978ba3.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0c425f97.system.entry.js → p-736fbb87.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-8dc15d33.js +1 -0
- package/dist/verdocs-web-sdk/p-915883e6.js +1 -0
- package/dist/verdocs-web-sdk/p-a627881e.system.js +1 -0
- package/dist/verdocs-web-sdk/p-aae6b4e0.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5645b8cd.entry.js → p-b91de346.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-bd9ba3b3.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e2ff37fb.system.js +1 -0
- package/dist/verdocs-web-sdk/p-e3ffc00f.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 +4 -4
- package/dist/cjs/interact.min-7c05ff8a.js +0 -12
- package/dist/custom-elements.json +0 -2067
- package/dist/esm/interact.min-ef5402f3.js +0 -10
- package/dist/esm-es5/TemplateStore-ad77a294.js +0 -1
- package/dist/esm-es5/interact.min-ef5402f3.js +0 -1
- package/dist/verdocs-web-sdk/p-746fce21.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-79168c6a.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-82b5e475.system.js +0 -1
- package/dist/verdocs-web-sdk/p-82d9fa84.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-85df0da6.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-8c0fafde.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-999fbe79.js +0 -1
- package/dist/verdocs-web-sdk/p-9a5c0882.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9d2995a9.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b9443a01.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e760f894.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-eda5691a.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f3dde708.js +0 -1
- package/dist/verdocs-web-sdk/p-fcd0a40a.system.js +0 -1
- package/dist/verdocs-web-sdk/p-fe67b620.system.entry.js +0 -1
@@ -8,7 +8,8 @@ const _commonjsHelpers = require('./_commonjsHelpers-1fbbf0eb.js');
|
|
8
8
|
require('./Types-f89f9116.js');
|
9
9
|
const VerdocsEndpoint = require('./VerdocsEndpoint-8f298664.js');
|
10
10
|
const Fields = require('./Fields-705a2168.js');
|
11
|
-
const
|
11
|
+
const TemplateFieldStore = require('./TemplateFieldStore-7449e5ff.js');
|
12
|
+
const TemplateStore = require('./TemplateStore-0074c71d.js');
|
12
13
|
const errors = require('./errors-0396da3d.js');
|
13
14
|
require('./index-f712049c.js');
|
14
15
|
|
@@ -285,21 +286,23 @@ const VerdocsTemplateFieldProperties = class {
|
|
285
286
|
this.delete = index.createEvent(this, "delete", 7);
|
286
287
|
this.settingsChanged = index.createEvent(this, "settingsChanged", 7);
|
287
288
|
this.sdkError = index.createEvent(this, "sdkError", 7);
|
288
|
-
this.
|
289
|
+
this.templateStore = null;
|
290
|
+
this.fieldStore = null;
|
291
|
+
this.watcher = null;
|
289
292
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
290
293
|
this.templateId = '';
|
291
294
|
this.fieldName = '';
|
292
295
|
this.helpText = '';
|
293
296
|
this.dirty = false;
|
294
297
|
this.loading = true;
|
295
|
-
this.type = 'signature';
|
296
298
|
this.setting = null;
|
297
299
|
this.label = '';
|
300
|
+
this.type = 'textbox';
|
298
301
|
this.name = '';
|
302
|
+
this.required = false;
|
299
303
|
this.roleName = '';
|
300
304
|
this.group = '';
|
301
305
|
this.fieldType = '';
|
302
|
-
this.required = false;
|
303
306
|
this.options = [];
|
304
307
|
this.placeholder = '';
|
305
308
|
this.value = '';
|
@@ -307,7 +310,7 @@ const VerdocsTemplateFieldProperties = class {
|
|
307
310
|
this.showingHelp = false;
|
308
311
|
}
|
309
312
|
async componentWillLoad() {
|
310
|
-
var _a, _b, _c, _d, _e, _f, _g
|
313
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
311
314
|
try {
|
312
315
|
this.endpoint.loadSession();
|
313
316
|
if (!this.templateId) {
|
@@ -322,11 +325,36 @@ const VerdocsTemplateFieldProperties = class {
|
|
322
325
|
console.log('[FIELD PROPERTIES] Unable to start builder session, must be authenticated');
|
323
326
|
return;
|
324
327
|
}
|
325
|
-
this.
|
326
|
-
|
328
|
+
this.templateStore = await TemplateStore.getTemplateStore(this.endpoint, this.templateId);
|
329
|
+
this.fieldStore = await TemplateFieldStore.createTemplateFieldStore(this.templateStore.state);
|
330
|
+
const field = this.fieldStore.get(this.fieldName);
|
327
331
|
if (!field) {
|
328
|
-
console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in
|
332
|
+
console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in fields`);
|
333
|
+
}
|
334
|
+
else {
|
335
|
+
console.log('props', field);
|
329
336
|
}
|
337
|
+
TemplateFieldStore.createTemplateFieldStore(this.templateStore.state);
|
338
|
+
this.watcher = this.fieldStore.onChange(this.fieldName, field => {
|
339
|
+
var _a, _b, _c, _d;
|
340
|
+
console.log('Field changed', field);
|
341
|
+
this.type = field.type;
|
342
|
+
this.name = field.name;
|
343
|
+
this.label = field.label;
|
344
|
+
this.group = field.name;
|
345
|
+
this.roleName = field.role_name;
|
346
|
+
this.required = field.required;
|
347
|
+
this.fieldType = field.type;
|
348
|
+
// TODO: Talk about how we want to handle labels/placeholders
|
349
|
+
this.placeholder = ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
350
|
+
this.value = ((_b = field.setting) === null || _b === void 0 ? void 0 : _b.result) || '';
|
351
|
+
this.leading = ((_c = field.setting) === null || _c === void 0 ? void 0 : _c.leading) || 0;
|
352
|
+
this.setting = field.setting || {};
|
353
|
+
this.options = ((_d = field.setting) === null || _d === void 0 ? void 0 : _d.options) || [];
|
354
|
+
this.dirty = false;
|
355
|
+
this.loading = false;
|
356
|
+
});
|
357
|
+
console.log('watcher', this.watcher);
|
330
358
|
this.type = field.type;
|
331
359
|
this.name = field.name;
|
332
360
|
this.label = field.label;
|
@@ -335,36 +363,37 @@ const VerdocsTemplateFieldProperties = class {
|
|
335
363
|
this.required = field.required;
|
336
364
|
this.fieldType = field.type;
|
337
365
|
// TODO: Talk about how we want to handle labels/placeholders
|
338
|
-
this.placeholder = ((
|
339
|
-
this.value = ((
|
340
|
-
this.leading = ((
|
366
|
+
this.placeholder = ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
367
|
+
this.value = ((_b = field.setting) === null || _b === void 0 ? void 0 : _b.result) || '';
|
368
|
+
this.leading = ((_c = field.setting) === null || _c === void 0 ? void 0 : _c.leading) || 0;
|
341
369
|
this.setting = field.setting || {};
|
342
|
-
this.options = ((
|
370
|
+
this.options = ((_d = field.setting) === null || _d === void 0 ? void 0 : _d.options) || [];
|
343
371
|
this.dirty = false;
|
344
372
|
this.loading = false;
|
373
|
+
console.log('Displaying settings for', this.setting);
|
345
374
|
}
|
346
375
|
catch (e) {
|
347
376
|
console.log('[FIELD PROPERTIES] Error loading template', e);
|
348
377
|
this.loading = false;
|
349
|
-
(
|
378
|
+
(_e = this.sdkError) === null || _e === void 0 ? void 0 : _e.emit(new errors.SDKError(e.message, (_f = e.response) === null || _f === void 0 ? void 0 : _f.status, (_g = e.response) === null || _g === void 0 ? void 0 : _g.data));
|
350
379
|
}
|
351
380
|
}
|
352
381
|
handleCancel(e) {
|
353
|
-
var _a, _b, _c, _d
|
382
|
+
var _a, _b, _c, _d;
|
354
383
|
e.stopPropagation();
|
355
|
-
const field =
|
384
|
+
const field = this.fieldStore.get(this.fieldName);
|
356
385
|
if (field) {
|
357
386
|
this.name = field.name;
|
358
387
|
this.label = field.label;
|
359
388
|
this.roleName = field.role_name;
|
360
389
|
this.required = field.required;
|
361
390
|
// TODO: Talk about how we want to handle labels/placeholders
|
362
|
-
this.placeholder = ((
|
363
|
-
this.value = ((
|
364
|
-
this.leading = ((
|
391
|
+
this.placeholder = ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
392
|
+
this.value = ((_b = field.setting) === null || _b === void 0 ? void 0 : _b.result) || '';
|
393
|
+
this.leading = ((_c = field.setting) === null || _c === void 0 ? void 0 : _c.leading) || 0;
|
365
394
|
}
|
366
395
|
this.dirty = false;
|
367
|
-
(
|
396
|
+
(_d = this.close) === null || _d === void 0 ? void 0 : _d.emit();
|
368
397
|
}
|
369
398
|
handleSave(e) {
|
370
399
|
e.stopPropagation();
|
@@ -390,6 +419,7 @@ const VerdocsTemplateFieldProperties = class {
|
|
390
419
|
options: this.options,
|
391
420
|
};
|
392
421
|
}
|
422
|
+
console.log('FP: Will update', newProperties);
|
393
423
|
Fields.updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
394
424
|
.then(field => {
|
395
425
|
var _a, _b;
|
@@ -441,33 +471,19 @@ const VerdocsTemplateFieldProperties = class {
|
|
441
471
|
});
|
442
472
|
}
|
443
473
|
updateField(newField) {
|
444
|
-
const
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
// field.name = this.name;
|
449
|
-
// field.role_name = this.roleName;
|
450
|
-
// field.required = this.required;
|
451
|
-
// field.label = this.placeholder;
|
452
|
-
// field.setting.result = this.defaultValue;
|
453
|
-
// if (field.setting.options) {
|
454
|
-
// field.setting.options = this.options;
|
455
|
-
// }
|
456
|
-
}
|
457
|
-
});
|
458
|
-
this.store.state.fields = newFields;
|
474
|
+
const oldField = this.fieldStore.get(this.fieldName) || {};
|
475
|
+
console.log('Updating field', newField, oldField);
|
476
|
+
Object.assign(oldField, newField);
|
477
|
+
this.fieldStore.set(this.fieldName, newField);
|
459
478
|
}
|
460
479
|
async handleDelete(e) {
|
461
480
|
e.stopPropagation();
|
462
481
|
if (window.confirm('Are you sure you wish to remove this field? This action cannot be undone.')) {
|
463
482
|
Fields.deleteField(this.endpoint, this.templateId, this.fieldName)
|
464
483
|
.then(() => {
|
465
|
-
var _a
|
466
|
-
this.
|
467
|
-
(
|
468
|
-
role.fields = [...role.fields.filter(field => field.name !== this.fieldName)];
|
469
|
-
});
|
470
|
-
(_e = this.delete) === null || _e === void 0 ? void 0 : _e.emit({ templateId: this.templateId, roleName: this.roleName });
|
484
|
+
var _a;
|
485
|
+
this.fieldStore.set(this.fieldName, undefined);
|
486
|
+
(_a = this.delete) === null || _a === void 0 ? void 0 : _a.emit({ templateId: this.templateId, roleName: this.roleName });
|
471
487
|
})
|
472
488
|
.catch(e => {
|
473
489
|
console.log('[FIELD PROPERTIES] Deletion error', e);
|
@@ -475,12 +491,13 @@ const VerdocsTemplateFieldProperties = class {
|
|
475
491
|
}
|
476
492
|
}
|
477
493
|
render() {
|
478
|
-
var _a
|
494
|
+
var _a;
|
495
|
+
// console.log('Rendering field properties', this.fieldStore.get(this.fieldName));
|
479
496
|
if (!this.endpoint.session) {
|
480
497
|
return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
481
498
|
}
|
482
499
|
// This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
|
483
|
-
if (!this.endpoint.session || !
|
500
|
+
if (!this.endpoint.session || !this.fieldStore.get(this.fieldName)) {
|
484
501
|
return index.h(index.Host, { class: "empty" });
|
485
502
|
}
|
486
503
|
if (this.helpText && this.showingHelp) {
|
@@ -496,7 +513,7 @@ const VerdocsTemplateFieldProperties = class {
|
|
496
513
|
placeholder: "Optional Label...", onInput: (e) => {
|
497
514
|
this.label = e.target.value;
|
498
515
|
this.dirty = true;
|
499
|
-
} })), index.h("div", { class: "row" }, index.h("div", { class: "input-label" }, "Role:"), index.h("verdocs-select-input", { value: this.roleName, options: (
|
516
|
+
} })), index.h("div", { class: "row" }, index.h("div", { class: "input-label" }, "Role:"), index.h("verdocs-select-input", { value: this.roleName, options: (_a = this.templateStore.state) === null || _a === void 0 ? void 0 : _a.roles.map(role => ({ label: role.name, value: role.name })), onInput: (e) => {
|
500
517
|
this.roleName = e.target.value;
|
501
518
|
this.dirty = true;
|
502
519
|
} })), ['textbox', 'textarea'].includes(this.type) && (index.h("div", { class: "row", style: { marginTop: '10px', marginBottom: '10px' } }, index.h("verdocs-text-input", { id: "verdocs-field-value", label: "Value", value: this.value, autocomplete: "off", placeholder: "Pre-defined value...", onInput: (e) => {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-5463795e.js');
|
6
|
-
const interact_min = require('./interact.min-
|
6
|
+
const interact_min = require('./interact.min-a61b43b3.js');
|
7
7
|
require('./Types-f89f9116.js');
|
8
8
|
const VerdocsEndpoint = require('./VerdocsEndpoint-8f298664.js');
|
9
9
|
const Fields = require('./Fields-705a2168.js');
|
@@ -3,17 +3,19 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-5463795e.js');
|
6
|
-
const interact_min = require('./interact.min-
|
6
|
+
const interact_min = require('./interact.min-a61b43b3.js');
|
7
7
|
require('./Types-f89f9116.js');
|
8
8
|
const VerdocsEndpoint = require('./VerdocsEndpoint-8f298664.js');
|
9
9
|
const Fields = require('./Fields-705a2168.js');
|
10
10
|
const Colors = require('./Colors-e809dcc9.js');
|
11
11
|
const utils = require('./utils-0916d10f.js');
|
12
|
+
const TemplateFieldStore = require('./TemplateFieldStore-7449e5ff.js');
|
12
13
|
require('./_commonjsHelpers-1fbbf0eb.js');
|
13
14
|
require('./Envelopes-0b9deb2c.js');
|
14
15
|
require('./Files-4bdc0c0f.js');
|
15
16
|
require('./Types-fb95ed6b.js');
|
16
17
|
require('./index-7c19ba1d.js');
|
18
|
+
require('./index-f712049c.js');
|
17
19
|
|
18
20
|
const verdocsFieldTextboxCss = "verdocs-field-textbox{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;width:150px;height:15px;display:block;font-size:11px;letter-spacing:-0.2px;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-textbox.disabled{opacity:0.5}verdocs-field-textbox input{cursor:inherit;width:100%;height:100%;border:none;outline:none;padding:0 3px;font-size:11px;background:none;font-weight:500;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-box-sizing:border-box;box-sizing:border-box;color:rgba(0, 0, 0, 0.87)}verdocs-field-textbox input.hide{display:none}verdocs-field-textbox.required{border:1px solid #cc0000}verdocs-field-textbox.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-textbox verdocs-button-panel{top:-3px;left:-2px;opacity:0.5;z-index:1000;cursor:pointer;position:absolute;-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-field-textbox verdocs-button-panel[data-active],verdocs-field-textbox verdocs-button-panel:hover{opacity:1}verdocs-field-textbox verdocs-button-panel .icon svg{fill:#333333}verdocs-field-textbox verdocs-button-panel .icon:hover svg{fill:#000000}verdocs-field-textbox [data-lastpass-icon-root]{display:none !important}";
|
19
21
|
|
@@ -23,9 +25,11 @@ const VerdocsFieldTextbox = class {
|
|
23
25
|
index.registerInstance(this, hostRef);
|
24
26
|
this.settingsChanged = index.createEvent(this, "settingsChanged", 7);
|
25
27
|
this.deleted = index.createEvent(this, "deleted", 7);
|
28
|
+
this.fieldStore = null;
|
26
29
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
27
30
|
this.templateid = '';
|
28
31
|
this.field = null;
|
32
|
+
this.fieldname = '';
|
29
33
|
this.disabled = false;
|
30
34
|
this.editable = false;
|
31
35
|
this.moveable = false;
|
@@ -50,6 +54,10 @@ const VerdocsFieldTextbox = class {
|
|
50
54
|
settingsPanel.hidePanel();
|
51
55
|
}
|
52
56
|
}
|
57
|
+
async componentWillLoad() {
|
58
|
+
console.log('Loading field', this.field);
|
59
|
+
this.fieldStore = TemplateFieldStore.getTemplateFieldStore(this.templateid);
|
60
|
+
}
|
53
61
|
componentDidRender() {
|
54
62
|
interact_min.interact_min.dynamicDrop(true);
|
55
63
|
if (this.editable) {
|
@@ -98,6 +106,8 @@ const VerdocsFieldTextbox = class {
|
|
98
106
|
}
|
99
107
|
render() {
|
100
108
|
var _a, _b, _c, _d;
|
109
|
+
const f = this.fieldStore.get(this.fieldname);
|
110
|
+
console.log('rendering field', f);
|
101
111
|
const settings = utils.getFieldSettings(this.field);
|
102
112
|
let disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
|
103
113
|
const backgroundColor = this.field['rgba'] || Colors.getRGBA(this.roleindex);
|
@@ -114,7 +124,6 @@ const VerdocsFieldTextbox = class {
|
|
114
124
|
return this.hideSettingsPanel();
|
115
125
|
}, onSettingsChanged: e => {
|
116
126
|
var _a;
|
117
|
-
console.log('here');
|
118
127
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
|
119
128
|
return this.hideSettingsPanel();
|
120
129
|
}, helpText: 'Text boxes may be used to capture simple text input. Participant-entered values will be stored for later retrieval via the "name" field.<br /><br />If marked required, the participant must complete the field before proceeding.' })))));
|
@@ -6,7 +6,7 @@ const index = require('./index-5463795e.js');
|
|
6
6
|
require('./Types-f89f9116.js');
|
7
7
|
const VerdocsEndpoint = require('./VerdocsEndpoint-8f298664.js');
|
8
8
|
const utils = require('./utils-0916d10f.js');
|
9
|
-
const TemplateStore = require('./TemplateStore-
|
9
|
+
const TemplateStore = require('./TemplateStore-0074c71d.js');
|
10
10
|
const errors = require('./errors-0396da3d.js');
|
11
11
|
const Envelopes = require('./Envelopes-0b9deb2c.js');
|
12
12
|
const Validators = require('./Validators-16e6d7d1.js');
|
@@ -19,6 +19,7 @@ require('./Files-4bdc0c0f.js');
|
|
19
19
|
require('./Types-fb95ed6b.js');
|
20
20
|
require('./index-7c19ba1d.js');
|
21
21
|
require('./index-f712049c.js');
|
22
|
+
require('./TemplateFieldStore-7449e5ff.js');
|
22
23
|
|
23
24
|
/**
|
24
25
|
* Enable automatic reminders. setup_time is the number of days after the envelope is sent that the first reminder
|
@@ -414,7 +414,7 @@ const VerdocsSign = class {
|
|
414
414
|
console.log('[SIGN] onfieldInput', e.detail, e.target.value);
|
415
415
|
// These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
|
416
416
|
// text boxes because we'd be updating the field on every keystroke. We do those on blur which fires fieldChange.
|
417
|
-
if (e.target.name.includes('
|
417
|
+
if (e.target.name.includes('checkbox_group') || e.target.name.includes('radio_button_group')) {
|
418
418
|
console.log('CB', e.target);
|
419
419
|
this.handleFieldChange(field, e).finally(() => this.checkRecipientFields());
|
420
420
|
}
|
@@ -3,13 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-5463795e.js');
|
6
|
-
const interact_min = require('./interact.min-
|
6
|
+
const interact_min = require('./interact.min-a61b43b3.js');
|
7
7
|
require('./Types-f89f9116.js');
|
8
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-0916d10f.js');
|
12
|
-
const
|
12
|
+
const TemplateFieldStore = require('./TemplateFieldStore-7449e5ff.js');
|
13
|
+
const TemplateStore = require('./TemplateStore-0074c71d.js');
|
13
14
|
const errors = require('./errors-0396da3d.js');
|
14
15
|
const Colors = require('./Colors-e809dcc9.js');
|
15
16
|
require('./_commonjsHelpers-1fbbf0eb.js');
|
@@ -76,7 +77,8 @@ const VerdocsTemplateFields = class {
|
|
76
77
|
this.sdkError = index.createEvent(this, "sdkError", 7);
|
77
78
|
this.templateUpdated = index.createEvent(this, "templateUpdated", 7);
|
78
79
|
this.pageHeights = {};
|
79
|
-
this.
|
80
|
+
this.templateStore = null;
|
81
|
+
this.fieldStore = null;
|
80
82
|
this.cachedPageInfo = {};
|
81
83
|
this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
|
82
84
|
this.templateId = null;
|
@@ -98,9 +100,10 @@ const VerdocsTemplateFields = class {
|
|
98
100
|
console.log('[FIELDS] Unable to start builder session, must be authenticated');
|
99
101
|
return;
|
100
102
|
}
|
101
|
-
this.
|
102
|
-
|
103
|
-
|
103
|
+
this.templateStore = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, true);
|
104
|
+
this.fieldStore = TemplateFieldStore.createTemplateFieldStore(this.templateStore.state);
|
105
|
+
console.log(`[FIELDS] Loaded template ${this.templateId}`, this.templateStore.state, this.fieldStore);
|
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) || '';
|
104
107
|
console.log('[FIELDS] Starting with role', this.selectedRoleName);
|
105
108
|
}
|
106
109
|
catch (e) {
|
@@ -121,8 +124,8 @@ const VerdocsTemplateFields = class {
|
|
121
124
|
componentWillUpdate() {
|
122
125
|
var _a, _b, _c, _d, _e, _f;
|
123
126
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
124
|
-
if (!this.selectedRoleName || !(((_b = (_a = this.
|
125
|
-
this.selectedRoleName = ((_f = (_e = (_d = (_c = this.
|
127
|
+
if (!this.selectedRoleName || !(((_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.roles) || []).find(role => role.name === this.selectedRoleName)) {
|
128
|
+
this.selectedRoleName = ((_f = (_e = (_d = (_c = this.templateStore) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.roles) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.name) || '';
|
126
129
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
127
130
|
}
|
128
131
|
}
|
@@ -136,35 +139,39 @@ const VerdocsTemplateFields = class {
|
|
136
139
|
console.log('[FIELDS] handleFieldChange', field, e, optionId);
|
137
140
|
this.rerender++;
|
138
141
|
}
|
139
|
-
handleFieldSettingsChange(pageInfo, field,
|
140
|
-
var _a, _b
|
142
|
+
handleFieldSettingsChange(pageInfo, field, el, newFieldData) {
|
143
|
+
var _a, _b;
|
144
|
+
// handleFieldSettingsChange(pageInfo: any, field: any, roleIndex: number, el: any, newFieldData: any) {
|
141
145
|
console.log('[FIELDS] Field settings changed', field.name, newFieldData);
|
142
146
|
Object.assign(field, newFieldData);
|
143
147
|
el.field = newFieldData;
|
144
148
|
this.selectedRoleName = field.role_name;
|
145
|
-
el.setAttribute('roleindex', utils.getRoleIndex(TemplateStore.getRoleNames(this.
|
146
|
-
el.field =
|
149
|
+
el.setAttribute('roleindex', utils.getRoleIndex(TemplateStore.getRoleNames(this.templateStore), field.role_name));
|
150
|
+
el.field = this.fieldStore.get(field.name);
|
147
151
|
this.rerender++;
|
148
152
|
el.setAttribute('rerender', this.rerender);
|
149
|
-
(
|
153
|
+
(_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' });
|
150
154
|
console.log('[FIELDS] Re-rendering field', field.name, pageInfo.pageNumber);
|
151
|
-
this.
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
155
|
+
this.fieldStore.set(field.name, field);
|
156
|
+
// this.reRenderField(field, pageInfo.pageNumber);
|
157
|
+
// const newEl = renderDocumentField(field, pageInfo, roleIndex, {disabled: true, editable: true, draggable: true});
|
158
|
+
// if (!newEl) {
|
159
|
+
// return;
|
160
|
+
// }
|
156
161
|
}
|
157
162
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
158
163
|
el.addEventListener('input', e => this.handleFieldChange(field, e));
|
159
|
-
el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field,
|
164
|
+
el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, el, e.detail.field));
|
165
|
+
// el.addEventListener('settingsChanged', e => this.handleFieldSettingsChange(pageInfo, field, roleIndex, el, e.detail.field));
|
160
166
|
el.addEventListener('deleted', () => {
|
161
167
|
var _a, _b;
|
162
168
|
console.log('[FIELDS] Deleted', this, field);
|
163
169
|
el.remove();
|
164
170
|
this.rerender++;
|
165
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: (_b = this.
|
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' });
|
166
172
|
});
|
167
173
|
el.setAttribute('templateid', this.templateId);
|
174
|
+
el.setAttribute('fieldname', field.name);
|
168
175
|
el.setAttribute('roleindex', roleIndex);
|
169
176
|
el.setAttribute('pageNumber', pageInfo.pageNumber);
|
170
177
|
el.setAttribute('xScale', pageInfo.xScale);
|
@@ -172,17 +179,16 @@ const VerdocsTemplateFields = class {
|
|
172
179
|
el.setAttribute('name', field.name);
|
173
180
|
}
|
174
181
|
handlePageRendered(e) {
|
175
|
-
var _a;
|
176
182
|
const pageInfo = e.detail;
|
177
183
|
console.log('[FIELDS] Page rendered', pageInfo.pageNumber, pageInfo);
|
178
184
|
this.cachedPageInfo[pageInfo.pageNumber] = pageInfo;
|
179
185
|
this.pageHeights[pageInfo.pageNumber] = pageInfo.naturalHeight;
|
180
|
-
const fields = (
|
186
|
+
const fields = Object.values(this.fieldStore.state).filter(field => field.page_sequence === pageInfo.pageNumber);
|
181
187
|
fields.forEach(field => this.reRenderField(field, pageInfo.pageNumber));
|
182
188
|
}
|
183
189
|
reRenderField(field, pageNumber) {
|
184
190
|
const pageInfo = this.cachedPageInfo[pageNumber];
|
185
|
-
const roleIndex = utils.getRoleIndex(TemplateStore.getRoleNames(this.
|
191
|
+
const roleIndex = utils.getRoleIndex(TemplateStore.getRoleNames(this.templateStore), field.role_name);
|
186
192
|
const el = utils.renderDocumentField(field, pageInfo, roleIndex, { disabled: true, editable: true, draggable: true });
|
187
193
|
if (!el) {
|
188
194
|
return;
|
@@ -218,10 +224,9 @@ const VerdocsTemplateFields = class {
|
|
218
224
|
utils.updateCssTransform(event.target, 'translate', `${newX}px, ${newY}px`);
|
219
225
|
}
|
220
226
|
async handleMoveEnd(event) {
|
221
|
-
var _a;
|
222
227
|
const name = event.target.getAttribute('name');
|
223
228
|
const option = +(event.target.getAttribute('option') || '0');
|
224
|
-
const field =
|
229
|
+
const field = this.fieldStore.get(name);
|
225
230
|
console.log('Dropped field', name, field);
|
226
231
|
if (!field) {
|
227
232
|
console.log('[FIELDS] Unable to find field', name);
|
@@ -268,19 +273,19 @@ const VerdocsTemplateFields = class {
|
|
268
273
|
console.log('[FIELDS] Will update', name, option, field);
|
269
274
|
const newFieldData = await Fields.updateField(this.endpoint, this.templateId, name, field);
|
270
275
|
const pageInfo = this.cachedPageInfo[pageNumber];
|
271
|
-
const roleIndex =
|
272
|
-
this.handleFieldSettingsChange(pageInfo, field,
|
276
|
+
// const roleIndex = getRoleIndex(getRoleNames(this.templateStore), field.role_name);
|
277
|
+
this.handleFieldSettingsChange(pageInfo, field, event.target, newFieldData);
|
278
|
+
// this.handleFieldSettingsChange(pageInfo, field, roleIndex, event.target, newFieldData);
|
273
279
|
event.target.removeAttribute('posX');
|
274
280
|
event.target.removeAttribute('posY');
|
275
281
|
}
|
276
282
|
generateFieldName(type, pageNumber) {
|
277
|
-
var _a;
|
278
283
|
let i = 1;
|
279
284
|
let fieldName;
|
280
285
|
do {
|
281
286
|
fieldName = `${type}P${pageNumber}-${i}`;
|
282
287
|
i++;
|
283
|
-
} while ((
|
288
|
+
} while (Object.values(this.fieldStore.state).some(field => field.name === fieldName));
|
284
289
|
return fieldName;
|
285
290
|
}
|
286
291
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|
@@ -292,7 +297,7 @@ const VerdocsTemplateFields = class {
|
|
292
297
|
return { x, y };
|
293
298
|
}
|
294
299
|
async handleClickPage(e, pageNumber) {
|
295
|
-
var _a, _b
|
300
|
+
var _a, _b;
|
296
301
|
if (this.placing) {
|
297
302
|
const clickedX = e.offsetX;
|
298
303
|
const clickedY = e.offsetY;
|
@@ -319,6 +324,7 @@ const VerdocsTemplateFields = class {
|
|
319
324
|
width,
|
320
325
|
height,
|
321
326
|
};
|
327
|
+
console.log('[FIELDS] Will save new field', field);
|
322
328
|
// TODO: Fix how the server validates all this. It uses a JSON schema and is very particular about shapes for each field type.
|
323
329
|
// That makes it harder for third party developers to create fields via API calls. It would be better to always set X/Y and
|
324
330
|
// let the server normalize the rest, discarding properties that are invalid and back-filling defaults as needed.
|
@@ -385,11 +391,9 @@ const VerdocsTemplateFields = class {
|
|
385
391
|
}
|
386
392
|
const saved = await Fields.createField(this.endpoint, this.templateId, field);
|
387
393
|
console.log('Saved field', saved);
|
388
|
-
|
389
|
-
this.store.state.fields = [...(_a = this.store) === null || _a === void 0 ? void 0 : _a.state.fields, saved];
|
390
|
-
}
|
394
|
+
this.fieldStore.set(saved.name, saved);
|
391
395
|
this.placing = null;
|
392
|
-
(
|
396
|
+
(_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: 'added-field' });
|
393
397
|
this.handlePageRendered({ detail: this.cachedPageInfo[pageNumber] });
|
394
398
|
}
|
395
399
|
}
|
@@ -400,10 +404,10 @@ const VerdocsTemplateFields = class {
|
|
400
404
|
return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
401
405
|
}
|
402
406
|
// TODO: Render a better error
|
403
|
-
if (!((_a = this.
|
407
|
+
if (!((_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state.isLoaded)) {
|
404
408
|
return (index.h(index.Host, null, index.h("verdocs-loader", null)));
|
405
409
|
}
|
406
|
-
const selectableRoles = (_c = (_b = this.
|
410
|
+
const selectableRoles = (_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.roles.map(role => ({ value: role.name, label: role.name }));
|
407
411
|
return (index.h(index.Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
|
408
412
|
console.log('onSubmit');
|
409
413
|
} }, 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: () => {
|
@@ -417,13 +421,13 @@ const VerdocsTemplateFields = class {
|
|
417
421
|
this.showMustSelectRole = true;
|
418
422
|
}
|
419
423
|
}
|
420
|
-
} })))), index.h("div", { class: "pages" }, (((_e = (_d = this.
|
424
|
+
} })))), index.h("div", { class: "pages" }, (((_e = (_d = this.templateStore) === null || _d === void 0 ? void 0 : _d.state) === null || _e === void 0 ? void 0 : _e.template_documents) || []).map(document => {
|
421
425
|
const pageNumbers = Primitives.integerSequence(1, document.page_numbers);
|
422
426
|
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: [
|
423
427
|
{ name: 'page', type: 'canvas' },
|
424
428
|
{ name: 'controls', type: 'div' },
|
425
429
|
] })));
|
426
|
-
})), this.showMustSelectRole && (index.h("verdocs-ok-dialog", { heading: "Unable to add field", message: ((_h = (_g = (_f = this.
|
430
|
+
})), this.showMustSelectRole && (index.h("verdocs-ok-dialog", { heading: "Unable to add field", message: ((_h = (_g = (_f = this.templateStore) === null || _f === void 0 ? void 0 : _f.state) === null || _g === void 0 ? void 0 : _g.roles) === null || _h === void 0 ? void 0 : _h.length) > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
|
427
431
|
}
|
428
432
|
};
|
429
433
|
VerdocsTemplateFields.style = verdocsTemplateFieldsCss;
|