@verdocs/web-sdk 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{VerdocsEndpoint-4b97517d.js → VerdocsEndpoint-3b44fa63.js} +36 -1
- package/dist/cjs/VerdocsEndpoint-3b44fa63.js.map +1 -0
- package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-dropdown_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
- package/dist/components/VerdocsEndpoint.js +35 -0
- package/dist/components/VerdocsEndpoint.js.map +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{VerdocsEndpoint-9353e4a0.js → VerdocsEndpoint-47652116.js} +36 -1
- package/dist/esm/VerdocsEndpoint-47652116.js.map +1 -0
- package/dist/esm/verdocs-auth.entry.js +1 -1
- package/dist/esm/verdocs-dropdown_4.entry.js +1 -1
- package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm/verdocs-search.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/VerdocsEndpoint-47652116.js +2 -0
- package/dist/esm-es5/VerdocsEndpoint-47652116.js.map +1 -0
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-dropdown_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-search.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/typings.d.ts +4 -0
- package/dist/verdocs-web-sdk/p-0df2b27c.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-72115808.system.entry.js → p-151e5f05.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-72115808.system.entry.js.map → p-151e5f05.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-07f55897.entry.js → p-54de17e5.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-07f55897.entry.js.map → p-54de17e5.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-8a0d8814.system.js +2 -0
- package/dist/verdocs-web-sdk/p-8a0d8814.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-ba477710.system.entry.js → p-922fe2fd.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ba477710.system.entry.js.map → p-922fe2fd.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-9d801657.system.entry.js → p-a60eade9.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9d801657.system.entry.js.map → p-a60eade9.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-a6da7b45.js +2 -0
- package/dist/verdocs-web-sdk/p-a6da7b45.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-24d7c3b0.entry.js → p-a99b8eff.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-24d7c3b0.entry.js.map → p-a99b8eff.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-bd2004b7.entry.js → p-b1e94023.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-bd2004b7.entry.js.map → p-b1e94023.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-c3e77379.system.entry.js → p-bf344dd9.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c3e77379.system.entry.js.map → p-bf344dd9.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-b3419893.entry.js → p-d89fef13.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b3419893.entry.js.map → p-d89fef13.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-1f4039a4.system.entry.js → p-dc0bcc2a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-1f4039a4.system.entry.js.map → p-dc0bcc2a.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-4e29c137.entry.js → p-fd708d32.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4e29c137.entry.js.map → p-fd708d32.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/VerdocsEndpoint-4b97517d.js.map +0 -1
- package/dist/custom-elements.json +0 -825
- package/dist/esm/VerdocsEndpoint-9353e4a0.js.map +0 -1
- package/dist/esm-es5/VerdocsEndpoint-9353e4a0.js +0 -2
- package/dist/esm-es5/VerdocsEndpoint-9353e4a0.js.map +0 -1
- package/dist/verdocs-web-sdk/p-64127985.system.js +0 -2
- package/dist/verdocs-web-sdk/p-64127985.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-7f162244.js +0 -2
- package/dist/verdocs-web-sdk/p-7f162244.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r["throw"](e))}catch(e){o(e)}}function a(e){e.done?n(e.value):i(e.value).then(s,c)}a((r=r.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:[]},r,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(t){return a([e,t])}}function a(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-af5f4964.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-9353e4a0.js";var getTemplates=function(e,t){return e.api.get("/templates/",{params:t}).then((function(e){return e.data}))};var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r["throw"](e))}catch(e){o(e)}}function a(e){e.done?n(e.value):i(e.value).then(s,c)}a((r=r.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:[]},r,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(t){return a([e,t])}}function a(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var getSearchHistory=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,e.api.get("/search/history").then((function(e){return e.data}))]}))}))};var TemplateIcon='<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/><g><path d="M19,5v14H5V5H19 M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z"/></g><path d="M14,17H7v-2h7V17z M17,13H7v-2h10V13z M17,9H7V7h10V9z"/></g></svg>';var DocumentIcon$1='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsQuickFunctionsCss='verdocs-quick-functions{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-quick-functions .container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;width:240px;background-color:#1e2031;text-transform:uppercase;padding:10px 10px 20px 10px;font-family:sans-serif;color:#ffffff}verdocs-quick-functions .title{font-size:22px;font-weight:700;line-height:30px;margin:1em 0 40px 0}verdocs-quick-functions button{width:140px;height:40px;border:none;display:-ms-flexbox;display:flex;color:#ffffff;cursor:pointer;font-size:14px;font-weight:700;line-height:25px;-ms-flex-align:center;align-items:center;margin-bottom:20px;border-radius:5px;text-transform:uppercase;-ms-flex-pack:space-evenly;justify-content:space-evenly;background-color:#55bc81}verdocs-quick-functions button svg{fill:#ffffff}';var VerdocsQuickFunctions=function(){function e(e){registerInstance(this,e);this.createTemplate=createEvent(this,"createTemplate",7);this.createDocument=createEvent(this,"createDocument",7);this.endpoint=VerdocsEndpoint.getDefault()}e.prototype.handleCreateTemplate=function(){this.createTemplate.emit()};e.prototype.handleCreateDocument=function(){this.createDocument.emit()};e.prototype.render=function(){var e=this;return h("div",{class:"container"},h("p",{class:"title"},"Quick Create"),h("button",{onClick:function(){return e.handleCreateTemplate()},innerHTML:TemplateIcon},"Template"),h("button",{onClick:function(){return e.handleCreateDocument()},innerHTML:DocumentIcon$1},"Document"))};return e}();VerdocsQuickFunctions.style=verdocsQuickFunctionsCss;var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsSearchActivityCss='verdocs-search-activity{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-activity .container{display:-ms-flexbox;display:flex;width:240px;color:#ffffff;-ms-flex-direction:column;flex-direction:column;text-transform:uppercase;padding:10px 10px 20px 10px;background-color:#1e2031}verdocs-search-activity .title{font-size:22px;font-weight:700;line-height:30px}verdocs-search-activity .items{display:-ms-flexbox;display:flex;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item{border:none;display:-ms-flexbox;display:flex;text-align:left;margin-bottom:20px;-ms-flex-direction:row;flex-direction:row;background:transparent}verdocs-search-activity .item:hover{cursor:pointer}verdocs-search-activity .icon{-ms-flex:0 0 22px;flex:0 0 22px;margin-right:14px}verdocs-search-activity .icon svg{fill:#707ae5;width:22px;height:22px}verdocs-search-activity .details{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item-title{font-size:16px;font-weight:400;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-search-activity .info{font-size:14px;font-weight:500;line-height:23px;color:#aeb4bf}verdocs-search-activity .empty{text-transform:none;line-height:22px;color:#cccccc}';var VerdocsSearchActivity=function(){function e(e){registerInstance(this,e);this.entrySelected=createEvent(this,"entrySelected",7);this.endpoint=VerdocsEndpoint.getDefault();this.type="recent";this.emptyMessage="You do not have any starred searches.";this.authFailure=false;this.title="Recent Searches";this.recent=[];this.saved=[];this.starred=[]}e.prototype.componentWillLoad=function(){var e=this;this.endpoint.loadSession();var t=function(t){var n;console.warn("[Verdocs/search-activity] Error getting search data",t);if(((n=t===null||t===void 0?void 0:t.response)===null||n===void 0?void 0:n.status)===401){e.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";getSearchHistory(this.endpoint).then((function(t){return e.recent=t.recent})).catch(t);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";getSearchHistory(this.endpoint).then((function(t){return e.saved=t.saved})).catch(t);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";getTemplates(this.endpoint,{is_starred:true}).then((function(t){return e.starred=t})).catch(t);break}};e.prototype.handleSelectEntry=function(e){this.entrySelected.emit(e)};e.prototype.computePagesText=function(e){if(e<2){return"".concat(e," Page")}else{return"".concat(e," Pages")}};e.prototype.computeRecipientsText=function(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return"".concat(e," Recipients")}else{return"".concat(e," Recipient")}};e.prototype.render=function(){var e=this;var t=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return h("div",{class:"container"},h("p",{class:"title"},this.title),h("div",{class:"items"},this.recent.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"},"Test")))})),this.saved.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"})))})),t&&h("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))};return e}();VerdocsSearchActivity.style=verdocsSearchActivityCss;var SearchIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M23.4809 20.7176L17.9111 15.2536C19.0961 13.6368 19.727 11.6926 19.7128 9.70131C19.7201 7.53345 18.9846 5.42606 17.6244 3.71753C16.2642 2.009 14.3581 0.798456 12.2123 0.280282C10.0665 -0.237892 7.80552 -0.0336342 5.79227 0.86026C3.77902 1.75415 2.13038 3.28582 1.1111 5.20931C0.0918114 7.1328 -0.238985 9.33652 0.171813 11.4666C0.582612 13.5967 1.71117 15.5296 3.37628 16.9548C5.0414 18.3801 7.14646 19.2151 9.35344 19.3257C11.5604 19.4364 13.7413 18.8162 15.5458 17.5649L21.1372 23.05L21.1563 23.0663C21.4841 23.3487 21.9039 23.507 22.3401 23.5128C22.7823 23.5125 23.2063 23.3402 23.5191 23.0337V23.0337C23.6749 22.8812 23.7979 22.6995 23.8804 22.4993C23.963 22.2991 24.0036 22.0847 23.9997 21.8688C23.9959 21.6529 23.9477 21.44 23.858 21.2428C23.7683 21.0456 23.639 20.8682 23.4778 20.7212L23.4809 20.7176ZM14.5167 14.1975C13.4564 15.2349 12.0623 15.8797 10.5719 16.022C9.08145 16.1644 7.58681 15.7955 6.34249 14.9781C5.09816 14.1608 4.18109 12.9456 3.74751 11.5395C3.31393 10.1334 3.39064 8.6233 3.96455 7.26643C4.53846 5.90955 5.57409 4.7898 6.89507 4.09787C8.21606 3.40594 9.74071 3.18461 11.2093 3.4716C12.678 3.75858 13.9998 4.53612 14.9497 5.6718C15.8996 6.80748 16.4188 8.23105 16.4189 9.7001C16.4196 10.5357 16.2519 11.3632 15.9254 12.135C15.599 12.9069 15.1202 13.6078 14.5167 14.1975V14.1975Z" fill="white"/>\n</svg>\n';var CloseIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0739 11.7565L19.7127 6.23228C20.0875 5.85692 20.0875 5.25309 19.7127 4.87773L19.0213 4.20046C18.6382 3.82511 18.0219 3.82511 17.6387 4.20046L12 9.72472L6.36127 4.20046C5.97814 3.82511 5.36179 3.82511 4.97866 4.20046L4.28735 4.87773C3.90422 5.25309 3.90422 5.85692 4.28735 6.23228L9.92608 11.7565L4.28735 17.2808C3.90422 17.6561 3.90422 18.26 4.28735 18.6353L4.97866 19.3126C5.36179 19.688 5.97814 19.688 6.36127 19.3126L12 13.7883L17.6387 19.3126C18.0219 19.688 18.6382 19.688 19.0213 19.3126L19.7127 18.6353C20.0958 18.26 20.0958 17.6561 19.7127 17.2808L14.0739 11.7565Z" fill="white"/>\n</svg>\n';var verdocsSearchBoxCss='verdocs-search-box{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-box form{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:45px;-webkit-box-sizing:border-box;box-sizing:border-box;margin:5px 0 0;border-radius:5px;-ms-flex-align:center;align-items:center;background-color:#fff;padding:0 8px;border-width:1px;border-style:solid;border-color:#707ae5}verdocs-search-box form input{-webkit-box-sizing:border-box;box-sizing:border-box;height:43px;width:100%;font-size:18px;border:none}verdocs-search-box form input:focus{outline:none}verdocs-search-box form button.search{cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;border:none;width:100px;height:28px;font-weight:700;font-size:10px;letter-spacing:1px;background-color:#55bc81;text-transform:uppercase;color:#fff}verdocs-search-box form .type{background-color:#707ae5;height:30px;display:-ms-inline-flexbox;display:inline-flex;padding:1px 0 2px 10px;font-size:13px;line-height:16px;border-radius:4px;-ms-flex-pack:center;justify-content:center;text-transform:uppercase;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#fff;margin-right:10px}verdocs-search-box form .type button{border:none;color:#fff;margin:5px 0 0 8px;background:transparent}verdocs-search-box form svg{width:12px;height:12px;margin-right:6px}verdocs-search-box ::-webkit-input-placeholder{color:#aeb4bf}verdocs-search-box ::-moz-placeholder{color:#aeb4bf}verdocs-search-box :-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::placeholder{color:#aeb4bf}';var VerdocsSearchBox=function(){function e(e){registerInstance(this,e);this.searchClicked=createEvent(this,"searchClicked",7);this.typeChanged=createEvent(this,"typeChanged",7);this.queryChanged=createEvent(this,"queryChanged",7);this.endpoint=VerdocsEndpoint.getDefault();this.placeholder="search documents, templates, people...";this.type="all";this.query="";this.grabsFocus=false}e.prototype.focusField=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.inputEl.focus();return[2]}))}))};e.prototype.componentDidRender=function(){if(this.grabsFocus){this.inputEl.focus()}};e.prototype.handleSearch=function(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false};e.prototype.handleChange=function(e){this.queryChanged.emit(e.target.value)};e.prototype.handleClearFilter=function(){this.typeChanged.emit("all")};e.prototype.handleKeyUp=function(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}};e.prototype.render=function(){var e=this;return h("form",{onSubmit:function(t){return e.handleSearch(t)}},this.type!==undefined&&this.type!=="all"&&h("span",{class:"type"},this.type,"s ",h("button",{class:"remove",innerHTML:CloseIcon,onClick:function(){return e.handleClearFilter()}})),h("input",{type:"text",value:this.query,placeholder:this.placeholder,onInput:function(t){return e.handleChange(t)},onKeyUp:function(t){return e.handleKeyUp(t)},ref:function(t){return e.inputEl=t}}),h("button",{onClick:function(t){return e.handleSearch(t)},class:"search"},h("span",{innerHTML:SearchIcon}),"Search"))};return e}();VerdocsSearchBox.style=verdocsSearchBoxCss;export{VerdocsQuickFunctions as verdocs_quick_functions,VerdocsSearchActivity as verdocs_search_activity,VerdocsSearchBox as verdocs_search_box};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r["throw"](e))}catch(e){o(e)}}function a(e){e.done?n(e.value):i(e.value).then(s,c)}a((r=r.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:[]},r,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(t){return a([e,t])}}function a(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-af5f4964.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-47652116.js";var getTemplates=function(e,t){return e.api.get("/templates/",{params:t}).then((function(e){return e.data}))};var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r["throw"](e))}catch(e){o(e)}}function a(e){e.done?n(e.value):i(e.value).then(s,c)}a((r=r.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:[]},r,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(t){return a([e,t])}}function a(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var getSearchHistory=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,e.api.get("/search/history").then((function(e){return e.data}))]}))}))};var TemplateIcon='<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/><g><path d="M19,5v14H5V5H19 M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z"/></g><path d="M14,17H7v-2h7V17z M17,13H7v-2h10V13z M17,9H7V7h10V9z"/></g></svg>';var DocumentIcon$1='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsQuickFunctionsCss='verdocs-quick-functions{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-quick-functions .container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;width:240px;background-color:#1e2031;text-transform:uppercase;padding:10px 10px 20px 10px;font-family:sans-serif;color:#ffffff}verdocs-quick-functions .title{font-size:22px;font-weight:700;line-height:30px;margin:1em 0 40px 0}verdocs-quick-functions button{width:140px;height:40px;border:none;display:-ms-flexbox;display:flex;color:#ffffff;cursor:pointer;font-size:14px;font-weight:700;line-height:25px;-ms-flex-align:center;align-items:center;margin-bottom:20px;border-radius:5px;text-transform:uppercase;-ms-flex-pack:space-evenly;justify-content:space-evenly;background-color:#55bc81}verdocs-quick-functions button svg{fill:#ffffff}';var VerdocsQuickFunctions=function(){function e(e){registerInstance(this,e);this.createTemplate=createEvent(this,"createTemplate",7);this.createDocument=createEvent(this,"createDocument",7);this.endpoint=VerdocsEndpoint.getDefault()}e.prototype.handleCreateTemplate=function(){this.createTemplate.emit()};e.prototype.handleCreateDocument=function(){this.createDocument.emit()};e.prototype.render=function(){var e=this;return h("div",{class:"container"},h("p",{class:"title"},"Quick Create"),h("button",{onClick:function(){return e.handleCreateTemplate()},innerHTML:TemplateIcon},"Template"),h("button",{onClick:function(){return e.handleCreateDocument()},innerHTML:DocumentIcon$1},"Document"))};return e}();VerdocsQuickFunctions.style=verdocsQuickFunctionsCss;var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsSearchActivityCss='verdocs-search-activity{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-activity .container{display:-ms-flexbox;display:flex;width:240px;color:#ffffff;-ms-flex-direction:column;flex-direction:column;text-transform:uppercase;padding:10px 10px 20px 10px;background-color:#1e2031}verdocs-search-activity .title{font-size:22px;font-weight:700;line-height:30px}verdocs-search-activity .items{display:-ms-flexbox;display:flex;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item{border:none;display:-ms-flexbox;display:flex;text-align:left;margin-bottom:20px;-ms-flex-direction:row;flex-direction:row;background:transparent}verdocs-search-activity .item:hover{cursor:pointer}verdocs-search-activity .icon{-ms-flex:0 0 22px;flex:0 0 22px;margin-right:14px}verdocs-search-activity .icon svg{fill:#707ae5;width:22px;height:22px}verdocs-search-activity .details{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item-title{font-size:16px;font-weight:400;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-search-activity .info{font-size:14px;font-weight:500;line-height:23px;color:#aeb4bf}verdocs-search-activity .empty{text-transform:none;line-height:22px;color:#cccccc}';var VerdocsSearchActivity=function(){function e(e){registerInstance(this,e);this.entrySelected=createEvent(this,"entrySelected",7);this.endpoint=VerdocsEndpoint.getDefault();this.type="recent";this.emptyMessage="You do not have any starred searches.";this.authFailure=false;this.title="Recent Searches";this.recent=[];this.saved=[];this.starred=[]}e.prototype.componentWillLoad=function(){var e=this;this.endpoint.loadSession();var t=function(t){var n;console.warn("[Verdocs/search-activity] Error getting search data",t);if(((n=t===null||t===void 0?void 0:t.response)===null||n===void 0?void 0:n.status)===401){e.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";getSearchHistory(this.endpoint).then((function(t){return e.recent=t.recent})).catch(t);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";getSearchHistory(this.endpoint).then((function(t){return e.saved=t.saved})).catch(t);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";getTemplates(this.endpoint,{is_starred:true}).then((function(t){return e.starred=t})).catch(t);break}};e.prototype.handleSelectEntry=function(e){this.entrySelected.emit(e)};e.prototype.computePagesText=function(e){if(e<2){return"".concat(e," Page")}else{return"".concat(e," Pages")}};e.prototype.computeRecipientsText=function(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return"".concat(e," Recipients")}else{return"".concat(e," Recipient")}};e.prototype.render=function(){var e=this;var t=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return h("div",{class:"container"},h("p",{class:"title"},this.title),h("div",{class:"items"},this.recent.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"},"Test")))})),this.saved.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"})))})),t&&h("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))};return e}();VerdocsSearchActivity.style=verdocsSearchActivityCss;var SearchIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M23.4809 20.7176L17.9111 15.2536C19.0961 13.6368 19.727 11.6926 19.7128 9.70131C19.7201 7.53345 18.9846 5.42606 17.6244 3.71753C16.2642 2.009 14.3581 0.798456 12.2123 0.280282C10.0665 -0.237892 7.80552 -0.0336342 5.79227 0.86026C3.77902 1.75415 2.13038 3.28582 1.1111 5.20931C0.0918114 7.1328 -0.238985 9.33652 0.171813 11.4666C0.582612 13.5967 1.71117 15.5296 3.37628 16.9548C5.0414 18.3801 7.14646 19.2151 9.35344 19.3257C11.5604 19.4364 13.7413 18.8162 15.5458 17.5649L21.1372 23.05L21.1563 23.0663C21.4841 23.3487 21.9039 23.507 22.3401 23.5128C22.7823 23.5125 23.2063 23.3402 23.5191 23.0337V23.0337C23.6749 22.8812 23.7979 22.6995 23.8804 22.4993C23.963 22.2991 24.0036 22.0847 23.9997 21.8688C23.9959 21.6529 23.9477 21.44 23.858 21.2428C23.7683 21.0456 23.639 20.8682 23.4778 20.7212L23.4809 20.7176ZM14.5167 14.1975C13.4564 15.2349 12.0623 15.8797 10.5719 16.022C9.08145 16.1644 7.58681 15.7955 6.34249 14.9781C5.09816 14.1608 4.18109 12.9456 3.74751 11.5395C3.31393 10.1334 3.39064 8.6233 3.96455 7.26643C4.53846 5.90955 5.57409 4.7898 6.89507 4.09787C8.21606 3.40594 9.74071 3.18461 11.2093 3.4716C12.678 3.75858 13.9998 4.53612 14.9497 5.6718C15.8996 6.80748 16.4188 8.23105 16.4189 9.7001C16.4196 10.5357 16.2519 11.3632 15.9254 12.135C15.599 12.9069 15.1202 13.6078 14.5167 14.1975V14.1975Z" fill="white"/>\n</svg>\n';var CloseIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0739 11.7565L19.7127 6.23228C20.0875 5.85692 20.0875 5.25309 19.7127 4.87773L19.0213 4.20046C18.6382 3.82511 18.0219 3.82511 17.6387 4.20046L12 9.72472L6.36127 4.20046C5.97814 3.82511 5.36179 3.82511 4.97866 4.20046L4.28735 4.87773C3.90422 5.25309 3.90422 5.85692 4.28735 6.23228L9.92608 11.7565L4.28735 17.2808C3.90422 17.6561 3.90422 18.26 4.28735 18.6353L4.97866 19.3126C5.36179 19.688 5.97814 19.688 6.36127 19.3126L12 13.7883L17.6387 19.3126C18.0219 19.688 18.6382 19.688 19.0213 19.3126L19.7127 18.6353C20.0958 18.26 20.0958 17.6561 19.7127 17.2808L14.0739 11.7565Z" fill="white"/>\n</svg>\n';var verdocsSearchBoxCss='verdocs-search-box{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-box form{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:45px;-webkit-box-sizing:border-box;box-sizing:border-box;margin:5px 0 0;border-radius:5px;-ms-flex-align:center;align-items:center;background-color:#fff;padding:0 8px;border-width:1px;border-style:solid;border-color:#707ae5}verdocs-search-box form input{-webkit-box-sizing:border-box;box-sizing:border-box;height:43px;width:100%;font-size:18px;border:none}verdocs-search-box form input:focus{outline:none}verdocs-search-box form button.search{cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;border:none;width:100px;height:28px;font-weight:700;font-size:10px;letter-spacing:1px;background-color:#55bc81;text-transform:uppercase;color:#fff}verdocs-search-box form .type{background-color:#707ae5;height:30px;display:-ms-inline-flexbox;display:inline-flex;padding:1px 0 2px 10px;font-size:13px;line-height:16px;border-radius:4px;-ms-flex-pack:center;justify-content:center;text-transform:uppercase;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#fff;margin-right:10px}verdocs-search-box form .type button{border:none;color:#fff;margin:5px 0 0 8px;background:transparent}verdocs-search-box form svg{width:12px;height:12px;margin-right:6px}verdocs-search-box ::-webkit-input-placeholder{color:#aeb4bf}verdocs-search-box ::-moz-placeholder{color:#aeb4bf}verdocs-search-box :-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::placeholder{color:#aeb4bf}';var VerdocsSearchBox=function(){function e(e){registerInstance(this,e);this.searchClicked=createEvent(this,"searchClicked",7);this.typeChanged=createEvent(this,"typeChanged",7);this.queryChanged=createEvent(this,"queryChanged",7);this.endpoint=VerdocsEndpoint.getDefault();this.placeholder="search documents, templates, people...";this.type="all";this.query="";this.grabsFocus=false}e.prototype.focusField=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.inputEl.focus();return[2]}))}))};e.prototype.componentDidRender=function(){if(this.grabsFocus){this.inputEl.focus()}};e.prototype.handleSearch=function(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false};e.prototype.handleChange=function(e){this.queryChanged.emit(e.target.value)};e.prototype.handleClearFilter=function(){this.typeChanged.emit("all")};e.prototype.handleKeyUp=function(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}};e.prototype.render=function(){var e=this;return h("form",{onSubmit:function(t){return e.handleSearch(t)}},this.type!==undefined&&this.type!=="all"&&h("span",{class:"type"},this.type,"s ",h("button",{class:"remove",innerHTML:CloseIcon,onClick:function(){return e.handleClearFilter()}})),h("input",{type:"text",value:this.query,placeholder:this.placeholder,onInput:function(t){return e.handleChange(t)},onKeyUp:function(t){return e.handleKeyUp(t)},ref:function(t){return e.inputEl=t}}),h("button",{onClick:function(t){return e.handleSearch(t)},class:"search"},h("span",{innerHTML:SearchIcon}),"Search"))};return e}();VerdocsSearchBox.style=verdocsSearchBoxCss;export{VerdocsQuickFunctions as verdocs_quick_functions,VerdocsSearchActivity as verdocs_search_activity,VerdocsSearchBox as verdocs_search_box};
|
|
2
2
|
//# sourceMappingURL=verdocs-quick-functions_3.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as registerInstance,h}from"./index-af5f4964.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-
|
|
1
|
+
import{r as registerInstance,h}from"./index-af5f4964.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-47652116.js";var verdocsSearchCss='verdocs-search{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;background-color:#1e2031}verdocs-search search-box{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:20px 10px}verdocs-search .boxes{-ms-flex-wrap:wrap;flex-wrap:wrap;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin:20px 0}verdocs-search search-recent,verdocs-search search-saved,verdocs-search search-quick-functions,verdocs-search search-starred{display:-ms-flexbox;display:flex;margin:0 20px 20px 0}';var VerdocsSearch=function(){function e(e){registerInstance(this,e);this.endpoint=VerdocsEndpoint.getDefault()}e.prototype.render=function(){return h("div",{class:"container"},h("verdocs-search-box",{endpoint:this.endpoint}),h("div",{class:"boxes"},h("verdocs-search-activity",{type:"recent",endpoint:this.endpoint}),h("verdocs-search-activity",{type:"saved",endpoint:this.endpoint}),h("verdocs-search-activity",{type:"starred",endpoint:this.endpoint}),h("verdocs-quick-functions",{endpoint:this.endpoint})))};return e}();VerdocsSearch.style=verdocsSearchCss;export{VerdocsSearch as verdocs_search};
|
|
2
2
|
//# sourceMappingURL=verdocs-search.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):i(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-af5f4964.js";import{V as VerdocsEndpoint,g as getSigningSession,a as getDocument,u as updateRecipientStatus,b as getDocumentFile,c as updateDocumentField}from"./VerdocsEndpoint-9353e4a0.js";var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.endpoint=VerdocsEndpoint.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,r;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,getSigningSession(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=s.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=o;this.endpoint.setToken(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.endpoint,this.documentId)];case 2:i=s.sent();this.document=i;console.log("[SIGN] Signing document",i);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=s.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,o;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:s,order:o,value:n.checked,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:s,order:o,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,s,l,c,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var h=(((l=(s=e.settings)===null||s===void 0?void 0:s.options)===null||l===void 0?void 0:l.filter((function(e){return e.checked})))||[]).length;return h>=(((c=e.settings)===null||c===void 0?void 0:c.minimum_checked)||0)&&h<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required field",i);if(i){var r=this.getFieldId(i);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=i.name}};e.prototype.setControlStyles=function(e,t,n){var o=t.settings,i=o.x,r=i===void 0?0:i,a=o.y,s=a===void 0?0:a,l=o.width,c=l===void 0?150:l,d=o.height,u=d===void 0?50:d;e.style.width="".concat(c,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(rescale(n.xScale,r),"px");e.style.bottom="".concat(rescale(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||getRGBA(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var o=document.getElementById(t.containerId+"-controls");if(!o){return}var i=this.getFieldId(e);var r=document.getElementById(i);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",i);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);o.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var o=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",o);o.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,n,o,i;var r=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"header"},h("div",{class:"intro"},"Please review and act on these documents."),h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:r,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{class:"agree"},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),h("span",null,"I agree to use electronic records and signatures.")):h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:function(){return e.handleNext()}})))),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):h("verdocs-loader",null)))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):i(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-af5f4964.js";import{V as VerdocsEndpoint,g as getSigningSession,a as getDocument,u as updateRecipientStatus,b as getDocumentFile,c as updateDocumentField}from"./VerdocsEndpoint-47652116.js";var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.endpoint=VerdocsEndpoint.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,r;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,getSigningSession(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=s.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=o;this.endpoint.setToken(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.endpoint,this.documentId)];case 2:i=s.sent();this.document=i;console.log("[SIGN] Signing document",i);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=s.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,o;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:s,order:o,value:n.checked,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:s,order:o,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,s,l,c,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var h=(((l=(s=e.settings)===null||s===void 0?void 0:s.options)===null||l===void 0?void 0:l.filter((function(e){return e.checked})))||[]).length;return h>=(((c=e.settings)===null||c===void 0?void 0:c.minimum_checked)||0)&&h<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required field",i);if(i){var r=this.getFieldId(i);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=i.name}};e.prototype.setControlStyles=function(e,t,n){var o=t.settings,i=o.x,r=i===void 0?0:i,a=o.y,s=a===void 0?0:a,l=o.width,c=l===void 0?150:l,d=o.height,u=d===void 0?50:d;e.style.width="".concat(c,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(rescale(n.xScale,r),"px");e.style.bottom="".concat(rescale(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||getRGBA(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var o=document.getElementById(t.containerId+"-controls");if(!o){return}var i=this.getFieldId(e);var r=document.getElementById(i);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",i);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);o.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var o=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",o);o.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,n,o,i;var r=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"header"},h("div",{class:"intro"},"Please review and act on these documents."),h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:r,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{class:"agree"},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),h("span",null,"I agree to use electronic records and signatures.")):h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:function(){return e.handleNext()}})))),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):h("verdocs-loader",null)))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
2
2
|
//# sourceMappingURL=verdocs-sign.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./p-eef0b919.system.js"],(function(e,d){"use strict";var s,t;return{setters:[function(e){s=e.p;t=e.b}],execute:function(){var e=function(){var e=d.meta.url;var t={};if(e!==""){t.resourcesUrl=new URL(".",e).href}return s(t)};e().then((function(e){return t([["p-
|
|
1
|
+
System.register(["./p-eef0b919.system.js"],(function(e,d){"use strict";var s,t;return{setters:[function(e){s=e.p;t=e.b}],execute:function(){var e=function(){var e=d.meta.url;var t={};if(e!==""){t.resourcesUrl=new URL(".",e).href}return s(t)};e().then((function(e){return t([["p-151e5f05.system",[[0,"verdocs-sign",{endpoint:[16],documentId:[1,"document-id"],roleId:[1,"role-id"],inviteCode:[1,"invite-code"],recipient:[32],signerToken:[32],pdfUrl:[32],recipientIndex:[32],document:[32],fields:[32],hasSignature:[32],nextButtonLabel:[32],focusedField:[32]}]]],["p-dc0bcc2a.system",[[0,"verdocs-auth",{endpoint:[16],visible:[4],logo:[1],debug:[4],isAuthenticated:[32],displayMode:[32],username:[32],password:[32],loggingIn:[32],activeSession:[32],loginError:[32]}]]],["p-fee6012f.system",[[0,"verdocs-field-initial",{required:[4],fullName:[1,"full-name"],value:[1],focusField:[64]}]]],["p-a3f64ad7.system",[[0,"verdocs-field-signature",{field:[16],recipient:[16],tempSignature:[32],focusField:[64]}]]],["p-922fe2fd.system",[[0,"verdocs-search",{endpoint:[16]}]]],["p-b347f7d8.system",[[0,"verdocs-field-attachment",{field:[16],order:[2],value:[1],required:[4],disabled:[4],focusField:[64]}]]],["p-e251c0ed.system",[[0,"verdocs-kba-dialog",{step:[2],steps:[2],helptitle:[1],helptext:[1],mode:[1],label:[1],placeholder:[1],choices:[16],open:[4],response:[32]}]]],["p-5160b7bd.system",[[0,"verdocs-field-date",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}]]],["p-9660162f.system",[[0,"verdocs-field-dropdown",{options:[16],required:[4],order:[2],disabled:[4],value:[1],focused:[32],focusField:[64]}]]],["p-a394a4ba.system",[[0,"verdocs-field-payment",{field:[16],fields:[16],pageNum:[2,"page-num"],roleName:[1,"role-name"],fieldId:[1,"field-id"],recipients:[8],selectedRoleName:[1,"selected-role-name"],pdfPages:[16],currentSignature:[1,"current-signature"],currentSignatureId:[1,"current-signature-id"],currentInitial:[1,"current-initial"],currentInitialId:[1,"current-initial-id"],focused:[4],signed:[4],preparedMessage:[32],signatureUrl:[32]}]]],["p-fa5dc225.system",[[0,"verdocs-field-textarea",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}]]],["p-a00e94fa.system",[[0,"verdocs-field-textbox",{field:[16],focused:[32],focusField:[64]}]]],["p-980bc364.system",[[0,"verdocs-field-timestamp",{field:[16],focused:[32],focusField:[64]}]]],["p-fb6927da.system",[[0,"verdocs-organization-card",{organization:[16]}]]],["p-3ce43f4b.system",[[0,"verdocs-search-tabs",{selected:[32]}]]],["p-7ea7db5c.system",[[0,"verdocs-status-indicator",{size:[1],theme:[1],status:[1],document:[16],isOpen:[32],recipientStatusIcons:[32],containerId:[32]}]]],["p-fdb32f3f.system",[[0,"verdocs-template-card",{template:[16]}]]],["p-d61aad62.system",[[0,"verdocs-template-tags",{tags:[16]}]]],["p-cb371aae.system",[[0,"verdocs-toggle",{options:[16],theme:[1]},[[6,"click","handleClick"]]]]],["p-0d6d5814.system",[[0,"verdocs-text-input",{value:[1],label:[1],placeholder:[1],autocomplete:[1],type:[1],disabled:[4],_value:[32]}]]],["p-6859482c.system",[[0,"verdocs-button",{label:[1],startIcon:[1,"start-icon"],endIcon:[1,"end-icon"],size:[1],type:[1],variant:[1],disabled:[4]}]]],["p-df215940.system",[[0,"verdocs-initial-dialog",{fullname:[1],open:[4],fontLoaded:[32],enteredInitials:[32],mode:[32]}]]],["p-99aef995.system",[[0,"verdocs-signature-dialog",{fullName:[1,"full-name"],open:[4],fontLoaded:[32],enteredName:[32],mode:[32]}]]],["p-31e5873f.system",[[0,"verdocs-ok-dialog",{heading:[1],message:[1],open:[4],cancel:[4]}]]],["p-68f4e8fc.system",[[0,"verdocs-upload-dialog",{open:[4],draggingOver:[32],decodedFiles:[32]}]]],["p-bf344dd9.system",[[0,"verdocs-quick-functions",{endpoint:[16]}],[0,"verdocs-search-activity",{endpoint:[16],type:[1],options:[8],emptyMessage:[32],authFailure:[32],title:[32],recent:[32],saved:[32],starred:[32]}],[0,"verdocs-search-box",{endpoint:[16],placeholder:[1],type:[1],query:[1],grabsFocus:[4,"grabs-focus"],focusField:[64]}]]],["p-68fc7efc.system",[[0,"verdocs-document-page",{pageNumber:[2,"page-number"],virtualWidth:[2,"virtual-width"],virtualHeight:[2,"virtual-height"],layers:[16],containerId:[32],renderedWidth:[32],renderedHeight:[32],skipFirstNotification:[32]}],[0,"verdocs-loader"]]],["p-a60eade9.system",[[0,"verdocs-view",{endpoint:[16],rotation:[2],pageLayers:[16],source:[1],loadProgress:[32],numPages:[32]}],[0,"verdocs-dropdown",{options:[16],open:[4],isOpen:[32]}],[0,"verdocs-field-checkbox",{order:[2],value:[4],required:[4],disabled:[4]}],[0,"verdocs-field-radio-button",{order:[2],checked:[4],value:[1],name:[1],required:[4],disabled:[4]}]]]],e)}))}}}));
|
|
2
2
|
//# sourceMappingURL=p-0df2b27c.system.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o["throw"](e))}catch(e){r(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-eef0b919.system.js","./p-64127985.system.js"],(function(e){"use strict";var t,n,o,i,r,a,s,c,l;return{setters:[function(e){t=e.r;n=e.h;o=e.H},function(e){i=e.V;r=e.g;a=e.a;s=e.u;c=e.b;l=e.c}],execute:function(){var d=new RegExp(/\+[1-9]\d{6,14}/g);function u(e){return e!==null&&e.length<16&&e.length>6&&d.test(e)||e===""||e===null}var p=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var h=function(e){return p.test(e)};var g=function(e){return u(e)};function f(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function v(e,t){return e*t}var b='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var x=e("verdocs_sign",function(){function e(e){t(this,e);this.endpoint=i.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,s;var c=this;return __generator(this,(function(l){switch(l.label){case 0:l.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,r(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=l.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=o;this.endpoint.setToken(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,a(this.endpoint,this.documentId)];case 2:i=l.sent();this.document=i;console.log("[SIGN] Signing document",i);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==c.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===c.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:s=l.sent();console.log("Error with signing session",s);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");s(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,c(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":l(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,o;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":l(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,o,i){var r=this;var a=v(e.xScale,o.x);var s=v(e.yScale,o.y);var c={left:"".concat(a,"px"),bottom:"".concat(s,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:f(this.recipientIndex)};return n("verdocs-field-checkbox",{style:c,order:i,value:o.checked,onFieldChange:function(e){return r.handleFieldChange(t,e,o.id)}})};e.prototype.renderRadioGroupOption=function(e,t,o,i){var r=this;var a=v(e.xScale,o.x);var s=v(e.yScale,o.y);var c={left:"".concat(a,"px"),bottom:"".concat(s,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:f(this.recipientIndex)};return n("verdocs-field-radio-button",{style:c,order:i,value:o.id,name:t.name,checked:o.selected,onFieldChange:function(e){return r.handleFieldChange(t,e,o.id)}})};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,s,c,l,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return h(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return g(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var f=(((c=(s=e.settings)===null||s===void 0?void 0:s.options)===null||c===void 0?void 0:c.filter((function(e){return e.checked})))||[]).length;return f>=(((l=e.settings)===null||l===void 0?void 0:l.minimum_checked)||0)&&f<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required field",i);if(i){var r=this.getFieldId(i);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=i.name}};e.prototype.setControlStyles=function(e,t,n){var o=t.settings,i=o.x,r=i===void 0?0:i,a=o.y,s=a===void 0?0:a,c=o.width,l=c===void 0?150:c,d=o.height,u=d===void 0?50:d;e.style.width="".concat(l,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(v(n.xScale,r),"px");e.style.bottom="".concat(v(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||f(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var o=document.getElementById(t.containerId+"-controls");if(!o){return}var i=this.getFieldId(e);var r=document.getElementById(i);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",i);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);o.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var o=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",o);o.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,i,r,a;var s=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return n(o,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},n("div",{class:"header"},n("div",{class:"intro"},"Please review and act on these documents."),n("div",{class:"toolbar"},n("div",{class:"tools"},n("verdocs-dropdown",{options:s,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?n("div",{class:"agree"},n("div",{class:"agree-checkbox"},n("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),n("label",{htmlFor:"agree-checkbox-element"})),n("span",null,"I agree to use electronic records and signatures.")):n("div",{style:{flex:"1"}}),n("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((r=this.recipient)===null||r===void 0?void 0:r.agreed),onClick:function(){return e.handleNext()}})))),!((a=this.recipient)===null||a===void 0?void 0:a.agreed)?n("div",{class:"cover"}):n("div",{style:{display:"none"}}),n("div",{class:"document"},this.pdfUrl?n("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):n("verdocs-loader",null)))};return e}());x.style=b}}}));
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o["throw"](e))}catch(e){r(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-eef0b919.system.js","./p-8a0d8814.system.js"],(function(e){"use strict";var t,n,o,i,r,a,s,c,l;return{setters:[function(e){t=e.r;n=e.h;o=e.H},function(e){i=e.V;r=e.g;a=e.a;s=e.u;c=e.b;l=e.c}],execute:function(){var d=new RegExp(/\+[1-9]\d{6,14}/g);function u(e){return e!==null&&e.length<16&&e.length>6&&d.test(e)||e===""||e===null}var p=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var h=function(e){return p.test(e)};var g=function(e){return u(e)};function f(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function v(e,t){return e*t}var b='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var x=e("verdocs_sign",function(){function e(e){t(this,e);this.endpoint=i.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,s;var c=this;return __generator(this,(function(l){switch(l.label){case 0:l.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,r(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=l.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=o;this.endpoint.setToken(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,a(this.endpoint,this.documentId)];case 2:i=l.sent();this.document=i;console.log("[SIGN] Signing document",i);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==c.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===c.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:s=l.sent();console.log("Error with signing session",s);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");s(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,c(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":l(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,o;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":l(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,o,i){var r=this;var a=v(e.xScale,o.x);var s=v(e.yScale,o.y);var c={left:"".concat(a,"px"),bottom:"".concat(s,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:f(this.recipientIndex)};return n("verdocs-field-checkbox",{style:c,order:i,value:o.checked,onFieldChange:function(e){return r.handleFieldChange(t,e,o.id)}})};e.prototype.renderRadioGroupOption=function(e,t,o,i){var r=this;var a=v(e.xScale,o.x);var s=v(e.yScale,o.y);var c={left:"".concat(a,"px"),bottom:"".concat(s,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:f(this.recipientIndex)};return n("verdocs-field-radio-button",{style:c,order:i,value:o.id,name:t.name,checked:o.selected,onFieldChange:function(e){return r.handleFieldChange(t,e,o.id)}})};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,s,c,l,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return h(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return g(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var f=(((c=(s=e.settings)===null||s===void 0?void 0:s.options)===null||c===void 0?void 0:c.filter((function(e){return e.checked})))||[]).length;return f>=(((l=e.settings)===null||l===void 0?void 0:l.minimum_checked)||0)&&f<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required field",i);if(i){var r=this.getFieldId(i);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=i.name}};e.prototype.setControlStyles=function(e,t,n){var o=t.settings,i=o.x,r=i===void 0?0:i,a=o.y,s=a===void 0?0:a,c=o.width,l=c===void 0?150:c,d=o.height,u=d===void 0?50:d;e.style.width="".concat(l,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(v(n.xScale,r),"px");e.style.bottom="".concat(v(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||f(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var o=document.getElementById(t.containerId+"-controls");if(!o){return}var i=this.getFieldId(e);var r=document.getElementById(i);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",i);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);o.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var o=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",o);o.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,i,r,a;var s=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return n(o,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},n("div",{class:"header"},n("div",{class:"intro"},"Please review and act on these documents."),n("div",{class:"toolbar"},n("div",{class:"tools"},n("verdocs-dropdown",{options:s,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?n("div",{class:"agree"},n("div",{class:"agree-checkbox"},n("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),n("label",{htmlFor:"agree-checkbox-element"})),n("span",null,"I agree to use electronic records and signatures.")):n("div",{style:{flex:"1"}}),n("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((r=this.recipient)===null||r===void 0?void 0:r.agreed),onClick:function(){return e.handleNext()}})))),!((a=this.recipient)===null||a===void 0?void 0:a.agreed)?n("div",{class:"cover"}):n("div",{style:{display:"none"}}),n("div",{class:"document"},this.pdfUrl?n("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):n("verdocs-loader",null)))};return e}());x.style=b}}}));
|
|
2
|
+
//# sourceMappingURL=p-151e5f05.system.entry.js.map
|
package/dist/verdocs-web-sdk/{p-72115808.system.entry.js.map → p-151e5f05.system.entry.js.map}
RENAMED
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,h as o,H as i}from"./p-61ecdb86.js";import{V as t,g as s,a as n,u as r,b as a,c as l}from"./p-7f162244.js";var d=new RegExp(/\+[1-9]\d{6,14}/g);function c(e){return e!==null&&e.length<16&&e.length>6&&d.test(e)||e===""||e===null}var h=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var u=function(e){return h.test(e)};var p=function(e){return c(e)};function g(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function b(e,o){return e*o}const x='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';const v=class{constructor(o){e(this,o);this.endpoint=t.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}async componentDidLoad(){try{console.log(`[SIGN] Processing invite code for ${this.documentId} / ${this.documentId}`);const{session:e,recipient:o,signerToken:i}=await s(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode});console.log(`[SIGN] Got signing session ${e.email} / ${e.profile_id}`);this.recipient=o;this.signerToken=i;this.endpoint.setToken(i);if(this.recipient.agreed){this.nextButtonLabel="Next"}const t=await n(this.endpoint,this.documentId);this.document=t;console.log("[SIGN] Signing document",t);this.pdfUrl=`${this.endpoint.getBaseURL()}/documents/${this.documentId}/envelope_documents/${t.envelope_document_id}?file=true`;this.recipientIndex=this.document.recipients.findIndex((e=>e.role_name==this.roleId));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((e=>e.recipient_role===this.roleId));console.log("Loaded fields",this.fields)}catch(e){console.log("Error with signing session",e)}}handleClickAgree(){console.log("agree clicked");r(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((e=>{console.log("update result",e);this.nextButtonLabel="Next";this.recipient=e})).catch((e=>{console.log("update failure",e)}))}async savePDF(){const e=`${this.document.name} - ${this.document.updated_at.split("T")[0]}.pdf`;const o=await a(this.endpoint,this.documentId,this.document.envelope_document_id);let i=new XMLHttpRequest;i.responseType="blob";i.onload=function(){let o=document.createElement("a");o.href=window.URL.createObjectURL(i.response);o.download=e;o.style.display="none";document.body.appendChild(o);o.click();o.remove()};const t=`data:application/pdf;base64,${o}`;console.log("url",t.length,t);i.open("GET",`data:application/pdf;base64,${o}`);i.send()}async handleOptionSelected(e){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((()=>{}));break}}async handleFieldChange(e,o,i){console.log("fieldChange",e,o.detail);switch(e.type){case"textbox":l(this.endpoint,this.documentId,e.name,{prepared:false,value:o.detail}).then((e=>console.log("Update result",e))).catch((e=>{var o,i,t;if(((o=e.response)===null||o===void 0?void 0:o.status)===401&&((t=(i=e.response)===null||i===void 0?void 0:i.data)===null||t===void 0?void 0:t.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:i,checked:o.detail}]}}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"radio_button_group":const t=e.settings.options.map((e=>({id:e.id,selected:i===e.id})));l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:t}}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"dropdown":l(this.endpoint,this.documentId,e.name,{prepared:false,value:o.detail}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"initial":console.log("Got initial",o.detail);break;case"signature":console.log("Got signature",o.detail);break}}renderCheckboxGroupOption(e,i,t,s){const n=b(e.xScale,t.x);const r=b(e.yScale,t.y);const a={left:`${n}px`,bottom:`${r}px`,position:"absolute",transform:`scale(${e.xScale}, ${e.yScale})`,backgroundColor:g(this.recipientIndex)};return o("verdocs-field-checkbox",{style:a,order:s,value:t.checked,onFieldChange:e=>this.handleFieldChange(i,e,t.id)})}renderRadioGroupOption(e,i,t,s){const n=b(e.xScale,t.x);const r=b(e.yScale,t.y);const a={left:`${n}px`,bottom:`${r}px`,position:"absolute",transform:`scale(${e.xScale}, ${e.yScale})`,backgroundColor:g(this.recipientIndex)};return o("verdocs-field-radio-button",{style:a,order:s,value:t.id,name:i.name,checked:t.selected,onFieldChange:e=>this.handleFieldChange(i,e,t.id)})}isFieldValid(e){var o,i,t,s,n,r,a,l,d,c,h,g;switch(e.type){case"textbox":switch(((o=e.settings)===null||o===void 0?void 0:o.validator)||""){case"email":return u(((i=e.settings)===null||i===void 0?void 0:i.result)||"");case"phone":return p(((t=e.settings)===null||t===void 0?void 0:t.result)||"");default:return!!((s=e.settings)===null||s===void 0?void 0:s.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((n=e.settings)===null||n===void 0?void 0:n.result);case"dropdown":return!!((r=e.settings)===null||r===void 0?void 0:r.value);case"checkbox_group":const b=(((l=(a=e.settings)===null||a===void 0?void 0:a.options)===null||l===void 0?void 0:l.filter((e=>e.checked)))||[]).length;return b>=(((d=e.settings)===null||d===void 0?void 0:d.minimum_checked)||0)&&b<=(((c=e.settings)===null||c===void 0?void 0:c.maximum_checked)||999);case"radio_button_group":return(((g=(h=e.settings)===null||h===void 0?void 0:h.options)===null||g===void 0?void 0:g.filter((e=>e.selected)))||[]).length>0;default:return false}}getFieldId(e){return`verdocs-doc-fld-${e.name}`}handleNext(){const e=this.fields.filter((e=>e.required));console.log("required Fields",e);const o=e.findIndex((e=>e.name===this.focusedField));console.log("focused Index",o);let i=o+1;if(i>=e.length){i=0}const t=e[i];console.log("next required field",t);if(t){const e=this.getFieldId(t);const o=document.getElementById(e);console.log("focusing",e,o);o===null||o===void 0?void 0:o.focusField();this.focusedField=t.name}}setControlStyles(e,o,i){const{x:t=0,y:s=0,width:n=150,height:r=50}=o.settings;e.style.width=`${n}px`;e.style.height=`${r}px`;e.style.position="absolute";e.style.left=`${b(i.xScale,t)}px`;e.style.bottom=`${b(i.yScale,s)}px`;e.style.transform=`scale(${i.xScale}, ${i.yScale})`;e.style.backgroundColor=o["rgba"]||g(this.recipientIndex)}renderField(e,o){const i=document.getElementById(o.containerId+"-controls");if(!i){return}const t=this.getFieldId(e);const s=document.getElementById(t);if(s){this.setControlStyles(s,e,o);return}let n;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":n=document.createElement(`verdocs-field-${e.type}`);break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(n){n.field=e;n.recipient=this.recipient;n.setAttribute("id",t);n.addEventListener("fieldChange",(o=>this.handleFieldChange(e,o)));this.setControlStyles(n,e,o);i.appendChild(n)}}handlePageRendered(e){const o=e.detail;console.log("[SIGN] Page rendered",o);const i=this.fields.filter((e=>e.page===o.renderedPage.pageNumber));console.log("[SIGN] Fields on page",i);i.forEach((e=>this.renderField(e,o.renderedPage)))}render(){var e,t,s,n;const r=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return o(i,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(e=this.recipient)===null||e===void 0?void 0:e.agreed}},o("div",{class:"header"},o("div",{class:"intro"},"Please review and act on these documents."),o("div",{class:"toolbar"},o("div",{class:"tools"},o("verdocs-dropdown",{options:r,onOptionSelected:e=>this.handleOptionSelected(e)}),!((t=this.recipient)===null||t===void 0?void 0:t.agreed)?o("div",{class:"agree"},o("div",{class:"agree-checkbox"},o("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:()=>this.handleClickAgree()}),o("label",{htmlFor:"agree-checkbox-element"})),o("span",null,"I agree to use electronic records and signatures.")):o("div",{style:{flex:"1"}}),o("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((s=this.recipient)===null||s===void 0?void 0:s.agreed),onClick:()=>this.handleNext()})))),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?o("div",{class:"cover"}):o("div",{style:{display:"none"}}),o("div",{class:"document"},this.pdfUrl?o("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:e=>this.handlePageRendered(e),pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):o("verdocs-loader",null)))}};v.style=x;export{v as verdocs_sign};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,h as o,H as i}from"./p-61ecdb86.js";import{V as t,g as s,a as n,u as a,b as r,c as l}from"./p-a6da7b45.js";var d=new RegExp(/\+[1-9]\d{6,14}/g);function c(e){return e!==null&&e.length<16&&e.length>6&&d.test(e)||e===""||e===null}var h=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var u=function(e){return h.test(e)};var p=function(e){return c(e)};function g(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function b(e,o){return e*o}const x='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}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;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';const v=class{constructor(o){e(this,o);this.endpoint=t.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}async componentDidLoad(){try{console.log(`[SIGN] Processing invite code for ${this.documentId} / ${this.documentId}`);const{session:e,recipient:o,signerToken:i}=await s(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode});console.log(`[SIGN] Got signing session ${e.email} / ${e.profile_id}`);this.recipient=o;this.signerToken=i;this.endpoint.setToken(i);if(this.recipient.agreed){this.nextButtonLabel="Next"}const t=await n(this.endpoint,this.documentId);this.document=t;console.log("[SIGN] Signing document",t);this.pdfUrl=`${this.endpoint.getBaseURL()}/documents/${this.documentId}/envelope_documents/${t.envelope_document_id}?file=true`;this.recipientIndex=this.document.recipients.findIndex((e=>e.role_name==this.roleId));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((e=>e.recipient_role===this.roleId));console.log("Loaded fields",this.fields)}catch(e){console.log("Error with signing session",e)}}handleClickAgree(){console.log("agree clicked");a(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((e=>{console.log("update result",e);this.nextButtonLabel="Next";this.recipient=e})).catch((e=>{console.log("update failure",e)}))}async savePDF(){const e=`${this.document.name} - ${this.document.updated_at.split("T")[0]}.pdf`;const o=await r(this.endpoint,this.documentId,this.document.envelope_document_id);let i=new XMLHttpRequest;i.responseType="blob";i.onload=function(){let o=document.createElement("a");o.href=window.URL.createObjectURL(i.response);o.download=e;o.style.display="none";document.body.appendChild(o);o.click();o.remove()};const t=`data:application/pdf;base64,${o}`;console.log("url",t.length,t);i.open("GET",`data:application/pdf;base64,${o}`);i.send()}async handleOptionSelected(e){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((()=>{}));break}}async handleFieldChange(e,o,i){console.log("fieldChange",e,o.detail);switch(e.type){case"textbox":l(this.endpoint,this.documentId,e.name,{prepared:false,value:o.detail}).then((e=>console.log("Update result",e))).catch((e=>{var o,i,t;if(((o=e.response)===null||o===void 0?void 0:o.status)===401&&((t=(i=e.response)===null||i===void 0?void 0:i.data)===null||t===void 0?void 0:t.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:i,checked:o.detail}]}}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"radio_button_group":const t=e.settings.options.map((e=>({id:e.id,selected:i===e.id})));l(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:t}}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"dropdown":l(this.endpoint,this.documentId,e.name,{prepared:false,value:o.detail}).then((e=>console.log("Update result",e))).catch((e=>console.log("Error updating",e)));break;case"initial":console.log("Got initial",o.detail);break;case"signature":console.log("Got signature",o.detail);break}}renderCheckboxGroupOption(e,i,t,s){const n=b(e.xScale,t.x);const a=b(e.yScale,t.y);const r={left:`${n}px`,bottom:`${a}px`,position:"absolute",transform:`scale(${e.xScale}, ${e.yScale})`,backgroundColor:g(this.recipientIndex)};return o("verdocs-field-checkbox",{style:r,order:s,value:t.checked,onFieldChange:e=>this.handleFieldChange(i,e,t.id)})}renderRadioGroupOption(e,i,t,s){const n=b(e.xScale,t.x);const a=b(e.yScale,t.y);const r={left:`${n}px`,bottom:`${a}px`,position:"absolute",transform:`scale(${e.xScale}, ${e.yScale})`,backgroundColor:g(this.recipientIndex)};return o("verdocs-field-radio-button",{style:r,order:s,value:t.id,name:i.name,checked:t.selected,onFieldChange:e=>this.handleFieldChange(i,e,t.id)})}isFieldValid(e){var o,i,t,s,n,a,r,l,d,c,h,g;switch(e.type){case"textbox":switch(((o=e.settings)===null||o===void 0?void 0:o.validator)||""){case"email":return u(((i=e.settings)===null||i===void 0?void 0:i.result)||"");case"phone":return p(((t=e.settings)===null||t===void 0?void 0:t.result)||"");default:return!!((s=e.settings)===null||s===void 0?void 0:s.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((n=e.settings)===null||n===void 0?void 0:n.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":const b=(((l=(r=e.settings)===null||r===void 0?void 0:r.options)===null||l===void 0?void 0:l.filter((e=>e.checked)))||[]).length;return b>=(((d=e.settings)===null||d===void 0?void 0:d.minimum_checked)||0)&&b<=(((c=e.settings)===null||c===void 0?void 0:c.maximum_checked)||999);case"radio_button_group":return(((g=(h=e.settings)===null||h===void 0?void 0:h.options)===null||g===void 0?void 0:g.filter((e=>e.selected)))||[]).length>0;default:return false}}getFieldId(e){return`verdocs-doc-fld-${e.name}`}handleNext(){const e=this.fields.filter((e=>e.required));console.log("required Fields",e);const o=e.findIndex((e=>e.name===this.focusedField));console.log("focused Index",o);let i=o+1;if(i>=e.length){i=0}const t=e[i];console.log("next required field",t);if(t){const e=this.getFieldId(t);const o=document.getElementById(e);console.log("focusing",e,o);o===null||o===void 0?void 0:o.focusField();this.focusedField=t.name}}setControlStyles(e,o,i){const{x:t=0,y:s=0,width:n=150,height:a=50}=o.settings;e.style.width=`${n}px`;e.style.height=`${a}px`;e.style.position="absolute";e.style.left=`${b(i.xScale,t)}px`;e.style.bottom=`${b(i.yScale,s)}px`;e.style.transform=`scale(${i.xScale}, ${i.yScale})`;e.style.backgroundColor=o["rgba"]||g(this.recipientIndex)}renderField(e,o){const i=document.getElementById(o.containerId+"-controls");if(!i){return}const t=this.getFieldId(e);const s=document.getElementById(t);if(s){this.setControlStyles(s,e,o);return}let n;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":n=document.createElement(`verdocs-field-${e.type}`);break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(n){n.field=e;n.recipient=this.recipient;n.setAttribute("id",t);n.addEventListener("fieldChange",(o=>this.handleFieldChange(e,o)));this.setControlStyles(n,e,o);i.appendChild(n)}}handlePageRendered(e){const o=e.detail;console.log("[SIGN] Page rendered",o);const i=this.fields.filter((e=>e.page===o.renderedPage.pageNumber));console.log("[SIGN] Fields on page",i);i.forEach((e=>this.renderField(e,o.renderedPage)))}render(){var e,t,s,n;const a=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return o(i,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(e=this.recipient)===null||e===void 0?void 0:e.agreed}},o("div",{class:"header"},o("div",{class:"intro"},"Please review and act on these documents."),o("div",{class:"toolbar"},o("div",{class:"tools"},o("verdocs-dropdown",{options:a,onOptionSelected:e=>this.handleOptionSelected(e)}),!((t=this.recipient)===null||t===void 0?void 0:t.agreed)?o("div",{class:"agree"},o("div",{class:"agree-checkbox"},o("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:()=>this.handleClickAgree()}),o("label",{htmlFor:"agree-checkbox-element"})),o("span",null,"I agree to use electronic records and signatures.")):o("div",{style:{flex:"1"}}),o("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((s=this.recipient)===null||s===void 0?void 0:s.agreed),onClick:()=>this.handleNext()})))),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?o("div",{class:"cover"}):o("div",{style:{display:"none"}}),o("div",{class:"document"},this.pdfUrl?o("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:e=>this.handlePageRendered(e),pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):o("verdocs-loader",null)))}};v.style=x;export{v as verdocs_sign};
|
|
2
|
+
//# sourceMappingURL=p-54de17e5.entry.js.map
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register([],(function(e){"use strict";return{execute:function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var n=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;var r=function(e){e=String(e).replace(/[\t\n\f\r ]+/g,"");if(!n.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));var r;var i="";var o;var a;var s=0;for(;s<e.length;){r=t.indexOf(e.charAt(s++))<<18|t.indexOf(e.charAt(s++))<<12|(o=t.indexOf(e.charAt(s++)))<<6|(a=t.indexOf(e.charAt(s++)));i+=o===64?String.fromCharCode(r>>16&255):a===64?String.fromCharCode(r>>16&255,r>>8&255):String.fromCharCode(r>>16&255,r>>8&255,r&255)}return i};var i=function(e){return JSON.parse(r((e||"").split(".")[1]||""))};var o=function(e){var t;try{t=i(e);if(t===null){return null}}catch(e){return null}Object.keys(t).forEach((function(e){if(typeof e==="string"&&e.startsWith("https://verdocs.com/")){t[e.replace("https://verdocs.com/","")]=t[e];delete t[e]}}));return t};var a=undefined&&undefined.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var s=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return u([e,t])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var u=function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.post("/documents/summary",{page:t}).then((function(e){return e.data}))]}))}))};var c=function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.post("/documents/search",t).then((function(e){return e.data}))]}))}))};var f=e("g",(function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.get("/documents/".concat(t.documentId,"/recipients/").concat(encodeURIComponent(t.roleId),"/invitation/").concat(t.inviteCode)).then((function(t){var n,r;var i=((n=t.headers)===null||n===void 0?void 0:n.signer_token)||"";var a=o(i);e.setToken((r=t.headers)===null||r===void 0?void 0:r.signer_token);return{recipient:t.data,session:a,signerToken:i}}))]}))}))}));var l=function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.get("/documents/".concat(t,"/recipients")).then((function(e){return e.data}))]}))}))};var d=e("a",(function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.get("/documents/".concat(t)).then((function(e){return e.data}))]}))}))}));var p=function(e,t){return a(void 0,void 0,void 0,(function(){return s(this,(function(n){return[2,e.api.put("/documents/".concat(t),{action:"cancel"}).then((function(e){return e.data}))]}))}))};var h=function(e){return!["submitted","canceled","declined"].includes(e.status)};var v=function(e){return((e===null||e===void 0?void 0:e.recipients)||[]).filter(h)};var m=function(e,t){var n;return e.sequence===((n=t===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.sequence)};var g=function(e,t){var n;var r=t.find((function(t){return t.email===e}));return r&&r.sequence===((n=t===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.sequence)};var y=e("b",(function(e,t,n){return a(void 0,void 0,void 0,(function(){return s(this,(function(r){return[2,e.api.get("/documents/".concat(t,"/envelope_documents/").concat(n,"?file=true"),{responseType:"arraybuffer"}).then((function(e){return Buffer.from(e.data,"binary").toString("base64")}))]}))}))}));var E=e("c",(function(e,t,n,r){return a(void 0,void 0,void 0,(function(){return s(this,(function(i){return[2,e.api.put("/documents/".concat(t,"/fields/").concat(n),r).then((function(e){return e.data}))]}))}))}));var b=function(e,t,n,r){return a(void 0,void 0,void 0,(function(){return s(this,(function(i){return[2,e.api.put("/documents/".concat(t,"/fields/").concat(n,"/signature/").concat(r)).then((function(e){return e.data}))]}))}))};var _=Object.freeze({__proto__:null,getSummary:u,searchDocuments:c,getSigningSession:f,getDocumentRecipients:l,getDocument:d,cancelDocument:p,recipientHasAction:h,getRecipientsWithActions:v,recipientCanAct:m,userCanAct:g,getDocumentFile:y,updateDocumentField:E,updateDocumentFieldSignature:b});var R=undefined&&undefined.__assign||function(){R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return R.apply(this,arguments)};var w=undefined&&undefined.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var T=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return u([e,t])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=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++;i=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];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var O=e("u",(function(e,t,n,r,i){return w(void 0,void 0,void 0,(function(){return T(this,(function(o){return[2,e.api.put("/documents/".concat(t,"/recipients/").concat(n),R({role_name:n,action:r},i||{})).then((function(e){return e.data}))]}))}))}));var S=Object.freeze({__proto__:null,updateRecipientStatus:O});var A=function(e,t,n){var r=new FormData;r.append("signature",n,t);return e.api.post("/signatures",r).then((function(e){return e.data}))};var C=function(e){return e.api.get("/signatures").then((function(e){return e.data}))};var L=function(e,t){return e.api.get("/signatures/".concat(t)).then((function(e){return e.data}))};var D=function(e,t){return e.api.delete("/signatures/".concat(t)).then((function(e){return e.data}))};var N=Object.freeze({__proto__:null,createSignature:A,getSignatures:C,getSignature:L,deleteSignature:D});var j=function(e,t,n){var r=new FormData;r.append("initial",n,t);return e.api.post("/initials",r).then((function(e){return e.data}))};var x=Object.freeze({__proto__:null,createInitials:j});var I=Object.freeze({__proto__:null});var P=Object.freeze({__proto__:null,Documents:_,Recipients:S,Signatures:N,Initials:x,Types:I});var U;(function(e){e["TEMPLATE_CREATOR_CREATE_PUBLIC"]="template:creator:create:public";e["TEMPLATE_CREATOR_CREATE_ORG"]="template:creator:create:org";e["TEMPLATE_CREATOR_CREATE_PERSONAL"]="template:creator:create:personal";e["TEMPLATE_CREATOR_DELETE"]="template:creator:delete";e["TEMPLATE_CREATOR_VISIBILITY"]="template:creator:visibility";e["TEMPLATE_MEMBER_READ"]="template:member:read";e["TEMPLATE_MEMBER_WRITE"]="template:member:write";e["TEMPLATE_MEMBER_DELETE"]="template:member:delete";e["TEMPLATE_MEMBER_VISIBILITY"]="template:member:visibility"})(U||(U={}));var B;(function(e){e["CREATOR"]="creator";e["ORGANIZATION_MEMBER"]="organization_member";e["ORGANIZATION_MEMBER_AS_CREATOR"]="organization_member_as_creator";e["EVERYONE"]="everyone";e["EVERYONE_AS_CREATOR"]="everyone_as_creator"})(B||(B={}));var k;(function(e){e["CREATE_PERSONAL"]="create_personal";e["CREATE_ORG"]="create_org";e["CREATE_PUBLIC"]="create_public";e["READ"]="read";e["WRITE"]="write";e["DELETE"]="delete";e["CHANGE_VISIBILITY_PERSONAL"]="change_visibility_personal";e["CHANGE_VISIBILITY_ORG"]="change_visibility_org";e["CHANGE_VISIBILITY_PUBLIC"]="change_visibility_public"})(k||(k={}));var M;(function(e){e["CREATED_AT"]="created_at";e["UPDATED_AT"]="updated_at";e["NAME"]="name";e["LAST_USED_AT"]="last_used_at";e["COUNTER"]="counter";e["STAR_COUNTER"]="star_counter"})(M||(M={}));var q=function e(t,n){return function e(){var r=new Array(arguments.length);for(var i=0;i<r.length;i++){r[i]=arguments[i]}return t.apply(n,r)}};var F=Object.prototype.toString;var z=function(e){return function(t){var n=F.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())}}(Object.create(null));function J(e){e=e.toLowerCase();return function t(n){return z(n)===e}}function V(e){return Array.isArray(e)}function W(e){return typeof e==="undefined"}function H(e){return e!==null&&!W(e)&&e.constructor!==null&&!W(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var G=J("ArrayBuffer");function K(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&G(e.buffer)}return t}function Y(e){return typeof e==="string"}function X(e){return typeof e==="number"}function Z(e){return e!==null&&typeof e==="object"}function $(e){if(z(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var Q=J("Date");var ee=J("File");var te=J("Blob");var ne=J("FileList");function re(e){return F.call(e)==="[object Function]"}function ie(e){return Z(e)&&re(e.pipe)}function oe(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||F.call(e)===t||re(e.toString)&&e.toString()===t)}var ae=J("URLSearchParams");function se(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function ue(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function ce(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(V(e)){for(var n=0,r=e.length;n<r;n++){t.call(null,e[n],n,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function fe(){var e={};function t(t,n){if($(e[n])&&$(t)){e[n]=fe(e[n],t)}else if($(t)){e[n]=fe({},t)}else if(V(t)){e[n]=t.slice()}else{e[n]=t}}for(var n=0,r=arguments.length;n<r;n++){ce(arguments[n],t)}return e}function le(e,t,n){ce(t,(function t(r,i){if(n&&typeof r==="function"){e[i]=q(r,n)}else{e[i]=r}}));return e}function de(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function pe(e,t,n,r){e.prototype=Object.create(t.prototype,r);e.prototype.constructor=e;n&&Object.assign(e.prototype,n)}function he(e,t,n){var r;var i;var o;var a={};t=t||{};do{r=Object.getOwnPropertyNames(e);i=r.length;while(i-- >0){o=r[i];if(!a[o]){t[o]=e[o];a[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t}function ve(e,t,n){e=String(e);if(n===undefined||n>e.length){n=e.length}n-=t.length;var r=e.indexOf(t,n);return r!==-1&&r===n}function me(e){if(!e)return null;var t=e.length;if(W(t))return null;var n=new Array(t);while(t-- >0){n[t]=e[t]}return n}var ge=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var ye={isArray:V,isArrayBuffer:G,isBuffer:H,isFormData:oe,isArrayBufferView:K,isString:Y,isNumber:X,isObject:Z,isPlainObject:$,isUndefined:W,isDate:Q,isFile:ee,isBlob:te,isFunction:re,isStream:ie,isURLSearchParams:ae,isStandardBrowserEnv:ue,forEach:ce,merge:fe,extend:le,trim:se,stripBOM:de,inherits:pe,toFlatObject:he,kindOf:z,kindOfTest:J,endsWith:ve,toArray:me,isTypedArray:ge,isFileList:ne};function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var be=function e(t,n,r){if(!n){return t}var i;if(r){i=r(n)}else if(ye.isURLSearchParams(n)){i=n.toString()}else{var o=[];ye.forEach(n,(function e(t,n){if(t===null||typeof t==="undefined"){return}if(ye.isArray(t)){n=n+"[]"}else{t=[t]}ye.forEach(t,(function e(t){if(ye.isDate(t)){t=t.toISOString()}else if(ye.isObject(t)){t=JSON.stringify(t)}o.push(Ee(n)+"="+Ee(t))}))}));i=o.join("&")}if(i){var a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function _e(){this.handlers=[]}_e.prototype.use=function e(t,n,r){this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:false,runWhen:r?r.runWhen:null});return this.handlers.length-1};_e.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};_e.prototype.forEach=function e(t){ye.forEach(this.handlers,(function e(n){if(n!==null){t(n)}}))};var Re=_e;var we=function e(t,n){ye.forEach(t,(function e(r,i){if(i!==n&&i.toUpperCase()===n.toUpperCase()){t[n]=r;delete t[i]}}))};function Te(e,t,n,r,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);n&&(this.config=n);r&&(this.request=r);i&&(this.response=i)}ye.inherits(Te,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Oe=Te.prototype;var Se={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){Se[e]={value:e}}));Object.defineProperties(Te,Se);Object.defineProperty(Oe,"isAxiosError",{value:true});Te.from=function(e,t,n,r,i,o){var a=Object.create(Oe);ye.toFlatObject(e,a,(function e(t){return t!==Error.prototype}));Te.call(a,e.message,t,n,r,i);a.name=e.name;o&&Object.assign(a,o);return a};var Ae=Te;var Ce={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function Le(e,t){t=t||new FormData;var n=[];function r(e){if(e===null)return"";if(ye.isDate(e)){return e.toISOString()}if(ye.isArrayBuffer(e)||ye.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(ye.isPlainObject(e)||ye.isArray(e)){if(n.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}n.push(e);ye.forEach(e,(function e(n,a){if(ye.isUndefined(n))return;var s=o?o+"."+a:a;var u;if(n&&!o&&typeof n==="object"){if(ye.endsWith(a,"{}")){n=JSON.stringify(n)}else if(ye.endsWith(a,"[]")&&(u=ye.toArray(n))){u.forEach((function(e){!ye.isUndefined(e)&&t.append(s,r(e))}));return}}i(n,s)}));n.pop()}else{t.append(o,r(e))}}i(e);return t}var De=Le;var Ne=function e(t,n,r){var i=r.config.validateStatus;if(!r.status||!i||i(r.status)){t(r)}else{n(new Ae("Request failed with status code "+r.status,[Ae.ERR_BAD_REQUEST,Ae.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}};var je=ye.isStandardBrowserEnv()?function e(){return{write:function e(t,n,r,i,o,a){var s=[];s.push(t+"="+encodeURIComponent(n));if(ye.isNumber(r)){s.push("expires="+new Date(r).toGMTString())}if(ye.isString(i)){s.push("path="+i)}if(ye.isString(o)){s.push("domain="+o)}if(a===true){s.push("secure")}document.cookie=s.join("; ")},read:function e(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var xe=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var Ie=function e(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t};var Pe=function e(t,n){if(t&&!xe(n)){return Ie(t,n)}return n};var Ue=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var Be=function e(t){var n={};var r;var i;var o;if(!t){return n}ye.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");r=ye.trim(t.substr(0,o)).toLowerCase();i=ye.trim(t.substr(o+1));if(r){if(n[r]&&Ue.indexOf(r)>=0){return}if(r==="set-cookie"){n[r]=(n[r]?n[r]:[]).concat([i])}else{n[r]=n[r]?n[r]+", "+i:i}}}));return n};var ke=ye.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var n=document.createElement("a");var r;function i(e){var r=e;if(t){n.setAttribute("href",r);r=n.href}n.setAttribute("href",r);return{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}r=i(window.location.href);return function e(t){var n=ye.isString(t)?i(t):t;return n.protocol===r.protocol&&n.host===r.host}}():function e(){return function e(){return true}}();function Me(e){Ae.call(this,e==null?"canceled":e,Ae.ERR_CANCELED);this.name="CanceledError"}ye.inherits(Me,Ae,{__CANCEL__:true});var qe=Me;var Fe=function e(t){var n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""};var ze=function e(t){return new Promise((function e(n,r){var i=t.data;var o=t.headers;var a=t.responseType;var s;function u(){if(t.cancelToken){t.cancelToken.unsubscribe(s)}if(t.signal){t.signal.removeEventListener("abort",s)}}if(ye.isFormData(i)&&ye.isStandardBrowserEnv()){delete o["Content-Type"]}var c=new XMLHttpRequest;if(t.auth){var f=t.auth.username||"";var l=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(f+":"+l)}var d=Pe(t.baseURL,t.url);c.open(t.method.toUpperCase(),be(d,t.params,t.paramsSerializer),true);c.timeout=t.timeout;function p(){if(!c){return}var e="getAllResponseHeaders"in c?Be(c.getAllResponseHeaders()):null;var i=!a||a==="text"||a==="json"?c.responseText:c.response;var o={data:i,status:c.status,statusText:c.statusText,headers:e,config:t,request:c};Ne((function e(t){n(t);u()}),(function e(t){r(t);u()}),o);c=null}if("onloadend"in c){c.onloadend=p}else{c.onreadystatechange=function e(){if(!c||c.readyState!==4){return}if(c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}c.onabort=function e(){if(!c){return}r(new Ae("Request aborted",Ae.ECONNABORTED,t,c));c=null};c.onerror=function e(){r(new Ae("Network Error",Ae.ERR_NETWORK,t,c,c));c=null};c.ontimeout=function e(){var n=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||Ce;if(t.timeoutErrorMessage){n=t.timeoutErrorMessage}r(new Ae(n,i.clarifyTimeoutError?Ae.ETIMEDOUT:Ae.ECONNABORTED,t,c));c=null};if(ye.isStandardBrowserEnv()){var h=(t.withCredentials||ke(d))&&t.xsrfCookieName?je.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in c){ye.forEach(o,(function e(t,n){if(typeof i==="undefined"&&n.toLowerCase()==="content-type"){delete o[n]}else{c.setRequestHeader(n,t)}}))}if(!ye.isUndefined(t.withCredentials)){c.withCredentials=!!t.withCredentials}if(a&&a!=="json"){c.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){c.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&c.upload){c.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){s=function(e){if(!c){return}r(!e||e&&e.type?new qe:e);c.abort();c=null};t.cancelToken&&t.cancelToken.subscribe(s);if(t.signal){t.signal.aborted?s():t.signal.addEventListener("abort",s)}}if(!i){i=null}var v=Fe(d);if(v&&["http","https","file"].indexOf(v)===-1){r(new Ae("Unsupported protocol "+v+":",Ae.ERR_BAD_REQUEST,t));return}c.send(i)}))};var Je=null;var Ve={"Content-Type":"application/x-www-form-urlencoded"};function We(e,t){if(!ye.isUndefined(e)&&ye.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function He(){var e;if(typeof XMLHttpRequest!=="undefined"){e=ze}else if(typeof process!=="undefined"&&Object.prototype.toString.call(process)==="[object process]"){e=ze}return e}function Ge(e,t,n){if(ye.isString(e)){try{(t||JSON.parse)(e);return ye.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(n||JSON.stringify)(e)}var Ke={transitional:Ce,adapter:He(),transformRequest:[function e(t,n){we(n,"Accept");we(n,"Content-Type");if(ye.isFormData(t)||ye.isArrayBuffer(t)||ye.isBuffer(t)||ye.isStream(t)||ye.isFile(t)||ye.isBlob(t)){return t}if(ye.isArrayBufferView(t)){return t.buffer}if(ye.isURLSearchParams(t)){We(n,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var r=ye.isObject(t);var i=n&&n["Content-Type"];var o;if((o=ye.isFileList(t))||r&&i==="multipart/form-data"){var a=this.env&&this.env.FormData;return De(o?{"files[]":t}:t,a&&new a)}else if(r||i==="application/json"){We(n,"application/json");return Ge(t)}return t}],transformResponse:[function e(t){var n=this.transitional||Ke.transitional;var r=n&&n.silentJSONParsing;var i=n&&n.forcedJSONParsing;var o=!r&&this.responseType==="json";if(o||i&&ye.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw Ae.from(e,Ae.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Je},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};ye.forEach(["delete","get","head"],(function e(t){Ke.headers[t]={}}));ye.forEach(["post","put","patch"],(function e(t){Ke.headers[t]=ye.merge(Ve)}));var Ye=Ke;var Xe=function e(t,n,r){var i=this||Ye;ye.forEach(r,(function e(r){t=r.call(i,t,n)}));return t};var Ze=function e(t){return!!(t&&t.__CANCEL__)};function $e(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new qe}}var Qe=function e(t){$e(t);t.headers=t.headers||{};t.data=Xe.call(t,t.data,t.headers,t.transformRequest);t.headers=ye.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);ye.forEach(["delete","get","head","post","put","patch","common"],(function e(n){delete t.headers[n]}));var n=t.adapter||Ye.adapter;return n(t).then((function e(n){$e(t);n.data=Xe.call(t,n.data,n.headers,t.transformResponse);return n}),(function e(n){if(!Ze(n)){$e(t);if(n&&n.response){n.response.data=Xe.call(t,n.response.data,n.response.headers,t.transformResponse)}}return Promise.reject(n)}))};var et=function e(t,n){n=n||{};var r={};function i(e,t){if(ye.isPlainObject(e)&&ye.isPlainObject(t)){return ye.merge(e,t)}else if(ye.isPlainObject(t)){return ye.merge({},t)}else if(ye.isArray(t)){return t.slice()}return t}function o(e){if(!ye.isUndefined(n[e])){return i(t[e],n[e])}else if(!ye.isUndefined(t[e])){return i(undefined,t[e])}}function a(e){if(!ye.isUndefined(n[e])){return i(undefined,n[e])}}function s(e){if(!ye.isUndefined(n[e])){return i(undefined,n[e])}else if(!ye.isUndefined(t[e])){return i(undefined,t[e])}}function u(e){if(e in n){return i(t[e],n[e])}else if(e in t){return i(undefined,t[e])}}var c={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u};ye.forEach(Object.keys(t).concat(Object.keys(n)),(function e(t){var n=c[t]||o;var i=n(t);ye.isUndefined(i)&&n!==u||(r[t]=i)}));return r};var tt={version:"0.27.2"};var nt=tt.version;var rt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){rt[e]=function n(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var it={};rt.transitional=function e(t,n,r){function i(e,t){return"[Axios v"+nt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(e,r,o){if(t===false){throw new Ae(i(r," has been removed"+(n?" in "+n:"")),Ae.ERR_DEPRECATED)}if(n&&!it[r]){it[r]=true;console.warn(i(r," has been deprecated since v"+n+" and will be removed in the near future"))}return t?t(e,r,o):true}};function ot(e,t,n){if(typeof e!=="object"){throw new Ae("options must be an object",Ae.ERR_BAD_OPTION_VALUE)}var r=Object.keys(e);var i=r.length;while(i-- >0){var o=r[i];var a=t[o];if(a){var s=e[o];var u=s===undefined||a(s,o,e);if(u!==true){throw new Ae("option "+o+" must be "+u,Ae.ERR_BAD_OPTION_VALUE)}continue}if(n!==true){throw new Ae("Unknown option "+o,Ae.ERR_BAD_OPTION)}}}var at={assertOptions:ot,validators:rt};var st=at.validators;function ut(e){this.defaults=e;this.interceptors={request:new Re,response:new Re}}ut.prototype.request=function e(t,n){if(typeof t==="string"){n=n||{};n.url=t}else{n=t||{}}n=et(this.defaults,n);if(n.method){n.method=n.method.toLowerCase()}else if(this.defaults.method){n.method=this.defaults.method.toLowerCase()}else{n.method="get"}var r=n.transitional;if(r!==undefined){at.assertOptions(r,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(n)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var a=[];this.interceptors.response.forEach((function e(t){a.push(t.fulfilled,t.rejected)}));var s;if(!o){var u=[Qe,undefined];Array.prototype.unshift.apply(u,i);u=u.concat(a);s=Promise.resolve(n);while(u.length){s=s.then(u.shift(),u.shift())}return s}var c=n;while(i.length){var f=i.shift();var l=i.shift();try{c=f(c)}catch(e){l(e);break}}try{s=Qe(c)}catch(e){return Promise.reject(e)}while(a.length){s=s.then(a.shift(),a.shift())}return s};ut.prototype.getUri=function e(t){t=et(this.defaults,t);var n=Pe(t.baseURL,t.url);return be(n,t.params,t.paramsSerializer)};ye.forEach(["delete","get","head","options"],(function e(t){ut.prototype[t]=function(e,n){return this.request(et(n||{},{method:t,url:e,data:(n||{}).data}))}}));ye.forEach(["post","put","patch"],(function e(t){function n(e){return function n(r,i,o){return this.request(et(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}ut.prototype[t]=n();ut.prototype[t+"Form"]=n(true)}));var ct=ut;function ft(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(n){t=n}));var n=this;this.promise.then((function(e){if(!n._listeners)return;var t;var r=n._listeners.length;for(t=0;t<r;t++){n._listeners[t](e)}n._listeners=null}));this.promise.then=function(e){var t;var r=new Promise((function(e){n.subscribe(e);t=e})).then(e);r.cancel=function e(){n.unsubscribe(t)};return r};e((function e(r){if(n.reason){return}n.reason=new qe(r);t(n.reason)}))}ft.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};ft.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};ft.prototype.unsubscribe=function e(t){if(!this._listeners){return}var n=this._listeners.indexOf(t);if(n!==-1){this._listeners.splice(n,1)}};ft.source=function e(){var t;var n=new ft((function e(n){t=n}));return{token:n,cancel:t}};var lt=ft;var dt=function e(t){return function e(n){return t.apply(null,n)}};var pt=function e(t){return ye.isObject(t)&&t.isAxiosError===true};function ht(e){var t=new ct(e);var n=q(ct.prototype.request,t);ye.extend(n,ct.prototype,t);ye.extend(n,t);n.create=function t(n){return ht(et(e,n))};return n}var vt=ht(Ye);vt.Axios=ct;vt.CanceledError=qe;vt.CancelToken=lt;vt.isCancel=Ze;vt.VERSION=tt.version;vt.toFormData=De;vt.AxiosError=Ae;vt.Cancel=vt.CanceledError;vt.all=function e(t){return Promise.all(t)};vt.spread=dt;vt.isAxiosError=pt;var mt=vt;var gt=vt;mt.default=gt;var yt=mt;var Et=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};var bt=function(){if(this)return this;if(typeof globalThis==="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:true})}catch(e){return Et()}try{if(!__global__)return Et();return __global__}finally{delete Object.prototype.__global__}}();var _t=Symbol.for("verdocs-default-endpoint");var Rt=function(e){console.debug("[JS-SDK] ".concat(e.method.toUpperCase()," ").concat(e.baseURL).concat(e.url),e.data?JSON.stringify(e.data):"");return e};var wt=e("V",function(){function e(e){this.environment="verdocs";this.sessionType="user";this.baseURL="https://api.verdocs.com";this.clientID="not-set";this.timeout=3e3;this.token=null;this.nextListenerId=0;this.sessionListeners=new Map;this.requestLoggerId=null;this.session=null;this.Documents=P;this.baseURL=(e===null||e===void 0?void 0:e.baseURL)||"https://api.verdocs.com";this.timeout=(e===null||e===void 0?void 0:e.timeout)||3e3;this.environment=(e===null||e===void 0?void 0:e.environment)||"verdocs";this.sessionType=(e===null||e===void 0?void 0:e.sessionType)||"user";this.clientID=(e===null||e===void 0?void 0:e.clientID)||"not-set";this.api=yt.create({baseURL:this.baseURL,timeout:this.timeout})}e.prototype.setDefault=function(){bt[_t]=this};e.getDefault=function(){if(!bt[_t]){bt[_t]=new e;window.console.debug("[JS_SDK] Created default endpoint",bt[_t])}else{window.console.debug("[JS SDK] Re-using existing endpoint",bt[_t])}return bt[_t]};e.prototype.getEnvironment=function(){return this.environment};e.prototype.getSessionType=function(){return this.sessionType};e.prototype.getBaseURL=function(){return this.baseURL};e.prototype.getClientID=function(){return this.clientID};e.prototype.getTimeout=function(){return this.timeout};e.prototype.getSession=function(){return this.session};e.prototype.setEnvironment=function(e){this.environment=e;return this};e.prototype.setSessionType=function(e){this.sessionType=e;return this};e.prototype.setBaseURL=function(e){this.api.defaults.baseURL=e;return this};e.prototype.setClientID=function(e){this.clientID=e;this.api.defaults.headers.common["X-Client-ID"]=e;return this};e.prototype.setTimeout=function(e){this.timeout=e;this.api.defaults.timeout=e;return this};e.prototype.logRequests=function(e){if(e&&this.requestLoggerId===null){this.requestLoggerId=this.api.interceptors.request.use(Rt)}else if(!e&&this.requestLoggerId!==null){this.api.interceptors.request.eject(this.requestLoggerId)}return this};e.prototype.setToken=function(e){if(!e){return this.clearSession()}var t=o(e);if(t===null||t.exp&&t.exp*1e3<(new Date).getTime()){return this.clearSession()}this.token=e;this.session=t;this.api.defaults.headers.common.Authorization="Bearer ".concat(e);localStorage.setItem(this.sessionStorageKey(),e);this.notifySessionListeners();return this};e.prototype.getToken=function(){return this.token};e.prototype.sessionStorageKey=function(){return"verdocs-session-".concat(this.getSessionType(),"-").concat(this.getEnvironment())};e.prototype.clearSession=function(){localStorage.removeItem(this.sessionStorageKey());delete this.api.defaults.headers.common.Authorization;this.session=null;this.token=null;this.notifySessionListeners();return this};e.prototype.notifySessionListeners=function(){var e=this;this.sessionListeners.forEach((function(t){try{t(e,e.session)}catch(e){}}))};e.prototype.onSessionChanged=function(e){var t=this;this.nextListenerId++;var n=Symbol.for(""+this.nextListenerId);this.sessionListeners.set(n,e);return function(){t.sessionListeners.delete(n)}};e.prototype.loadSession=function(){var e=localStorage.getItem(this.sessionStorageKey());if(!e){return this.clearSession()}return this.setToken(e)};return e}())}}}));
|
|
2
|
+
//# sourceMappingURL=p-8a0d8814.system.js.map
|