@verdocs/web-sdk 2.3.19 → 2.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +1 -3
- package/dist/cjs/verdocs-preview_8.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +1 -1
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +1 -1
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +1 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +3 -3
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +1 -3
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -3
- package/dist/components/verdocs-preview2.js +1 -1
- package/dist/components/verdocs-send2.js +1 -1
- package/dist/components/verdocs-template-fields2.js +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +1 -3
- package/dist/esm/verdocs-preview_8.entry.js +2 -2
- package/dist/esm/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-build.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-template-fields_4.entry.js +1 -1
- package/dist/verdocs-web-sdk/{p-83bedd31.entry.js → p-593e4dde.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-6925f18d.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-92e5e32d.system.entry.js → p-710d6928.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-558f9f80.system.entry.js → p-79fcaf1e.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-9cae1b71.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-cc9a62c3.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-9ac6d5eb.entry.js → p-d1837af9.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
- package/dist/verdocs-web-sdk/p-f8093452.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/verdocs-web-sdk/p-27abd162.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-32522783.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b409f610.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-ff46c394.entry.js +0 -1
@@ -56,7 +56,7 @@ const VerdocsBuild = class {
|
|
56
56
|
async loadTemplate(templateId) {
|
57
57
|
if (templateId) {
|
58
58
|
console.log('Loading store', templateId);
|
59
|
-
this.store = await TemplateStore.getTemplateStore(this.endpoint, templateId,
|
59
|
+
this.store = await TemplateStore.getTemplateStore(this.endpoint, templateId, false);
|
60
60
|
index.forceUpdate(this.el);
|
61
61
|
}
|
62
62
|
}
|
@@ -56,7 +56,6 @@ const VerdocsFieldTextbox = class {
|
|
56
56
|
}
|
57
57
|
async componentWillLoad() {
|
58
58
|
this.fieldStore = TemplateFieldStore.getTemplateFieldStore(this.templateid);
|
59
|
-
console.log('fs', this.templateid);
|
60
59
|
}
|
61
60
|
componentDidRender() {
|
62
61
|
interact_min.interact_min.dynamicDrop(true);
|
@@ -99,7 +98,7 @@ const VerdocsFieldTextbox = class {
|
|
99
98
|
Fields.updateField(this.endpoint, this.templateid, this.fieldname, { setting: newSettings })
|
100
99
|
.then(field => {
|
101
100
|
var _a;
|
102
|
-
console.log('
|
101
|
+
console.log('Update result', field);
|
103
102
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: field.name, settings: newSettings, field });
|
104
103
|
Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
|
105
104
|
})
|
@@ -108,7 +107,6 @@ const VerdocsFieldTextbox = class {
|
|
108
107
|
render() {
|
109
108
|
var _a, _b;
|
110
109
|
const field = this.fieldStore.get(this.fieldname);
|
111
|
-
console.log('textbox', this.fieldname, field);
|
112
110
|
if (!field) {
|
113
111
|
return index.h(index.Fragment, null);
|
114
112
|
}
|
@@ -69,7 +69,7 @@ const VerdocsPreview = class {
|
|
69
69
|
console.log('[PREVIEW] Unable to start builder session, must be authenticated');
|
70
70
|
return;
|
71
71
|
}
|
72
|
-
this.store = await TemplateStore.getTemplateStore(this.endpoint, this.templateId,
|
72
|
+
this.store = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
73
73
|
console.log(`[PREVIEW] Loading template ${this.templateId}`, this.endpoint.session);
|
74
74
|
}
|
75
75
|
catch (e) {
|
@@ -143,7 +143,7 @@ const VerdocsSend = class {
|
|
143
143
|
console.log('[SEND] Unable to start builder session, must be authenticated');
|
144
144
|
return;
|
145
145
|
}
|
146
|
-
this.store = await TemplateStore.getTemplateStore(this.endpoint, this.templateId,
|
146
|
+
this.store = await TemplateStore.getTemplateStore(this.endpoint, this.templateId, false);
|
147
147
|
if (!((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable)) {
|
148
148
|
console.warn(`[SEND] Template is not sendable`, this.templateId);
|
149
149
|
}
|
@@ -393,7 +393,7 @@ const VerdocsTemplateFields = class {
|
|
393
393
|
this.fieldStore.set(saved.name, saved);
|
394
394
|
this.placing = null;
|
395
395
|
(_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' });
|
396
|
-
this.
|
396
|
+
this.reRenderField(saved, pageNumber);
|
397
397
|
}
|
398
398
|
}
|
399
399
|
render() {
|
@@ -43,7 +43,7 @@ export class VerdocsBuild {
|
|
43
43
|
async loadTemplate(templateId) {
|
44
44
|
if (templateId) {
|
45
45
|
console.log('Loading store', templateId);
|
46
|
-
this.store = await getTemplateStore(this.endpoint, templateId,
|
46
|
+
this.store = await getTemplateStore(this.endpoint, templateId, false);
|
47
47
|
forceUpdate(this.el);
|
48
48
|
}
|
49
49
|
}
|
@@ -27,7 +27,7 @@ export class VerdocsPreview {
|
|
27
27
|
console.log('[PREVIEW] Unable to start builder session, must be authenticated');
|
28
28
|
return;
|
29
29
|
}
|
30
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
30
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
31
31
|
console.log(`[PREVIEW] Loading template ${this.templateId}`, this.endpoint.session);
|
32
32
|
}
|
33
33
|
catch (e) {
|
@@ -48,7 +48,7 @@ export class VerdocsSend {
|
|
48
48
|
console.log('[SEND] Unable to start builder session, must be authenticated');
|
49
49
|
return;
|
50
50
|
}
|
51
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
51
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
52
52
|
if (!((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable)) {
|
53
53
|
console.warn(`[SEND] Template is not sendable`, this.templateId);
|
54
54
|
}
|
@@ -3,9 +3,9 @@ export default {
|
|
3
3
|
title: 'Embeds/Sign',
|
4
4
|
component: 'verdocs-sign',
|
5
5
|
args: {
|
6
|
-
envelopeId: '
|
7
|
-
roleId: '
|
8
|
-
inviteCode: '
|
6
|
+
envelopeId: '',
|
7
|
+
roleId: '',
|
8
|
+
inviteCode: '',
|
9
9
|
},
|
10
10
|
argTypes: {
|
11
11
|
envelopeId: {
|
@@ -42,7 +42,6 @@ export class VerdocsFieldTextbox {
|
|
42
42
|
}
|
43
43
|
async componentWillLoad() {
|
44
44
|
this.fieldStore = getTemplateFieldStore(this.templateid);
|
45
|
-
console.log('fs', this.templateid);
|
46
45
|
}
|
47
46
|
componentDidRender() {
|
48
47
|
interact.dynamicDrop(true);
|
@@ -85,7 +84,7 @@ export class VerdocsFieldTextbox {
|
|
85
84
|
updateField(this.endpoint, this.templateid, this.fieldname, { setting: newSettings })
|
86
85
|
.then(field => {
|
87
86
|
var _a;
|
88
|
-
console.log('
|
87
|
+
console.log('Update result', field);
|
89
88
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: field.name, settings: newSettings, field });
|
90
89
|
Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
|
91
90
|
})
|
@@ -94,7 +93,6 @@ export class VerdocsFieldTextbox {
|
|
94
93
|
render() {
|
95
94
|
var _a, _b;
|
96
95
|
const field = this.fieldStore.get(this.fieldname);
|
97
|
-
console.log('textbox', this.fieldname, field);
|
98
96
|
if (!field) {
|
99
97
|
return h(Fragment, null);
|
100
98
|
}
|
package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js
CHANGED
@@ -356,7 +356,7 @@ export class VerdocsTemplateFields {
|
|
356
356
|
this.fieldStore.set(saved.name, saved);
|
357
357
|
this.placing = null;
|
358
358
|
(_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' });
|
359
|
-
this.
|
359
|
+
this.reRenderField(saved, pageNumber);
|
360
360
|
}
|
361
361
|
}
|
362
362
|
render() {
|
@@ -81,7 +81,7 @@ const VerdocsBuild$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
81
81
|
async loadTemplate(templateId) {
|
82
82
|
if (templateId) {
|
83
83
|
console.log('Loading store', templateId);
|
84
|
-
this.store = await getTemplateStore(this.endpoint, templateId,
|
84
|
+
this.store = await getTemplateStore(this.endpoint, templateId, false);
|
85
85
|
forceUpdate(this.el);
|
86
86
|
}
|
87
87
|
}
|
@@ -55,7 +55,6 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
55
55
|
}
|
56
56
|
async componentWillLoad() {
|
57
57
|
this.fieldStore = getTemplateFieldStore(this.templateid);
|
58
|
-
console.log('fs', this.templateid);
|
59
58
|
}
|
60
59
|
componentDidRender() {
|
61
60
|
interact_min.dynamicDrop(true);
|
@@ -98,7 +97,7 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
98
97
|
updateField(this.endpoint, this.templateid, this.fieldname, { setting: newSettings })
|
99
98
|
.then(field => {
|
100
99
|
var _a;
|
101
|
-
console.log('
|
100
|
+
console.log('Update result', field);
|
102
101
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: field.name, settings: newSettings, field });
|
103
102
|
Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
|
104
103
|
})
|
@@ -107,7 +106,6 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
107
106
|
render() {
|
108
107
|
var _a, _b;
|
109
108
|
const field = this.fieldStore.get(this.fieldname);
|
110
|
-
console.log('textbox', this.fieldname, field);
|
111
109
|
if (!field) {
|
112
110
|
return h(Fragment, null);
|
113
111
|
}
|
@@ -30,7 +30,7 @@ const VerdocsPreview = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
30
30
|
console.log('[PREVIEW] Unable to start builder session, must be authenticated');
|
31
31
|
return;
|
32
32
|
}
|
33
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
33
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
34
34
|
console.log(`[PREVIEW] Loading template ${this.templateId}`, this.endpoint.session);
|
35
35
|
}
|
36
36
|
catch (e) {
|
@@ -54,7 +54,7 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
54
54
|
console.log('[SEND] Unable to start builder session, must be authenticated');
|
55
55
|
return;
|
56
56
|
}
|
57
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
57
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
58
58
|
if (!((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable)) {
|
59
59
|
console.warn(`[SEND] Template is not sendable`, this.templateId);
|
60
60
|
}
|
@@ -367,7 +367,7 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
367
367
|
this.fieldStore.set(saved.name, saved);
|
368
368
|
this.placing = null;
|
369
369
|
(_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' });
|
370
|
-
this.
|
370
|
+
this.reRenderField(saved, pageNumber);
|
371
371
|
}
|
372
372
|
}
|
373
373
|
render() {
|
package/dist/docs.json
CHANGED
@@ -52,7 +52,7 @@ const VerdocsBuild = class {
|
|
52
52
|
async loadTemplate(templateId) {
|
53
53
|
if (templateId) {
|
54
54
|
console.log('Loading store', templateId);
|
55
|
-
this.store = await getTemplateStore(this.endpoint, templateId,
|
55
|
+
this.store = await getTemplateStore(this.endpoint, templateId, false);
|
56
56
|
forceUpdate(this.el);
|
57
57
|
}
|
58
58
|
}
|
@@ -52,7 +52,6 @@ const VerdocsFieldTextbox = class {
|
|
52
52
|
}
|
53
53
|
async componentWillLoad() {
|
54
54
|
this.fieldStore = getTemplateFieldStore(this.templateid);
|
55
|
-
console.log('fs', this.templateid);
|
56
55
|
}
|
57
56
|
componentDidRender() {
|
58
57
|
interact_min.dynamicDrop(true);
|
@@ -95,7 +94,7 @@ const VerdocsFieldTextbox = class {
|
|
95
94
|
updateField(this.endpoint, this.templateid, this.fieldname, { setting: newSettings })
|
96
95
|
.then(field => {
|
97
96
|
var _a;
|
98
|
-
console.log('
|
97
|
+
console.log('Update result', field);
|
99
98
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: field.name, settings: newSettings, field });
|
100
99
|
Object.assign(e.target.dataset, { x: 0, y: 0, h: 0 });
|
101
100
|
})
|
@@ -104,7 +103,6 @@ const VerdocsFieldTextbox = class {
|
|
104
103
|
render() {
|
105
104
|
var _a, _b;
|
106
105
|
const field = this.fieldStore.get(this.fieldname);
|
107
|
-
console.log('textbox', this.fieldname, field);
|
108
106
|
if (!field) {
|
109
107
|
return h(Fragment, null);
|
110
108
|
}
|
@@ -65,7 +65,7 @@ const VerdocsPreview = class {
|
|
65
65
|
console.log('[PREVIEW] Unable to start builder session, must be authenticated');
|
66
66
|
return;
|
67
67
|
}
|
68
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
68
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
69
69
|
console.log(`[PREVIEW] Loading template ${this.templateId}`, this.endpoint.session);
|
70
70
|
}
|
71
71
|
catch (e) {
|
@@ -139,7 +139,7 @@ const VerdocsSend = class {
|
|
139
139
|
console.log('[SEND] Unable to start builder session, must be authenticated');
|
140
140
|
return;
|
141
141
|
}
|
142
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId,
|
142
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
143
143
|
if (!((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable)) {
|
144
144
|
console.warn(`[SEND] Template is not sendable`, this.templateId);
|
145
145
|
}
|
@@ -389,7 +389,7 @@ const VerdocsTemplateFields = class {
|
|
389
389
|
this.fieldStore.set(saved.name, saved);
|
390
390
|
this.placing = null;
|
391
391
|
(_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' });
|
392
|
-
this.
|
392
|
+
this.reRenderField(saved, pageNumber);
|
393
393
|
}
|
394
394
|
}
|
395
395
|
render() {
|
@@ -1 +1 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function l(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,l)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,a as getElement}from"./index-172625c5.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-56fa3371.js";import{g as getTemplateStore}from"./TemplateStore-3994341c.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./index-4439b0d1.js";import"./TemplateFieldStore-295f240e.js";var verdocsBuildCss='verdocs-build{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-build .content{-ms-flex:1;flex:1;gap:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column}verdocs-build verdocs-template-attachments,verdocs-build verdocs-template-roles{margin:20px}verdocs-build verdocs-template-fields{border-top:1px solid #777777}verdocs-build verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-build verdocs-template-fields{width:100%}verdocs-build verdocs-preview{-ms-flex:1;flex:1}verdocs-build .preview-container{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;width:100%;background-color:#eeeeee;max-height:100%}@media all and (max-width: 450px){verdocs-build .preview-container{-ms-flex-direction:column;flex-direction:column}}verdocs-build .preview-send-wrapper{display:-ms-flexbox;display:flex;-ms-flex:0 0 300px;flex:0 0 300px;background-color:#ffffff;-webkit-box-shadow:1px 1px 6px -2px #0000007f;box-shadow:1px 1px 6px -2px #0000007f}@media all and (max-width: 450px){verdocs-build .preview-send-wrapper{-ms-flex:0;flex:0}}verdocs-build .preview-preview-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;overflow-y:scroll}';var VerdocsBuild=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.stepChanged=createEvent(this,"stepChanged",7);this.send=createEvent(this,"send",7);this.templateUpdated=createEvent(this,"templateUpdated",7);this.templateCreated=createEvent(this,"templateCreated",7);this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.store=null}e.prototype.onTemplateIdChanged=function(e){console.log("Template ID changed",e);this.loadTemplate(e).catch((function(e){return console.log("Unknown Error",e)}))};e.prototype.onStepChanged=function(e){console.log("Step changed",e);this.loadTemplate(this.templateId).catch((function(e){return console.log("Unknown Error",e)}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(o){try{this.endpoint.loadSession();if(!this.templateId){console.log("[BUILD] No template ID, activating upload mode");this.step="attachments";return[2]}if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}this.loadTemplate(this.templateId).catch((function(e){return console.log("[BUILD] Unable to load template",e)}))}catch(o){console.log("[BUILD] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(n=o.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.loadTemplate=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:if(!e)return[3,2];console.log("Loading store",e);t=this;return[4,getTemplateStore(this.endpoint,e,
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function l(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,l)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,a as getElement}from"./index-172625c5.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-56fa3371.js";import{g as getTemplateStore}from"./TemplateStore-3994341c.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./index-4439b0d1.js";import"./TemplateFieldStore-295f240e.js";var verdocsBuildCss='verdocs-build{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-build .content{-ms-flex:1;flex:1;gap:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column}verdocs-build verdocs-template-attachments,verdocs-build verdocs-template-roles{margin:20px}verdocs-build verdocs-template-fields{border-top:1px solid #777777}verdocs-build verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-build verdocs-template-fields{width:100%}verdocs-build verdocs-preview{-ms-flex:1;flex:1}verdocs-build .preview-container{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;width:100%;background-color:#eeeeee;max-height:100%}@media all and (max-width: 450px){verdocs-build .preview-container{-ms-flex-direction:column;flex-direction:column}}verdocs-build .preview-send-wrapper{display:-ms-flexbox;display:flex;-ms-flex:0 0 300px;flex:0 0 300px;background-color:#ffffff;-webkit-box-shadow:1px 1px 6px -2px #0000007f;box-shadow:1px 1px 6px -2px #0000007f}@media all and (max-width: 450px){verdocs-build .preview-send-wrapper{-ms-flex:0;flex:0}}verdocs-build .preview-preview-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;overflow-y:scroll}';var VerdocsBuild=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.stepChanged=createEvent(this,"stepChanged",7);this.send=createEvent(this,"send",7);this.templateUpdated=createEvent(this,"templateUpdated",7);this.templateCreated=createEvent(this,"templateCreated",7);this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.store=null}e.prototype.onTemplateIdChanged=function(e){console.log("Template ID changed",e);this.loadTemplate(e).catch((function(e){return console.log("Unknown Error",e)}))};e.prototype.onStepChanged=function(e){console.log("Step changed",e);this.loadTemplate(this.templateId).catch((function(e){return console.log("Unknown Error",e)}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(o){try{this.endpoint.loadSession();if(!this.templateId){console.log("[BUILD] No template ID, activating upload mode");this.step="attachments";return[2]}if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}this.loadTemplate(this.templateId).catch((function(e){return console.log("[BUILD] Unable to load template",e)}))}catch(o){console.log("[BUILD] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(n=o.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.loadTemplate=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:if(!e)return[3,2];console.log("Loading store",e);t=this;return[4,getTemplateStore(this.endpoint,e,false)];case 1:t.store=n.sent();forceUpdate(this.el);n.label=2;case 2:return[2]}}))}))};e.prototype.handleCancel=function(e){console.log("Cancel",e.detail);this.step="preview"};e.prototype.handleTemplateCreated=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:return[4,this.loadTemplate(e)];case 1:n.sent();this.templateId=e;this.step="roles";(t=this.stepChanged)===null||t===void 0?void 0:t.emit("roles");return[2]}}))}))};e.prototype.handleTemplateUpdated=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){console.log("tup");(t=this.templateUpdated)===null||t===void 0?void 0:t.emit(e.detail);return[2]}))}))};e.prototype.handleAttachmentsNext=function(){var e;this.step="roles";(e=this.stepChanged)===null||e===void 0?void 0:e.emit("roles")};e.prototype.handleRolesNext=function(){var e;this.step="fields";(e=this.stepChanged)===null||e===void 0?void 0:e.emit("fields")};e.prototype.handleStepChanged=function(e){var t;console.log("osc",e);this.step=e;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(!this.store){console.log("[BUILD] No template ID, rendering created view");return h(Host,null,h("div",{class:"content"},h("verdocs-template-build-tabs",{endpoint:this.endpoint,templateId:this.templateId,step:"attachments",onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)},onStepChanged:function(t){return e.handleStepChanged(t.detail)}}),h("verdocs-template-create",{endpoint:this.endpoint,onExit:function(t){return e.handleCancel(t)},onNext:function(){return e.handleAttachmentsNext()},onTemplateCreated:function(t){return e.handleTemplateCreated(t.detail.templateId)}})))}console.log("[BUILD] Rendering build view",this.templateId,this.step,["attachments","roles","settings","fields","preview"].indexOf(this.step));return h(Host,null,h("div",{class:"content"},h("verdocs-template-build-tabs",{endpoint:this.endpoint,templateId:this.templateId,step:this.step,onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)},onStepChanged:function(t){return e.handleStepChanged(t.detail)}}),this.step==="attachments"&&h("verdocs-template-attachments",{templateId:this.templateId,endpoint:this.endpoint,onExit:function(t){return e.handleCancel(t)},onNext:function(){return e.handleAttachmentsNext()},onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}}),this.step==="roles"&&h("verdocs-template-roles",{templateId:this.templateId,endpoint:this.endpoint,onExit:function(t){return e.handleCancel(t)},onNext:function(){return e.handleRolesNext()},onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}}),this.step==="settings"&&h("div",{style:{flexDirection:"column",gap:"20px",display:"flex",maxWidth:"400px",margin:"20px"}},h("verdocs-template-name",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}}),h("verdocs-template-reminders",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}}),h("verdocs-template-visibility",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}})),this.step==="fields"&&h("verdocs-template-fields",{templateId:this.templateId,endpoint:this.endpoint,onTemplateUpdated:function(t){return e.handleTemplateUpdated(t)}}),this.step==="preview"&&h("div",{class:"preview-container"},h("div",{class:"preview-send-wrapper"},h("verdocs-send",{templateId:this.templateId,endpoint:this.endpoint,onSend:function(t){var n;return(n=e.send)===null||n===void 0?void 0:n.emit(t.detail)},style:{width:"100%"}})),h("div",{class:"preview-preview-wrapper"},h("verdocs-preview",{templateId:this.templateId,endpoint:this.endpoint,style:{display:"flex",flex:"1",maxWidth:"1000px"}})))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}();VerdocsBuild.style=verdocsBuildCss;export{VerdocsBuild as verdocs_build};
|
@@ -1 +1 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,o){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o["throw"](e))}catch(e){r(e)}}function l(e){e.done?i(e.value):n(e.value).then(s,a)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(i)try{if(o=1,n&&(r=s[0]&2?n["return"]:s[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;if(n=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;n=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(s[0]===6&&i.label<r[1]){i.label=r[1];r=s;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(s);break}if(r[2])i.ops.pop();i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e];n=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,F as Fragment,H as Host,a as getElement}from"./index-172625c5.js";import{i as interact_min}from"./interact.min-6a7b19a1.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-56fa3371.js";import{u as updateField}from"./Fields-c82e6df3.js";import{g as getRGBA}from"./Colors-1b298092.js";import{g as getTemplateFieldStore}from"./TemplateFieldStore-295f240e.js";import{g as getFieldSettings}from"./utils-f76f3448.js";import"./_commonjsHelpers-8a9f3b18.js";import"./index-4439b0d1.js";import"./Envelopes-627c5239.js";import"./Files-70a192df.js";import"./Types-1628dc71.js";import"./index-914ed6f7.js";var 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}verdocs-field-textbox .settings-icon{position:absolute;top:-4px;left:-20px;display:inline-block;cursor:pointer;opacity:0.6}verdocs-field-textbox .settings-icon svg{fill:#707ae5}verdocs-field-textbox .settings-icon:hover{opacity:1}';var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.992 6.992 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" clip-rule="evenodd" /></svg>';var VerdocsFieldTextbox=function(){function e(e){registerInstance(this,e);this.settingsChanged=createEvent(this,"settingsChanged",7);this.deleted=createEvent(this,"deleted",7);this.fieldStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateid="";this.fieldname="";this.disabled=false;this.editable=false;this.moveable=false;this.done=false;this.roleindex=0;this.xscale=1;this.yscale=1;this.rerender=0;this.showingProperties=false}e.prototype.focusField=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.inputEl.focus();return[2]}))}))};e.prototype.showSettingsPanel=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.getElementById("verdocs-settings-panel-".concat(this.fieldname));if(e&&e.showPanel){e.showPanel()}return[2]}))}))};e.prototype.hideSettingsPanel=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.getElementById("verdocs-settings-panel-".concat(this.fieldname));if(e&&e.hidePanel){e.hidePanel()}return[2]}))}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.fieldStore=getTemplateFieldStore(this.templateid);console.log("fs",this.templateid);return[2]}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);if(this.editable){interact_min(this.el).resizable({edges:{top:false,bottom:false,left:true,right:true},listeners:{start:this.handleResizeStart.bind(this),move:this.handleResize.bind(this),end:this.handleResizeEnd.bind(this)}})}};e.prototype.handleResizeStart=function(e){e.preventDefault();e.stopPropagation()};e.prototype.handleResize=function(e){var t=e.target.dataset,i=t.x,o=i===void 0?0:i,n=t.y,r=n===void 0?0:n,s=t.h,a=s===void 0?0:s;var l=e.rect,d=l.width,c=l.height;o=(parseFloat(o)||0)+e.deltaRect.left;r=(parseFloat(r)||0)+e.deltaRect.top;a=(parseFloat(a)||0)+e.deltaRect.height;Object.assign(e.target.style,{width:"".concat(d,"px"),height:"".concat(c,"px"),transform:"translate(".concat(o,"px, ").concat(r+a,"px)")});Object.assign(e.target.dataset,{x:o,y:r,h:a})};e.prototype.handleResizeEnd=function(e){var t=this;var i=this.fieldStore.get(this.fieldname);var o=__assign({},getFieldSettings(i));var n=e.target.style.transform.split("(")[1].split(")")[0].split(",").map(parseFloat),r=n[0],s=n[1];o.width=Math.round(parseFloat(e.target.style.width)/this.xscale);o.height=Math.round(parseFloat(e.target.style.height)/this.yscale);o.x=Math.round(o.x+r/this.xscale);o.y=Math.round(o.y-s/this.yscale);updateField(this.endpoint,this.templateid,this.fieldname,{setting:o}).then((function(i){var n;console.log("update result",i);(n=t.settingsChanged)===null||n===void 0?void 0:n.emit({fieldName:i.name,settings:o,field:i});Object.assign(e.target.dataset,{x:0,y:0,h:0})})).catch((function(e){return console.log("Field update failed",e)}))};e.prototype.render=function(){var e=this;var t,i;var o=this.fieldStore.get(this.fieldname);console.log("textbox",this.fieldname,o);if(!o){return h(Fragment,null)}var n=getFieldSettings(o);var r=(i=(t=this.disabled)!==null&&t!==void 0?t:n.disabled)!==null&&i!==void 0?i:false;var s=o["rgba"]||getRGBA(this.roleindex);var a=(n===null||n===void 0?void 0:n.result)||"";var l=n.width||150;var d=l/5;if(this.done){return h(Host,{class:{done:this.done}},a)}return h(Host,{class:{required:o.required,disabled:r,done:this.done},style:{backgroundColor:s}},h("input",{type:"text",name:o.name,placeholder:n===null||n===void 0?void 0:n.placeholder,tabIndex:n===null||n===void 0?void 0:n.order,value:a,disabled:r,required:o===null||o===void 0?void 0:o.required,ref:function(t){return e.inputEl=t},maxlength:d}),this.editable&&h(Fragment,null,h("div",{id:"verdocs-settings-panel-trigger-".concat(o.name),style:{transform:"scale(".concat(Math.floor(1/this.xscale*1e3)/1e3,", ").concat(Math.floor(1/this.yscale*1e3)/1e3,")")},class:"settings-icon",innerHTML:settingsIcon,onClick:function(t){t.stopPropagation();e.showingProperties=!e.showingProperties}}),this.showingProperties&&h("verdocs-portal",{anchor:"verdocs-settings-panel-trigger-".concat(o.name),onClickAway:function(){return e.showingProperties=false}},h("verdocs-template-field-properties",{templateId:this.templateid,fieldName:o.name,onClose:function(){return e.showingProperties=false},onDelete:function(){var t;(t=e.deleted)===null||t===void 0?void 0:t.emit({fieldName:o.name});return e.hideSettingsPanel()},onSettingsChanged:function(t){var i;(i=e.settingsChanged)===null||i===void 0?void 0:i.emit(t.detail);return e.hideSettingsPanel()},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.'}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsFieldTextbox.style=verdocsFieldTextboxCss;export{VerdocsFieldTextbox as verdocs_field_textbox};
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,o){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o["throw"](e))}catch(e){r(e)}}function l(e){e.done?i(e.value):n(e.value).then(s,a)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(i)try{if(o=1,n&&(r=s[0]&2?n["return"]:s[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;if(n=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;n=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(s[0]===6&&i.label<r[1]){i.label=r[1];r=s;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(s);break}if(r[2])i.ops.pop();i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e];n=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,F as Fragment,H as Host,a as getElement}from"./index-172625c5.js";import{i as interact_min}from"./interact.min-6a7b19a1.js";import"./Types-5f31149e.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-56fa3371.js";import{u as updateField}from"./Fields-c82e6df3.js";import{g as getRGBA}from"./Colors-1b298092.js";import{g as getTemplateFieldStore}from"./TemplateFieldStore-295f240e.js";import{g as getFieldSettings}from"./utils-f76f3448.js";import"./_commonjsHelpers-8a9f3b18.js";import"./index-4439b0d1.js";import"./Envelopes-627c5239.js";import"./Files-70a192df.js";import"./Types-1628dc71.js";import"./index-914ed6f7.js";var 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}verdocs-field-textbox .settings-icon{position:absolute;top:-4px;left:-20px;display:inline-block;cursor:pointer;opacity:0.6}verdocs-field-textbox .settings-icon svg{fill:#707ae5}verdocs-field-textbox .settings-icon:hover{opacity:1}';var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.992 6.992 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" clip-rule="evenodd" /></svg>';var VerdocsFieldTextbox=function(){function e(e){registerInstance(this,e);this.settingsChanged=createEvent(this,"settingsChanged",7);this.deleted=createEvent(this,"deleted",7);this.fieldStore=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateid="";this.fieldname="";this.disabled=false;this.editable=false;this.moveable=false;this.done=false;this.roleindex=0;this.xscale=1;this.yscale=1;this.rerender=0;this.showingProperties=false}e.prototype.focusField=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.inputEl.focus();return[2]}))}))};e.prototype.showSettingsPanel=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.getElementById("verdocs-settings-panel-".concat(this.fieldname));if(e&&e.showPanel){e.showPanel()}return[2]}))}))};e.prototype.hideSettingsPanel=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.getElementById("verdocs-settings-panel-".concat(this.fieldname));if(e&&e.hidePanel){e.hidePanel()}return[2]}))}))};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.fieldStore=getTemplateFieldStore(this.templateid);return[2]}))}))};e.prototype.componentDidRender=function(){interact_min.dynamicDrop(true);if(this.editable){interact_min(this.el).resizable({edges:{top:false,bottom:false,left:true,right:true},listeners:{start:this.handleResizeStart.bind(this),move:this.handleResize.bind(this),end:this.handleResizeEnd.bind(this)}})}};e.prototype.handleResizeStart=function(e){e.preventDefault();e.stopPropagation()};e.prototype.handleResize=function(e){var t=e.target.dataset,i=t.x,o=i===void 0?0:i,n=t.y,r=n===void 0?0:n,s=t.h,a=s===void 0?0:s;var l=e.rect,d=l.width,c=l.height;o=(parseFloat(o)||0)+e.deltaRect.left;r=(parseFloat(r)||0)+e.deltaRect.top;a=(parseFloat(a)||0)+e.deltaRect.height;Object.assign(e.target.style,{width:"".concat(d,"px"),height:"".concat(c,"px"),transform:"translate(".concat(o,"px, ").concat(r+a,"px)")});Object.assign(e.target.dataset,{x:o,y:r,h:a})};e.prototype.handleResizeEnd=function(e){var t=this;var i=this.fieldStore.get(this.fieldname);var o=__assign({},getFieldSettings(i));var n=e.target.style.transform.split("(")[1].split(")")[0].split(",").map(parseFloat),r=n[0],s=n[1];o.width=Math.round(parseFloat(e.target.style.width)/this.xscale);o.height=Math.round(parseFloat(e.target.style.height)/this.yscale);o.x=Math.round(o.x+r/this.xscale);o.y=Math.round(o.y-s/this.yscale);updateField(this.endpoint,this.templateid,this.fieldname,{setting:o}).then((function(i){var n;console.log("Update result",i);(n=t.settingsChanged)===null||n===void 0?void 0:n.emit({fieldName:i.name,settings:o,field:i});Object.assign(e.target.dataset,{x:0,y:0,h:0})})).catch((function(e){return console.log("Field update failed",e)}))};e.prototype.render=function(){var e=this;var t,i;var o=this.fieldStore.get(this.fieldname);if(!o){return h(Fragment,null)}var n=getFieldSettings(o);var r=(i=(t=this.disabled)!==null&&t!==void 0?t:n.disabled)!==null&&i!==void 0?i:false;var s=o["rgba"]||getRGBA(this.roleindex);var a=(n===null||n===void 0?void 0:n.result)||"";var l=n.width||150;var d=l/5;if(this.done){return h(Host,{class:{done:this.done}},a)}return h(Host,{class:{required:o.required,disabled:r,done:this.done},style:{backgroundColor:s}},h("input",{type:"text",name:o.name,placeholder:n===null||n===void 0?void 0:n.placeholder,tabIndex:n===null||n===void 0?void 0:n.order,value:a,disabled:r,required:o===null||o===void 0?void 0:o.required,ref:function(t){return e.inputEl=t},maxlength:d}),this.editable&&h(Fragment,null,h("div",{id:"verdocs-settings-panel-trigger-".concat(o.name),style:{transform:"scale(".concat(Math.floor(1/this.xscale*1e3)/1e3,", ").concat(Math.floor(1/this.yscale*1e3)/1e3,")")},class:"settings-icon",innerHTML:settingsIcon,onClick:function(t){t.stopPropagation();e.showingProperties=!e.showingProperties}}),this.showingProperties&&h("verdocs-portal",{anchor:"verdocs-settings-panel-trigger-".concat(o.name),onClickAway:function(){return e.showingProperties=false}},h("verdocs-template-field-properties",{templateId:this.templateid,fieldName:o.name,onClose:function(){return e.showingProperties=false},onDelete:function(){var t;(t=e.deleted)===null||t===void 0?void 0:t.emit({fieldName:o.name});return e.hideSettingsPanel()},onSettingsChanged:function(t){var i;(i=e.settingsChanged)===null||i===void 0?void 0:i.emit(t.detail);return e.hideSettingsPanel()},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.'}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsFieldTextbox.style=verdocsFieldTextboxCss;export{VerdocsFieldTextbox as verdocs_field_textbox};
|