@verdocs/web-sdk 2.2.20 → 2.2.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/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +58 -27
- package/dist/cjs/{verdocs-dialog_3.cjs.entry.js → verdocs-dialog_2.cjs.entry.js} +0 -25
- package/dist/cjs/{verdocs-preview_6.cjs.entry.js → verdocs-preview_7.cjs.entry.js} +109 -12
- package/dist/cjs/verdocs-tabs.cjs.entry.js +34 -0
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.css +15 -16
- package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.js +4 -1
- package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.stories.js +4 -13
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.css +1 -34
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +116 -13
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.stories.js +1 -1
- package/dist/collection/components/templates/verdocs-template-attachments/verdocs-template-attachments.js +13 -8
- package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.js +28 -3
- package/dist/collection/components/templates/verdocs-template-name/verdocs-template-name.js +27 -3
- package/dist/collection/components/templates/verdocs-template-reminders/verdocs-template-reminders.js +28 -3
- package/dist/collection/components/templates/verdocs-template-visibillity/verdocs-template-visibility.js +27 -2
- package/dist/components/verdocs-build.js +102 -57
- package/dist/components/verdocs-tabs2.js +5 -2
- package/dist/components/verdocs-template-attachments2.js +5 -4
- package/dist/components/verdocs-template-create.js +1 -138
- package/dist/{esm/verdocs-template-create.entry.js → components/verdocs-template-create2.js} +61 -14
- package/dist/components/verdocs-template-name2.js +4 -3
- package/dist/components/verdocs-template-reminders2.js +5 -3
- package/dist/components/verdocs-template-visibility2.js +4 -2
- package/dist/docs.json +81 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +58 -27
- package/dist/esm/{verdocs-dialog_3.entry.js → verdocs-dialog_2.entry.js} +1 -25
- package/dist/esm/{verdocs-preview_6.entry.js → verdocs-preview_7.entry.js} +112 -16
- package/dist/esm/verdocs-tabs.entry.js +30 -0
- package/dist/esm/verdocs-web-sdk.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-dialog_3.entry.js → verdocs-dialog_2.entry.js} +1 -1
- package/dist/esm-es5/verdocs-preview_7.entry.js +1 -0
- package/dist/esm-es5/verdocs-tabs.entry.js +1 -0
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/controls/verdocs-tabs/verdocs-tabs.d.ts +2 -1
- package/dist/types/components/controls/verdocs-tabs/verdocs-tabs.stories.d.ts +2 -3
- package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +22 -1
- package/dist/types/components/templates/verdocs-template-attachments/verdocs-template-attachments.d.ts +4 -2
- package/dist/types/components/templates/verdocs-template-create/verdocs-template-create.d.ts +8 -0
- package/dist/types/components/templates/verdocs-template-name/verdocs-template-name.d.ts +9 -0
- package/dist/types/components/templates/verdocs-template-reminders/verdocs-template-reminders.d.ts +9 -0
- package/dist/types/components/templates/verdocs-template-visibillity/verdocs-template-visibility.d.ts +9 -0
- package/dist/types/components.d.ts +26 -2
- package/dist/verdocs-web-sdk/p-08571348.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-2a0ed0ab.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-3ce7e733.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-3d25b680.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-473f6990.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-65e1ab33.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-b860a7fe.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-d07dcf76.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/cjs/verdocs-template-create.cjs.entry.js +0 -99
- package/dist/esm-es5/verdocs-preview_6.entry.js +0 -1
- package/dist/esm-es5/verdocs-template-create.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-070dfd64.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7ebe11ff.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-88e12975.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-93eb4996.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b35e8183.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e1cad931.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f3aa514e.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-fbd27c79.entry.js +0 -1
@@ -50,7 +50,7 @@ export class VerdocsTemplateReminders {
|
|
50
50
|
(_c = this.close) === null || _c === void 0 ? void 0 : _c.emit();
|
51
51
|
}
|
52
52
|
async handleSave(e) {
|
53
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
54
54
|
e.stopPropagation();
|
55
55
|
try {
|
56
56
|
if (this.sendReminders) {
|
@@ -71,14 +71,15 @@ export class VerdocsTemplateReminders {
|
|
71
71
|
await deleteReminder(this.endpoint, this.templateId, (_d = this.store) === null || _d === void 0 ? void 0 : _d.state.reminder_id);
|
72
72
|
this.store = await getTemplateStore(this.endpoint, this.templateId, true);
|
73
73
|
}
|
74
|
+
(_e = this.templateUpdated) === null || _e === void 0 ? void 0 : _e.emit({ endpoint: this.endpoint, template: this.store.state, event: 'attachments' });
|
74
75
|
}
|
75
76
|
catch (e) {
|
76
77
|
console.log('[TEMPLATE REMINDERS] Unable to update reminders', e);
|
77
78
|
VerdocsToast(e.message);
|
78
|
-
(
|
79
|
+
(_f = this.sdkError) === null || _f === void 0 ? void 0 : _f.emit(new SDKError(e.message, (_g = e.response) === null || _g === void 0 ? void 0 : _g.status, (_h = e.response) === null || _h === void 0 ? void 0 : _h.data));
|
79
80
|
}
|
80
81
|
this.dirty = false;
|
81
|
-
(
|
82
|
+
(_j = this.close) === null || _j === void 0 ? void 0 : _j.emit();
|
82
83
|
}
|
83
84
|
render() {
|
84
85
|
var _a, _b;
|
@@ -201,6 +202,30 @@ export class VerdocsTemplateReminders {
|
|
201
202
|
}
|
202
203
|
}
|
203
204
|
}
|
205
|
+
}, {
|
206
|
+
"method": "templateUpdated",
|
207
|
+
"name": "templateUpdated",
|
208
|
+
"bubbles": true,
|
209
|
+
"cancelable": true,
|
210
|
+
"composed": true,
|
211
|
+
"docs": {
|
212
|
+
"tags": [],
|
213
|
+
"text": "Event fired when the user updates the template."
|
214
|
+
},
|
215
|
+
"complexType": {
|
216
|
+
"original": "{endpoint: VerdocsEndpoint; template: ITemplate; event: string}",
|
217
|
+
"resolved": "{ endpoint: VerdocsEndpoint; template: ITemplate; event: string; }",
|
218
|
+
"references": {
|
219
|
+
"VerdocsEndpoint": {
|
220
|
+
"location": "import",
|
221
|
+
"path": "@verdocs/js-sdk"
|
222
|
+
},
|
223
|
+
"ITemplate": {
|
224
|
+
"location": "import",
|
225
|
+
"path": "@verdocs/js-sdk/Templates/Types"
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
204
229
|
}];
|
205
230
|
}
|
206
231
|
}
|
@@ -46,7 +46,7 @@ export class VerdocsTemplateVisibility {
|
|
46
46
|
(_e = this.close) === null || _e === void 0 ? void 0 : _e.emit();
|
47
47
|
}
|
48
48
|
async handleSave(e) {
|
49
|
-
var _a, _b;
|
49
|
+
var _a, _b, _c;
|
50
50
|
e.stopPropagation();
|
51
51
|
await updateTemplate(this.endpoint, this.templateId, { is_personal: this.personal, is_public: this.public });
|
52
52
|
if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.state) {
|
@@ -54,7 +54,8 @@ export class VerdocsTemplateVisibility {
|
|
54
54
|
this.store.state.is_public = this.public;
|
55
55
|
}
|
56
56
|
this.dirty = false;
|
57
|
-
(_b = this.
|
57
|
+
(_b = this.templateUpdated) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, template: this.store.state, event: 'visibility' });
|
58
|
+
(_c = this.close) === null || _c === void 0 ? void 0 : _c.emit();
|
58
59
|
}
|
59
60
|
render() {
|
60
61
|
var _a, _b;
|
@@ -170,6 +171,30 @@ export class VerdocsTemplateVisibility {
|
|
170
171
|
}
|
171
172
|
}
|
172
173
|
}
|
174
|
+
}, {
|
175
|
+
"method": "templateUpdated",
|
176
|
+
"name": "templateUpdated",
|
177
|
+
"bubbles": true,
|
178
|
+
"cancelable": true,
|
179
|
+
"composed": true,
|
180
|
+
"docs": {
|
181
|
+
"tags": [],
|
182
|
+
"text": "Event fired when the user updates the template."
|
183
|
+
},
|
184
|
+
"complexType": {
|
185
|
+
"original": "{endpoint: VerdocsEndpoint; template: ITemplate; event: string}",
|
186
|
+
"resolved": "{ endpoint: VerdocsEndpoint; template: ITemplate; event: string; }",
|
187
|
+
"references": {
|
188
|
+
"VerdocsEndpoint": {
|
189
|
+
"location": "import",
|
190
|
+
"path": "@verdocs/js-sdk"
|
191
|
+
},
|
192
|
+
"ITemplate": {
|
193
|
+
"location": "import",
|
194
|
+
"path": "@verdocs/js-sdk/Templates/Types"
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
173
198
|
}];
|
174
199
|
}
|
175
200
|
}
|
@@ -3,20 +3,22 @@ import './Types.js';
|
|
3
3
|
import { P as Permissions, V as VerdocsEndpoint } from './VerdocsEndpoint.js';
|
4
4
|
import { g as getTemplateStore } from './TemplateStore.js';
|
5
5
|
import { S as SDKError } from './errors.js';
|
6
|
-
import { d as defineCustomElement$
|
7
|
-
import { d as defineCustomElement$
|
8
|
-
import { d as defineCustomElement$
|
9
|
-
import { d as defineCustomElement$
|
10
|
-
import { d as defineCustomElement$
|
11
|
-
import { d as defineCustomElement$
|
12
|
-
import { d as defineCustomElement$
|
13
|
-
import { d as defineCustomElement$
|
14
|
-
import { d as defineCustomElement$
|
15
|
-
import { d as defineCustomElement$
|
16
|
-
import { d as defineCustomElement$
|
17
|
-
import { d as defineCustomElement$
|
18
|
-
import { d as defineCustomElement$
|
19
|
-
import { d as defineCustomElement$
|
6
|
+
import { d as defineCustomElement$s } from './verdocs-button2.js';
|
7
|
+
import { d as defineCustomElement$r } from './verdocs-checkbox2.js';
|
8
|
+
import { d as defineCustomElement$q } from './verdocs-component-error2.js';
|
9
|
+
import { d as defineCustomElement$p } from './verdocs-contact-picker2.js';
|
10
|
+
import { d as defineCustomElement$o } from './verdocs-file-chooser2.js';
|
11
|
+
import { d as defineCustomElement$n } from './verdocs-help-icon2.js';
|
12
|
+
import { d as defineCustomElement$m } from './verdocs-loader2.js';
|
13
|
+
import { d as defineCustomElement$l } from './verdocs-ok-dialog2.js';
|
14
|
+
import { d as defineCustomElement$k } from './verdocs-preview2.js';
|
15
|
+
import { d as defineCustomElement$j } from './verdocs-progress-bar2.js';
|
16
|
+
import { d as defineCustomElement$i } from './verdocs-radio-button2.js';
|
17
|
+
import { d as defineCustomElement$h } from './verdocs-select-input2.js';
|
18
|
+
import { d as defineCustomElement$g } from './verdocs-send2.js';
|
19
|
+
import { d as defineCustomElement$f } from './verdocs-tabs2.js';
|
20
|
+
import { d as defineCustomElement$e } from './verdocs-template-attachments2.js';
|
21
|
+
import { d as defineCustomElement$d } from './verdocs-template-create2.js';
|
20
22
|
import { d as defineCustomElement$c } from './verdocs-template-document-page2.js';
|
21
23
|
import { d as defineCustomElement$b } from './verdocs-template-fields2.js';
|
22
24
|
import { d as defineCustomElement$a } from './verdocs-template-name2.js';
|
@@ -53,14 +55,6 @@ var userIsTemplateCreator = function (session, template) {
|
|
53
55
|
var userHasSharedTemplate = function (session, template) {
|
54
56
|
return session && template && !template.is_personal && session.organization_id === template.organization_id;
|
55
57
|
};
|
56
|
-
/**
|
57
|
-
* Check to see if the user can read/view a template.
|
58
|
-
*/
|
59
|
-
var userCanReadTemplate = function (session, template) {
|
60
|
-
return template.is_public ||
|
61
|
-
userIsTemplateCreator(session, template) ||
|
62
|
-
(userHasSharedTemplate(session, template) && userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_READ]));
|
63
|
-
};
|
64
58
|
/**
|
65
59
|
* Check to see if the user can update a tempate.
|
66
60
|
*/
|
@@ -76,17 +70,8 @@ var userCanUpdateTemplate = function (session, template) {
|
|
76
70
|
var userCanBuildTemplate = function (session, template) {
|
77
71
|
return userCanUpdateTemplate(session, template) && (template.roles || []).filter(function (role) { return role.type === 'signer'; }).length > 0;
|
78
72
|
};
|
79
|
-
/**
|
80
|
-
* Check to see if the user can preview the template. The user must have read access to the template, the template must
|
81
|
-
* have at least one signer, and every signer must have at least one field.
|
82
|
-
*/
|
83
|
-
var userCanPreviewTemplate = function (session, template) {
|
84
|
-
var hasPermission = userCanReadTemplate(session, template);
|
85
|
-
var signers = (template.roles || []).filter(function (role) { return role.type === 'signer'; });
|
86
|
-
return hasPermission && signers.length > 0 && signers.every(function (signer) { return (signer.fields || []).length > 0; });
|
87
|
-
};
|
88
73
|
|
89
|
-
const 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 .
|
74
|
+
const 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}";
|
90
75
|
|
91
76
|
const VerdocsBuild$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
92
77
|
constructor() {
|
@@ -95,35 +80,60 @@ const VerdocsBuild$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
95
80
|
this.sdkError = createEvent(this, "sdkError", 7);
|
96
81
|
this.stepChanged = createEvent(this, "stepChanged", 7);
|
97
82
|
this.send = createEvent(this, "send", 7);
|
98
|
-
this.
|
83
|
+
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
84
|
+
this.templateCreated = createEvent(this, "templateCreated", 7);
|
99
85
|
this.endpoint = VerdocsEndpoint.getDefault();
|
100
86
|
this.templateId = null;
|
101
|
-
this.step =
|
87
|
+
this.step = 'preview';
|
88
|
+
this.store = null;
|
89
|
+
this.tabsUpdateKey = 1;
|
90
|
+
}
|
91
|
+
onTemplateIdChanged() {
|
92
|
+
console.log('Template ID changed', this.templateId);
|
93
|
+
this.loadTemplate().catch((e) => console.log('Unknown Error', e));
|
102
94
|
}
|
103
95
|
async componentWillLoad() {
|
104
96
|
var _a, _b, _c;
|
105
97
|
try {
|
106
98
|
this.endpoint.loadSession();
|
107
99
|
if (!this.templateId) {
|
108
|
-
console.log(`[BUILD]
|
100
|
+
console.log(`[BUILD] No template ID, activating upload mode`);
|
101
|
+
this.step = 'attachments';
|
109
102
|
return;
|
110
103
|
}
|
111
104
|
if (!this.endpoint.session) {
|
112
105
|
console.log('[BUILD] Unable to start builder session, must be authenticated');
|
113
106
|
return;
|
114
107
|
}
|
115
|
-
this.
|
116
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, true);
|
108
|
+
this.loadTemplate().catch(e => console.log('[BUILD] Unable to load template', e));
|
117
109
|
}
|
118
110
|
catch (e) {
|
119
111
|
console.log('[BUILD] Error loading template', e);
|
120
112
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
121
113
|
}
|
122
114
|
}
|
115
|
+
async loadTemplate() {
|
116
|
+
if (this.templateId) {
|
117
|
+
this.store = await getTemplateStore(this.endpoint, this.templateId, true);
|
118
|
+
}
|
119
|
+
}
|
123
120
|
handleCancel(e) {
|
124
121
|
console.log('Cancel', e.detail);
|
125
122
|
this.step = 'preview';
|
126
123
|
}
|
124
|
+
async handleTemplateCreated(templateId) {
|
125
|
+
var _a;
|
126
|
+
this.templateId = templateId;
|
127
|
+
await this.loadTemplate();
|
128
|
+
this.step = 'roles';
|
129
|
+
(_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit('roles');
|
130
|
+
}
|
131
|
+
async handleTemplateUpdated(e) {
|
132
|
+
var _a;
|
133
|
+
console.log('tup');
|
134
|
+
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
|
135
|
+
this.tabsUpdateKey++;
|
136
|
+
}
|
127
137
|
handleAttachmentsNext() {
|
128
138
|
var _a;
|
129
139
|
this.step = 'roles';
|
@@ -142,25 +152,50 @@ const VerdocsBuild$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
142
152
|
(_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit(step);
|
143
153
|
}
|
144
154
|
render() {
|
155
|
+
var _a, _b, _c;
|
145
156
|
if (!this.endpoint.session) {
|
146
157
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
147
158
|
}
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
159
|
+
if (!this.templateId || !this.store) {
|
160
|
+
console.log('[BUILD] No template ID, rendering created view');
|
161
|
+
return (h(Host, null, h("div", { class: "content" }, h("verdocs-tabs", { key: this.tabsUpdateKey, onSelectTab: () => { }, tabs: [
|
162
|
+
{ id: 'attachments', disabled: false, label: 'Upload Attachment(s)' },
|
163
|
+
{ id: 'roles', disabled: true, label: 'Roles' },
|
164
|
+
{ id: 'settings', disabled: true, label: 'Settings' },
|
165
|
+
{ id: 'fields', disabled: true, label: 'Fields' },
|
166
|
+
{ id: 'preview', disabled: true, label: 'Preview/Send' },
|
167
|
+
] }), h("verdocs-template-create", { endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateCreated: e => this.handleTemplateCreated(e.detail.templateId) }))));
|
168
|
+
}
|
169
|
+
console.log('[BUILD] Rendering build view', this.step, ['attachments', 'roles', 'settings', 'fields', 'preview'].indexOf(this.step));
|
170
|
+
// const canPreview = this.store && userCanPreviewTemplate(this.endpoint.session, this.store?.state);
|
171
|
+
// TODO: Had to disable this for now to research why reactivity isn't re-rendering the tabs
|
172
|
+
const canPreview = this.store && userCanBuildTemplate(this.endpoint.session, (_a = this.store) === null || _a === void 0 ? void 0 : _a.state);
|
173
|
+
const canEditFields = this.store && userCanBuildTemplate(this.endpoint.session, (_b = this.store) === null || _b === void 0 ? void 0 : _b.state);
|
174
|
+
const canEditRoles = this.store && userCanUpdateTemplate(this.endpoint.session, (_c = this.store) === null || _c === void 0 ? void 0 : _c.state);
|
175
|
+
return (h(Host, null, h("div", { class: "content" }, h("verdocs-tabs", { key: this.tabsUpdateKey, onSelectTab: e => this.setStep(e, e.detail.tab.id), defaultTab: ['attachments', 'roles', 'settings', 'fields', 'preview'].indexOf(this.step), tabs: [
|
176
|
+
{ id: 'attachments', disabled: false, label: 'Attachment(s)' },
|
177
|
+
{ id: 'roles', disabled: !canEditRoles, label: 'Roles' },
|
178
|
+
{ id: 'settings', disabled: !canEditFields, label: 'Settings' },
|
179
|
+
{ id: 'fields', disabled: !canEditFields, label: 'Fields' },
|
180
|
+
{ id: 'preview', disabled: !canPreview, label: 'Preview/Send' },
|
181
|
+
] }), this.step === 'attachments' && (h("verdocs-template-attachments", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), this.step === 'roles' && (h("verdocs-template-roles", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleRolesNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), 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: e => this.handleTemplateUpdated(e) }), h("verdocs-template-reminders", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), h("verdocs-template-visibility", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }))), this.step === 'fields' && h("verdocs-template-fields", { templateId: this.templateId, endpoint: this.endpoint, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), this.step === 'preview' && (h("div", { style: { flexDirection: 'row', display: 'flex', width: '100%', backgroundColor: '#eeeeee', maxHeight: '100%' } }, h("div", { style: { display: 'flex', flex: '0 0 300px', backgroundColor: '#ffffff', boxShadow: '1px 1px 6px -2px #0000007f' } }, h("verdocs-send", { templateId: this.templateId, endpoint: this.endpoint, onSend: e => { var _a; return (_a = this.send) === null || _a === void 0 ? void 0 : _a.emit(e.detail); }, style: { width: '100%' } })), h("div", { style: { display: 'flex', flex: '1', justifyContent: 'center', overflowY: 'scroll' } }, h("verdocs-preview", { templateId: this.templateId, endpoint: this.endpoint, style: { display: 'flex', flex: '1', maxWidth: '1000px' } })))))));
|
152
182
|
}
|
183
|
+
static get watchers() { return {
|
184
|
+
"templateId": ["onTemplateIdChanged"]
|
185
|
+
}; }
|
153
186
|
static get style() { return verdocsBuildCss; }
|
154
187
|
}, [0, "verdocs-build", {
|
155
188
|
"endpoint": [16],
|
156
|
-
"templateId": [
|
157
|
-
"step": [1537]
|
189
|
+
"templateId": [1537, "template-id"],
|
190
|
+
"step": [1537],
|
191
|
+
"store": [32],
|
192
|
+
"tabsUpdateKey": [32]
|
158
193
|
}]);
|
159
194
|
function defineCustomElement$1() {
|
160
195
|
if (typeof customElements === "undefined") {
|
161
196
|
return;
|
162
197
|
}
|
163
|
-
const components = ["verdocs-build", "verdocs-button", "verdocs-checkbox", "verdocs-component-error", "verdocs-contact-picker", "verdocs-file-chooser", "verdocs-help-icon", "verdocs-loader", "verdocs-ok-dialog", "verdocs-preview", "verdocs-progress-bar", "verdocs-radio-button", "verdocs-select-input", "verdocs-send", "verdocs-template-attachments", "verdocs-template-document-page", "verdocs-template-fields", "verdocs-template-name", "verdocs-template-reminders", "verdocs-template-role-properties", "verdocs-template-roles", "verdocs-template-sender", "verdocs-template-visibility", "verdocs-text-input", "verdocs-toggle-button", "verdocs-toolbar-icon"];
|
198
|
+
const components = ["verdocs-build", "verdocs-button", "verdocs-checkbox", "verdocs-component-error", "verdocs-contact-picker", "verdocs-file-chooser", "verdocs-help-icon", "verdocs-loader", "verdocs-ok-dialog", "verdocs-preview", "verdocs-progress-bar", "verdocs-radio-button", "verdocs-select-input", "verdocs-send", "verdocs-tabs", "verdocs-template-attachments", "verdocs-template-create", "verdocs-template-document-page", "verdocs-template-fields", "verdocs-template-name", "verdocs-template-reminders", "verdocs-template-role-properties", "verdocs-template-roles", "verdocs-template-sender", "verdocs-template-visibility", "verdocs-text-input", "verdocs-toggle-button", "verdocs-toolbar-icon"];
|
164
199
|
components.forEach(tagName => { switch (tagName) {
|
165
200
|
case "verdocs-build":
|
166
201
|
if (!customElements.get(tagName)) {
|
@@ -169,70 +204,80 @@ function defineCustomElement$1() {
|
|
169
204
|
break;
|
170
205
|
case "verdocs-button":
|
171
206
|
if (!customElements.get(tagName)) {
|
172
|
-
defineCustomElement$
|
207
|
+
defineCustomElement$s();
|
173
208
|
}
|
174
209
|
break;
|
175
210
|
case "verdocs-checkbox":
|
176
211
|
if (!customElements.get(tagName)) {
|
177
|
-
defineCustomElement$
|
212
|
+
defineCustomElement$r();
|
178
213
|
}
|
179
214
|
break;
|
180
215
|
case "verdocs-component-error":
|
181
216
|
if (!customElements.get(tagName)) {
|
182
|
-
defineCustomElement$
|
217
|
+
defineCustomElement$q();
|
183
218
|
}
|
184
219
|
break;
|
185
220
|
case "verdocs-contact-picker":
|
186
221
|
if (!customElements.get(tagName)) {
|
187
|
-
defineCustomElement$
|
222
|
+
defineCustomElement$p();
|
188
223
|
}
|
189
224
|
break;
|
190
225
|
case "verdocs-file-chooser":
|
191
226
|
if (!customElements.get(tagName)) {
|
192
|
-
defineCustomElement$
|
227
|
+
defineCustomElement$o();
|
193
228
|
}
|
194
229
|
break;
|
195
230
|
case "verdocs-help-icon":
|
196
231
|
if (!customElements.get(tagName)) {
|
197
|
-
defineCustomElement$
|
232
|
+
defineCustomElement$n();
|
198
233
|
}
|
199
234
|
break;
|
200
235
|
case "verdocs-loader":
|
201
236
|
if (!customElements.get(tagName)) {
|
202
|
-
defineCustomElement$
|
237
|
+
defineCustomElement$m();
|
203
238
|
}
|
204
239
|
break;
|
205
240
|
case "verdocs-ok-dialog":
|
206
241
|
if (!customElements.get(tagName)) {
|
207
|
-
defineCustomElement$
|
242
|
+
defineCustomElement$l();
|
208
243
|
}
|
209
244
|
break;
|
210
245
|
case "verdocs-preview":
|
211
246
|
if (!customElements.get(tagName)) {
|
212
|
-
defineCustomElement$
|
247
|
+
defineCustomElement$k();
|
213
248
|
}
|
214
249
|
break;
|
215
250
|
case "verdocs-progress-bar":
|
216
251
|
if (!customElements.get(tagName)) {
|
217
|
-
defineCustomElement$
|
252
|
+
defineCustomElement$j();
|
218
253
|
}
|
219
254
|
break;
|
220
255
|
case "verdocs-radio-button":
|
221
256
|
if (!customElements.get(tagName)) {
|
222
|
-
defineCustomElement$
|
257
|
+
defineCustomElement$i();
|
223
258
|
}
|
224
259
|
break;
|
225
260
|
case "verdocs-select-input":
|
226
261
|
if (!customElements.get(tagName)) {
|
227
|
-
defineCustomElement$
|
262
|
+
defineCustomElement$h();
|
228
263
|
}
|
229
264
|
break;
|
230
265
|
case "verdocs-send":
|
231
266
|
if (!customElements.get(tagName)) {
|
232
|
-
defineCustomElement$
|
267
|
+
defineCustomElement$g();
|
268
|
+
}
|
269
|
+
break;
|
270
|
+
case "verdocs-tabs":
|
271
|
+
if (!customElements.get(tagName)) {
|
272
|
+
defineCustomElement$f();
|
233
273
|
}
|
234
274
|
break;
|
235
275
|
case "verdocs-template-attachments":
|
276
|
+
if (!customElements.get(tagName)) {
|
277
|
+
defineCustomElement$e();
|
278
|
+
}
|
279
|
+
break;
|
280
|
+
case "verdocs-template-create":
|
236
281
|
if (!customElements.get(tagName)) {
|
237
282
|
defineCustomElement$d();
|
238
283
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
2
|
|
3
|
-
const verdocsTabsCss = "verdocs-tabs{
|
3
|
+
const verdocsTabsCss = "verdocs-tabs{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-tabs .tab{display:-ms-flexbox;display:flex;color:#111111;cursor:pointer;font-size:14px;font-weight:400;padding:5px 10px;-ms-flex-align:center;align-items:center;text-transform:none;-ms-flex-pack:center;justify-content:center;border-bottom:4px solid transparent}verdocs-tabs .tab:focus{border:none;outline:none}verdocs-tabs .tab.active{color:#000000;font-weight:500;border-bottom:4px solid #654dcb}verdocs-tabs .tab.disabled{color:#666666;cursor:default}";
|
4
4
|
|
5
5
|
const VerdocsTabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
6
6
|
constructor() {
|
@@ -11,7 +11,10 @@ const VerdocsTabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
this.defaultTab = 0;
|
12
12
|
this.selectedTab = 0;
|
13
13
|
}
|
14
|
-
|
14
|
+
componentDidLoad() {
|
15
|
+
this.selectedTab = this.defaultTab || 0;
|
16
|
+
}
|
17
|
+
componentDidUpdate() {
|
15
18
|
this.selectedTab = this.defaultTab || 0;
|
16
19
|
}
|
17
20
|
handleSelectTab(index) {
|
@@ -19,7 +19,7 @@ const VerdocsTemplateAttachments = /*@__PURE__*/ proxyCustomElement(class extend
|
|
19
19
|
this.__registerHost();
|
20
20
|
this.exit = createEvent(this, "exit", 7);
|
21
21
|
this.next = createEvent(this, "next", 7);
|
22
|
-
this.
|
22
|
+
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
23
23
|
this.sdkError = createEvent(this, "sdkError", 7);
|
24
24
|
this.endpoint = VerdocsEndpoint.getDefault();
|
25
25
|
this.templateId = '';
|
@@ -63,7 +63,7 @@ const VerdocsTemplateAttachments = /*@__PURE__*/ proxyCustomElement(class extend
|
|
63
63
|
}
|
64
64
|
}
|
65
65
|
async handleUpload(e) {
|
66
|
-
var _a, _b, _c;
|
66
|
+
var _a, _b, _c, _d;
|
67
67
|
e.stopPropagation();
|
68
68
|
const file = e.detail.file;
|
69
69
|
if (!file) {
|
@@ -76,14 +76,15 @@ const VerdocsTemplateAttachments = /*@__PURE__*/ proxyCustomElement(class extend
|
|
76
76
|
const template = await createTemplateDocument(this.endpoint, this.templateId, file, this.handleUploadProgress.bind(this));
|
77
77
|
console.log('[ATTACHMENTS] Created attachment', template);
|
78
78
|
this.store = await getTemplateStore(this.endpoint, this.templateId, true);
|
79
|
-
console.log('[ATTACHMENTS]
|
79
|
+
console.log('[ATTACHMENTS] Updated template', this.store.state);
|
80
|
+
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: this.store.state, event: 'attachments' });
|
80
81
|
this.uploading = false;
|
81
82
|
this.progressLabel = '';
|
82
83
|
this.progressPercent = 0;
|
83
84
|
}
|
84
85
|
catch (e) {
|
85
86
|
console.log('[ATTACHMENTS] Error creating template', e);
|
86
|
-
(
|
87
|
+
(_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
|
87
88
|
this.uploading = false;
|
88
89
|
}
|
89
90
|
}
|
@@ -1,141 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import './Types.js';
|
3
|
-
import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
|
4
|
-
import { c as createTemplate } from './Templates.js';
|
5
|
-
import { S as SDKError } from './errors.js';
|
6
|
-
import { d as defineCustomElement$5 } from './verdocs-button2.js';
|
7
|
-
import { d as defineCustomElement$4 } from './verdocs-component-error2.js';
|
8
|
-
import { d as defineCustomElement$3 } from './verdocs-loader2.js';
|
9
|
-
import { d as defineCustomElement$2 } from './verdocs-progress-bar2.js';
|
10
|
-
|
11
|
-
const verdocsTemplateCreateCss = "verdocs-template-create{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box.drag-over{border:2px solid #4c56cb}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .progress-wrapper{padding:20px}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}";
|
12
|
-
|
13
|
-
const unicodeNBSP = ' ';
|
14
|
-
const FileIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>';
|
15
|
-
const VerdocsTemplateCreate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
16
|
-
constructor() {
|
17
|
-
super();
|
18
|
-
this.__registerHost();
|
19
|
-
this.exit = createEvent(this, "exit", 7);
|
20
|
-
this.next = createEvent(this, "next", 7);
|
21
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
22
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
23
|
-
this.file = undefined;
|
24
|
-
this.creating = false;
|
25
|
-
this.progressLabel = 'Uploading...';
|
26
|
-
this.progressPercent = 0;
|
27
|
-
}
|
28
|
-
componentWillLoad() {
|
29
|
-
this.endpoint.setTimeout(30000);
|
30
|
-
this.endpoint.loadSession();
|
31
|
-
}
|
32
|
-
handleFileChanged(e) {
|
33
|
-
var _a;
|
34
|
-
this.file = ((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || null;
|
35
|
-
console.log('[CREATE] Selected file', this.file);
|
36
|
-
// this.filePath = e.target.files?.[0]?.name;
|
37
|
-
}
|
38
|
-
handleUpload(e) {
|
39
|
-
e.stopPropagation();
|
40
|
-
const fileElem = document.getElementById('verdocs-template-create-file');
|
41
|
-
fileElem.click();
|
42
|
-
}
|
43
|
-
handleCancel(e) {
|
44
|
-
e.stopPropagation();
|
45
|
-
this.exit.emit();
|
46
|
-
}
|
47
|
-
async handleSubmit(e) {
|
48
|
-
var _a, _b, _c, _d;
|
49
|
-
e.stopPropagation();
|
50
|
-
console.log('Submitting');
|
51
|
-
// Should be true if we're here because onClick is only enabled then. We're just guarding this for Typescript.
|
52
|
-
if (!this.file) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
this.creating = true;
|
56
|
-
this.progressLabel = 'Uploading...';
|
57
|
-
try {
|
58
|
-
const template = await createTemplate(this.endpoint, { name: this.file.name, documents: [this.file] }, percent => {
|
59
|
-
if (percent >= 99) {
|
60
|
-
this.progressLabel = 'Processing...';
|
61
|
-
this.progressPercent = 100;
|
62
|
-
}
|
63
|
-
else {
|
64
|
-
this.progressPercent = percent;
|
65
|
-
}
|
66
|
-
});
|
67
|
-
console.log('[CREATE] Created template', template);
|
68
|
-
(_a = this.next) === null || _a === void 0 ? void 0 : _a.emit(template);
|
69
|
-
this.creating = false;
|
70
|
-
this.progressLabel = '';
|
71
|
-
this.progressPercent = 0;
|
72
|
-
}
|
73
|
-
catch (e) {
|
74
|
-
console.log('[CREATE] Error creating template', e);
|
75
|
-
(_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
|
76
|
-
this.creating = false;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
render() {
|
80
|
-
if (!this.endpoint.session) {
|
81
|
-
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
82
|
-
}
|
83
|
-
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("input", { type: "file", id: "verdocs-template-create-file", multiple: true, accept: "application/pdf", style: { display: 'none' }, onChange: e => this.handleFileChanged(e) }), this.creating ? (h("div", { class: "loader-wrapper" }, h("verdocs-loader", null), this.progressLabel && (h("div", { class: "progress-wrapper" }, h("verdocs-progress-bar", { showPercent: true, percent: this.progressPercent, label: this.progressLabel }))))) : (h("div", { class: "upload-box", onDrop: (e) => {
|
84
|
-
e.preventDefault();
|
85
|
-
e.target.classList.remove('drag-over');
|
86
|
-
this.file = e.dataTransfer.files[0];
|
87
|
-
}, onDragOver: (e) => {
|
88
|
-
e.preventDefault();
|
89
|
-
e.dataTransfer.dropEffect = 'copy';
|
90
|
-
}, onDragEnter: (e) => e.target.classList.add('drag-over'), onDragLeave: (e) => e.target.classList.remove('drag-over') }, h("div", null, h("span", { innerHTML: FileIcon })), h("div", { style: { marginTop: '20px', fontSize: '20px', fontWeight: 'bold', overflowWrap: 'anywhere' } }, this.file ? this.file.name : 'Drag a file here'), h("div", { style: {
|
91
|
-
marginTop: '20px',
|
92
|
-
marginBottom: '20px',
|
93
|
-
fontSize: '16px',
|
94
|
-
height: '20px',
|
95
|
-
} }, this.file ? unicodeNBSP : 'Or, if you prefer...'), h("verdocs-button", { label: this.file ? 'Select a different file' : 'Select a file from your computer', size: "small", onClick: e => this.handleUpload(e) }))), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e), disabled: this.creating }), h("verdocs-button", { label: "Next", size: "small", onClick: e => this.handleSubmit(e), disabled: !this.file || this.creating })))));
|
96
|
-
}
|
97
|
-
static get style() { return verdocsTemplateCreateCss; }
|
98
|
-
}, [0, "verdocs-template-create", {
|
99
|
-
"endpoint": [16],
|
100
|
-
"file": [32],
|
101
|
-
"creating": [32],
|
102
|
-
"progressLabel": [32],
|
103
|
-
"progressPercent": [32]
|
104
|
-
}]);
|
105
|
-
function defineCustomElement$1() {
|
106
|
-
if (typeof customElements === "undefined") {
|
107
|
-
return;
|
108
|
-
}
|
109
|
-
const components = ["verdocs-template-create", "verdocs-button", "verdocs-component-error", "verdocs-loader", "verdocs-progress-bar"];
|
110
|
-
components.forEach(tagName => { switch (tagName) {
|
111
|
-
case "verdocs-template-create":
|
112
|
-
if (!customElements.get(tagName)) {
|
113
|
-
customElements.define(tagName, VerdocsTemplateCreate$1);
|
114
|
-
}
|
115
|
-
break;
|
116
|
-
case "verdocs-button":
|
117
|
-
if (!customElements.get(tagName)) {
|
118
|
-
defineCustomElement$5();
|
119
|
-
}
|
120
|
-
break;
|
121
|
-
case "verdocs-component-error":
|
122
|
-
if (!customElements.get(tagName)) {
|
123
|
-
defineCustomElement$4();
|
124
|
-
}
|
125
|
-
break;
|
126
|
-
case "verdocs-loader":
|
127
|
-
if (!customElements.get(tagName)) {
|
128
|
-
defineCustomElement$3();
|
129
|
-
}
|
130
|
-
break;
|
131
|
-
case "verdocs-progress-bar":
|
132
|
-
if (!customElements.get(tagName)) {
|
133
|
-
defineCustomElement$2();
|
134
|
-
}
|
135
|
-
break;
|
136
|
-
} });
|
137
|
-
}
|
138
|
-
defineCustomElement$1();
|
1
|
+
import { V as VerdocsTemplateCreate$1, d as defineCustomElement$1 } from './verdocs-template-create2.js';
|
139
2
|
|
140
3
|
const VerdocsTemplateCreate = VerdocsTemplateCreate$1;
|
141
4
|
const defineCustomElement = defineCustomElement$1;
|