@verdocs/web-sdk 5.0.18 → 5.0.20
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/{Datastore-4448f6ef.js → Datastore-931fd77e.js} +7 -4
- package/dist/cjs/Datastore-931fd77e.js.map +1 -0
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +18 -15
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +1 -1
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +5 -10
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +16 -13
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map +1 -1
- package/dist/components/{p-d9a2e920.js → p-1ab01232.js} +3 -3
- package/dist/components/{p-d9a2e920.js.map → p-1ab01232.js.map} +1 -1
- package/dist/components/{p-efa3b8ac.js → p-1ce18a42.js} +2 -2
- package/dist/components/{p-efa3b8ac.js.map → p-1ce18a42.js.map} +1 -1
- package/dist/components/{p-c662e5f4.js → p-1f0f5448.js} +2 -2
- package/dist/components/{p-c662e5f4.js.map → p-1f0f5448.js.map} +1 -1
- package/dist/components/{p-aa59fa42.js → p-28e3b2e3.js} +14 -14
- package/dist/components/{p-aa59fa42.js.map → p-28e3b2e3.js.map} +1 -1
- package/dist/components/{p-9bcf9620.js → p-2d8b46e5.js} +2 -2
- package/dist/components/{p-9bcf9620.js.map → p-2d8b46e5.js.map} +1 -1
- package/dist/components/{p-58d027d1.js → p-3828cb31.js} +7 -4
- package/dist/components/p-3828cb31.js.map +1 -0
- package/dist/components/{p-314d698d.js → p-53168eec.js} +2 -2
- package/dist/components/{p-314d698d.js.map → p-53168eec.js.map} +1 -1
- package/dist/components/{p-bcc8771f.js → p-681e7dd4.js} +3 -3
- package/dist/components/{p-bcc8771f.js.map → p-681e7dd4.js.map} +1 -1
- package/dist/components/{p-78043e4b.js → p-78de9e65.js} +20 -17
- package/dist/components/p-78de9e65.js.map +1 -0
- package/dist/components/{p-14c80ae8.js → p-91d65fde.js} +3 -3
- package/dist/components/{p-14c80ae8.js.map → p-91d65fde.js.map} +1 -1
- package/dist/components/{p-d8340641.js → p-a415ce22.js} +3 -3
- package/dist/components/{p-d8340641.js.map → p-a415ce22.js.map} +1 -1
- package/dist/components/{p-022b87d3.js → p-b8885b5c.js} +2 -2
- package/dist/components/{p-022b87d3.js.map → p-b8885b5c.js.map} +1 -1
- package/dist/components/{p-5182136e.js → p-c4c9feda.js} +3 -3
- package/dist/components/{p-5182136e.js.map → p-c4c9feda.js.map} +1 -1
- package/dist/components/{p-2ddf4d5b.js → p-e4799d51.js} +3 -3
- package/dist/components/{p-2ddf4d5b.js.map → p-e4799d51.js.map} +1 -1
- package/dist/components/{p-261521bc.js → p-e4a97ad5.js} +3 -3
- package/dist/components/{p-261521bc.js.map → p-e4a97ad5.js.map} +1 -1
- package/dist/components/{p-c9bed8f7.js → p-e9528d9f.js} +3 -3
- package/dist/components/{p-c9bed8f7.js.map → p-e9528d9f.js.map} +1 -1
- package/dist/components/{p-8a76ec8a.js → p-e95ded6b.js} +14 -14
- package/dist/components/{p-8a76ec8a.js.map → p-e95ded6b.js.map} +1 -1
- package/dist/components/{p-7cd6c0ce.js → p-eb12a71c.js} +2 -2
- package/dist/components/{p-7cd6c0ce.js.map → p-eb12a71c.js.map} +1 -1
- package/dist/components/{p-6c4fe42c.js → p-eb2ad8d0.js} +2 -2
- package/dist/components/{p-6c4fe42c.js.map → p-eb2ad8d0.js.map} +1 -1
- package/dist/components/{p-43fa069d.js → p-ecfc85ae.js} +3 -3
- package/dist/components/{p-43fa069d.js.map → p-ecfc85ae.js.map} +1 -1
- package/dist/components/{p-211fa3e2.js → p-f6156f7a.js} +3 -3
- package/dist/components/{p-211fa3e2.js.map → p-f6156f7a.js.map} +1 -1
- package/dist/components/{p-13260b9f.js → p-fcf13666.js} +13 -13
- package/dist/components/{p-13260b9f.js.map → p-fcf13666.js.map} +1 -1
- package/dist/components/verdocs-build.js +20 -20
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +2 -2
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +2 -2
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +2 -2
- package/dist/components/verdocs-template-attachments.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/{Datastore-b55570ff.js → Datastore-3f924d94.js} +7 -4
- package/dist/esm/Datastore-3f924d94.js.map +1 -0
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +18 -15
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/{Datastore-b55570ff.js → Datastore-3f924d94.js} +2 -2
- package/dist/esm-es5/Datastore-3f924d94.js.map +1 -0
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +3 -0
- package/dist/verdocs-web-sdk/{p-19462841.system.entry.js → p-086ee7f1.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-fedcc413.entry.js → p-1902bf04.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-fda9c437.system.entry.js → p-208a8b41.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-00ed440b.system.entry.js → p-2175c81a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-3cc50f0b.system.entry.js → p-26106576.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-eb3ceb39.system.entry.js → p-32cf09f0.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9021fc7b.system.entry.js → p-34c2298e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-d8d279a8.entry.js → p-3701b851.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-3701b851.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-58d027d1.js → p-3828cb31.js} +2 -2
- package/dist/verdocs-web-sdk/p-3828cb31.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-dced30fa.entry.js → p-471fd78e.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-99d5305a.system.entry.js → p-51c7f852.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-51c7f852.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-17f35bcb.entry.js → p-60da8e6b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-35dcb386.system.js → p-65be7617.system.js} +2 -2
- package/dist/verdocs-web-sdk/p-65be7617.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-e3077c5e.system.entry.js → p-6b2fc4bd.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-37fa9d00.system.entry.js → p-7975ec40.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-27416916.entry.js → p-7ffebea3.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-bbf30adc.system.entry.js → p-90690dde.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-03399c69.entry.js → p-a4d94e2e.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-882aa754.entry.js → p-c59aa521.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f2b16ddf.entry.js → p-cc230abf.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c2bca18a.entry.js → p-d4aff253.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-db1faf41.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-d23b5949.entry.js.map → p-db1faf41.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-ea078594.system.entry.js → p-dc5c275f.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-88baf4d1.entry.js → p-e84cf41e.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-546daa8b.entry.js → p-f6ed768d.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-41f22b0a.system.entry.js → p-ff048639.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +5 -5
- package/dist/cjs/Datastore-4448f6ef.js.map +0 -1
- package/dist/components/p-58d027d1.js.map +0 -1
- package/dist/components/p-78043e4b.js.map +0 -1
- package/dist/esm/Datastore-b55570ff.js.map +0 -1
- package/dist/esm-es5/Datastore-b55570ff.js.map +0 -1
- package/dist/verdocs-web-sdk/p-35dcb386.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-58d027d1.js.map +0 -1
- package/dist/verdocs-web-sdk/p-99d5305a.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-d23b5949.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-d8d279a8.entry.js.map +0 -1
- /package/dist/verdocs-web-sdk/{p-19462841.system.entry.js.map → p-086ee7f1.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-fedcc413.entry.js.map → p-1902bf04.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-fda9c437.system.entry.js.map → p-208a8b41.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-00ed440b.system.entry.js.map → p-2175c81a.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3cc50f0b.system.entry.js.map → p-26106576.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-eb3ceb39.system.entry.js.map → p-32cf09f0.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-9021fc7b.system.entry.js.map → p-34c2298e.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-dced30fa.entry.js.map → p-471fd78e.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-17f35bcb.entry.js.map → p-60da8e6b.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-e3077c5e.system.entry.js.map → p-6b2fc4bd.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-37fa9d00.system.entry.js.map → p-7975ec40.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-27416916.entry.js.map → p-7ffebea3.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-bbf30adc.system.entry.js.map → p-90690dde.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-03399c69.entry.js.map → p-a4d94e2e.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-882aa754.entry.js.map → p-c59aa521.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-f2b16ddf.entry.js.map → p-cc230abf.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-c2bca18a.entry.js.map → p-d4aff253.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-ea078594.system.entry.js.map → p-dc5c275f.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-88baf4d1.entry.js.map → p-e84cf41e.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-546daa8b.entry.js.map → p-f6ed768d.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-41f22b0a.system.entry.js.map → p-ff048639.system.entry.js.map} +0 -0
@@ -7,7 +7,7 @@ const jsSdk = require('@verdocs/js-sdk');
|
|
7
7
|
const utils = require('./utils-746daf30.js');
|
8
8
|
const Toast = require('./Toast-d84d7bd3.js');
|
9
9
|
const errors = require('./errors-017fb835.js');
|
10
|
-
const Datastore = require('./Datastore-
|
10
|
+
const Datastore = require('./Datastore-931fd77e.js');
|
11
11
|
require('./_commonjsHelpers-e6ff1d6e.js');
|
12
12
|
require('./Types-7a726ff3.js');
|
13
13
|
require('./format-dc0f3757.js');
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-ccac8641.js');
|
6
6
|
const jsSdk = require('@verdocs/js-sdk');
|
7
7
|
const utils = require('./utils-746daf30.js');
|
8
|
-
const Datastore = require('./Datastore-
|
8
|
+
const Datastore = require('./Datastore-931fd77e.js');
|
9
9
|
const popper = require('./popper-31badbf8.js');
|
10
10
|
require('./_commonjsHelpers-e6ff1d6e.js');
|
11
11
|
require('./Types-7a726ff3.js');
|
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css
CHANGED
@@ -22,7 +22,6 @@ verdocs-template-roles .roles {
|
|
22
22
|
}
|
23
23
|
verdocs-template-roles .roles .sequence {
|
24
24
|
gap: 10px;
|
25
|
-
height: 34px;
|
26
25
|
display: flex;
|
27
26
|
flex-wrap: wrap;
|
28
27
|
font-weight: 500;
|
@@ -43,7 +42,6 @@ verdocs-template-roles .roles .sequence-roles {
|
|
43
42
|
display: flex;
|
44
43
|
position: relative;
|
45
44
|
flex-wrap: wrap;
|
46
|
-
font-weight: 500;
|
47
45
|
flex-direction: row;
|
48
46
|
}
|
49
47
|
verdocs-template-roles .roles .role {
|
@@ -124,21 +122,17 @@ verdocs-template-roles .row.add-sequence {
|
|
124
122
|
display: none;
|
125
123
|
}
|
126
124
|
verdocs-template-roles .add-role {
|
127
|
-
margin: 0;
|
128
|
-
padding: 0;
|
129
|
-
border: none;
|
130
125
|
opacity: 0.3;
|
126
|
+
padding: 0 10px;
|
131
127
|
cursor: pointer;
|
132
128
|
background: none;
|
133
|
-
|
129
|
+
height: 32px;
|
130
|
+
border: 1px solid #cccccc;
|
131
|
+
border-radius: 32px;
|
134
132
|
}
|
135
133
|
verdocs-template-roles .add-role:hover {
|
136
134
|
opacity: 1;
|
137
135
|
}
|
138
|
-
verdocs-template-roles .add-role svg {
|
139
|
-
width: 32px;
|
140
|
-
height: 32px;
|
141
|
-
}
|
142
136
|
verdocs-template-roles .add-step {
|
143
137
|
margin: 0;
|
144
138
|
padding: 0;
|
@@ -177,6 +171,7 @@ verdocs-template-roles .empty svg {
|
|
177
171
|
}
|
178
172
|
verdocs-template-roles .sequence-roles {
|
179
173
|
display: flex;
|
174
|
+
max-width: 400px;
|
180
175
|
}
|
181
176
|
verdocs-template-roles ::placeholder {
|
182
177
|
color: #aaaaaa;
|
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js
CHANGED
@@ -14,6 +14,7 @@ const iconCC = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><
|
|
14
14
|
export class VerdocsTemplateRoles {
|
15
15
|
constructor() {
|
16
16
|
this.templateListenerId = null;
|
17
|
+
this.sortableRefs = [];
|
17
18
|
this.endpoint = VerdocsEndpoint.getDefault();
|
18
19
|
this.templateId = '';
|
19
20
|
this.showingRoleDialog = null;
|
@@ -24,6 +25,7 @@ export class VerdocsTemplateRoles {
|
|
24
25
|
}
|
25
26
|
disconnectedCallback() {
|
26
27
|
this.unlistenToTemplate();
|
28
|
+
this.cleanupSortables();
|
27
29
|
}
|
28
30
|
async listenToTemplate() {
|
29
31
|
console.log('[ROLES] Loading template', this.templateId);
|
@@ -43,7 +45,6 @@ export class VerdocsTemplateRoles {
|
|
43
45
|
async componentWillLoad() {
|
44
46
|
var _a, _b, _c;
|
45
47
|
try {
|
46
|
-
VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');
|
47
48
|
this.endpoint.loadSession();
|
48
49
|
if (!this.templateId) {
|
49
50
|
console.log(`[ROLES] Missing required template ID ${this.templateId}`);
|
@@ -60,13 +61,18 @@ export class VerdocsTemplateRoles {
|
|
60
61
|
(_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));
|
61
62
|
}
|
62
63
|
}
|
64
|
+
cleanupSortables() {
|
65
|
+
this.sortableRefs.forEach(sr => sr.destroy());
|
66
|
+
this.sortableRefs.length = 0;
|
67
|
+
}
|
63
68
|
componentDidRender() {
|
69
|
+
this.cleanupSortables();
|
64
70
|
// Existing sequence numbers
|
65
71
|
const sequenceNumbers = this.getSequenceNumbers();
|
66
72
|
(sequenceNumbers || []).forEach(sequence => {
|
67
73
|
const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);
|
68
74
|
if (el) {
|
69
|
-
new Sortable(el, {
|
75
|
+
const sortable = new Sortable(el, {
|
70
76
|
group: 'roles',
|
71
77
|
animation: 150,
|
72
78
|
dragoverBubble: true,
|
@@ -75,11 +81,13 @@ export class VerdocsTemplateRoles {
|
|
75
81
|
onChoose: () => (this.dragging = true),
|
76
82
|
onUnchoose: () => (this.dragging = false),
|
77
83
|
});
|
84
|
+
this.sortableRefs.push(sortable);
|
78
85
|
}
|
79
86
|
});
|
80
87
|
const el = document.getElementById(`verdocs-roles-sequence-add-target`);
|
81
88
|
if (el) {
|
82
|
-
|
89
|
+
console.log('[ROLES] Applying sortable to add-sequence slot');
|
90
|
+
const sortable = new Sortable(el, {
|
83
91
|
group: 'roles',
|
84
92
|
animation: 150,
|
85
93
|
dragoverBubble: true,
|
@@ -88,6 +96,7 @@ export class VerdocsTemplateRoles {
|
|
88
96
|
onChoose: () => (this.dragging = true),
|
89
97
|
onUnchoose: () => (this.dragging = false),
|
90
98
|
});
|
99
|
+
this.sortableRefs.push(sortable);
|
91
100
|
}
|
92
101
|
}
|
93
102
|
handleMoveEnd(evt) {
|
@@ -124,15 +133,9 @@ export class VerdocsTemplateRoles {
|
|
124
133
|
}
|
125
134
|
});
|
126
135
|
});
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
return Promise.all(renumberRequests).then(async () => {
|
131
|
-
const newTemplate = JSON.parse(JSON.stringify(this.template));
|
132
|
-
newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);
|
133
|
-
await Store.getTemplate(this.endpoint, this.templateId, true);
|
134
|
-
// Store.updateTemplate(this.templateId, newTemplate);
|
135
|
-
});
|
136
|
+
return Promise.all(renumberRequests)
|
137
|
+
.then(async () => console.log('[ROLES] Done renumbering'))
|
138
|
+
.catch(e => console.log('[ROLES] Error updating roles', e));
|
136
139
|
}
|
137
140
|
handleCancel() {
|
138
141
|
var _a;
|
@@ -273,7 +276,7 @@ export class VerdocsTemplateRoles {
|
|
273
276
|
return (h(Host, { class: { dragging: this.dragging } }, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "roles" }, sequences.map((sequence, index) => (h("div", { class: "sequence" }, h("div", { class: "sequence-label no-drag" }, index + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
|
274
277
|
const unknown = !role.email || !role.first_name || !role.last_name;
|
275
278
|
return unknown ? (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, role.name), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("div", { class: "role-name" }, formatFullName(role)), h("div", { class: "icons" }, h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
|
276
|
-
})), h("button", { class: "add-role no-drag",
|
279
|
+
})), h("button", { class: "add-role no-drag", onClick: e => this.handleAddRole(e, sequence) }, "+ Add Role")))), h("div", { class: "sequence add-sequence" }, h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-add-target`, "data-sequence": nextSequence }), h("button", { class: "add-role no-drag", onClick: e => this.handleAddRole(e, nextSequence) }, "+ Add Role"))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
277
280
|
var _a;
|
278
281
|
(_a = document.getElementById('verdocs-menu-panel-overlay')) === null || _a === void 0 ? void 0 : _a.remove();
|
279
282
|
this.showingRoleDialog = null;
|
package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs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AU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" fill=\"#00000089\"><path d=\"m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z\"/></svg>';\n\nconst plusIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"#ffffff\" viewBox=\"0 0 24 24\" strokeWidth={1.5} stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z\" /></svg>`;\n\nconst iconSigner =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z\"/></svg>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path fill-rule=\"evenodd\" d=\"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z\" clip-rule=\"evenodd\" /></svg>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z\" /><path d=\"M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z\" /></svg>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n VerdocsEndpoint.getDefault().setBaseURL('https://api.verdocs.com');\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[ROLES] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n componentDidRender() {\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-add-target`);\n if (el) {\n new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.dataset.sequence;\n const toSeq = +evt.to.dataset.sequence;\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<string, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n const ras = this.getRolesAtSequence(sequence);\n\n sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq] ||= [];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);\n return Promise.all(renumberRequests).then(async () => {\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n });\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map((sequence, index) => (\n <div class=\"sequence\">\n <div class=\"sequence-label no-drag\">{index + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div\n class=\"role\"\n // style={{borderColor: getRGBA(getRoleIndex(this.template, role.name))}}\n data-rolename={role.name}\n data-sequence={sequence}\n data-order={role.order}\n >\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, sequence)} />\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-add-target`} data-sequence={nextSequence} />\n\n <button class=\"add-role no-drag\" innerHTML={plusIcon} onClick={e => this.handleAddRole(e, nextSequence)} />\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"verdocs-template-roles.js","sourceRoot":"","sources":["../../../../src/components/templates/verdocs-template-roles/verdocs-template-roles.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAoB,kBAAkB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACvI,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,YAAY,GAChB,myCAAmyC,CAAC;AAEtyC,MAAM,QAAQ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AE,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,GAAI,CAC1G,CACD;YAEN,IAAI,CAAC,iBAAiB,IAAI,CACzB,0BAAoB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAChE,wCACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,OAAO,EAAE,GAAG,EAAE;;wBACZ,MAAA,QAAQ,CAAC,cAAc,CAAC,4BAA4B,CAAC,0CAAE,MAAM,EAAE,CAAC;wBAChE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;oBAChC,CAAC,EACD,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;wBAC9B,+EAA+E;wBAC/E,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;wBACnC,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAAC,CAAC,CAAC;oBAClI,CAAC,GACD,CACiB,CACtB,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Sortable from 'sortablejs';\nimport {Component, h, Element, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {createTemplateRole, formatFullName, getTemplate, IRole, ITemplate, updateTemplateRole, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\" fill=\"#00000089\"><path d=\"m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z\"/></svg>';\n\nconst plusIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"#ffffff\" viewBox=\"0 0 24 24\" strokeWidth={1.5} stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z\" /></svg>`;\n\nconst iconSigner =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z\"/></svg>';\n\nconst iconApprover = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path fill-rule=\"evenodd\" d=\"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z\" clip-rule=\"evenodd\" /></svg>`;\n\nconst iconCC = `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" width=\"24\"><path d=\"M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z\" /><path d=\"M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z\" /></svg>`;\n\n/**\n * Display an edit form that allows the user to adjust a template's roles and workflow.\n */\n@Component({\n tag: 'verdocs-template-roles',\n styleUrl: 'verdocs-template-roles.scss',\n shadow: false,\n})\nexport class VerdocsTemplateRoles {\n private templateListenerId = null;\n\n @Element()\n el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The template ID to edit.\n */\n @Prop() templateId: string = '';\n\n /**\n * Event fired when the user clicks to proceed.\n */\n @Event({composed: true}) next: EventEmitter;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() showingRoleDialog: string | null = null;\n @State() sender = null;\n\n @State() dragging = false;\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n this.cleanupSortables();\n }\n\n async listenToTemplate() {\n console.log('[ROLES] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n console.log('[ROLES] Template Updated', template);\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.templateId) {\n console.log(`[ROLES] Missing required template ID ${this.templateId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[ROLES] Unable to start builder session, must be authenticated');\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[ROLES] Error with preview session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n sortableRefs: Sortable[] = [];\n\n cleanupSortables() {\n this.sortableRefs.forEach(sr => sr.destroy());\n this.sortableRefs.length = 0;\n }\n\n componentDidRender() {\n this.cleanupSortables();\n\n // Existing sequence numbers\n const sequenceNumbers = this.getSequenceNumbers();\n (sequenceNumbers || []).forEach(sequence => {\n const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);\n if (el) {\n const sortable = new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n this.sortableRefs.push(sortable);\n }\n });\n\n const el = document.getElementById(`verdocs-roles-sequence-add-target`);\n if (el) {\n console.log('[ROLES] Applying sortable to add-sequence slot');\n const sortable = new Sortable(el, {\n group: 'roles',\n animation: 150,\n dragoverBubble: true,\n filter: '.no-drag',\n onEnd: this.handleMoveEnd.bind(this),\n onChoose: () => (this.dragging = true),\n onUnchoose: () => (this.dragging = false),\n });\n this.sortableRefs.push(sortable);\n }\n }\n\n handleMoveEnd(evt) {\n const fromSeq = +evt.from.dataset.sequence;\n const toSeq = +evt.to.dataset.sequence;\n const fromIndex = +evt.oldIndex + 1;\n const toIndex = +evt.newIndex + 1;\n\n console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);\n\n const sortableRoles: Record<string, IRole[]> = {};\n const sequenceNumbers = this.getSequenceNumbers();\n sequenceNumbers.forEach(sequence => {\n const ras = this.getRolesAtSequence(sequence);\n\n sortableRoles[String(sequence)] = JSON.parse(JSON.stringify(ras));\n });\n\n // We might be adding a new sequence number now. Make sure we have an array to drop\n // the record into.\n sortableRoles[sequenceNumbers[sequenceNumbers.length - 1] + 1] = [];\n\n const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];\n sortableRoles[toSeq] ||= [];\n sortableRoles[toSeq].splice(toIndex - 1, 0, role);\n\n const renumberRequests = [];\n Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {\n roles.forEach((role, index) => {\n if (!role) {\n return;\n }\n\n const targetOrder = +index + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n return Promise.all(renumberRequests)\n .then(async () => console.log('[ROLES] Done renumbering'))\n .catch(e => console.log('[ROLES] Error updating roles', e));\n }\n\n handleCancel() {\n this.exit?.emit();\n }\n\n handleSubmit() {\n this.next?.emit();\n }\n\n getSortedRoles() {\n // NOTE: This mutates the source array but that's OK because everything that touches\n // it will want the same thing done.\n return (this.template?.roles || []).sort((a, b) => {\n return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;\n });\n }\n\n getSequenceNumbers() {\n const sequenceNumbers = (this.template?.roles || []).map(role => role.sequence);\n const deduped = [...new Set(sequenceNumbers)];\n deduped.sort((a, b) => a - b);\n return deduped;\n }\n\n getRoleNames() {\n const roles = this.getSortedRoles();\n return roles.map(role => role.name);\n }\n\n getRolesAtSequence(sequence: number) {\n // Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.\n // See https://github.com/ionic-team/stencil-store/issues/23\n return (this.template?.roles || []).filter(role => role && role.sequence === sequence);\n }\n\n // When the user drags a role around, we handle placement \"between\" items by assigning it a half-order number\n // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.\n // Then we re-sort the list of roles and renumber them.\n async renumberTemplateRoles() {\n const sortableRoles: Record<string, IRole[]> = {};\n const renumberRequests = [];\n const sequenceNumbers = this.getSequenceNumbers();\n\n (sequenceNumbers || []).forEach(targetSeq => {\n (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {\n const targetOrder = +targetOrderMinusOne + 1;\n if (role.sequence !== +targetSeq || role.order !== targetOrder) {\n console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);\n role.sequence = +targetSeq;\n role.order = targetOrder;\n renumberRequests.push(\n updateTemplateRole(this.endpoint, this.templateId, role.name, {sequence: +targetSeq, order: targetOrder})\n .then(r => console.log('[ROLES] Updated role', role.name, r))\n .catch(e => console.log('[ROLES] Error updating role', e)),\n );\n }\n });\n });\n\n console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);\n await Promise.all(renumberRequests).then(async () => {\n // When renumbering, we don't try to update the store for every individual item\n // changing. We just do it once at the end.\n const newTemplate = JSON.parse(JSON.stringify(this.template));\n newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);\n console.log(\n '[ROLES] Done renumbering',\n newTemplate.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n Store.updateTemplate(this.templateId, newTemplate);\n // TODO: Explore race condition in reordering roles\n // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);\n });\n\n this.rolesUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }\n\n // Look for name conflicts, because they're UGC and can be anything, regardless of order.\n getNextRoleName() {\n let name = '';\n let nextNumber = (this.template?.roles || []).length;\n do {\n nextNumber++;\n name = `Recipient ${nextNumber}`;\n } while (!name || (this.template?.roles || []).some(role => role && role.name === name));\n\n return name;\n }\n\n callCreateRole(name: string, sequence: number, order: number) {\n console.log('[ROLES] Will create role', {name, sequence, order});\n createTemplateRole(this.endpoint, this.templateId, {\n template_id: this.templateId,\n name,\n sequence,\n message: '',\n order,\n full_name: null,\n first_name: '',\n last_name: '',\n email: '',\n phone: '',\n type: 'signer',\n delegator: false,\n kba_method: null,\n })\n .then(async role => {\n console.log('[ROLES] Created role', role);\n // const newTemplate = JSON.parse(JSON.stringify(this.template));\n // newTemplate.roles.push(role);\n // TODO: Verify this immediately triggers a self-update\n console.log('Updating template in data store');\n await Store.getTemplate(this.endpoint, this.templateId, true);\n // Store.updateTemplate(this.templateId, newTemplate);\n // This will re-sort the roles and renumbers them via server calls if necessary\n // await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n })\n .catch(e => {\n console.log('[ROLES] Error creating role', e);\n });\n }\n\n handleAddRole(e: any, sequence: number) {\n e.stopPropagation();\n const order = this.getRolesAtSequence(sequence).length + 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n handleAddStep(e: any, sequence: number) {\n e.stopPropagation();\n\n const order = 1;\n const name = this.getNextRoleName();\n this.callCreateRole(name, sequence, order);\n }\n\n render() {\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n if (this.loading || !this.template) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n console.log(\n '[ROLES] Rendering',\n this.template.roles.map(r => ({name: r.name, sequence: r.sequence, order: r.order})),\n );\n\n const roleNames = this.getRoleNames();\n const sequences = this.getSequenceNumbers();\n const nextSequence = sequences && sequences.length > 0 ? (sequences[sequences.length - 1] || 0) + 1 : 1;\n\n // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}\n return (\n <Host class={{dragging: this.dragging}}>\n <form onSubmit={e => e.preventDefault()} onClick={e => e.stopPropagation()} autocomplete=\"off\">\n <h5>Roles and Workflow</h5>\n\n <div class=\"roles\">\n {sequences.map((sequence, index) => (\n <div class=\"sequence\">\n <div class=\"sequence-label no-drag\">{index + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-${sequence}`} data-sequence={sequence}>\n {this.getRolesAtSequence(sequence).map(role => {\n const unknown = !role.email || !role.first_name || !role.last_name;\n return unknown ? (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{role.name}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n ) : (\n <div class=\"role\" data-rolename={role.name} data-sequence={sequence} data-order={role.order}>\n <div class=\"role-name\">{formatFullName(role)}</div>\n <div class=\"icons\">\n <div class=\"gear-button\" innerHTML={settingsIcon} onClick={() => (this.showingRoleDialog = role.name)} aria-role=\"button\" />\n <span class=\"type-icon\" innerHTML={role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover} />\n </div>\n </div>\n );\n })}\n </div>\n\n <button class=\"add-role no-drag\" onClick={e => this.handleAddRole(e, sequence)}>\n + Add Role\n </button>\n </div>\n ))}\n\n <div class=\"sequence add-sequence\">\n <div class=\"sequence-label no-drag\">{sequences.length + 1}.</div>\n\n <div class=\"sequence-roles\" id={`verdocs-roles-sequence-add-target`} data-sequence={nextSequence} />\n\n <button class=\"add-role no-drag\" onClick={e => this.handleAddRole(e, nextSequence)}>\n + Add Role\n </button>\n </div>\n </div>\n\n {roleNames.length < 1 && (\n <div class=\"empty\">\n You must add at least one Role before proceeding.\n <br /> Click the <span innerHTML={plusIcon} /> Add button above to get started.\n </div>\n )}\n\n <div class=\"buttons\">\n <div class=\"flex-fill\" />\n\n <verdocs-button variant=\"outline\" label=\"Cancel\" size=\"small\" onClick={() => this.handleCancel()} />\n <verdocs-button label=\"OK\" size=\"small\" onClick={() => this.handleSubmit()} disabled={roleNames.length < 1} />\n </div>\n </form>\n\n {this.showingRoleDialog && (\n <verdocs-menu-panel onClose={() => (this.showingRoleDialog = null)}>\n <verdocs-template-role-properties\n endpoint={this.endpoint}\n templateId={this.templateId}\n roleName={this.showingRoleDialog}\n onClose={() => {\n document.getElementById('verdocs-menu-panel-overlay')?.remove();\n this.showingRoleDialog = null;\n }}\n onDelete={async () => {\n this.showingRoleDialog = null;\n // This will re-sort the roles and renumbers them via server calls if necessary\n await this.renumberTemplateRoles();\n this.rolesUpdated?.emit({event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles()});\n }}\n />\n </verdocs-menu-panel>\n )}\n </Host>\n );\n }\n}\n"]}
|
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment, d as Ho
|
|
2
2
|
import { i as interact } from './p-a901dff2.js';
|
3
3
|
import { VerdocsEndpoint, updateField, getRGBA } from '@verdocs/js-sdk';
|
4
4
|
import { S as SettingsIcon } from './p-b0766439.js';
|
5
|
-
import { S as Store } from './p-
|
5
|
+
import { S as Store } from './p-3828cb31.js';
|
6
6
|
import { d as defineCustomElement$9 } from './p-0e332769.js';
|
7
7
|
import { d as defineCustomElement$8 } from './p-3201d529.js';
|
8
8
|
import { d as defineCustomElement$7 } from './p-84ae0283.js';
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$6 } from './p-7f32e087.js';
|
|
10
10
|
import { d as defineCustomElement$5 } from './p-1ae5d7e0.js';
|
11
11
|
import { d as defineCustomElement$4 } from './p-6719b0d7.js';
|
12
12
|
import { d as defineCustomElement$3 } from './p-62743fd3.js';
|
13
|
-
import { d as defineCustomElement$2 } from './p-
|
13
|
+
import { d as defineCustomElement$2 } from './p-eb12a71c.js';
|
14
14
|
import { d as defineCustomElement$1 } from './p-325b3828.js';
|
15
15
|
|
16
16
|
const verdocsFieldTextareaCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-field-textarea{width:150px;height:15px;display:block;font-size:11px;position:relative;scroll-margin:20px 0;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-textarea textarea{cursor:inherit;width:100%;height:100%;resize:none;border:none;outline:none;padding:0 3px;font-size:11px;background:none;font-weight:500;-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-textarea textarea.hide{display:none}verdocs-field-textarea.disabled textarea{opacity:0.5}verdocs-field-textarea label{top:-14px;left:-1px;height:14px;color:white;padding:0 4px;font-size:9px;line-height:13px;position:absolute;background:#4a4a99;border-top-left-radius:2px;border-top-right-radius:2px}verdocs-field-textarea.required{border:1px solid rgb(204, 0, 0)}verdocs-field-textarea.focused{-webkit-animation:verdocs-field-pulse 0.4s 1;animation:verdocs-field-pulse 0.4s 1}verdocs-field-textarea 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-textarea verdocs-button-panel[data-active],verdocs-field-textarea verdocs-button-panel:hover{opacity:1}verdocs-field-textarea verdocs-button-panel .icon svg{fill:#333333}verdocs-field-textarea verdocs-button-panel .icon:hover svg{fill:#000000}verdocs-field-textarea .settings-icon{position:absolute;top:-3px;left:-20px;display:inline-block;cursor:pointer;opacity:0.3}verdocs-field-textarea .settings-icon svg{fill:#707ae5}verdocs-field-textarea .settings-icon:hover{opacity:1}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}";
|
@@ -204,4 +204,4 @@ function defineCustomElement() {
|
|
204
204
|
|
205
205
|
export { VerdocsFieldTextarea as V, defineCustomElement as d };
|
206
206
|
|
207
|
-
//# sourceMappingURL=p-
|
207
|
+
//# sourceMappingURL=p-1ab01232.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"p-d9a2e920.js","mappings":";;;;;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jC,EACD,QAAQ,EAAE,0DAA0D,GACpE,CACa,CAClB,CACQ,CACZ,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/fields/verdocs-field-textarea/verdocs-field-textarea.scss?tag=verdocs-field-textarea","src/components/fields/verdocs-field-textarea/verdocs-field-textarea.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-field-textarea {\n width: 150px;\n height: 15px;\n display: block;\n font-size: 11px;\n position: relative;\n scroll-margin: 20px 0;\n box-sizing: border-box;\n background-color: transparent;\n transform-origin: bottom left;\n font-family: $verdocs-primary-font;\n border: 1px solid rgba(0, 0, 0, 0.2);\n\n textarea {\n // This is needed to bring down the cursor from the parent element, which is where interactjs applies it\n cursor: inherit;\n\n width: 100%;\n height: 100%;\n resize: none;\n border: none;\n outline: none;\n padding: 0 3px;\n font-size: 11px;\n background: none;\n font-weight: 500;\n transform-origin: 0 0;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.87);\n\n &.hide {\n display: none;\n }\n }\n\n &.disabled textarea {\n opacity: 0.5;\n }\n\n label {\n top: -14px;\n left: -1px;\n height: 14px;\n color: white;\n padding: 0 4px;\n font-size: 9px;\n line-height: 13px;\n position: absolute;\n background: #4a4a99;\n border-top-left-radius: 2px;\n border-top-right-radius: 2px;\n }\n\n &.required {\n border: 1px solid rgb(204, 0, 0);\n }\n\n &.focused {\n animation: verdocs-field-pulse 0.4s 1;\n }\n\n verdocs-button-panel {\n top: -3px;\n left: -2px;\n opacity: 0.5;\n z-index: 1000;\n cursor: pointer;\n position: absolute;\n transform: scale(0.6);\n\n &[data-active],\n &:hover {\n opacity: 1;\n }\n\n .icon {\n svg {\n fill: #333333;\n }\n\n &:hover {\n svg {\n fill: #000000;\n }\n }\n }\n }\n\n .settings-icon {\n position: absolute;\n top: -3px;\n left: -20px;\n display: inline-block;\n cursor: pointer;\n opacity: 0.3;\n\n svg {\n fill: $border-color;\n }\n\n &:hover {\n opacity: 1;\n }\n }\n}\n\n@keyframes verdocs-field-pulse {\n 0% {\n background-color: rgba(0, 0, 0, 0.35);\n }\n 50% {\n background-color: rgba(0, 0, 0, 0);\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.35);\n }\n}\n","import interact from 'interactjs';\nimport {IEnvelopeField, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {ITemplateField, updateField, getRGBA} from '@verdocs/js-sdk';\nimport {Component, h, Host, Prop, Method, Event, EventEmitter, Element, Fragment, State} from '@stencil/core';\nimport {SettingsIcon} from '../../../utils/Icons';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Display a multi-line text input field. Reminder: the \"position\" of the field is specified\n * as the BOTTOM-LEFT corner.\n */\n@Component({\n tag: 'verdocs-field-textarea',\n styleUrl: 'verdocs-field-textarea.scss',\n shadow: false,\n})\nexport class VerdocsFieldTextarea {\n @Element() el: HTMLElement;\n private inputEl: HTMLTextAreaElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n * This component self-manages its resize (width) behavior when in edit-template mode, and uses\n * this endpoint to save changes.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Fields may be attached to templates or envelopes, but only template fields may be edited.\n */\n @Prop({reflect: true}) source: 'template' | 'envelope' = 'template';\n\n /**\n * The source template or envelope ID the field is found in.\n */\n @Prop({reflect: true}) sourceid: string = '';\n\n /**\n * The name of the field to display.\n */\n @Prop({reflect: true}) fieldname: string = '';\n\n /**\n * Override the field's settings. This is intended to be used during signing when fields are being\n * mutated.\n */\n @Prop() field: IEnvelopeField | null | undefined = null;\n\n /**\n * If set, overrides the field's settings object. Primarily used to support \"preview\" modes where all fields are disabled.\n */\n @Prop({reflect: true}) disabled?: boolean = false;\n\n /**\n * If set, a settings icon will be displayed on hover. The settings shown allow the field's recipient and other settings to be\n * changed, so it should typically only be enabled in the Builder.\n */\n @Prop({reflect: true}) editable?: boolean = false;\n\n /**\n * If set, the field may be dragged to a new location. This should only be enabled in the Builder, or for self-placed fields.\n */\n @Prop({reflect: true}) moveable?: boolean = false;\n\n /**\n * If set, the field is considered \"done\" and is drawn in a display-final-value state.\n */\n @Prop({reflect: true}) done?: boolean = false;\n\n /**\n * If set, the field will be be scaled horizontally by this factor.\n */\n @Prop({reflect: true}) xscale?: number = 1;\n\n /**\n * If set, the field will be be scaled vertically by this factor.\n */\n @Prop({reflect: true}) yscale?: number = 1;\n\n /**\n * The page the field is on\n */\n @Prop({reflect: true}) pagenumber?: number = 1;\n\n @Method()\n async focusField() {\n this.inputEl.focus();\n }\n\n /**\n * Event fired when the field's settings are changed.\n */\n @Event({composed: true}) settingsChanged: EventEmitter<{fieldName: string; field: ITemplateField}>;\n\n /**\n * Event fired when the field is deleted.\n */\n @Event({composed: true}) deleted: EventEmitter<{fieldName: string}>;\n\n @State() showingProperties?: boolean = false;\n\n @Method()\n async showSettingsPanel() {\n const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`) as any;\n if (settingsPanel && settingsPanel.showPanel) {\n settingsPanel.showPanel();\n }\n }\n\n @Method()\n async hideSettingsPanel() {\n const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`) as any;\n if (settingsPanel && settingsPanel.hidePanel) {\n settingsPanel.hidePanel();\n }\n }\n\n @State() focused?: boolean = false;\n\n componentDidRender() {\n interact.dynamicDrop(true);\n\n if (this.editable) {\n interact(this.el).resizable({\n edges: {top: true, bottom: true, left: true, right: true},\n listeners: {\n start: this.handleResizeStart.bind(this),\n move: this.handleResize.bind(this),\n end: this.handleResizeEnd.bind(this),\n },\n });\n }\n }\n\n handleResizeStart(e: any) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n handleResize(e: any) {\n let {x = 0, y = 0, h = 0} = e.target.dataset;\n let {width, height} = e.rect;\n\n x = (parseFloat(x) || 0) + e.deltaRect.left;\n y = (parseFloat(y) || 0) + e.deltaRect.top;\n h = (parseFloat(h) || 0) + e.deltaRect.height;\n\n Object.assign(e.target.style, {\n width: `${width}px`,\n height: `${height}px`,\n transform: `translate(${x}px, ${y + h}px)`,\n });\n\n Object.assign(e.target.dataset, {x, y, h});\n }\n\n handleResizeEnd(e: any) {\n const {source, sourceid, fieldname} = this;\n const {field} = Store.getField(source, sourceid, fieldname, this.field);\n if (!field) {\n return;\n }\n\n const [translateX, translateY] = e.target.style.transform.split('(')[1].split(')')[0].split(',').map(parseFloat);\n\n const width = Math.round(parseFloat(e.target.style.width) / this.xscale);\n const height = Math.round(parseFloat(e.target.style.height) / this.yscale);\n const x = Math.round(field.x + translateX / this.xscale);\n const y = Math.round(field.y - translateY / this.yscale);\n\n updateField(this.endpoint, this.sourceid, this.fieldname, {x, y, width, height})\n .then(field => {\n this.settingsChanged?.emit({fieldName: this.fieldname, field});\n Object.assign(e.target.dataset, {x: 0, y: 0, h: 0});\n })\n .catch(e => console.log('Field update failed', e));\n }\n\n render() {\n const {source, sourceid, fieldname, editable = false, done = false, disabled = false, focused, xscale = 1, yscale = 1} = this;\n\n const {index, field} = Store.getField(source, sourceid, fieldname, this.field);\n const {required = false, placeholder = '', value = '', label = ''} = field || {};\n const backgroundColor = getRGBA(index);\n\n if (done) {\n return <Host class={{done}}>{value}</Host>;\n }\n\n return (\n <Host class={{required, disabled, done, focused}} style={{backgroundColor}}>\n {label && <label>{label}</label>}\n\n <textarea\n name={fieldname}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n ref={el => (this.inputEl = el)}\n onFocus={() => (this.focused = true)}\n onBlur={() => (this.focused = false)}\n >\n {value}\n </textarea>\n\n {editable && (\n <Fragment>\n <div\n id={`verdocs-settings-panel-trigger-${fieldname}`}\n style={{transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})`}}\n class=\"settings-icon\"\n innerHTML={SettingsIcon}\n onClick={(e: any) => {\n e.stopPropagation();\n this.showingProperties = !this.showingProperties;\n }}\n />\n\n {this.showingProperties && (\n <verdocs-portal anchor={`verdocs-settings-panel-trigger-${fieldname}`} onClickAway={() => (this.showingProperties = false)}>\n <verdocs-template-field-properties\n templateId={sourceid}\n fieldName={fieldname}\n onClose={() => (this.showingProperties = false)}\n onDelete={() => {\n this.deleted?.emit({fieldName: fieldname});\n return this.hideSettingsPanel();\n }}\n onSettingsChanged={e => {\n this.settingsChanged?.emit(e.detail);\n return this.hideSettingsPanel();\n }}\n helpText={'Text areas may be used to create multi-line text fields.'}\n />\n </verdocs-portal>\n )}\n </Fragment>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"p-1ab01232.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,uBAAuB,GAAG,kwEAAkwE,CAAC;AACnyE,mCAAe,uBAAuB;;MCezB,oBAAoB;;;;;;wBASK,eAAe,CAAC,UAAU,EAAE;sBAKP,UAAU;wBAKzB,EAAE;yBAKD,EAAE;qBAMM,IAAI;wBAKX,KAAK;wBAML,KAAK;wBAKL,KAAK;oBAKT,KAAK;sBAKJ,CAAC;sBAKD,CAAC;0BAKG,CAAC;iCAiBP,KAAK;uBAkBf,KAAK;;IAhClC,MAAM,UAAU;QACd,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;KACtB;IAeD,MAAM,iBAAiB;QACrB,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,0BAA0B,IAAI,CAAC,SAAS,EAAE,CAAQ,CAAC;QACjG,IAAI,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE;YAC5C,aAAa,CAAC,SAAS,EAAE,CAAC;SAC3B;KACF;IAGD,MAAM,iBAAiB;QACrB,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,0BAA0B,IAAI,CAAC,SAAS,EAAE,CAAQ,CAAC;QACjG,IAAI,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE;YAC5C,aAAa,CAAC,SAAS,EA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AK,CAAC,IACxH,yCACE,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,EAC/C,QAAQ,EAAE;;gBACR,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAC,SAAS,EAAE,SAAS,EAAC,CAAC,CAAC;gBAC3C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;aACjC,EACD,iBAAiB,EAAE,CAAC;;gBAClB,MAAA,IAAI,CAAC,eAAe,0CAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;gBACrC,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;aACjC,EACD,QAAQ,EAAE,0DAA0D,GACpE,CACa,CAClB,CACQ,CACZ,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/fields/verdocs-field-textarea/verdocs-field-textarea.scss?tag=verdocs-field-textarea","src/components/fields/verdocs-field-textarea/verdocs-field-textarea.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-field-textarea {\n width: 150px;\n height: 15px;\n display: block;\n font-size: 11px;\n position: relative;\n scroll-margin: 20px 0;\n box-sizing: border-box;\n background-color: transparent;\n transform-origin: bottom left;\n font-family: $verdocs-primary-font;\n border: 1px solid rgba(0, 0, 0, 0.2);\n\n textarea {\n // This is needed to bring down the cursor from the parent element, which is where interactjs applies it\n cursor: inherit;\n\n width: 100%;\n height: 100%;\n resize: none;\n border: none;\n outline: none;\n padding: 0 3px;\n font-size: 11px;\n background: none;\n font-weight: 500;\n transform-origin: 0 0;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.87);\n\n &.hide {\n display: none;\n }\n }\n\n &.disabled textarea {\n opacity: 0.5;\n }\n\n label {\n top: -14px;\n left: -1px;\n height: 14px;\n color: white;\n padding: 0 4px;\n font-size: 9px;\n line-height: 13px;\n position: absolute;\n background: #4a4a99;\n border-top-left-radius: 2px;\n border-top-right-radius: 2px;\n }\n\n &.required {\n border: 1px solid rgb(204, 0, 0);\n }\n\n &.focused {\n animation: verdocs-field-pulse 0.4s 1;\n }\n\n verdocs-button-panel {\n top: -3px;\n left: -2px;\n opacity: 0.5;\n z-index: 1000;\n cursor: pointer;\n position: absolute;\n transform: scale(0.6);\n\n &[data-active],\n &:hover {\n opacity: 1;\n }\n\n .icon {\n svg {\n fill: #333333;\n }\n\n &:hover {\n svg {\n fill: #000000;\n }\n }\n }\n }\n\n .settings-icon {\n position: absolute;\n top: -3px;\n left: -20px;\n display: inline-block;\n cursor: pointer;\n opacity: 0.3;\n\n svg {\n fill: $border-color;\n }\n\n &:hover {\n opacity: 1;\n }\n }\n}\n\n@keyframes verdocs-field-pulse {\n 0% {\n background-color: rgba(0, 0, 0, 0.35);\n }\n 50% {\n background-color: rgba(0, 0, 0, 0);\n }\n 100% {\n background-color: rgba(0, 0, 0, 0.35);\n }\n}\n","import interact from 'interactjs';\nimport {IEnvelopeField, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {ITemplateField, updateField, getRGBA} from '@verdocs/js-sdk';\nimport {Component, h, Host, Prop, Method, Event, EventEmitter, Element, Fragment, State} from '@stencil/core';\nimport {SettingsIcon} from '../../../utils/Icons';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Display a multi-line text input field. Reminder: the \"position\" of the field is specified\n * as the BOTTOM-LEFT corner.\n */\n@Component({\n tag: 'verdocs-field-textarea',\n styleUrl: 'verdocs-field-textarea.scss',\n shadow: false,\n})\nexport class VerdocsFieldTextarea {\n @Element() el: HTMLElement;\n private inputEl: HTMLTextAreaElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n * This component self-manages its resize (width) behavior when in edit-template mode, and uses\n * this endpoint to save changes.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Fields may be attached to templates or envelopes, but only template fields may be edited.\n */\n @Prop({reflect: true}) source: 'template' | 'envelope' = 'template';\n\n /**\n * The source template or envelope ID the field is found in.\n */\n @Prop({reflect: true}) sourceid: string = '';\n\n /**\n * The name of the field to display.\n */\n @Prop({reflect: true}) fieldname: string = '';\n\n /**\n * Override the field's settings. This is intended to be used during signing when fields are being\n * mutated.\n */\n @Prop() field: IEnvelopeField | null | undefined = null;\n\n /**\n * If set, overrides the field's settings object. Primarily used to support \"preview\" modes where all fields are disabled.\n */\n @Prop({reflect: true}) disabled?: boolean = false;\n\n /**\n * If set, a settings icon will be displayed on hover. The settings shown allow the field's recipient and other settings to be\n * changed, so it should typically only be enabled in the Builder.\n */\n @Prop({reflect: true}) editable?: boolean = false;\n\n /**\n * If set, the field may be dragged to a new location. This should only be enabled in the Builder, or for self-placed fields.\n */\n @Prop({reflect: true}) moveable?: boolean = false;\n\n /**\n * If set, the field is considered \"done\" and is drawn in a display-final-value state.\n */\n @Prop({reflect: true}) done?: boolean = false;\n\n /**\n * If set, the field will be be scaled horizontally by this factor.\n */\n @Prop({reflect: true}) xscale?: number = 1;\n\n /**\n * If set, the field will be be scaled vertically by this factor.\n */\n @Prop({reflect: true}) yscale?: number = 1;\n\n /**\n * The page the field is on\n */\n @Prop({reflect: true}) pagenumber?: number = 1;\n\n @Method()\n async focusField() {\n this.inputEl.focus();\n }\n\n /**\n * Event fired when the field's settings are changed.\n */\n @Event({composed: true}) settingsChanged: EventEmitter<{fieldName: string; field: ITemplateField}>;\n\n /**\n * Event fired when the field is deleted.\n */\n @Event({composed: true}) deleted: EventEmitter<{fieldName: string}>;\n\n @State() showingProperties?: boolean = false;\n\n @Method()\n async showSettingsPanel() {\n const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`) as any;\n if (settingsPanel && settingsPanel.showPanel) {\n settingsPanel.showPanel();\n }\n }\n\n @Method()\n async hideSettingsPanel() {\n const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.fieldname}`) as any;\n if (settingsPanel && settingsPanel.hidePanel) {\n settingsPanel.hidePanel();\n }\n }\n\n @State() focused?: boolean = false;\n\n componentDidRender() {\n interact.dynamicDrop(true);\n\n if (this.editable) {\n interact(this.el).resizable({\n edges: {top: true, bottom: true, left: true, right: true},\n listeners: {\n start: this.handleResizeStart.bind(this),\n move: this.handleResize.bind(this),\n end: this.handleResizeEnd.bind(this),\n },\n });\n }\n }\n\n handleResizeStart(e: any) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n handleResize(e: any) {\n let {x = 0, y = 0, h = 0} = e.target.dataset;\n let {width, height} = e.rect;\n\n x = (parseFloat(x) || 0) + e.deltaRect.left;\n y = (parseFloat(y) || 0) + e.deltaRect.top;\n h = (parseFloat(h) || 0) + e.deltaRect.height;\n\n Object.assign(e.target.style, {\n width: `${width}px`,\n height: `${height}px`,\n transform: `translate(${x}px, ${y + h}px)`,\n });\n\n Object.assign(e.target.dataset, {x, y, h});\n }\n\n handleResizeEnd(e: any) {\n const {source, sourceid, fieldname} = this;\n const {field} = Store.getField(source, sourceid, fieldname, this.field);\n if (!field) {\n return;\n }\n\n const [translateX, translateY] = e.target.style.transform.split('(')[1].split(')')[0].split(',').map(parseFloat);\n\n const width = Math.round(parseFloat(e.target.style.width) / this.xscale);\n const height = Math.round(parseFloat(e.target.style.height) / this.yscale);\n const x = Math.round(field.x + translateX / this.xscale);\n const y = Math.round(field.y - translateY / this.yscale);\n\n updateField(this.endpoint, this.sourceid, this.fieldname, {x, y, width, height})\n .then(field => {\n this.settingsChanged?.emit({fieldName: this.fieldname, field});\n Object.assign(e.target.dataset, {x: 0, y: 0, h: 0});\n })\n .catch(e => console.log('Field update failed', e));\n }\n\n render() {\n const {source, sourceid, fieldname, editable = false, done = false, disabled = false, focused, xscale = 1, yscale = 1} = this;\n\n const {index, field} = Store.getField(source, sourceid, fieldname, this.field);\n const {required = false, placeholder = '', value = '', label = ''} = field || {};\n const backgroundColor = getRGBA(index);\n\n if (done) {\n return <Host class={{done}}>{value}</Host>;\n }\n\n return (\n <Host class={{required, disabled, done, focused}} style={{backgroundColor}}>\n {label && <label>{label}</label>}\n\n <textarea\n name={fieldname}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n ref={el => (this.inputEl = el)}\n onFocus={() => (this.focused = true)}\n onBlur={() => (this.focused = false)}\n >\n {value}\n </textarea>\n\n {editable && (\n <Fragment>\n <div\n id={`verdocs-settings-panel-trigger-${fieldname}`}\n style={{transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})`}}\n class=\"settings-icon\"\n innerHTML={SettingsIcon}\n onClick={(e: any) => {\n e.stopPropagation();\n this.showingProperties = !this.showingProperties;\n }}\n />\n\n {this.showingProperties && (\n <verdocs-portal anchor={`verdocs-settings-panel-trigger-${fieldname}`} onClickAway={() => (this.showingProperties = false)}>\n <verdocs-template-field-properties\n templateId={sourceid}\n fieldName={fieldname}\n onClose={() => (this.showingProperties = false)}\n onDelete={() => {\n this.deleted?.emit({fieldName: fieldname});\n return this.hideSettingsPanel();\n }}\n onSettingsChanged={e => {\n this.settingsChanged?.emit(e.detail);\n return this.hideSettingsPanel();\n }}\n helpText={'Text areas may be used to create multi-line text fields.'}\n />\n </verdocs-portal>\n )}\n </Fragment>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-
|
|
2
2
|
import { VerdocsEndpoint, getEnvelope, getInPersonLink, formatFullName } from '@verdocs/js-sdk';
|
3
3
|
import { V as VerdocsToast } from './p-04c07b7b.js';
|
4
4
|
import { S as SDKError } from './p-fd97809c.js';
|
5
|
-
import { S as Store } from './p-
|
5
|
+
import { S as Store } from './p-3828cb31.js';
|
6
6
|
import { d as defineCustomElement$1 } from './p-0e332769.js';
|
7
7
|
|
8
8
|
const verdocsEnvelopeRecipientLinkCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-envelope-recipient-link{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:100000;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:\"Inter\", \"Barlow\", sans-serif;background-color:rgba(0, 0, 0, 0.4980392157)}verdocs-envelope-recipient-link .summary-content{width:600px;display:-ms-flexbox;display:flex;max-width:90%;font-size:18px;-ms-flex:0 0 600px;flex:0 0 600px;border-radius:6px;background:#ffffff;-ms-flex-direction:column;flex-direction:column;padding:30px 20px 20px}verdocs-envelope-recipient-link .summary-content .summary-title{font-size:20px;font-weight:700;margin:0 0 10px 0;color:#33364b}verdocs-envelope-recipient-link .summary-recipient{display:-ms-flexbox;display:flex;color:#33364b;margin:8px 0 24px 0;-ms-flex-direction:column;flex-direction:column}verdocs-envelope-recipient-link .summary-recipient .role-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:14px;font-weight:600;margin:0 0 8px 0;color:#092c4c}verdocs-envelope-recipient-link .summary-recipient .role-info{gap:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end}verdocs-envelope-recipient-link .summary-recipient .role-full-name{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .summary-recipient .recipient-link{width:120px;padding:0 16px;font-weight:500;margin:0 0 0 8px;text-align:center;font-size:0.875rem;border-radius:100%;color:rgb(55, 65, 81);line-height:1.25rem;background-color:#d8d8d8;border:2px solid rgb(156, 163, 175)}verdocs-envelope-recipient-link .summary-recipient .link-wrapper{gap:5px;display:-ms-flexbox;display:flex;margin:4px 0 0 0;-ms-flex-direction:row;flex-direction:row}verdocs-envelope-recipient-link .summary-recipient .link-wrapper .link{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;overflow:hidden;margin:0 6px 0 0;border-radius:4px;white-space:nowrap;-ms-flex-align:center;align-items:center;text-overflow:ellipsis;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:10px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-envelope-recipient-link .buttons verdocs-button{-ms-flex:0 0 120px;flex:0 0 120px;margin-left:10px;white-space:nowrap}verdocs-envelope-recipient-link .buttons verdocs-button button{width:100%}";
|
@@ -137,4 +137,4 @@ function defineCustomElement() {
|
|
137
137
|
|
138
138
|
export { VerdocsEnvelopeRecipientLink as V, defineCustomElement as d };
|
139
139
|
|
140
|
-
//# sourceMappingURL=p-
|
140
|
+
//# sourceMappingURL=p-1ce18a42.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"p-efa3b8ac.js","mappings":";;;;;;;AAAA,MAAM,+BAA+B,GAAG,mhGAAmhG,CAAC;AAC5jG,2CAAe,+BAA+B;;MCajC,4BAA4B;;;;;;QAC/B,uBAAkB,GAAG,IAAI,CAAC;wBAKE,eAAe,CAAC,UAAU,EAAE;0BAKnC,EAAE;wBAKJ,EAAE;;2BAeN,IAAI;oBACX,EAAE;uBAEC,IAAI;wBACe,IAAI;yBACF,IAAI;;IAE5C,MAAM,iBAAiB;;QACrB,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAE5B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,OAAO,CAAC,GAAG,C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CACG,CACF,CACF,EAEN,WAAK,KAAK,EAAC,SAAS,IAClB,sBAAgB,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAI,CAC1E,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.scss?tag=verdocs-envelope-recipient-link","src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-envelope-recipient-link {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n z-index: 100000;\n position: fixed;\n align-items: center;\n justify-content: center;\n font-family: $primary-font;\n background-color: #0000007f;\n\n .summary-content {\n width: 600px;\n display: flex;\n max-width: 90%;\n font-size: 18px;\n flex: 0 0 600px;\n border-radius: 6px;\n background: #ffffff;\n flex-direction: column;\n padding: 30px 20px 20px;\n\n .summary-title {\n font-size: 20px;\n font-weight: 700;\n margin: 0 0 10px 0;\n color: $verdocs-dark-blue;\n }\n }\n\n .summary-recipient {\n display: flex;\n color: $verdocs-grey-1;\n margin: 8px 0 24px 0;\n flex-direction: column;\n\n .role-name {\n flex: 1;\n display: flex;\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: $verdocs-grey-0;\n }\n\n .role-details {\n }\n\n .role-info {\n gap: 5px;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n }\n\n .role-full-name {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n border-radius: 4px;\n align-items: center;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n\n .recipient-link {\n width: 120px;\n padding: 0 16px;\n font-weight: 500;\n margin: 0 0 0 8px;\n text-align: center;\n font-size: 0.875rem;\n border-radius: 100%;\n color: rgb(55, 65, 81);\n line-height: 1.25rem;\n background-color: #d8d8d8;\n border: 2px solid rgb(156, 163, 175);\n }\n\n .link-wrapper {\n gap: 5px;\n display: flex;\n margin: 4px 0 0 0;\n flex-direction: row;\n\n .link {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n overflow: hidden;\n margin: 0 6px 0 0;\n border-radius: 4px;\n white-space: nowrap;\n align-items: center;\n text-overflow: ellipsis;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n }\n }\n\n .buttons {\n display: flex;\n column-gap: 15px;\n margin: 10px 0 0 0;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n verdocs-button {\n flex: 0 0 120px;\n margin-left: 10px;\n white-space: nowrap;\n\n button {\n width: 100%;\n }\n }\n }\n}\n","import {Component, Prop, Host, h, State, Event, EventEmitter} from '@stencil/core';\nimport {formatFullName, getEnvelope, getInPersonLink, IEnvelope, IRecipient, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Displays a single recipient from an envelope, with the opportunity to copy an in-person\n * signing link for that recipient to use.\n */\n@Component({\n tag: 'verdocs-envelope-recipient-link',\n styleUrl: 'verdocs-envelope-recipient-link.scss',\n})\nexport class VerdocsEnvelopeRecipientLink {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to edit.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * The role to load.\n */\n @Prop() roleName: string = '';\n\n /**\n * Event fired when the user clicks Done to proceed. It is up to the host application\n * to redirect the user to the appropriate next workflow step.\n */\n @Event({composed: true}) next: EventEmitter<{envelope: IEnvelope}>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() isOpen: boolean;\n @State() gettingLink = true;\n @State() link = '';\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n @State() recipient: IRecipient | null = null;\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.envelopeId) {\n console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[RECIPIENT_LINK] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[SIDEBAR] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n\n this.recipient = (this.envelope?.recipients || []).find(r => r.role_name === this.roleName);\n this.getLink(this.recipient);\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handleDone(e: any) {\n e.preventDefault();\n this.next?.emit({envelope: this.envelope});\n }\n\n copyLink(link: string) {\n navigator.clipboard\n .writeText(link)\n .then(() => VerdocsToast('Link copied to clipboard!', {style: 'success', duration: 3000}))\n .catch(e => {\n console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);\n VerdocsToast(`Unable to copy to clipboard: ${e.message}`, {style: 'error'});\n });\n }\n\n getLink(recipient: IRecipient) {\n this.gettingLink = true;\n getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)\n .then(response => {\n this.gettingLink = false;\n this.link = response.link;\n // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now\n // error on that because we aren't the focus/gesture-initiator since we're a new component just being\n // drawn in the DOM. So we let the user click to trigger that.\n // this.copyLink(response.link);\n })\n .catch(e => {\n this.gettingLink = false;\n console.log('[RECIPIENT_LINK] Error getting link', e);\n VerdocsToast('Unable to get link: ' + e.message, {style: 'error'});\n });\n }\n\n render() {\n if (this.loading || !this.recipient) {\n return <Host />;\n }\n\n // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =\n // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (\n\n const fullName = formatFullName(this.recipient);\n return (\n <Host>\n <div class=\"summary-content\">\n <h1 class=\"summary-title\">In-Person Signing Link</h1>\n <div class=\"summary-rows\">\n <div class=\"summary-recipient\">\n <div class=\"role-name\">{this.recipient.role_name}</div>\n <div class=\"role-details\">\n <div class=\"role-info\">\n <div class=\"role-full-name\">\n {fullName} ({this.recipient.email || this.recipient.phone})\n </div>\n {!this.link && (\n <verdocs-button\n size=\"small\"\n variant=\"outline\"\n label={this.gettingLink ? 'Loading...' : 'Get Link'}\n disabled={this.gettingLink}\n onClick={() => this.getLink(this.recipient)}\n />\n )}\n </div>\n\n {this.link && (\n <div class=\"link-wrapper\">\n <div class=\"link\">{this.link}</div>\n <verdocs-button size=\"small\" variant=\"outline\" label=\"Copy\" onClick={() => this.copyLink(this.link)} />\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Done\" onClick={e => this.handleDone(e)} />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"p-1ce18a42.js","mappings":";;;;;;;AAAA,MAAM,+BAA+B,GAAG,mhGAAmhG,CAAC;AAC5jG,2CAAe,+BAA+B;;MCajC,4BAA4B;;;;;;QAC/B,uBAAkB,GAAG,IAAI,CAAC;wBAKE,eAAe,CAAC,UAAU,EAAE;0BAKnC,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,cAAc,IACvB,WAAK,KAAK,EAAC,MAAM,IAAE,IAAI,CAAC,IAAI,CAAO,EACnC,sBAAgB,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAI,CACnG,CACP,CACG,CACF,CACF,EAEN,WAAK,KAAK,EAAC,SAAS,IAClB,sBAAgB,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAI,CAC1E,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.scss?tag=verdocs-envelope-recipient-link","src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-envelope-recipient-link {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n z-index: 100000;\n position: fixed;\n align-items: center;\n justify-content: center;\n font-family: $primary-font;\n background-color: #0000007f;\n\n .summary-content {\n width: 600px;\n display: flex;\n max-width: 90%;\n font-size: 18px;\n flex: 0 0 600px;\n border-radius: 6px;\n background: #ffffff;\n flex-direction: column;\n padding: 30px 20px 20px;\n\n .summary-title {\n font-size: 20px;\n font-weight: 700;\n margin: 0 0 10px 0;\n color: $verdocs-dark-blue;\n }\n }\n\n .summary-recipient {\n display: flex;\n color: $verdocs-grey-1;\n margin: 8px 0 24px 0;\n flex-direction: column;\n\n .role-name {\n flex: 1;\n display: flex;\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: $verdocs-grey-0;\n }\n\n .role-details {\n }\n\n .role-info {\n gap: 5px;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n }\n\n .role-full-name {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n border-radius: 4px;\n align-items: center;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n\n .recipient-link {\n width: 120px;\n padding: 0 16px;\n font-weight: 500;\n margin: 0 0 0 8px;\n text-align: center;\n font-size: 0.875rem;\n border-radius: 100%;\n color: rgb(55, 65, 81);\n line-height: 1.25rem;\n background-color: #d8d8d8;\n border: 2px solid rgb(156, 163, 175);\n }\n\n .link-wrapper {\n gap: 5px;\n display: flex;\n margin: 4px 0 0 0;\n flex-direction: row;\n\n .link {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n overflow: hidden;\n margin: 0 6px 0 0;\n border-radius: 4px;\n white-space: nowrap;\n align-items: center;\n text-overflow: ellipsis;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n }\n }\n\n .buttons {\n display: flex;\n column-gap: 15px;\n margin: 10px 0 0 0;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n verdocs-button {\n flex: 0 0 120px;\n margin-left: 10px;\n white-space: nowrap;\n\n button {\n width: 100%;\n }\n }\n }\n}\n","import {Component, Prop, Host, h, State, Event, EventEmitter} from '@stencil/core';\nimport {formatFullName, getEnvelope, getInPersonLink, IEnvelope, IRecipient, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Displays a single recipient from an envelope, with the opportunity to copy an in-person\n * signing link for that recipient to use.\n */\n@Component({\n tag: 'verdocs-envelope-recipient-link',\n styleUrl: 'verdocs-envelope-recipient-link.scss',\n})\nexport class VerdocsEnvelopeRecipientLink {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to edit.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * The role to load.\n */\n @Prop() roleName: string = '';\n\n /**\n * Event fired when the user clicks Done to proceed. It is up to the host application\n * to redirect the user to the appropriate next workflow step.\n */\n @Event({composed: true}) next: EventEmitter<{envelope: IEnvelope}>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() isOpen: boolean;\n @State() gettingLink = true;\n @State() link = '';\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n @State() recipient: IRecipient | null = null;\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.envelopeId) {\n console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[RECIPIENT_LINK] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[SIDEBAR] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n\n this.recipient = (this.envelope?.recipients || []).find(r => r.role_name === this.roleName);\n this.getLink(this.recipient);\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handleDone(e: any) {\n e.preventDefault();\n this.next?.emit({envelope: this.envelope});\n }\n\n copyLink(link: string) {\n navigator.clipboard\n .writeText(link)\n .then(() => VerdocsToast('Link copied to clipboard!', {style: 'success', duration: 3000}))\n .catch(e => {\n console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);\n VerdocsToast(`Unable to copy to clipboard: ${e.message}`, {style: 'error'});\n });\n }\n\n getLink(recipient: IRecipient) {\n this.gettingLink = true;\n getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)\n .then(response => {\n this.gettingLink = false;\n this.link = response.link;\n // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now\n // error on that because we aren't the focus/gesture-initiator since we're a new component just being\n // drawn in the DOM. So we let the user click to trigger that.\n // this.copyLink(response.link);\n })\n .catch(e => {\n this.gettingLink = false;\n console.log('[RECIPIENT_LINK] Error getting link', e);\n VerdocsToast('Unable to get link: ' + e.message, {style: 'error'});\n });\n }\n\n render() {\n if (this.loading || !this.recipient) {\n return <Host />;\n }\n\n // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =\n // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (\n\n const fullName = formatFullName(this.recipient);\n return (\n <Host>\n <div class=\"summary-content\">\n <h1 class=\"summary-title\">In-Person Signing Link</h1>\n <div class=\"summary-rows\">\n <div class=\"summary-recipient\">\n <div class=\"role-name\">{this.recipient.role_name}</div>\n <div class=\"role-details\">\n <div class=\"role-info\">\n <div class=\"role-full-name\">\n {fullName} ({this.recipient.email || this.recipient.phone})\n </div>\n {!this.link && (\n <verdocs-button\n size=\"small\"\n variant=\"outline\"\n label={this.gettingLink ? 'Loading...' : 'Get Link'}\n disabled={this.gettingLink}\n onClick={() => this.getLink(this.recipient)}\n />\n )}\n </div>\n\n {this.link && (\n <div class=\"link-wrapper\">\n <div class=\"link\">{this.link}</div>\n <verdocs-button size=\"small\" variant=\"outline\" label=\"Copy\" onClick={() => this.copyLink(this.link)} />\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Done\" onClick={e => this.handleDone(e)} />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, c as createEvent, h, d as Host, F as Fragme
|
|
2
2
|
import { VerdocsEndpoint, getEnvelope, getDocumentDownloadLink, cancelEnvelope, userCanCancelEnvelope, integerSequence } from '@verdocs/js-sdk';
|
3
3
|
import { s as saveEnvelopesAsZip } from './p-af5ecc92.js';
|
4
4
|
import { S as SDKError } from './p-fd97809c.js';
|
5
|
-
import { S as Store } from './p-
|
5
|
+
import { S as Store } from './p-3828cb31.js';
|
6
6
|
import { d as defineCustomElement$6 } from './p-0e332769.js';
|
7
7
|
import { d as defineCustomElement$5 } from './p-9fb98ea2.js';
|
8
8
|
import { d as defineCustomElement$4 } from './p-b99b485b.js';
|
@@ -262,4 +262,4 @@ function defineCustomElement() {
|
|
262
262
|
|
263
263
|
export { VerdocsView as V, defineCustomElement as d };
|
264
264
|
|
265
|
-
//# sourceMappingURL=p-
|
265
|
+
//# sourceMappingURL=p-1f0f5448.js.map
|