@hubsync/esign-web-sdk 6.5.1 → 6.5.3
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/index-CQ5bTnED.js +6 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.cjs.js.map +1 -0
- package/dist/cjs/{verdocs-adopt-signature-dialog_9.cjs.entry.js → verdocs-adopt-signature-dialog_8.cjs.entry.js} +97 -52
- package/dist/cjs/verdocs-download-dialog.verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.cjs.js.map +1 -0
- package/dist/cjs/{verdocs-envelope-document-page_3.cjs.entry.js → verdocs-download-dialog_4.cjs.entry.js} +30 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -0
- package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +1 -0
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.css +62 -33
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +98 -22
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js.map +1 -1
- package/dist/components/{p-CFZQhAqt.js → p-4olD14NA.js} +113 -43
- package/dist/components/p-4olD14NA.js.map +1 -0
- package/dist/components/verdocs-sign.js +2 -1
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/index-BIRwgFLv.js +6 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +1 -0
- package/dist/esm/{verdocs-adopt-signature-dialog_9.entry.js → verdocs-adopt-signature-dialog_8.entry.js} +98 -52
- package/dist/esm/verdocs-download-dialog.verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.js.map +1 -0
- package/dist/esm/{verdocs-envelope-document-page_3.entry.js → verdocs-download-dialog_4.entry.js} +30 -2
- package/dist/esm/verdocs-sign.entry.js +1 -0
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/index-BIRwgFLv.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js +2 -0
- package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-download-dialog.verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js +2 -0
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +6 -0
- package/dist/verdocs-web-sdk/p-1b63fe0b.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-1b63fe0b.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-9d130fa2.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-9d130fa2.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/p-CRNRCDCr.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DHIUuwfR.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DixucIng.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-00a82c91.entry.js → p-cc1ba953.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-00a82c91.entry.js.map → p-cc1ba953.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-660037f2.system.entry.js → p-da7d065e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-660037f2.system.entry.js.map → p-da7d065e.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-f24d6c61.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-f24d6c61.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-ffc07aab.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-ffc07aab.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-download-dialog.verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-download-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.cjs.js.map +0 -1
- package/dist/cjs/verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.cjs.js.map +0 -1
- package/dist/components/p-CFZQhAqt.js.map +0 -1
- package/dist/esm/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-download-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +0 -1
- package/dist/esm/verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-download-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-adopt-signature-dialog_9.entry.js +0 -2
- package/dist/esm-es5/verdocs-adopt-signature-dialog_9.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-envelope-document-page_3.entry.js +0 -2
- package/dist/esm-es5/verdocs-envelope-document-page_3.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-1083d8e2.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-1083d8e2.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2622d80c.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-2622d80c.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-51a509ef.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-51a509ef.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-BACQ3t2g.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-C3cf-C2H.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DHfIae9S.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-c284aac4.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-c284aac4.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/verdocs-adopt-signature-dialog.verdocs-delegate-dialog.verdocs-disclosure-dialog.verdocs-download-dialog.verdocs-kba-dialog.verdocs-otp-dialog.verdocs-passcode-dialog.verdocs-signing-progress.verdocs-view.entry.esm.js.map +0 -1
- package/dist/verdocs-web-sdk/verdocs-envelope-document-page.verdocs-question-dialog.verdocs-sign-footer.entry.esm.js.map +0 -1
|
@@ -38,6 +38,15 @@ verdocs-view .document {
|
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
flex-direction: column;
|
|
40
40
|
}
|
|
41
|
+
verdocs-view .document.zoom-normal {
|
|
42
|
+
max-width: 1200px;
|
|
43
|
+
}
|
|
44
|
+
verdocs-view .document.zoom-zoom1 {
|
|
45
|
+
max-width: 1400px;
|
|
46
|
+
}
|
|
47
|
+
verdocs-view .document.zoom-zoom2 {
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
}
|
|
41
50
|
verdocs-view .document .inner {
|
|
42
51
|
width: 100%;
|
|
43
52
|
max-width: 1028px;
|
|
@@ -55,47 +64,67 @@ verdocs-view .loading-indicator {
|
|
|
55
64
|
|
|
56
65
|
#verdocs-view-header {
|
|
57
66
|
width: 100%;
|
|
58
|
-
color: #fff;
|
|
59
|
-
display: flex;
|
|
60
67
|
z-index: 1000;
|
|
61
68
|
flex: 0 0 56px;
|
|
62
|
-
padding: 0 20px;
|
|
63
|
-
font-size: 12px;
|
|
64
|
-
column-gap: 15px;
|
|
65
|
-
align-items: center;
|
|
66
|
-
flex-direction: row;
|
|
67
|
-
transition: all 0.25s;
|
|
68
|
-
background-color: #33354c;
|
|
69
|
-
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);
|
|
70
|
-
}
|
|
71
|
-
@media all and (max-width: 500px) {
|
|
72
|
-
#verdocs-view-header {
|
|
73
|
-
padding: 0 10px;
|
|
74
|
-
}
|
|
75
69
|
}
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
|
|
71
|
+
.controls-toolbar {
|
|
78
72
|
display: flex;
|
|
79
|
-
margin: 0 auto;
|
|
80
|
-
padding: 0 20px;
|
|
81
|
-
max-width: 1200px;
|
|
82
73
|
align-items: center;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
height: 54px;
|
|
76
|
+
padding: 0 12px 0 24px;
|
|
77
|
+
background-color: #ffffff;
|
|
78
|
+
border-bottom: 1px solid #e0e0e0;
|
|
79
|
+
box-shadow: none;
|
|
80
|
+
font-family: "Inter", sans-serif;
|
|
81
|
+
color: #424242;
|
|
82
|
+
z-index: 1000;
|
|
89
83
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
display:
|
|
93
|
-
|
|
84
|
+
.controls-toolbar .left-controls {
|
|
85
|
+
flex: 1;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
font-size: 18px;
|
|
89
|
+
.controls-toolbar .left-controls .title {
|
|
97
90
|
font-weight: 500;
|
|
98
|
-
|
|
91
|
+
font-size: 16px;
|
|
92
|
+
color: #242424;
|
|
99
93
|
white-space: nowrap;
|
|
94
|
+
overflow: hidden;
|
|
100
95
|
text-overflow: ellipsis;
|
|
96
|
+
}
|
|
97
|
+
.controls-toolbar .right-controls {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
}
|
|
103
|
+
.controls-toolbar .icon-button {
|
|
104
|
+
width: 32px;
|
|
105
|
+
height: 32px;
|
|
106
|
+
display: flex;
|
|
107
|
+
color: #424242;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
transition: background-color 0.2s;
|
|
112
|
+
}
|
|
113
|
+
.controls-toolbar .icon-button:hover {
|
|
114
|
+
background-color: #f5f5f5;
|
|
115
|
+
}
|
|
116
|
+
.controls-toolbar .icon-button.disabled {
|
|
117
|
+
opacity: 0.3;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
.controls-toolbar .icon-button svg {
|
|
121
|
+
display: block;
|
|
122
|
+
width: 20px;
|
|
123
|
+
height: 20px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (max-width: 768px) {
|
|
127
|
+
verdocs-view .document {
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
}
|
|
101
130
|
}
|
|
@@ -3,6 +3,10 @@ import { h, Host, Fragment } from "@stencil/core";
|
|
|
3
3
|
import { VerdocsToast } from "../../../utils/Toast";
|
|
4
4
|
import { SDKError } from "../../../utils/errors";
|
|
5
5
|
import { Store } from "../../../utils/Datastore";
|
|
6
|
+
const ToolbarMinusIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>`;
|
|
7
|
+
const ToolbarPlusIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242"/></svg>`;
|
|
8
|
+
const ToolbarDownloadIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>`;
|
|
9
|
+
const ToolbarPrintIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>`;
|
|
6
10
|
/**
|
|
7
11
|
* Render the documents attached to an envelope in read-only (view) mode. All documents are
|
|
8
12
|
* displayed in order.
|
|
@@ -40,6 +44,8 @@ export class VerdocsView {
|
|
|
40
44
|
this.showLoadError = false;
|
|
41
45
|
this.loading = true;
|
|
42
46
|
this.envelope = null;
|
|
47
|
+
this.zoomLevel = 'normal';
|
|
48
|
+
this.showDownloadDialog = false;
|
|
43
49
|
}
|
|
44
50
|
async componentWillLoad() {
|
|
45
51
|
var _a, _b, _c;
|
|
@@ -73,8 +79,44 @@ export class VerdocsView {
|
|
|
73
79
|
headerTarget.append(headerEl);
|
|
74
80
|
}
|
|
75
81
|
}
|
|
82
|
+
componentDidLoad() {
|
|
83
|
+
this.updateZoomFromWindow();
|
|
84
|
+
window.addEventListener('resize', () => this.updateZoomFromWindow());
|
|
85
|
+
}
|
|
76
86
|
disconnectedCallback() {
|
|
77
87
|
this.unlistenToEnvelope();
|
|
88
|
+
window.removeEventListener('resize', () => this.updateZoomFromWindow());
|
|
89
|
+
}
|
|
90
|
+
updateZoomFromWindow() {
|
|
91
|
+
const width = window.innerWidth;
|
|
92
|
+
if (width < 768) {
|
|
93
|
+
if (this.zoomLevel !== 'zoom2')
|
|
94
|
+
this.zoomLevel = 'zoom2';
|
|
95
|
+
}
|
|
96
|
+
else if (width < 1024) {
|
|
97
|
+
if (this.zoomLevel !== 'zoom1')
|
|
98
|
+
this.zoomLevel = 'zoom1';
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (this.zoomLevel !== 'normal')
|
|
102
|
+
this.zoomLevel = 'normal';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
handleZoomIn() {
|
|
106
|
+
if (this.zoomLevel === 'normal') {
|
|
107
|
+
this.zoomLevel = 'zoom1';
|
|
108
|
+
}
|
|
109
|
+
else if (this.zoomLevel === 'zoom1') {
|
|
110
|
+
this.zoomLevel = 'zoom2';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleZoomOut() {
|
|
114
|
+
if (this.zoomLevel === 'zoom1') {
|
|
115
|
+
this.zoomLevel = 'normal';
|
|
116
|
+
}
|
|
117
|
+
else if (this.zoomLevel === 'zoom2') {
|
|
118
|
+
this.zoomLevel = 'zoom1';
|
|
119
|
+
}
|
|
78
120
|
}
|
|
79
121
|
async listenToEnvelope() {
|
|
80
122
|
console.log('[VIEW] Loading envelope', this.envelopeId);
|
|
@@ -121,6 +163,9 @@ export class VerdocsView {
|
|
|
121
163
|
(_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: this.envelope, event: 'canceled' });
|
|
122
164
|
}
|
|
123
165
|
break;
|
|
166
|
+
case 'download':
|
|
167
|
+
this.showDownloadDialog = true;
|
|
168
|
+
break;
|
|
124
169
|
case 'print':
|
|
125
170
|
window.print();
|
|
126
171
|
(_b = this.envelopeUpdated) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, envelope: this.envelope, event: 'printed' });
|
|
@@ -169,7 +214,7 @@ export class VerdocsView {
|
|
|
169
214
|
}
|
|
170
215
|
}
|
|
171
216
|
render() {
|
|
172
|
-
var _a;
|
|
217
|
+
var _a, _b, _c;
|
|
173
218
|
if (this.loading) {
|
|
174
219
|
return (h(Host, null, h("verdocs-loader", null)));
|
|
175
220
|
}
|
|
@@ -181,29 +226,13 @@ export class VerdocsView {
|
|
|
181
226
|
if (!this.envelope) {
|
|
182
227
|
return (h(Host, null, h("img", { src: "https://public-assets.verdocs.com/loading-placeholder.png", style: { width: '612px', height: '792px', boxShadow: '0 0 10px 5px #0000000f', marginTop: '15px' }, alt: "Placeholder page" })));
|
|
183
228
|
}
|
|
184
|
-
const menuOptions = [{ id: 'print', label: 'Print' }];
|
|
185
|
-
if (userCanCancelEnvelope(this.endpoint.profile, this.envelope)) {
|
|
186
|
-
menuOptions.push({ id: 'cancel', label: 'Cancel' });
|
|
187
|
-
}
|
|
188
229
|
// TODO: Review whether we want a different trigger for this.
|
|
189
230
|
const showFooter = userCanCancelEnvelope(this.endpoint.profile, this.envelope);
|
|
190
231
|
// Add download options to the menu
|
|
191
|
-
const hasAttachments = this.envelope.documents.
|
|
192
|
-
const normalDocCount = this.envelope.documents.filter(doc => doc.type === 'attachment').length;
|
|
232
|
+
const hasAttachments = this.envelope.documents.some(doc => doc.type === 'attachment');
|
|
193
233
|
const hasCertificate = this.envelope.documents.find(doc => doc.type === 'certificate') !== undefined;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (hasAttachments) {
|
|
197
|
-
menuOptions.push({ id: 'download-attachments', label: normalDocCount > 1 ? 'Download Documents' : 'Download Document' });
|
|
198
|
-
}
|
|
199
|
-
if (hasCertificate) {
|
|
200
|
-
menuOptions.push({ id: 'download-certificate', label: 'Download Certificate' });
|
|
201
|
-
}
|
|
202
|
-
if (hasAttachments && hasCertificate) {
|
|
203
|
-
menuOptions.push({ id: 'download-all', label: 'Download All Files' });
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return (h(Host, null, h("div", { id: "verdocs-view-header" }, h("div", { class: "inner" }, h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (((_a = this.envelope) === null || _a === void 0 ? void 0 : _a.documents) || [])
|
|
234
|
+
const canDownload = hasAttachments || hasCertificate;
|
|
235
|
+
return (h(Host, null, h("div", { id: "verdocs-view-header" }, h("div", { class: "controls-toolbar" }, h("div", { class: "left-controls" }, h("div", { class: "title" }, this.envelope.name)), h("div", { class: "right-controls" }, h("div", { class: { 'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal' }, innerHTML: ToolbarMinusIcon, onClick: () => this.handleZoomOut() }), h("div", { class: { 'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2' }, innerHTML: ToolbarPlusIcon, onClick: () => this.handleZoomIn() }), h("div", { class: { 'icon-button': true, 'disabled': !canDownload }, innerHTML: ToolbarDownloadIcon, onClick: () => canDownload && this.handleOptionSelected({ detail: { id: 'download' } }) }), h("div", { class: "icon-button print", innerHTML: ToolbarPrintIcon, onClick: () => this.handleOptionSelected({ detail: { id: 'print' } }) })))), h("div", { class: `document zoom-${this.zoomLevel}`, style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (((_a = this.envelope) === null || _a === void 0 ? void 0 : _a.documents) || [])
|
|
207
236
|
.filter(document => document.type !== 'certificate')
|
|
208
237
|
.map(envelopeDocument => {
|
|
209
238
|
const pageNumbers = integerSequence(1, envelopeDocument.pages);
|
|
@@ -217,7 +246,52 @@ export class VerdocsView {
|
|
|
217
246
|
})));
|
|
218
247
|
})), this.showCancelDone && (h("verdocs-ok-dialog", { heading: "Cancelled", message: `This envelope has been cancelled successfully.`, onNext: () => {
|
|
219
248
|
this.showCancelDone = false;
|
|
220
|
-
} })), this.canceling && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null))),
|
|
249
|
+
} })), this.canceling && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null))), this.showDownloadDialog && (h("verdocs-download-dialog", { hasCertificate: (_c = (_b = this.envelope) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.some(d => d.type === 'certificate'), onExit: () => (this.showDownloadDialog = false), onNext: async (e) => {
|
|
250
|
+
this.showDownloadDialog = false;
|
|
251
|
+
const { action } = e.detail;
|
|
252
|
+
console.log('[VIEW] Download action selected:', action);
|
|
253
|
+
try {
|
|
254
|
+
if (action === 'document') {
|
|
255
|
+
const attachments = this.envelope.documents.filter(d => d.type === 'attachment');
|
|
256
|
+
if (attachments.length === 1) {
|
|
257
|
+
const url = await getEnvelopeDocumentDownloadLink(this.endpoint, attachments[0].id);
|
|
258
|
+
window.open(url, '_blank');
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
const firstDoc = attachments[0];
|
|
262
|
+
if (firstDoc) {
|
|
263
|
+
const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);
|
|
264
|
+
window.open(url, '_blank');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
else if (action === 'certificate') {
|
|
269
|
+
const cert = this.envelope.documents.find(d => d.type === 'certificate');
|
|
270
|
+
if (cert) {
|
|
271
|
+
const url = await getEnvelopeDocumentDownloadLink(this.endpoint, cert.id);
|
|
272
|
+
window.open(url, '_blank');
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
VerdocsToast('Certificate not yet available.', { style: 'info' });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else if (action === 'zip') {
|
|
279
|
+
const blob = await getEnvelopesZip(this.endpoint, [this.envelopeId]);
|
|
280
|
+
const url = window.URL.createObjectURL(blob.data);
|
|
281
|
+
const a = document.createElement('a');
|
|
282
|
+
a.href = url;
|
|
283
|
+
a.download = `${this.envelope.name}.zip`;
|
|
284
|
+
document.body.appendChild(a);
|
|
285
|
+
a.click();
|
|
286
|
+
a.remove();
|
|
287
|
+
window.URL.revokeObjectURL(url);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch (err) {
|
|
291
|
+
console.error('Download error', err);
|
|
292
|
+
VerdocsToast('Unable to complete download request.', { style: 'error' });
|
|
293
|
+
}
|
|
294
|
+
} })), !showFooter && (h("verdocs-sign-footer", { endpoint: this.endpoint, envelopeId: this.envelopeId, isDone: true, onAskQuestion: () => { }, onDecline: () => { }, onFinishLater: () => { } }))));
|
|
221
295
|
}
|
|
222
296
|
static get is() { return "verdocs-view"; }
|
|
223
297
|
static get originalStyleUrls() {
|
|
@@ -304,7 +378,9 @@ export class VerdocsView {
|
|
|
304
378
|
"showCancelDone": {},
|
|
305
379
|
"showLoadError": {},
|
|
306
380
|
"loading": {},
|
|
307
|
-
"envelope": {}
|
|
381
|
+
"envelope": {},
|
|
382
|
+
"zoomLevel": {},
|
|
383
|
+
"showDownloadDialog": {}
|
|
308
384
|
};
|
|
309
385
|
}
|
|
310
386
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-view.js","sourceRoot":"","sources":["../../../../src/components/embeds/verdocs-view/verdocs-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,+BAA+B,EAAE,WAAW,EAAa,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAClL,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAgB,QAAQ,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAC,YAAY,EAAC,M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AAI,CACtB,yBACE,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,gDAAgD,EACzD,MAAM,EAAE,GAAG,EAAE;oBACX,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAC9B,CAAC,GACD,CACH;YAEA,IAAI,CAAC,SAAS,IAAI,CACjB,WAAK,KAAK,EAAC,mBAAmB;gBAC5B,yBAAkB,CACd,CACP;YAEA,CAAC,UAAU,IAAI,CACd,2BAAqB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC,GAAI,CACnK,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {cancelEnvelope, getEnvelopeDocumentDownloadLink, getEnvelope, IEnvelope, integerSequence, userCanCancelEnvelope, VerdocsEndpoint, getEnvelopesZip} from '@verdocs/js-sdk';\nimport {Component, h, Element, Event, Host, Prop, EventEmitter, Fragment, State} from '@stencil/core';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Render the documents attached to an envelope in read-only (view) mode. All documents are\n * displayed in order.\n *\n * ```ts\n * <verdocs-view\n * envelopeId={ENVELOPE_ID}\n * onSdkError={({ detail }) => { console.log('SDK error', detail) }\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-view',\n styleUrl: 'verdocs-view.scss',\n shadow: false,\n})\nexport class VerdocsView {\n private envelopeListenerId = null;\n\n @Element() component: 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 | null = null;\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If set, (recommended), the host application should create a <DIV> element with a unique ID. When this\n * component renders, the header will be removed from its default location and placed in the target element.\n * This allows the parent application to more easily control its placement and scroll effects (e.g. \"fixed\").\n *\n * The movement of the header to the target container is not dynamic - it is performed only on the initial\n * render. Host applications should not conditionally render this container. If the header's visibility must\n * be externally controlled, use CSS display options to hide/show it instead.\n */\n @Prop() headerTargetId: string | null = null;\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 envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n /**\n * Event fired when the user clicks Send Another 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}) another: EventEmitter;\n\n /**\n * Event fired when the user clicks Send Another 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}) view: EventEmitter;\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;\n @State() canceling = false;\n @State() showCancelDone = false;\n @State() showLoadError = false;\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n\n async componentWillLoad() {\n if (!this.endpoint) {\n this.endpoint = VerdocsEndpoint.getDefault();\n this.endpoint.loadSession();\n }\n\n if (!this.envelopeId) {\n console.error(`[VIEW] Missing required envelopeId`);\n return;\n }\n\n await this.listenToEnvelope();\n\n if (!this.envelope) {\n try {\n console.log('[VIEW] Loading envelope...');\n this.envelope = await getEnvelope(this.endpoint, this.envelopeId);\n console.log('[VIEW] Loaded envelope', this.envelope);\n } catch (e) {\n this.showLoadError = true;\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n }\n\n componentDidRender() {\n const headerTarget = this.headerTargetId ? document.getElementById(this.headerTargetId) : null;\n const headerEl = document.getElementById('verdocs-view-header');\n if (headerTarget && headerEl) {\n console.log('[VIEW] Moving header');\n headerEl.remove();\n headerTarget.append(headerEl);\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[VIEW] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n true,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handlePageRendered(_e: any) {\n // const pageInfo = e.detail as IDocumentPageInfo;\n // console.log('[VIEW] Page rendered', pageInfo);\n }\n\n async handleOptionSelected(e: any) {\n switch (e.detail.id) {\n case 'cancel':\n // TODO: Better option for inline-flow confirmation and alert dialogs.\n if (confirm('Are you sure you wish to cancel this envelope? This action cannot be undone.')) {\n this.canceling = true;\n cancelEnvelope(this.endpoint, this.envelopeId)\n .then(r => {\n this.canceling = false;\n console.log('[VIEW] Envelope canceled', r);\n return getEnvelope(this.endpoint, this.envelopeId);\n })\n .then(env => {\n console.log('[VIEW] Loaded new envelope details', env);\n this.envelope = env;\n })\n .catch(e => {\n this.canceling = false;\n console.log('[VIEW] Error canceling envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n });\n this.showCancelDone = true;\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'canceled'});\n }\n break;\n\n case 'print':\n window.print();\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'printed'});\n break;\n\n case 'download-attachments':\n // TODO: Multiple document support\n try {\n const firstDoc = this.envelope.documents.find(doc => doc.type === 'attachment');\n if (firstDoc) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);\n window.open(url, '_blank');\n }\n } catch (e) {\n console.log('Unable to download document', e);\n VerdocsToast(e.response?.data?.error || 'Unable to download document. Please try again later.', {style: 'error'});\n }\n break;\n\n case 'download-certificate':\n // TODO: Multiple certificate support\n {\n const firstCert = this.envelope.documents.find(doc => doc.type === 'certificate');\n if (firstCert) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstCert.id);\n window.open(url, '_blank');\n }\n }\n // saveCertificate(this.endpoint, this.envelope, this.envelope.certificate_document_id)\n // .then(() => {\n // this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'downloaded'});\n // })\n // .catch(e => {\n // console.log('Error downloading PDF', e);\n // });\n break;\n\n case 'download-all':\n getEnvelopesZip(this.endpoint, [this.envelope.id])\n .then(() => {\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'downloaded'});\n })\n .catch(e => {\n console.log('Error downloading Zip', e);\n });\n break;\n }\n }\n\n render() {\n if (this.loading) {\n return (\n <Host>\n <verdocs-loader />\n </Host>\n );\n }\n\n if (this.showLoadError) {\n return (\n <Host>\n <verdocs-ok-dialog\n heading=\"Unable to View Envelope\"\n message={`Sorry, that envelope is not valid.`}\n buttonLabel=\"OK\"\n onNext={() => {\n this.showLoadError = false;\n }}\n />\n </Host>\n );\n }\n\n if (!this.envelope) {\n return (\n <Host>\n <img\n src=\"https://public-assets.verdocs.com/loading-placeholder.png\"\n style={{width: '612px', height: '792px', boxShadow: '0 0 10px 5px #0000000f', marginTop: '15px'}}\n alt=\"Placeholder page\"\n />\n </Host>\n );\n }\n\n const menuOptions: any[] = [{id: 'print', label: 'Print'}];\n\n if (userCanCancelEnvelope(this.endpoint.profile, this.envelope)) {\n menuOptions.push({id: 'cancel', label: 'Cancel'});\n }\n\n // TODO: Review whether we want a different trigger for this.\n const showFooter = userCanCancelEnvelope(this.endpoint.profile, this.envelope);\n\n // Add download options to the menu\n const hasAttachments = this.envelope.documents.length > 0;\n const normalDocCount = this.envelope.documents.filter(doc => doc.type === 'attachment').length;\n const hasCertificate = this.envelope.documents.find(doc => doc.type === 'certificate') !== undefined;\n if (hasAttachments || hasCertificate) {\n menuOptions.push({label: ''});\n if (hasAttachments) {\n menuOptions.push({id: 'download-attachments', label: normalDocCount > 1 ? 'Download Documents' : 'Download Document'});\n }\n if (hasCertificate) {\n menuOptions.push({id: 'download-certificate', label: 'Download Certificate'});\n }\n if (hasAttachments && hasCertificate) {\n menuOptions.push({id: 'download-all', label: 'Download All Files'});\n }\n }\n\n return (\n <Host>\n <div id=\"verdocs-view-header\">\n <div class=\"inner\">\n <img src=\"https://verdocs.com/assets/white-logo.svg\" alt=\"Verdocs Logo\" class=\"logo\" />\n <div class=\"title\">{this.envelope.name}</div>\n <div style={{flex: '1'}} />\n <div style={{marginLeft: '10px'}} />\n <verdocs-dropdown options={menuOptions} onOptionSelected={e => this.handleOptionSelected(e)} />\n </div>\n </div>\n\n <div class=\"document\" style={{paddingTop: this.headerTargetId ? '70px' : '15px'}}>\n {(this.envelope?.documents || [])\n .filter(document => document.type !== 'certificate')\n .map(envelopeDocument => {\n const pageNumbers = integerSequence(1, envelopeDocument.pages);\n\n return (\n <Fragment>\n {pageNumbers.map(pageNumber => {\n const pageSize = envelopeDocument.page_sizes?.[pageNumber] || {width: 612, height: 792};\n\n return (\n <verdocs-envelope-document-page\n envelopeId={this.envelopeId}\n documentId={envelopeDocument.id}\n endpoint={this.endpoint}\n type=\"filled\"\n virtualWidth={pageSize.width}\n virtualHeight={pageSize.height}\n pageNumber={pageNumber}\n onPageRendered={e => this.handlePageRendered(e)}\n layers={[\n {name: 'page', type: 'canvas'},\n {name: 'controls', type: 'div'},\n ]}\n />\n );\n })}\n </Fragment>\n );\n })}\n </div>\n\n {this.showCancelDone && (\n <verdocs-ok-dialog\n heading=\"Cancelled\"\n message={`This envelope has been cancelled successfully.`}\n onNext={() => {\n this.showCancelDone = false;\n }}\n />\n )}\n\n {this.canceling && (\n <div class=\"loading-indicator\">\n <verdocs-loader />\n </div>\n )}\n\n {!showFooter && (\n <verdocs-sign-footer endpoint={this.endpoint} envelopeId={this.envelopeId} isDone={true} onAskQuestion={() => {}} onDecline={() => {}} onFinishLater={() => {}} />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verdocs-view.js","sourceRoot":"","sources":["../../../../src/components/embeds/verdocs-view/verdocs-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,+BAA+B,EAAE,WAAW,EAAa,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAClL,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAgB,QAAQ,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,gBAAgB,GAAG,+pBAA+pB,CAAC;AACzrB,MAAM,eAAe,GAAG,kyBAAkyB,CAAC;AAC3zB,MAAM,mBAAmB,GAAG,k3BAAk3B,CAAC;AAC/4B,MAAM,gBAAgB,GAAG,mzBAAmzB,CAAC;AAE70B;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,WAAW;IALxB;QAMU,uBAAkB,GAAG,IAAI,CAAC;QAIlC;;WAEG;QACK,aAA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,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC,GAAI,CACnK,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {cancelEnvelope, getEnvelopeDocumentDownloadLink, getEnvelope, IEnvelope, integerSequence, userCanCancelEnvelope, VerdocsEndpoint, getEnvelopesZip} from '@verdocs/js-sdk';\nimport {Component, h, Element, Event, Host, Prop, EventEmitter, Fragment, State} from '@stencil/core';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst ToolbarMinusIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z\" fill=\"#424242\" /></svg>`;\nconst ToolbarPlusIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z\" fill=\"#424242\"/></svg>`;\nconst ToolbarDownloadIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z\" fill=\"#424242\"/></svg>`;\nconst ToolbarPrintIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z\" fill=\"#424242\"/></svg>`;\n\n/**\n * Render the documents attached to an envelope in read-only (view) mode. All documents are\n * displayed in order.\n *\n * ```ts\n * <verdocs-view\n * envelopeId={ENVELOPE_ID}\n * onSdkError={({ detail }) => { console.log('SDK error', detail) }\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-view',\n styleUrl: 'verdocs-view.scss',\n shadow: false,\n})\nexport class VerdocsView {\n private envelopeListenerId = null;\n\n @Element() component: 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 | null = null;\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If set, (recommended), the host application should create a <DIV> element with a unique ID. When this\n * component renders, the header will be removed from its default location and placed in the target element.\n * This allows the parent application to more easily control its placement and scroll effects (e.g. \"fixed\").\n *\n * The movement of the header to the target container is not dynamic - it is performed only on the initial\n * render. Host applications should not conditionally render this container. If the header's visibility must\n * be externally controlled, use CSS display options to hide/show it instead.\n */\n @Prop() headerTargetId: string | null = null;\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 envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n /**\n * Event fired when the user clicks Send Another 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}) another: EventEmitter;\n\n /**\n * Event fired when the user clicks Send Another 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}) view: EventEmitter;\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;\n @State() canceling = false;\n @State() showCancelDone = false;\n @State() showLoadError = false;\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n @State() zoomLevel: 'normal' | 'zoom1' | 'zoom2' = 'normal';\n @State() showDownloadDialog = false;\n\n async componentWillLoad() {\n if (!this.endpoint) {\n this.endpoint = VerdocsEndpoint.getDefault();\n this.endpoint.loadSession();\n }\n\n if (!this.envelopeId) {\n console.error(`[VIEW] Missing required envelopeId`);\n return;\n }\n\n await this.listenToEnvelope();\n\n if (!this.envelope) {\n try {\n console.log('[VIEW] Loading envelope...');\n this.envelope = await getEnvelope(this.endpoint, this.envelopeId);\n console.log('[VIEW] Loaded envelope', this.envelope);\n } catch (e) {\n this.showLoadError = true;\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n }\n\n componentDidRender() {\n const headerTarget = this.headerTargetId ? document.getElementById(this.headerTargetId) : null;\n const headerEl = document.getElementById('verdocs-view-header');\n if (headerTarget && headerEl) {\n console.log('[VIEW] Moving header');\n headerEl.remove();\n headerTarget.append(headerEl);\n }\n }\n\n componentDidLoad() {\n this.updateZoomFromWindow();\n window.addEventListener('resize', () => this.updateZoomFromWindow());\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n window.removeEventListener('resize', () => this.updateZoomFromWindow());\n }\n\n updateZoomFromWindow() {\n const width = window.innerWidth;\n if (width < 768) {\n if (this.zoomLevel !== 'zoom2') this.zoomLevel = 'zoom2';\n } else if (width < 1024) {\n if (this.zoomLevel !== 'zoom1') this.zoomLevel = 'zoom1';\n } else {\n if (this.zoomLevel !== 'normal') this.zoomLevel = 'normal';\n }\n }\n\n handleZoomIn() {\n if (this.zoomLevel === 'normal') {\n this.zoomLevel = 'zoom1';\n } else if (this.zoomLevel === 'zoom1') {\n this.zoomLevel = 'zoom2';\n }\n }\n\n handleZoomOut() {\n if (this.zoomLevel === 'zoom1') {\n this.zoomLevel = 'normal';\n } else if (this.zoomLevel === 'zoom2') {\n this.zoomLevel = 'zoom1';\n }\n }\n\n async listenToEnvelope() {\n console.log('[VIEW] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n true,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handlePageRendered(_e: any) {\n // const pageInfo = e.detail as IDocumentPageInfo;\n // console.log('[VIEW] Page rendered', pageInfo);\n }\n\n async handleOptionSelected(e: any) {\n switch (e.detail.id) {\n case 'cancel':\n // TODO: Better option for inline-flow confirmation and alert dialogs.\n if (confirm('Are you sure you wish to cancel this envelope? This action cannot be undone.')) {\n this.canceling = true;\n cancelEnvelope(this.endpoint, this.envelopeId)\n .then(r => {\n this.canceling = false;\n console.log('[VIEW] Envelope canceled', r);\n return getEnvelope(this.endpoint, this.envelopeId);\n })\n .then(env => {\n console.log('[VIEW] Loaded new envelope details', env);\n this.envelope = env;\n })\n .catch(e => {\n this.canceling = false;\n console.log('[VIEW] Error canceling envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n });\n this.showCancelDone = true;\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'canceled'});\n }\n break;\n\n case 'download':\n this.showDownloadDialog = true;\n break;\n\n case 'print':\n window.print();\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'printed'});\n break;\n\n case 'download-attachments':\n // TODO: Multiple document support\n try {\n const firstDoc = this.envelope.documents.find(doc => doc.type === 'attachment');\n if (firstDoc) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);\n window.open(url, '_blank');\n }\n } catch (e) {\n console.log('Unable to download document', e);\n VerdocsToast(e.response?.data?.error || 'Unable to download document. Please try again later.', {style: 'error'});\n }\n break;\n\n case 'download-certificate':\n // TODO: Multiple certificate support\n {\n const firstCert = this.envelope.documents.find(doc => doc.type === 'certificate');\n if (firstCert) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstCert.id);\n window.open(url, '_blank');\n }\n }\n // saveCertificate(this.endpoint, this.envelope, this.envelope.certificate_document_id)\n // .then(() => {\n // this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'downloaded'});\n // })\n // .catch(e => {\n // console.log('Error downloading PDF', e);\n // });\n break;\n\n case 'download-all':\n getEnvelopesZip(this.endpoint, [this.envelope.id])\n .then(() => {\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: this.envelope, event: 'downloaded'});\n })\n .catch(e => {\n console.log('Error downloading Zip', e);\n });\n break;\n }\n }\n\n render() {\n if (this.loading) {\n return (\n <Host>\n <verdocs-loader />\n </Host>\n );\n }\n\n if (this.showLoadError) {\n return (\n <Host>\n <verdocs-ok-dialog\n heading=\"Unable to View Envelope\"\n message={`Sorry, that envelope is not valid.`}\n buttonLabel=\"OK\"\n onNext={() => {\n this.showLoadError = false;\n }}\n />\n </Host>\n );\n }\n\n if (!this.envelope) {\n return (\n <Host>\n <img\n src=\"https://public-assets.verdocs.com/loading-placeholder.png\"\n style={{width: '612px', height: '792px', boxShadow: '0 0 10px 5px #0000000f', marginTop: '15px'}}\n alt=\"Placeholder page\"\n />\n </Host>\n );\n }\n\n // TODO: Review whether we want a different trigger for this.\n const showFooter = userCanCancelEnvelope(this.endpoint.profile, this.envelope);\n\n // Add download options to the menu\n const hasAttachments = this.envelope.documents.some(doc => doc.type === 'attachment');\n const hasCertificate = this.envelope.documents.find(doc => doc.type === 'certificate') !== undefined;\n const canDownload = hasAttachments || hasCertificate;\n\n return (\n <Host>\n <div id=\"verdocs-view-header\">\n <div class=\"controls-toolbar\">\n <div class=\"left-controls\">\n <div class=\"title\">{this.envelope.name}</div>\n </div>\n <div class=\"right-controls\">\n <div class={{'icon-button': true, 'minus': true, 'disabled': this.zoomLevel === 'normal'}} innerHTML={ToolbarMinusIcon} onClick={() => this.handleZoomOut()} />\n <div class={{'icon-button': true, 'plus': true, 'disabled': this.zoomLevel === 'zoom2'}} innerHTML={ToolbarPlusIcon} onClick={() => this.handleZoomIn()} />\n <div\n class={{'icon-button': true, 'disabled': !canDownload}}\n innerHTML={ToolbarDownloadIcon}\n onClick={() => canDownload && this.handleOptionSelected({detail: {id: 'download'}})}\n />\n <div class=\"icon-button print\" innerHTML={ToolbarPrintIcon} onClick={() => this.handleOptionSelected({detail: {id: 'print'}})} />\n </div>\n </div>\n </div>\n\n <div class={`document zoom-${this.zoomLevel}`} style={{paddingTop: this.headerTargetId ? '70px' : '15px'}}>\n {(this.envelope?.documents || [])\n .filter(document => document.type !== 'certificate')\n .map(envelopeDocument => {\n const pageNumbers = integerSequence(1, envelopeDocument.pages);\n\n return (\n <Fragment>\n {pageNumbers.map(pageNumber => {\n const pageSize = envelopeDocument.page_sizes?.[pageNumber] || {width: 612, height: 792};\n\n return (\n <verdocs-envelope-document-page\n envelopeId={this.envelopeId}\n documentId={envelopeDocument.id}\n endpoint={this.endpoint}\n type=\"filled\"\n virtualWidth={pageSize.width}\n virtualHeight={pageSize.height}\n pageNumber={pageNumber}\n onPageRendered={e => this.handlePageRendered(e)}\n layers={[\n {name: 'page', type: 'canvas'},\n {name: 'controls', type: 'div'},\n ]}\n />\n );\n })}\n </Fragment>\n );\n })}\n </div>\n\n {this.showCancelDone && (\n <verdocs-ok-dialog\n heading=\"Cancelled\"\n message={`This envelope has been cancelled successfully.`}\n onNext={() => {\n this.showCancelDone = false;\n }}\n />\n )}\n\n {this.canceling && (\n <div class=\"loading-indicator\">\n <verdocs-loader />\n </div>\n )}\n\n {this.showDownloadDialog && (\n <verdocs-download-dialog\n hasCertificate={this.envelope?.documents?.some(d => d.type === 'certificate')}\n onExit={() => (this.showDownloadDialog = false)}\n onNext={async e => {\n this.showDownloadDialog = false;\n const {action} = e.detail;\n console.log('[VIEW] Download action selected:', action);\n\n try {\n if (action === 'document') {\n const attachments = this.envelope.documents.filter(d => d.type === 'attachment');\n if (attachments.length === 1) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, attachments[0].id);\n window.open(url, '_blank');\n } else {\n const firstDoc = attachments[0];\n if (firstDoc) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, firstDoc.id);\n window.open(url, '_blank');\n }\n }\n } else if (action === 'certificate') {\n const cert = this.envelope.documents.find(d => d.type === 'certificate');\n if (cert) {\n const url = await getEnvelopeDocumentDownloadLink(this.endpoint, cert.id);\n window.open(url, '_blank');\n } else {\n VerdocsToast('Certificate not yet available.', {style: 'info'});\n }\n } else if (action === 'zip') {\n const blob = await getEnvelopesZip(this.endpoint, [this.envelopeId]);\n const url = window.URL.createObjectURL(blob.data);\n const a = document.createElement('a');\n a.href = url;\n a.download = `${this.envelope.name}.zip`;\n document.body.appendChild(a);\n a.click();\n a.remove();\n window.URL.revokeObjectURL(url);\n }\n } catch (err) {\n console.error('Download error', err);\n VerdocsToast('Unable to complete download request.', {style: 'error'});\n }\n }}\n />\n )}\n\n {!showFooter && (\n <verdocs-sign-footer endpoint={this.endpoint} envelopeId={this.envelopeId} isDone={true} onAskQuestion={() => {}} onDecline={() => {}} onFinishLater={() => {}} />\n )}\n </Host>\n );\n }\n}\n"]}
|