@verdocs/web-sdk 1.12.24 → 1.12.26

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.
@@ -106,7 +106,7 @@ var createInitials = function (endpoint, name, initials) {
106
106
  .then(function (r) { return r.data; });
107
107
  };
108
108
 
109
- const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 15px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-sign-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
109
+ const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 20px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff}verdocs-sign .intro .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0;max-width:1200px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
110
110
 
111
111
  const inProgressMenuOptions = [
112
112
  { id: 'later', label: 'Finish Later' },
@@ -523,7 +523,7 @@ const VerdocsSign = class {
523
523
  this.isDone = true;
524
524
  } }))));
525
525
  }
526
- return (index.h(index.Host, { class: { agreed: this.agreed } }, !this.finishLater && index.h("div", { class: "intro" }, "Please review and act on these documents."), index.h("div", { id: "verdocs-sign-header" }, !this.agreed ? (index.h("div", { class: "agree" }, index.h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (index.h(index.Fragment, null, index.h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }))), !this.finishLater && index.h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), index.h("div", { style: { marginLeft: '10px' } }), index.h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })), !this.agreed ? index.h("div", { class: "cover" }) : index.h("div", { style: { display: 'none' } }), index.h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
526
+ return (index.h(index.Host, { class: { agreed: this.agreed } }, !this.finishLater && (index.h("div", { class: "intro" }, index.h("div", { class: "inner" }, "Please review and act on these documents."))), index.h("div", { id: "verdocs-sign-header" }, index.h("div", { class: "inner" }, !this.agreed ? (index.h("div", { class: "agree" }, index.h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (index.h(index.Fragment, null, index.h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }))), !this.finishLater && index.h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), index.h("div", { style: { marginLeft: '10px' } }), index.h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), !this.agreed ? index.h("div", { class: "cover" }) : index.h("div", { style: { display: 'none' } }), index.h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
527
527
  const pages = [...((envelopeDocument === null || envelopeDocument === void 0 ? void 0 : envelopeDocument.pages) || [])];
528
528
  pages.sort((a, b) => a.sequence - b.sequence);
529
529
  return (index.h(index.Fragment, null, pages.map(page => {
@@ -30,7 +30,7 @@ var userCanCancelEnvelope = function (session, envelope) {
30
30
  envelope.status !== Types.EnvelopeStates.CANCELED;
31
31
  };
32
32
 
33
- const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-view-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
33
+ const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
34
34
 
35
35
  const VerdocsView = class {
36
36
  constructor(hostRef) {
@@ -133,7 +133,6 @@ const VerdocsView = class {
133
133
  render() {
134
134
  var _a;
135
135
  if (!this.envelope) {
136
- console.log('rendering, no env');
137
136
  return (index.h(index.Host, null, index.h("verdocs-loader", null)));
138
137
  }
139
138
  const menuOptions = [{ id: 'print', label: 'Print' }];
@@ -155,8 +154,7 @@ const VerdocsView = class {
155
154
  menuOptions.push({ id: 'download-all', label: 'Download All Files' });
156
155
  }
157
156
  }
158
- console.log('docs', this.envelope, this.envelope.documents);
159
- return (index.h(index.Host, null, index.h("div", { id: "verdocs-view-header" }, index.h(index.Fragment, null, index.h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }), index.h("div", { style: { marginLeft: '10px' } }), index.h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), index.h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (((_a = this.envelope) === null || _a === void 0 ? void 0 : _a.documents) || [])
157
+ return (index.h(index.Host, null, index.h("div", { id: "verdocs-view-header" }, index.h("div", { class: "inner" }, index.h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), index.h("div", { class: "title" }, this.envelope.name), index.h("div", { style: { flex: '1' } }), index.h("div", { style: { marginLeft: '10px' } }), index.h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), index.h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (((_a = this.envelope) === null || _a === void 0 ? void 0 : _a.documents) || [])
160
158
  .filter(document => document.type !== 'certificate')
161
159
  .map(envelopeDocument => {
162
160
  console.log('[VIEW] Rendering document', this.envelope, envelopeDocument);
@@ -19,12 +19,20 @@ verdocs-sign .intro {
19
19
  display: flex;
20
20
  flex: 0 0 60px;
21
21
  color: #111111;
22
- padding: 0 15px;
22
+ padding: 0 20px;
23
23
  font-size: 18px;
24
24
  font-weight: 500;
25
25
  line-height: 28px;
26
26
  flex-direction: row;
27
27
  background: #ffffff;
28
+ }
29
+ verdocs-sign .intro .inner {
30
+ width: 100%;
31
+ display: flex;
32
+ margin: 0 auto;
33
+ padding: 0;
34
+ max-width: 1200px;
35
+ flex-direction: row;
28
36
  align-items: center;
29
37
  }
30
38
  verdocs-sign .cover {
@@ -81,26 +89,36 @@ verdocs-sign verdocs-ok-dialog .background-overlay {
81
89
  }
82
90
  #verdocs-sign-header {
83
91
  color: #fff;
92
+ width: 100%;
84
93
  display: flex;
85
94
  z-index: 1000;
86
95
  flex: 0 0 56px;
87
- padding: 0 15px;
96
+ padding: 0 20px;
88
97
  font-size: 12px;
98
+ column-gap: 15px;
89
99
  align-items: center;
90
100
  flex-direction: row;
91
101
  transition: all 0.25s;
92
102
  background-color: #33354c;
93
103
  box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);
94
104
  }
105
+ #verdocs-sign-header .inner {
106
+ padding: 0;
107
+ width: 100%;
108
+ display: flex;
109
+ margin: 0 auto;
110
+ max-width: 1200px;
111
+ align-items: center;
112
+ flex-direction: row;
113
+ }
95
114
  #verdocs-sign-header .logo {
96
115
  width: 80px;
97
116
  display: none;
98
- margin: -6px 0 0 10px;
117
+ margin: -6px 0 0 0;
99
118
  }
100
119
  #verdocs-sign-header .title {
101
- padding-left: 16px;
102
120
  font-size: 18px;
103
121
  font-weight: 500;
104
- text-overflow: ellipsis;
105
122
  white-space: nowrap;
123
+ text-overflow: ellipsis;
106
124
  }
@@ -437,7 +437,7 @@ export class VerdocsSign {
437
437
  this.isDone = true;
438
438
  } }))));
439
439
  }
440
- return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && h("div", { class: "intro" }, "Please review and act on these documents."), h("div", { id: "verdocs-sign-header" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
440
+ return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && (h("div", { class: "intro" }, h("div", { class: "inner" }, "Please review and act on these documents."))), h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
441
441
  const pages = [...((envelopeDocument === null || envelopeDocument === void 0 ? void 0 : envelopeDocument.pages) || [])];
442
442
  pages.sort((a, b) => a.sequence - b.sequence);
443
443
  return (h(Fragment, null, pages.map(page => {
@@ -38,23 +38,32 @@ verdocs-view .document .inner {
38
38
  display: flex;
39
39
  z-index: 1000;
40
40
  flex: 0 0 56px;
41
- padding: 0 15px;
41
+ padding: 0 20px;
42
42
  font-size: 12px;
43
+ column-gap: 15px;
43
44
  align-items: center;
44
45
  flex-direction: row;
45
46
  transition: all 0.25s;
46
47
  background-color: #33354c;
47
48
  box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);
48
49
  }
50
+ #verdocs-view-header .inner {
51
+ padding: 0;
52
+ width: 100%;
53
+ display: flex;
54
+ margin: 0 auto;
55
+ max-width: 1200px;
56
+ align-items: center;
57
+ flex-direction: row;
58
+ }
49
59
  #verdocs-view-header .logo {
50
60
  width: 80px;
51
61
  display: none;
52
- margin: -6px 0 0 10px;
62
+ margin: -6px 0 0 0;
53
63
  }
54
64
  #verdocs-view-header .title {
55
- padding-left: 16px;
56
65
  font-size: 18px;
57
66
  font-weight: 500;
58
- text-overflow: ellipsis;
59
67
  white-space: nowrap;
68
+ text-overflow: ellipsis;
60
69
  }
@@ -105,7 +105,6 @@ export class VerdocsView {
105
105
  render() {
106
106
  var _a;
107
107
  if (!this.envelope) {
108
- console.log('rendering, no env');
109
108
  return (h(Host, null, h("verdocs-loader", null)));
110
109
  }
111
110
  const menuOptions = [{ id: 'print', label: 'Print' }];
@@ -127,8 +126,7 @@ export class VerdocsView {
127
126
  menuOptions.push({ id: 'download-all', label: 'Download All Files' });
128
127
  }
129
128
  }
130
- console.log('docs', this.envelope, this.envelope.documents);
131
- return (h(Host, null, h("div", { id: "verdocs-view-header" }, h(Fragment, null, 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) || [])
129
+ 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) || [])
132
130
  .filter(document => document.type !== 'certificate')
133
131
  .map(envelopeDocument => {
134
132
  console.log('[VIEW] Rendering document', this.envelope, envelopeDocument);
@@ -107,7 +107,7 @@ var createInitials = function (endpoint, name, initials) {
107
107
  .then(function (r) { return r.data; });
108
108
  };
109
109
 
110
- const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 15px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-sign-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
110
+ const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 20px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff}verdocs-sign .intro .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0;max-width:1200px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
111
111
 
112
112
  const inProgressMenuOptions = [
113
113
  { id: 'later', label: 'Finish Later' },
@@ -525,7 +525,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
525
525
  this.isDone = true;
526
526
  } }))));
527
527
  }
528
- return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && h("div", { class: "intro" }, "Please review and act on these documents."), h("div", { id: "verdocs-sign-header" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
528
+ return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && (h("div", { class: "intro" }, h("div", { class: "inner" }, "Please review and act on these documents."))), h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
529
529
  const pages = [...((envelopeDocument === null || envelopeDocument === void 0 ? void 0 : envelopeDocument.pages) || [])];
530
530
  pages.sort((a, b) => a.sequence - b.sequence);
531
531
  return (h(Fragment, null, pages.map(page => {
@@ -27,7 +27,7 @@ var userCanCancelEnvelope = function (session, envelope) {
27
27
  envelope.status !== EnvelopeStates.CANCELED;
28
28
  };
29
29
 
30
- const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-view-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
30
+ const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
31
31
 
32
32
  const VerdocsView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
33
33
  constructor() {
@@ -131,7 +131,6 @@ const VerdocsView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
131
131
  render() {
132
132
  var _a;
133
133
  if (!this.envelope) {
134
- console.log('rendering, no env');
135
134
  return (h(Host, null, h("verdocs-loader", null)));
136
135
  }
137
136
  const menuOptions = [{ id: 'print', label: 'Print' }];
@@ -153,8 +152,7 @@ const VerdocsView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
152
  menuOptions.push({ id: 'download-all', label: 'Download All Files' });
154
153
  }
155
154
  }
156
- console.log('docs', this.envelope, this.envelope.documents);
157
- return (h(Host, null, h("div", { id: "verdocs-view-header" }, h(Fragment, null, 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) || [])
155
+ 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) || [])
158
156
  .filter(document => document.type !== 'certificate')
159
157
  .map(envelopeDocument => {
160
158
  console.log('[VIEW] Rendering document', this.envelope, envelopeDocument);
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-03-15T23:09:34",
2
+ "timestamp": "2023-03-16T00:52:53",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.20.0",
@@ -102,7 +102,7 @@ var createInitials = function (endpoint, name, initials) {
102
102
  .then(function (r) { return r.data; });
103
103
  };
104
104
 
105
- const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 15px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-sign-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
105
+ const verdocsSignCss = "verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 20px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff}verdocs-sign .intro .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0;max-width:1200px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
106
106
 
107
107
  const inProgressMenuOptions = [
108
108
  { id: 'later', label: 'Finish Later' },
@@ -519,7 +519,7 @@ const VerdocsSign = class {
519
519
  this.isDone = true;
520
520
  } }))));
521
521
  }
522
- return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && h("div", { class: "intro" }, "Please review and act on these documents."), h("div", { id: "verdocs-sign-header" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) })), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
522
+ return (h(Host, { class: { agreed: this.agreed } }, !this.finishLater && (h("div", { class: "intro" }, h("div", { class: "inner" }, "Please review and act on these documents."))), h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, !this.agreed ? (h("div", { class: "agree" }, h("verdocs-checkbox", { name: "agree", label: "I agree to use electronic records and signatures.", onInput: () => this.handleClickAgree() }))) : (h(Fragment, null, 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' } }))), !this.finishLater && h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), !this.agreed ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document", style: { paddingTop: this.headerTargetId ? '70px' : '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
523
523
  const pages = [...((envelopeDocument === null || envelopeDocument === void 0 ? void 0 : envelopeDocument.pages) || [])];
524
524
  pages.sort((a, b) => a.sequence - b.sequence);
525
525
  return (h(Fragment, null, pages.map(page => {
@@ -26,7 +26,7 @@ var userCanCancelEnvelope = function (session, envelope) {
26
26
  envelope.status !== EnvelopeStates.CANCELED;
27
27
  };
28
28
 
29
- const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-view-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}";
29
+ const verdocsViewCss = "verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}";
30
30
 
31
31
  const VerdocsView = class {
32
32
  constructor(hostRef) {
@@ -129,7 +129,6 @@ const VerdocsView = class {
129
129
  render() {
130
130
  var _a;
131
131
  if (!this.envelope) {
132
- console.log('rendering, no env');
133
132
  return (h(Host, null, h("verdocs-loader", null)));
134
133
  }
135
134
  const menuOptions = [{ id: 'print', label: 'Print' }];
@@ -151,8 +150,7 @@ const VerdocsView = class {
151
150
  menuOptions.push({ id: 'download-all', label: 'Download All Files' });
152
151
  }
153
152
  }
154
- console.log('docs', this.envelope, this.envelope.documents);
155
- return (h(Host, null, h("div", { id: "verdocs-view-header" }, h(Fragment, null, 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) || [])
153
+ 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) || [])
156
154
  .filter(document => document.type !== 'certificate')
157
155
  .map(envelopeDocument => {
158
156
  console.log('[VIEW] Rendering document', this.envelope, envelopeDocument);
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):r(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];r=0}finally{i=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,r=t.length,o;i<r;i++){if(o||!(i in t)){if(!o)o=Array.prototype.slice.call(t,0,i);o[i]=t[i]}}return e.concat(o||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment}from"./index-5260ed60.js";import{b as getSigningSession,t as throttledGetEnvelope,u as updateEnvelopeField,c as updateEnvelopeFieldSignature,d as updateEnvelopeFieldInitials}from"./Envelopes-c36c692e.js";import"./Types-6dc82c14.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-ddde1255.js";import{a as isValidPhone,i as isValidEmail}from"./Validators-f110bae2.js";import{f as fullNameToInitials}from"./Primitives-054bc6e5.js";import{s as saveAttachment,u as updateDocumentFieldValue,b as getRoleIndex,r as renderDocumentField,d as getFieldId}from"./utils-1d934f99.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Files-70a192df.js";import"./index-d264c496.js";var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):r(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;r=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];r=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var updateRecipient=function(e,t,n,i){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(r){return[2,e.api.put("/envelopes/".concat(t,"/recipients/").concat(n),i).then((function(e){return e.data}))]}))}))};var envelopeRecipientSubmit=function(e,t,n){return updateRecipient(e,t,n,{action:"submit"})};var envelopeRecipientDecline=function(e,t,n){return updateRecipient(e,t,n,{action:"decline"})};var envelopeRecipientAgree=function(e,t,n,i){return updateRecipient(e,t,n,{action:"update",agreed:i})};var createSignature=function(e,t,n){var i=new FormData;i.append("signature",n,t);return e.api.post("/signatures",i).then((function(e){return e.data}))};var createInitials=function(e,t,n){var i=new FormData;i.append("initial",n,t);return e.api.post("/initials",i).then((function(e){return e.data}))};var verdocsSignCss='verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 15px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-sign-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}';var inProgressMenuOptions=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var doneMenuOptions=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeLoaded=createEvent(this,"envelopeLoaded",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.endpoint=null;this.recipientIndex=-1;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.envelope=null;this.roleNames=[];this.recipient=null;this.signerToken=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.errorMessage="";this.focusedField="";this.isDone=false;this.showDone=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document"}e.prototype.componentWillLoad=function(){this.endpoint=new VerdocsEndpoint({sessionType:"signing"})};e.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,l,d,c,u,p;var h=this;return __generator(this,(function(v){switch(v.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}v.label=1;case 1:v.trys.push([1,4,,5]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,getSigningSession(this.endpoint,{envelopeId:this.envelopeId,roleId:this.roleId,inviteCode:this.inviteCode})];case 2:a=v.sent(),l=a.session,d=a.recipient,c=a.signerToken;console.log("[SIGN] Loaded signing session ".concat(l.email," / ").concat(l.profile_id));this.recipient=d;console.log("[SIGN] We are recipient",this.recipient);this.signerToken=c;this.endpoint.setToken(c);if(this.agreed){this.nextButtonLabel="Next"}u=this;return[4,throttledGetEnvelope(this.endpoint,this.envelopeId)];case 3:u.envelope=v.sent();this.roleNames=this.envelope.recipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.envelope.recipients.findIndex((function(e){return e.role_name==h.roleId}));if(this.recipientIndex>-1){this.recipient=this.envelope.recipients[this.recipientIndex];this.agreed=this.recipient.agreed;console.log("[SIGN] Found our recipient in the envelope",this.recipientIndex,this.recipient)}else{console.log("[SIGN] Could not find our recipient record",this.roleId,this.envelope.recipients)}this.isDone=["submitted","canceled","declined"].includes(this.recipient.status);this.checkRecipientFields();(i=this.envelopeLoaded)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope});return[3,5];case 4:p=v.sent();console.log("Error with signing session",p);(r=this.sdkError)===null||r===void 0?void 0:r.emit(new SDKError(p.message,(o=p.response)===null||o===void 0?void 0:o.status,(s=p.response)===null||s===void 0?void 0:s.data));return[3,5];case 5:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}};e.prototype.handleClickAgree=function(){var e=this;envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var n,i,r;console.log("Update failure",t);(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(i=t.response)===null||i===void 0?void 0:i.status,(r=t.response)===null||r===void 0?void 0:r.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return __generator(this,(function(l){switch(l.label){case 0:s=e.detail.id;switch(s){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:window.alert("This feature will be available in an upcoming release.");(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:return[4,envelopeRecipientDecline(this.endpoint,this.envelopeId,this.roleId)];case 4:a=l.sent();console.log("Decline result",a);(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.isDone=true;return[3,7];case 5:window.print();(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:saveAttachment(this.endpoint,this.envelope,this.envelope.envelope_document_id).catch((function(e){console.log("Error downloading PDF",e)}));(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"});return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,t){var n=this;this.recipient.fields.forEach((function(i){if(i.name===e){i.settings=t.settings;updateDocumentFieldValue(i);n.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,t){var n=this;updateEnvelopeField(this.endpoint,this.envelopeId,e,t).then((function(t){n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,r,o,s,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((r=(i=e.response)===null||i===void 0?void 0:i.data)===null||r===void 0?void 0:r.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.errorMessage="Signing session expired. Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(o=n.sdkError)===null||o===void 0?void 0:o.emit(new SDKError(e.message,(s=e.response)===null||s===void 0?void 0:s.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n,i,r,o,s,s,a,l,d;var c=this;return __generator(this,(function(u){switch(u.label){case 0:n=t.target,i=n.value,r=n.checked;o=e.type;switch(o){case"textbox":return[3,1];case"checkbox_group":return[3,2];case"radio_button_group":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:i})];case 2:{s=e.settings.options.map((function(e){return{id:e.id,checked:t.target.checked}}));return[2,this.saveFieldChange(e.name,{prepared:false,value:{options:s}})]}u.label=3;case 3:{s=e.settings.options.map((function(e){return{id:e.id,selected:t.target.value===e.id}}));return[2,this.saveFieldChange(e.name,{prepared:false,value:{options:s}})]}u.label=4;case 4:return[2,this.saveFieldChange(e.name,{prepared:false,value:t.detail})];case 5:return[4,fetch(t.detail)];case 6:return[4,u.sent().blob()];case 7:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).then((function(t){return __awaiter(c,void 0,void 0,(function(){var n;return __generator(this,(function(i){switch(i.label){case 0:return[4,updateEnvelopeFieldInitials(this.endpoint,this.envelopeId,e.name,t.id)];case 1:n=i.sent();this.updateRecipientFieldValue(e.name,n);return[2]}}))}))}))];case 8:return[4,fetch(t.detail)];case 9:return[4,u.sent().blob()];case 10:l=u.sent();return[2,createSignature(this.endpoint,"signature",l).then((function(t){return __awaiter(c,void 0,void 0,(function(){var n;return __generator(this,(function(i){switch(i.label){case 0:return[4,updateEnvelopeFieldSignature(this.endpoint,this.envelopeId,e.name,t.id)];case 1:n=i.sent();this.updateRecipientFieldValue(e.name,n);return[2]}}))}))}))];case 11:d=t.target.getAttribute("iso");return[2,this.saveFieldChange(e.name,{prepared:false,value:d})];case 12:console.log("Updating timestamp",{value:i,ts:t.target.getAttribute("timestamp")});return[3,14];case 13:console.log("Unhandled field update",{value:i,checked:r},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldValid=function(e){var t,n,i,r,o,s,a;var l=e.required,d=l===void 0?false:l;var c=e.settings||{},u=c.result,p=u===void 0?"":u,h=c.value,v=h===void 0?"":h,f=c.base64,g=f===void 0?"":f;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(p);case"phone":return isValidPhone(p);default:return!d||p!==""}case"signature":case"initial":return!d||g!=="";case"timestamp":return true;case"textarea":case"date":case"attachment":return!d||p!=="";case"dropdown":return!d||v!=="";case"checkbox_group":var m=(((i=(n=e.settings)===null||n===void 0?void 0:n.options)===null||i===void 0?void 0:i.filter((function(e){return e.checked})))||[]).length;return!d||m>=(((r=e.settings)===null||r===void 0?void 0:r.minimum_checked)||0)&&m<=(((o=e.settings)===null||o===void 0?void 0:o.maximum_checked)||999);case"radio_button_group":return!d||(((a=(s=e.settings)===null||s===void 0?void 0:s.options)===null||a===void 0?void 0:a.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,l,d;var c=this;return __generator(this,(function(u){switch(u.label){case 0:console.log("Next");if(!this.nextSubmits)return[3,5];console.log("Next submits");u.label=1;case 1:u.trys.push([1,3,,4]);return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=u.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;this.isDone=true;return[3,4];case 3:n=u.sent();console.log("Error submitting",n);return[3,4];case 4:return[2];case 5:i=this.recipient.fields.filter((function(e){return e.required}));r=i.findIndex((function(e){return e.name===c.focusedField}));o=r+1;if(o>=i.length){o=0}s=i[o];a=0;if(a<i.length&&["signature","initial"].includes(s.type)&&((e=s.settings)===null||e===void 0?void 0:e.result)==="signed"){a++;o++;if(o>=i.length){o=0}s=i[o]}if(a>=i.length){s=null}if(s){l=getFieldId(s);d=document.getElementById(l);d===null||d===void 0?void 0:d.focusField();this.focusedField=s.name}return[2]}}))}))};e.prototype.checkRecipientFields=function(){var e=this;var t=this.recipient.fields.filter((function(t){return!e.isFieldValid(t)}));if(t.length<1){this.nextButtonLabel="Finish";this.nextSubmits=true}else{console.log("[SIGN] Remaining invalid fields",t);this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,t,n,i){var r=this;var o;i.addEventListener("input",(function(){return r.checkRecipientFields()}));i.addEventListener("focusout",(function(e){return r.handleFieldChange(t,e).finally((function(){return r.checkRecipientFields()}))}));i.addEventListener("fieldChange",(function(e){return r.handleFieldChange(t,e).finally((function(){return r.checkRecipientFields()}))}));i.setAttribute("roleindex",n);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);i.setAttribute("initials",this.recipient?fullNameToInitials(this.recipient.full_name):"");i.setAttribute("name",((o=this.recipient)===null||o===void 0?void 0:o.full_name)||"")};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;var i=getRoleIndex(this.roleNames,this.recipient.role_name);var r=this.recipient.fields.filter((function(e){return e.page===n.pageNumber}));console.log("[SIGN] Page rendered, updating fields",{pageInfo:n,roleIndex:i,recipientFields:r});r.forEach((function(e){var r=renderDocumentField(e,n,i,{disabled:false,editable:false,draggable:false,done:t.isDone});if(!r){return}if(Array.isArray(r)){r.map((function(r){return t.attachFieldAttributes(n,e,i,r)}))}else{t.attachFieldAttributes(n,e,i,r)}}));this.envelope.recipients.filter((function(e){return e.role_name!==t.recipient.role_name})).forEach((function(e){var i=getRoleIndex(t.roleNames,e.role_name);var r=e.fields.filter((function(e){return e.page===n.pageNumber}));r.forEach((function(e){var r=renderDocumentField(e,n,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!r){return}if(r.setAttribute){r.setAttribute("roleindex",i);r.setAttribute("xScale",n.xScale);r.setAttribute("yScale",n.yScale)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},this.isDone?h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)}}):h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)}}),this.errorMessage&&h("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}))}return h(Host,{class:{agreed:this.agreed}},!this.finishLater&&h("div",{class:"intro"},"Please review and act on these documents."),h("div",{id:"verdocs-sign-header"},!this.agreed?h("div",{class:"agree"},h("verdocs-checkbox",{name:"agree",label:"I agree to use electronic records and signatures.",onInput:function(){return e.handleClickAgree()}})):h(Fragment,null,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"}})),!this.finishLater&&h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?inProgressMenuOptions:doneMenuOptions,onOptionSelected:function(t){return e.handleOptionSelected(t)}})),!this.agreed?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},(this.envelope.documents||[]).map((function(t){var n=__spreadArray([],(t===null||t===void 0?void 0:t.pages)||[],true);n.sort((function(e,t){return e.sequence-t.sequence}));return h(Fragment,null,n.map((function(n){return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:n.sequence,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.errorMessage&&h("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):r(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(s){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];r=0}finally{i=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,r=t.length,o;i<r;i++){if(o||!(i in t)){if(!o)o=Array.prototype.slice.call(t,0,i);o[i]=t[i]}}return e.concat(o||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment}from"./index-5260ed60.js";import{b as getSigningSession,t as throttledGetEnvelope,u as updateEnvelopeField,c as updateEnvelopeFieldSignature,d as updateEnvelopeFieldInitials}from"./Envelopes-c36c692e.js";import"./Types-6dc82c14.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-ddde1255.js";import{a as isValidPhone,i as isValidEmail}from"./Validators-f110bae2.js";import{f as fullNameToInitials}from"./Primitives-054bc6e5.js";import{s as saveAttachment,u as updateDocumentFieldValue,b as getRoleIndex,r as renderDocumentField,d as getFieldId}from"./utils-1d934f99.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Files-70a192df.js";import"./index-d264c496.js";var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):r(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;r=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];r=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var updateRecipient=function(e,t,n,i){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(r){return[2,e.api.put("/envelopes/".concat(t,"/recipients/").concat(n),i).then((function(e){return e.data}))]}))}))};var envelopeRecipientSubmit=function(e,t,n){return updateRecipient(e,t,n,{action:"submit"})};var envelopeRecipientDecline=function(e,t,n){return updateRecipient(e,t,n,{action:"decline"})};var envelopeRecipientAgree=function(e,t,n,i){return updateRecipient(e,t,n,{action:"update",agreed:i})};var createSignature=function(e,t,n){var i=new FormData;i.append("signature",n,t);return e.api.post("/signatures",i).then((function(e){return e.data}))};var createInitials=function(e,t,n){var i=new FormData;i.append("initial",n,t);return e.api.post("/initials",i).then((function(e){return e.data}))};var verdocsSignCss='verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 20px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff}verdocs-sign .intro .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0;max-width:1200px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}';var inProgressMenuOptions=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var doneMenuOptions=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeLoaded=createEvent(this,"envelopeLoaded",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.endpoint=null;this.recipientIndex=-1;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.envelope=null;this.roleNames=[];this.recipient=null;this.signerToken=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.errorMessage="";this.focusedField="";this.isDone=false;this.showDone=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document"}e.prototype.componentWillLoad=function(){this.endpoint=new VerdocsEndpoint({sessionType:"signing"})};e.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,l,d,c,u,p;var h=this;return __generator(this,(function(v){switch(v.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}v.label=1;case 1:v.trys.push([1,4,,5]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,getSigningSession(this.endpoint,{envelopeId:this.envelopeId,roleId:this.roleId,inviteCode:this.inviteCode})];case 2:a=v.sent(),l=a.session,d=a.recipient,c=a.signerToken;console.log("[SIGN] Loaded signing session ".concat(l.email," / ").concat(l.profile_id));this.recipient=d;console.log("[SIGN] We are recipient",this.recipient);this.signerToken=c;this.endpoint.setToken(c);if(this.agreed){this.nextButtonLabel="Next"}u=this;return[4,throttledGetEnvelope(this.endpoint,this.envelopeId)];case 3:u.envelope=v.sent();this.roleNames=this.envelope.recipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.envelope.recipients.findIndex((function(e){return e.role_name==h.roleId}));if(this.recipientIndex>-1){this.recipient=this.envelope.recipients[this.recipientIndex];this.agreed=this.recipient.agreed;console.log("[SIGN] Found our recipient in the envelope",this.recipientIndex,this.recipient)}else{console.log("[SIGN] Could not find our recipient record",this.roleId,this.envelope.recipients)}this.isDone=["submitted","canceled","declined"].includes(this.recipient.status);this.checkRecipientFields();(i=this.envelopeLoaded)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope});return[3,5];case 4:p=v.sent();console.log("Error with signing session",p);(r=this.sdkError)===null||r===void 0?void 0:r.emit(new SDKError(p.message,(o=p.response)===null||o===void 0?void 0:o.status,(s=p.response)===null||s===void 0?void 0:s.data));return[3,5];case 5:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}};e.prototype.handleClickAgree=function(){var e=this;envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var n,i,r;console.log("Update failure",t);(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(i=t.response)===null||i===void 0?void 0:i.status,(r=t.response)===null||r===void 0?void 0:r.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return __generator(this,(function(l){switch(l.label){case 0:s=e.detail.id;switch(s){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:window.alert("This feature will be available in an upcoming release.");(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:return[4,envelopeRecipientDecline(this.endpoint,this.envelopeId,this.roleId)];case 4:a=l.sent();console.log("Decline result",a);(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.isDone=true;return[3,7];case 5:window.print();(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:saveAttachment(this.endpoint,this.envelope,this.envelope.envelope_document_id).catch((function(e){console.log("Error downloading PDF",e)}));(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"});return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,t){var n=this;this.recipient.fields.forEach((function(i){if(i.name===e){i.settings=t.settings;updateDocumentFieldValue(i);n.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,t){var n=this;updateEnvelopeField(this.endpoint,this.envelopeId,e,t).then((function(t){n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,r,o,s,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((r=(i=e.response)===null||i===void 0?void 0:i.data)===null||r===void 0?void 0:r.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.errorMessage="Signing session expired. Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(o=n.sdkError)===null||o===void 0?void 0:o.emit(new SDKError(e.message,(s=e.response)===null||s===void 0?void 0:s.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n,i,r,o,s,s,a,l,d;var c=this;return __generator(this,(function(u){switch(u.label){case 0:n=t.target,i=n.value,r=n.checked;o=e.type;switch(o){case"textbox":return[3,1];case"checkbox_group":return[3,2];case"radio_button_group":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:i})];case 2:{s=e.settings.options.map((function(e){return{id:e.id,checked:t.target.checked}}));return[2,this.saveFieldChange(e.name,{prepared:false,value:{options:s}})]}u.label=3;case 3:{s=e.settings.options.map((function(e){return{id:e.id,selected:t.target.value===e.id}}));return[2,this.saveFieldChange(e.name,{prepared:false,value:{options:s}})]}u.label=4;case 4:return[2,this.saveFieldChange(e.name,{prepared:false,value:t.detail})];case 5:return[4,fetch(t.detail)];case 6:return[4,u.sent().blob()];case 7:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).then((function(t){return __awaiter(c,void 0,void 0,(function(){var n;return __generator(this,(function(i){switch(i.label){case 0:return[4,updateEnvelopeFieldInitials(this.endpoint,this.envelopeId,e.name,t.id)];case 1:n=i.sent();this.updateRecipientFieldValue(e.name,n);return[2]}}))}))}))];case 8:return[4,fetch(t.detail)];case 9:return[4,u.sent().blob()];case 10:l=u.sent();return[2,createSignature(this.endpoint,"signature",l).then((function(t){return __awaiter(c,void 0,void 0,(function(){var n;return __generator(this,(function(i){switch(i.label){case 0:return[4,updateEnvelopeFieldSignature(this.endpoint,this.envelopeId,e.name,t.id)];case 1:n=i.sent();this.updateRecipientFieldValue(e.name,n);return[2]}}))}))}))];case 11:d=t.target.getAttribute("iso");return[2,this.saveFieldChange(e.name,{prepared:false,value:d})];case 12:console.log("Updating timestamp",{value:i,ts:t.target.getAttribute("timestamp")});return[3,14];case 13:console.log("Unhandled field update",{value:i,checked:r},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldValid=function(e){var t,n,i,r,o,s,a;var l=e.required,d=l===void 0?false:l;var c=e.settings||{},u=c.result,p=u===void 0?"":u,h=c.value,v=h===void 0?"":h,f=c.base64,g=f===void 0?"":f;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(p);case"phone":return isValidPhone(p);default:return!d||p!==""}case"signature":case"initial":return!d||g!=="";case"timestamp":return true;case"textarea":case"date":case"attachment":return!d||p!=="";case"dropdown":return!d||v!=="";case"checkbox_group":var m=(((i=(n=e.settings)===null||n===void 0?void 0:n.options)===null||i===void 0?void 0:i.filter((function(e){return e.checked})))||[]).length;return!d||m>=(((r=e.settings)===null||r===void 0?void 0:r.minimum_checked)||0)&&m<=(((o=e.settings)===null||o===void 0?void 0:o.maximum_checked)||999);case"radio_button_group":return!d||(((a=(s=e.settings)===null||s===void 0?void 0:s.options)===null||a===void 0?void 0:a.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,l,d;var c=this;return __generator(this,(function(u){switch(u.label){case 0:console.log("Next");if(!this.nextSubmits)return[3,5];console.log("Next submits");u.label=1;case 1:u.trys.push([1,3,,4]);return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=u.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;this.isDone=true;return[3,4];case 3:n=u.sent();console.log("Error submitting",n);return[3,4];case 4:return[2];case 5:i=this.recipient.fields.filter((function(e){return e.required}));r=i.findIndex((function(e){return e.name===c.focusedField}));o=r+1;if(o>=i.length){o=0}s=i[o];a=0;if(a<i.length&&["signature","initial"].includes(s.type)&&((e=s.settings)===null||e===void 0?void 0:e.result)==="signed"){a++;o++;if(o>=i.length){o=0}s=i[o]}if(a>=i.length){s=null}if(s){l=getFieldId(s);d=document.getElementById(l);d===null||d===void 0?void 0:d.focusField();this.focusedField=s.name}return[2]}}))}))};e.prototype.checkRecipientFields=function(){var e=this;var t=this.recipient.fields.filter((function(t){return!e.isFieldValid(t)}));if(t.length<1){this.nextButtonLabel="Finish";this.nextSubmits=true}else{console.log("[SIGN] Remaining invalid fields",t);this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,t,n,i){var r=this;var o;i.addEventListener("input",(function(){return r.checkRecipientFields()}));i.addEventListener("focusout",(function(e){return r.handleFieldChange(t,e).finally((function(){return r.checkRecipientFields()}))}));i.addEventListener("fieldChange",(function(e){return r.handleFieldChange(t,e).finally((function(){return r.checkRecipientFields()}))}));i.setAttribute("roleindex",n);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);i.setAttribute("initials",this.recipient?fullNameToInitials(this.recipient.full_name):"");i.setAttribute("name",((o=this.recipient)===null||o===void 0?void 0:o.full_name)||"")};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;var i=getRoleIndex(this.roleNames,this.recipient.role_name);var r=this.recipient.fields.filter((function(e){return e.page===n.pageNumber}));console.log("[SIGN] Page rendered, updating fields",{pageInfo:n,roleIndex:i,recipientFields:r});r.forEach((function(e){var r=renderDocumentField(e,n,i,{disabled:false,editable:false,draggable:false,done:t.isDone});if(!r){return}if(Array.isArray(r)){r.map((function(r){return t.attachFieldAttributes(n,e,i,r)}))}else{t.attachFieldAttributes(n,e,i,r)}}));this.envelope.recipients.filter((function(e){return e.role_name!==t.recipient.role_name})).forEach((function(e){var i=getRoleIndex(t.roleNames,e.role_name);var r=e.fields.filter((function(e){return e.page===n.pageNumber}));r.forEach((function(e){var r=renderDocumentField(e,n,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!r){return}if(r.setAttribute){r.setAttribute("roleindex",i);r.setAttribute("xScale",n.xScale);r.setAttribute("yScale",n.yScale)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},this.isDone?h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)}}):h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var n;return(n=e.sdkError)===null||n===void 0?void 0:n.emit(t.detail)}}),this.errorMessage&&h("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}))}return h(Host,{class:{agreed:this.agreed}},!this.finishLater&&h("div",{class:"intro"},h("div",{class:"inner"},"Please review and act on these documents.")),h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},!this.agreed?h("div",{class:"agree"},h("verdocs-checkbox",{name:"agree",label:"I agree to use electronic records and signatures.",onInput:function(){return e.handleClickAgree()}})):h(Fragment,null,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"}})),!this.finishLater&&h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?inProgressMenuOptions:doneMenuOptions,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),!this.agreed?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},(this.envelope.documents||[]).map((function(t){var n=__spreadArray([],(t===null||t===void 0?void 0:t.pages)||[],true);n.sort((function(e,t){return e.sequence-t.sequence}));return h(Fragment,null,n.map((function(n){return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:n.sequence,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.errorMessage&&h("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,t,o){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o["throw"](e))}catch(e){r(e)}}function a(e){e.done?t(e.value):i(e.value).then(s,l)}a((o=o.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(e){return function(n){return a([e,n])}}function a(s){if(o)throw new TypeError("Generator is already executing.");while(t)try{if(o=1,i&&(r=s[0]&2?i["return"]:s[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;if(i=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;i=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){t.label=s[1];break}if(s[0]===6&&t.label<r[1]){t.label=r[1];r=s;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(s);break}if(r[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];i=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var o=0,i=n.length,r;o<i;o++){if(r||!(o in n)){if(!r)r=Array.prototype.slice.call(n,0,o);r[o]=n[o]}}return e.concat(r||Array.prototype.slice.call(n))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,a as getElement}from"./index-5260ed60.js";import{t as throttledGetEnvelope,e as cancelEnvelope}from"./Envelopes-c36c692e.js";import{E as EnvelopeStates}from"./Types-6dc82c14.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-ddde1255.js";import{i as saveEnvelopesAsZip,j as saveCertificate,s as saveAttachment}from"./utils-1d934f99.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Files-70a192df.js";import"./index-d264c496.js";var userIsEnvelopeOwner=function(e,n){return n.profile_id===(e===null||e===void 0?void 0:e.profile_id)};var userCanCancelEnvelope=function(e,n){return userIsEnvelopeOwner(e,n)&&n.status!==EnvelopeStates.COMPLETE&&n.status!==EnvelopeStates.DECLINED&&n.status!==EnvelopeStates.CANCELED};var verdocsViewCss='verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 10px}#verdocs-view-header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}';var VerdocsView=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.endpoint=VerdocsEndpoint.getDefault();this.envelopeId="";this.headerTargetId=null;this.isProcessing=false;this.envelope=null;this.roleNames=[]}e.prototype.componentWillLoad=function(){this.endpoint.loadSession()};e.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.envelopeId){console.error("[VIEW] Missing required envelopeId");return[2]}return[2,this.reloadEnvelope()]}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var n=document.getElementById("verdocs-view-header");if(e&&n){console.log("[VIEW] Moving header");n.remove();e.append(n)}};e.prototype.reloadEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,t,o,i;var r=this;return __generator(this,(function(s){switch(s.label){case 0:console.log("[VIEW] Checking for updated envelope");s.label=1;case 1:s.trys.push([1,3,,4]);o=this;return[4,throttledGetEnvelope(this.endpoint,this.envelopeId)];case 2:o.envelope=s.sent();this.roleNames=this.envelope.recipients.map((function(e){return e.role_name}));this.isProcessing=this.envelope.documents.some((function(e){return e.type==="attachment"&&!e.processed}));if(this.isProcessing){setTimeout((function(){return r.reloadEnvelope()}),3e3)}return[3,4];case 3:i=s.sent();(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(n=i.response)===null||n===void 0?void 0:n.status,(t=i.response)===null||t===void 0?void 0:t.data));return[3,4];case 4:return[2]}}))}))};e.prototype.handlePageRendered=function(e){var n=e.detail;console.log("[VIEW] Page rendered",n)};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var n,t,o;var i=this;return __generator(this,(function(r){switch(r.label){case 0:o=e.detail.id;switch(o){case"cancel":return[3,1];case"print":return[3,4];case"download-attachments":return[3,5];case"download-certificate":return[3,6];case"download-all":return[3,7]}return[3,8];case 1:if(!confirm("Are you sure you wish to cancel this envelope? This action cannot be undone."))return[3,3];return[4,cancelEnvelope(this.endpoint,this.envelopeId)];case 2:r.sent();(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"});r.label=3;case 3:return[3,8];case 4:window.print();(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,8];case 5:saveAttachment(this.endpoint,this.envelope,this.envelope.envelope_document_id).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading PDF",e)}));return[3,8];case 6:saveCertificate(this.endpoint,this.envelope,this.envelope.certificate_document_id).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading PDF",e)}));return[3,8];case 7:saveEnvelopesAsZip(this.endpoint,[this.envelope]).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading Zip",e)}));return[3,8];case 8:return[2]}}))}))};e.prototype.render=function(){var e=this;var n;if(!this.envelope){console.log("rendering, no env");return h(Host,null,h("verdocs-loader",null))}var t=[{id:"print",label:"Print"}];if(userCanCancelEnvelope(this.endpoint.session,this.envelope)){t.push({id:"cancel",label:"Cancel"})}var o=this.envelope.documents.length>0;var i=!!this.envelope.certificate;if(o||i){t.push({label:""});if(o){t.push({id:"download-attachments",label:"Download Documents(s)"})}if(i){t.push({id:"download-certificate",label:"Download Certificate"})}if(o&&i){t.push({id:"download-all",label:"Download All Files"})}}console.log("docs",this.envelope,this.envelope.documents);return h(Host,null,h("div",{id:"verdocs-view-header"},h(Fragment,null,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:t,onOptionSelected:function(n){return e.handleOptionSelected(n)}}))),h("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((n=this.envelope)===null||n===void 0?void 0:n.documents)||[]).filter((function(e){return e.type!=="certificate"})).map((function(n){console.log("[VIEW] Rendering document",e.envelope,n);var t=__spreadArray([],(n===null||n===void 0?void 0:n.pages)||[],true);t.sort((function(e,n){return e.sequence-n.sequence}));if(!n.processed){return h("verdocs-loader",null)}return h(Fragment,null,t.map((function(t){return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:n.id,endpoint:e.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:t.sequence,onPageRendered:function(n){return e.handlePageRendered(n)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))))};Object.defineProperty(e.prototype,"component",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsView.style=verdocsViewCss;export{VerdocsView as verdocs_view};
1
+ var __awaiter=this&&this.__awaiter||function(e,n,t,o){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o["throw"](e))}catch(e){r(e)}}function a(e){e.done?t(e.value):i(e.value).then(s,l)}a((o=o.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(e){return function(n){return a([e,n])}}function a(s){if(o)throw new TypeError("Generator is already executing.");while(t)try{if(o=1,i&&(r=s[0]&2?i["return"]:s[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;if(i=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;i=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){t.label=s[1];break}if(s[0]===6&&t.label<r[1]){t.label=r[1];r=s;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(s);break}if(r[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];i=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var o=0,i=n.length,r;o<i;o++){if(r||!(o in n)){if(!r)r=Array.prototype.slice.call(n,0,o);r[o]=n[o]}}return e.concat(r||Array.prototype.slice.call(n))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,a as getElement}from"./index-5260ed60.js";import{t as throttledGetEnvelope,e as cancelEnvelope}from"./Envelopes-c36c692e.js";import{E as EnvelopeStates}from"./Types-6dc82c14.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-ddde1255.js";import{i as saveEnvelopesAsZip,j as saveCertificate,s as saveAttachment}from"./utils-1d934f99.js";import{S as SDKError}from"./errors-9b5498c8.js";import"./Files-70a192df.js";import"./index-d264c496.js";var userIsEnvelopeOwner=function(e,n){return n.profile_id===(e===null||e===void 0?void 0:e.profile_id)};var userCanCancelEnvelope=function(e,n){return userIsEnvelopeOwner(e,n)&&n.status!==EnvelopeStates.COMPLETE&&n.status!==EnvelopeStates.DECLINED&&n.status!==EnvelopeStates.CANCELED};var verdocsViewCss='verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-view-header .inner{padding:0;width:100%;display:-ms-flexbox;display:flex;margin:0 auto;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;white-space:nowrap;text-overflow:ellipsis}';var VerdocsView=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.endpoint=VerdocsEndpoint.getDefault();this.envelopeId="";this.headerTargetId=null;this.isProcessing=false;this.envelope=null;this.roleNames=[]}e.prototype.componentWillLoad=function(){this.endpoint.loadSession()};e.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.envelopeId){console.error("[VIEW] Missing required envelopeId");return[2]}return[2,this.reloadEnvelope()]}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var n=document.getElementById("verdocs-view-header");if(e&&n){console.log("[VIEW] Moving header");n.remove();e.append(n)}};e.prototype.reloadEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,t,o,i;var r=this;return __generator(this,(function(s){switch(s.label){case 0:console.log("[VIEW] Checking for updated envelope");s.label=1;case 1:s.trys.push([1,3,,4]);o=this;return[4,throttledGetEnvelope(this.endpoint,this.envelopeId)];case 2:o.envelope=s.sent();this.roleNames=this.envelope.recipients.map((function(e){return e.role_name}));this.isProcessing=this.envelope.documents.some((function(e){return e.type==="attachment"&&!e.processed}));if(this.isProcessing){setTimeout((function(){return r.reloadEnvelope()}),3e3)}return[3,4];case 3:i=s.sent();(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(n=i.response)===null||n===void 0?void 0:n.status,(t=i.response)===null||t===void 0?void 0:t.data));return[3,4];case 4:return[2]}}))}))};e.prototype.handlePageRendered=function(e){var n=e.detail;console.log("[VIEW] Page rendered",n)};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var n,t,o;var i=this;return __generator(this,(function(r){switch(r.label){case 0:o=e.detail.id;switch(o){case"cancel":return[3,1];case"print":return[3,4];case"download-attachments":return[3,5];case"download-certificate":return[3,6];case"download-all":return[3,7]}return[3,8];case 1:if(!confirm("Are you sure you wish to cancel this envelope? This action cannot be undone."))return[3,3];return[4,cancelEnvelope(this.endpoint,this.envelopeId)];case 2:r.sent();(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"});r.label=3;case 3:return[3,8];case 4:window.print();(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,8];case 5:saveAttachment(this.endpoint,this.envelope,this.envelope.envelope_document_id).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading PDF",e)}));return[3,8];case 6:saveCertificate(this.endpoint,this.envelope,this.envelope.certificate_document_id).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading PDF",e)}));return[3,8];case 7:saveEnvelopesAsZip(this.endpoint,[this.envelope]).then((function(){var e;(e=i.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,envelope:i.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading Zip",e)}));return[3,8];case 8:return[2]}}))}))};e.prototype.render=function(){var e=this;var n;if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}var t=[{id:"print",label:"Print"}];if(userCanCancelEnvelope(this.endpoint.session,this.envelope)){t.push({id:"cancel",label:"Cancel"})}var o=this.envelope.documents.length>0;var i=!!this.envelope.certificate;if(o||i){t.push({label:""});if(o){t.push({id:"download-attachments",label:"Download Documents(s)"})}if(i){t.push({id:"download-certificate",label:"Download Certificate"})}if(o&&i){t.push({id:"download-all",label:"Download All Files"})}}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:t,onOptionSelected:function(n){return e.handleOptionSelected(n)}}))),h("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((n=this.envelope)===null||n===void 0?void 0:n.documents)||[]).filter((function(e){return e.type!=="certificate"})).map((function(n){console.log("[VIEW] Rendering document",e.envelope,n);var t=__spreadArray([],(n===null||n===void 0?void 0:n.pages)||[],true);t.sort((function(e,n){return e.sequence-n.sequence}));if(!n.processed){return h("verdocs-loader",null)}return h(Fragment,null,t.map((function(t){return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:n.id,endpoint:e.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:t.sequence,onPageRendered:function(n){return e.handlePageRendered(n)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))))};Object.defineProperty(e.prototype,"component",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsView.style=verdocsViewCss;export{VerdocsView as verdocs_view};