@verdocs/web-sdk 1.7.5 → 1.7.6

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.
Files changed (60) hide show
  1. package/dist/cjs/{VerdocsEndpoint-3b44fa63.js → VerdocsEndpoint-efa7c21e.js} +7 -2
  2. package/dist/cjs/VerdocsEndpoint-efa7c21e.js.map +1 -0
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
  4. package/dist/cjs/verdocs-dropdown_4.cjs.entry.js +1 -1
  5. package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
  8. package/dist/components/VerdocsEndpoint.js +6 -1
  9. package/dist/components/VerdocsEndpoint.js.map +1 -1
  10. package/dist/custom-elements.json +825 -0
  11. package/dist/docs.json +1 -1
  12. package/dist/esm/{VerdocsEndpoint-47652116.js → VerdocsEndpoint-9260b220.js} +7 -2
  13. package/dist/esm/VerdocsEndpoint-9260b220.js.map +1 -0
  14. package/dist/esm/verdocs-auth.entry.js +1 -1
  15. package/dist/esm/verdocs-dropdown_4.entry.js +1 -1
  16. package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
  17. package/dist/esm/verdocs-search.entry.js +1 -1
  18. package/dist/esm/verdocs-sign.entry.js +1 -1
  19. package/dist/esm-es5/VerdocsEndpoint-9260b220.js +2 -0
  20. package/dist/esm-es5/VerdocsEndpoint-9260b220.js.map +1 -0
  21. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  22. package/dist/esm-es5/verdocs-dropdown_4.entry.js +1 -1
  23. package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
  24. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  25. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  26. package/dist/verdocs-web-sdk/{p-d89fef13.entry.js → p-051cc391.entry.js} +2 -2
  27. package/dist/verdocs-web-sdk/{p-d89fef13.entry.js.map → p-051cc391.entry.js.map} +0 -0
  28. package/dist/verdocs-web-sdk/p-0df2b27c.system.js +1 -1
  29. package/dist/verdocs-web-sdk/{p-fd708d32.entry.js → p-1f82a5b4.entry.js} +2 -2
  30. package/dist/verdocs-web-sdk/{p-fd708d32.entry.js.map → p-1f82a5b4.entry.js.map} +0 -0
  31. package/dist/verdocs-web-sdk/{p-922fe2fd.system.entry.js → p-2ab7beb1.system.entry.js} +2 -2
  32. package/dist/verdocs-web-sdk/{p-922fe2fd.system.entry.js.map → p-2ab7beb1.system.entry.js.map} +0 -0
  33. package/dist/verdocs-web-sdk/{p-a99b8eff.entry.js → p-339b3031.entry.js} +2 -2
  34. package/dist/verdocs-web-sdk/{p-a99b8eff.entry.js.map → p-339b3031.entry.js.map} +0 -0
  35. package/dist/verdocs-web-sdk/{p-151e5f05.system.entry.js → p-42913c6c.system.entry.js} +2 -2
  36. package/dist/verdocs-web-sdk/{p-151e5f05.system.entry.js.map → p-42913c6c.system.entry.js.map} +0 -0
  37. package/dist/verdocs-web-sdk/{p-bf344dd9.system.entry.js → p-7b2c0c20.system.entry.js} +2 -2
  38. package/dist/verdocs-web-sdk/{p-bf344dd9.system.entry.js.map → p-7b2c0c20.system.entry.js.map} +0 -0
  39. package/dist/verdocs-web-sdk/{p-a60eade9.system.entry.js → p-7d3b43cb.system.entry.js} +2 -2
  40. package/dist/verdocs-web-sdk/{p-a60eade9.system.entry.js.map → p-7d3b43cb.system.entry.js.map} +0 -0
  41. package/dist/verdocs-web-sdk/{p-b1e94023.entry.js → p-8615b75d.entry.js} +2 -2
  42. package/dist/verdocs-web-sdk/{p-b1e94023.entry.js.map → p-8615b75d.entry.js.map} +0 -0
  43. package/dist/verdocs-web-sdk/{p-dc0bcc2a.system.entry.js → p-93f92d14.system.entry.js} +2 -2
  44. package/dist/verdocs-web-sdk/{p-dc0bcc2a.system.entry.js.map → p-93f92d14.system.entry.js.map} +0 -0
  45. package/dist/verdocs-web-sdk/{p-54de17e5.entry.js → p-9ac208f7.entry.js} +2 -2
  46. package/dist/verdocs-web-sdk/{p-54de17e5.entry.js.map → p-9ac208f7.entry.js.map} +0 -0
  47. package/dist/verdocs-web-sdk/p-a10c13cd.js +2 -0
  48. package/dist/verdocs-web-sdk/p-a10c13cd.js.map +1 -0
  49. package/dist/verdocs-web-sdk/p-d00144e7.system.js +2 -0
  50. package/dist/verdocs-web-sdk/p-d00144e7.system.js.map +1 -0
  51. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  52. package/package.json +2 -2
  53. package/dist/cjs/VerdocsEndpoint-3b44fa63.js.map +0 -1
  54. package/dist/esm/VerdocsEndpoint-47652116.js.map +0 -1
  55. package/dist/esm-es5/VerdocsEndpoint-47652116.js +0 -2
  56. package/dist/esm-es5/VerdocsEndpoint-47652116.js.map +0 -1
  57. package/dist/verdocs-web-sdk/p-8a0d8814.system.js +0 -2
  58. package/dist/verdocs-web-sdk/p-8a0d8814.system.js.map +0 -1
  59. package/dist/verdocs-web-sdk/p-a6da7b45.js +0 -2
  60. package/dist/verdocs-web-sdk/p-a6da7b45.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,h as i}from"./p-61ecdb86.js";import{V as s}from"./p-a6da7b45.js";var o=function(e,t){return e.api.get("/templates/",{params:t}).then((function(e){return e.data}))};var r=undefined&&undefined.__awaiter||function(e,t,i,s){function o(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function n(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s["throw"](e))}catch(e){r(e)}}function a(e){e.done?i(e.value):o(e.value).then(n,c)}a((s=s.apply(e,t||[])).next())}))};var n=undefined&&undefined.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,o,r,n;return n={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function c(e){return function(t){return a([e,t])}}function a(n){if(s)throw new TypeError("Generator is already executing.");while(i)try{if(s=1,o&&(r=n[0]&2?o["return"]:n[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,n[1])).done)return r;if(o=0,r)n=[n[0]&2,r.value];switch(n[0]){case 0:case 1:r=n;break;case 4:i.label++;return{value:n[1],done:false};case 5:i.label++;o=n[1];n=[0];continue;case 7:n=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(n[0]===6||n[0]===2)){i=0;continue}if(n[0]===3&&(!r||n[1]>r[0]&&n[1]<r[3])){i.label=n[1];break}if(n[0]===6&&i.label<r[1]){i.label=r[1];r=n;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(n);break}if(r[2])i.ops.pop();i.trys.pop();continue}n=t.call(e,i)}catch(e){n=[6,e];o=0}finally{s=r=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};var c=function(e){return r(void 0,void 0,void 0,(function(){return n(this,(function(t){return[2,e.api.get("/search/history").then((function(e){return e.data}))]}))}))};const a=`<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>`;const l=`<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>`;const h='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}';const f=class{constructor(i){e(this,i);this.createTemplate=t(this,"createTemplate",7);this.createDocument=t(this,"createDocument",7);this.endpoint=s.getDefault()}handleCreateTemplate(){this.createTemplate.emit()}handleCreateDocument(){this.createDocument.emit()}render(){return i("div",{class:"container"},i("p",{class:"title"},"Quick Create"),i("button",{onClick:()=>this.handleCreateTemplate(),innerHTML:a},"Template"),i("button",{onClick:()=>this.handleCreateDocument(),innerHTML:l},"Document"))}};f.style=h;const d=`<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>`;const p='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}';const x=class{constructor(i){e(this,i);this.entrySelected=t(this,"entrySelected",7);this.endpoint=s.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=[]}componentWillLoad(){this.endpoint.loadSession();const e=e=>{var t;console.warn("[Verdocs/search-activity] Error getting search data",e);if(((t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.status)===401){this.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";c(this.endpoint).then((e=>this.recent=e.recent)).catch(e);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";c(this.endpoint).then((e=>this.saved=e.saved)).catch(e);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";o(this.endpoint,{is_starred:true}).then((e=>this.starred=e)).catch(e);break}}handleSelectEntry(e){this.entrySelected.emit(e)}computePagesText(e){if(e<2){return`${e} Page`}else{return`${e} Pages`}}computeRecipientsText(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return`${e} Recipients`}else{return`${e} Recipient`}}render(){const e=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return i("div",{class:"container"},i("p",{class:"title"},this.title),i("div",{class:"items"},this.recent.map((e=>i("button",{class:"item",onClick:()=>this.handleSelectEntry(e)},i("div",{class:"icon",innerHTML:d}),i("div",{class:"details"},i("div",{class:"item-title"},e.params.q),i("div",{class:"info"},"Test"))))),this.saved.map((e=>i("button",{class:"item",onClick:()=>this.handleSelectEntry(e)},i("div",{class:"icon",innerHTML:d}),i("div",{class:"details"},i("div",{class:"item-title"},e.params.q),i("div",{class:"info"}))))),e&&i("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))}};x.style=p;const u=`<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`;const v=`<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`;const m='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}';const b=class{constructor(i){e(this,i);this.searchClicked=t(this,"searchClicked",7);this.typeChanged=t(this,"typeChanged",7);this.queryChanged=t(this,"queryChanged",7);this.endpoint=s.getDefault();this.placeholder="search documents, templates, people...";this.type="all";this.query="";this.grabsFocus=false}async focusField(){this.inputEl.focus()}componentDidRender(){if(this.grabsFocus){this.inputEl.focus()}}handleSearch(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false}handleChange(e){this.queryChanged.emit(e.target.value)}handleClearFilter(){this.typeChanged.emit("all")}handleKeyUp(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}}render(){return i("form",{onSubmit:e=>this.handleSearch(e)},this.type!==undefined&&this.type!=="all"&&i("span",{class:"type"},this.type,"s ",i("button",{class:"remove",innerHTML:v,onClick:()=>this.handleClearFilter()})),i("input",{type:"text",value:this.query,placeholder:this.placeholder,onInput:e=>this.handleChange(e),onKeyUp:e=>this.handleKeyUp(e),ref:e=>this.inputEl=e}),i("button",{onClick:e=>this.handleSearch(e),class:"search"},i("span",{innerHTML:u}),"Search"))}};b.style=m;export{f as verdocs_quick_functions,x as verdocs_search_activity,b as verdocs_search_box};
2
- //# sourceMappingURL=p-b1e94023.entry.js.map
1
+ import{r as e,c as t,h as i}from"./p-61ecdb86.js";import{V as s}from"./p-a10c13cd.js";var o=function(e,t){return e.api.get("/templates/",{params:t}).then((function(e){return e.data}))};var r=undefined&&undefined.__awaiter||function(e,t,i,s){function o(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function n(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s["throw"](e))}catch(e){r(e)}}function a(e){e.done?i(e.value):o(e.value).then(n,c)}a((s=s.apply(e,t||[])).next())}))};var n=undefined&&undefined.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,o,r,n;return n={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function c(e){return function(t){return a([e,t])}}function a(n){if(s)throw new TypeError("Generator is already executing.");while(i)try{if(s=1,o&&(r=n[0]&2?o["return"]:n[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,n[1])).done)return r;if(o=0,r)n=[n[0]&2,r.value];switch(n[0]){case 0:case 1:r=n;break;case 4:i.label++;return{value:n[1],done:false};case 5:i.label++;o=n[1];n=[0];continue;case 7:n=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(n[0]===6||n[0]===2)){i=0;continue}if(n[0]===3&&(!r||n[1]>r[0]&&n[1]<r[3])){i.label=n[1];break}if(n[0]===6&&i.label<r[1]){i.label=r[1];r=n;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(n);break}if(r[2])i.ops.pop();i.trys.pop();continue}n=t.call(e,i)}catch(e){n=[6,e];o=0}finally{s=r=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};var c=function(e){return r(void 0,void 0,void 0,(function(){return n(this,(function(t){return[2,e.api.get("/search/history").then((function(e){return e.data}))]}))}))};const a=`<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>`;const l=`<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>`;const h='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}';const f=class{constructor(i){e(this,i);this.createTemplate=t(this,"createTemplate",7);this.createDocument=t(this,"createDocument",7);this.endpoint=s.getDefault()}handleCreateTemplate(){this.createTemplate.emit()}handleCreateDocument(){this.createDocument.emit()}render(){return i("div",{class:"container"},i("p",{class:"title"},"Quick Create"),i("button",{onClick:()=>this.handleCreateTemplate(),innerHTML:a},"Template"),i("button",{onClick:()=>this.handleCreateDocument(),innerHTML:l},"Document"))}};f.style=h;const d=`<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>`;const p='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}';const x=class{constructor(i){e(this,i);this.entrySelected=t(this,"entrySelected",7);this.endpoint=s.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=[]}componentWillLoad(){this.endpoint.loadSession();const e=e=>{var t;console.warn("[Verdocs/search-activity] Error getting search data",e);if(((t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.status)===401){this.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";c(this.endpoint).then((e=>this.recent=e.recent)).catch(e);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";c(this.endpoint).then((e=>this.saved=e.saved)).catch(e);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";o(this.endpoint,{is_starred:true}).then((e=>this.starred=e)).catch(e);break}}handleSelectEntry(e){this.entrySelected.emit(e)}computePagesText(e){if(e<2){return`${e} Page`}else{return`${e} Pages`}}computeRecipientsText(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return`${e} Recipients`}else{return`${e} Recipient`}}render(){const e=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return i("div",{class:"container"},i("p",{class:"title"},this.title),i("div",{class:"items"},this.recent.map((e=>i("button",{class:"item",onClick:()=>this.handleSelectEntry(e)},i("div",{class:"icon",innerHTML:d}),i("div",{class:"details"},i("div",{class:"item-title"},e.params.q),i("div",{class:"info"},"Test"))))),this.saved.map((e=>i("button",{class:"item",onClick:()=>this.handleSelectEntry(e)},i("div",{class:"icon",innerHTML:d}),i("div",{class:"details"},i("div",{class:"item-title"},e.params.q),i("div",{class:"info"}))))),e&&i("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))}};x.style=p;const u=`<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`;const v=`<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`;const m='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}';const b=class{constructor(i){e(this,i);this.searchClicked=t(this,"searchClicked",7);this.typeChanged=t(this,"typeChanged",7);this.queryChanged=t(this,"queryChanged",7);this.endpoint=s.getDefault();this.placeholder="search documents, templates, people...";this.type="all";this.query="";this.grabsFocus=false}async focusField(){this.inputEl.focus()}componentDidRender(){if(this.grabsFocus){this.inputEl.focus()}}handleSearch(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false}handleChange(e){this.queryChanged.emit(e.target.value)}handleClearFilter(){this.typeChanged.emit("all")}handleKeyUp(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}}render(){return i("form",{onSubmit:e=>this.handleSearch(e)},this.type!==undefined&&this.type!=="all"&&i("span",{class:"type"},this.type,"s ",i("button",{class:"remove",innerHTML:v,onClick:()=>this.handleClearFilter()})),i("input",{type:"text",value:this.query,placeholder:this.placeholder,onInput:e=>this.handleChange(e),onKeyUp:e=>this.handleKeyUp(e),ref:e=>this.inputEl=e}),i("button",{onClick:e=>this.handleSearch(e),class:"search"},i("span",{innerHTML:u}),"Search"))}};b.style=m;export{f as verdocs_quick_functions,x as verdocs_search_activity,b as verdocs_search_box};
2
+ //# sourceMappingURL=p-8615b75d.entry.js.map
@@ -1,2 +1,2 @@
1
- var __extends=this&&this.__extends||function(){var t=function(e,n){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))t[n]=e[n]};return t(e,n)};return function(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function o(){this.constructor=e}e.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();System.register(["./p-eef0b919.system.js","./p-8a0d8814.system.js"],(function(t){"use strict";var e,n,o,i;return{setters:[function(t){e=t.r;n=t.c;o=t.h},function(t){i=t.V}],execute:function(){var s=function(t,e){return t.api.post("/authentication/login",e).then((function(t){return t.data}))};var r=function(t){__extends(e,t);function e(e,n,o){var i=this.constructor;var s=t.call(this,e||"SDK Error")||this;s.response=o;s.statusCode=n;Object.setPrototypeOf(s,i.prototype);return s}return e}(Error);var a='verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}';var l=t("verdocs_auth",function(){function t(t){e(this,t);this.authenticated=n(this,"authenticated",7);this.sdkError=n(this,"sdkError",7);this.endpoint=i.getDefault();this.visible=true;this.logo="https://verdocs.com/assets/blue-logo.svg";this.debug=false;this.isAuthenticated=false;this.displayMode="login";this.username="";this.password="";this.loggingIn=false;this.activeSession=null;this.loginError=null}t.prototype.componentDidLoad=function(){var t,e;console.log("loaded",this);this.endpoint.loadSession();if(this.endpoint.session){this.isAuthenticated=true;this.activeSession=this.endpoint.session;(t=this.authenticated)===null||t===void 0?void 0:t.emit({authenticated:true,session:this.endpoint.session})}else{(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:false,session:null})}};t.prototype.handleLogin=function(){var t=this;this.loggingIn=true;s(this.endpoint,{username:this.username,password:this.password}).then((function(e){var n;t.loggingIn=false;t.endpoint.setToken(e.accessToken);t.activeSession=t.endpoint.session;t.isAuthenticated=true;(n=t.authenticated)===null||n===void 0?void 0:n.emit({authenticated:true,session:t.endpoint.session})})).catch((function(e){var n,o,i,s,a;console.log("[VERDOCS] Login error",e.response,JSON.stringify(e));t.loggingIn=false;t.activeSession=null;(n=t.authenticated)===null||n===void 0?void 0:n.emit({authenticated:false,session:null});(o=t.sdkError)===null||o===void 0?void 0:o.emit(new r(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(s=e.response)===null||s===void 0?void 0:s.data));if(((a=e===null||e===void 0?void 0:e.response)===null||a===void 0?void 0:a.status)===403){t.loginError="Please check your username and password and try again."}}))};t.prototype.handleLogout=function(){this.endpoint.clearSession();this.isAuthenticated=false;this.authenticated.emit({authenticated:false,session:null})};t.prototype.handleClearError=function(){this.loginError=null};t.prototype.render=function(){var t=this;if(!this.visible){return o("div",{style:{display:"none"}},"Verdocs Auth Placeholder")}if(this.isAuthenticated){if(this.debug){return o("div",{class:"status-result debug"},o("verdocs-button",{label:"Logout",disabled:this.loggingIn,onPress:function(){return t.handleLogout()}}))}return o("div",{class:"status-result"},"Authenticated")}if(this.displayMode==="signup"){return o("div",{class:"signup-form"},o("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),o("h3",null,"Sign up for an account"),o("h4",null,"Already have an account?",o("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return t.displayMode="login"},disabled:this.loggingIn})),o("form",{onSubmit:function(){return t.handleLogin()}},o("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),o("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),o("verdocs-button",{label:"Signup",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return o("div",{class:"login-form"},o("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),o("h3",null,"Log in to your account"),o("h4",null,"Don't have an account?",o("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn})),o("form",{onSubmit:function(){return t.handleLogin()}},o("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),o("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),o("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),o("verdocs-button",{label:"Login",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})),this.loginError?o("verdocs-ok-dialog",{open:true,heading:"Login Error",message:this.loginError,onClosed:function(){return t.handleClearError()}}):o("div",null))};return t}());l.style=a}}}));
2
- //# sourceMappingURL=p-dc0bcc2a.system.entry.js.map
1
+ var __extends=this&&this.__extends||function(){var t=function(e,n){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))t[n]=e[n]};return t(e,n)};return function(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function o(){this.constructor=e}e.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();System.register(["./p-eef0b919.system.js","./p-d00144e7.system.js"],(function(t){"use strict";var e,n,o,i;return{setters:[function(t){e=t.r;n=t.c;o=t.h},function(t){i=t.V}],execute:function(){var s=function(t,e){return t.api.post("/authentication/login",e).then((function(t){return t.data}))};var r=function(t){__extends(e,t);function e(e,n,o){var i=this.constructor;var s=t.call(this,e||"SDK Error")||this;s.response=o;s.statusCode=n;Object.setPrototypeOf(s,i.prototype);return s}return e}(Error);var a='verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}';var l=t("verdocs_auth",function(){function t(t){e(this,t);this.authenticated=n(this,"authenticated",7);this.sdkError=n(this,"sdkError",7);this.endpoint=i.getDefault();this.visible=true;this.logo="https://verdocs.com/assets/blue-logo.svg";this.debug=false;this.isAuthenticated=false;this.displayMode="login";this.username="";this.password="";this.loggingIn=false;this.activeSession=null;this.loginError=null}t.prototype.componentDidLoad=function(){var t,e;console.log("loaded",this);this.endpoint.loadSession();if(this.endpoint.session){this.isAuthenticated=true;this.activeSession=this.endpoint.session;(t=this.authenticated)===null||t===void 0?void 0:t.emit({authenticated:true,session:this.endpoint.session})}else{(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:false,session:null})}};t.prototype.handleLogin=function(){var t=this;this.loggingIn=true;s(this.endpoint,{username:this.username,password:this.password}).then((function(e){var n;t.loggingIn=false;t.endpoint.setToken(e.accessToken);t.activeSession=t.endpoint.session;t.isAuthenticated=true;(n=t.authenticated)===null||n===void 0?void 0:n.emit({authenticated:true,session:t.endpoint.session})})).catch((function(e){var n,o,i,s,a;console.log("[VERDOCS] Login error",e.response,JSON.stringify(e));t.loggingIn=false;t.activeSession=null;(n=t.authenticated)===null||n===void 0?void 0:n.emit({authenticated:false,session:null});(o=t.sdkError)===null||o===void 0?void 0:o.emit(new r(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(s=e.response)===null||s===void 0?void 0:s.data));if(((a=e===null||e===void 0?void 0:e.response)===null||a===void 0?void 0:a.status)===403){t.loginError="Please check your username and password and try again."}}))};t.prototype.handleLogout=function(){this.endpoint.clearSession();this.isAuthenticated=false;this.authenticated.emit({authenticated:false,session:null})};t.prototype.handleClearError=function(){this.loginError=null};t.prototype.render=function(){var t=this;if(!this.visible){return o("div",{style:{display:"none"}},"Verdocs Auth Placeholder")}if(this.isAuthenticated){if(this.debug){return o("div",{class:"status-result debug"},o("verdocs-button",{label:"Logout",disabled:this.loggingIn,onPress:function(){return t.handleLogout()}}))}return o("div",{class:"status-result"},"Authenticated")}if(this.displayMode==="signup"){return o("div",{class:"signup-form"},o("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),o("h3",null,"Sign up for an account"),o("h4",null,"Already have an account?",o("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return t.displayMode="login"},disabled:this.loggingIn})),o("form",{onSubmit:function(){return t.handleLogin()}},o("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),o("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),o("verdocs-button",{label:"Signup",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return o("div",{class:"login-form"},o("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),o("h3",null,"Log in to your account"),o("h4",null,"Don't have an account?",o("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn})),o("form",{onSubmit:function(){return t.handleLogin()}},o("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),o("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),o("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),o("verdocs-button",{label:"Login",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})),this.loginError?o("verdocs-ok-dialog",{open:true,heading:"Login Error",message:this.loginError,onClosed:function(){return t.handleClearError()}}):o("div",null))};return t}());l.style=a}}}));
2
+ //# sourceMappingURL=p-93f92d14.system.entry.js.map
@@ -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 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
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-a10c13cd.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-9ac208f7.entry.js.map
@@ -0,0 +1,2 @@
1
+ var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var t=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;var e=function(e){e=String(e).replace(/[\t\n\f\r ]+/g,"");if(!t.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 u;var a=0;for(;a<e.length;){r=n.indexOf(e.charAt(a++))<<18|n.indexOf(e.charAt(a++))<<12|(o=n.indexOf(e.charAt(a++)))<<6|(u=n.indexOf(e.charAt(a++)));i+=o===64?String.fromCharCode(r>>16&255):u===64?String.fromCharCode(r>>16&255,r>>8&255):String.fromCharCode(r>>16&255,r>>8&255,r&255)}return i};var r=function(n){return JSON.parse(e((n||"").split(".")[1]||""))};var i=function(n){var t;try{t=r(n);if(t===null){return null}}catch(n){return null}Object.keys(t).forEach((function(n){if(typeof n==="string"&&n.startsWith("https://verdocs.com/")){t[n.replace("https://verdocs.com/","")]=t[n];delete t[n]}}));return t};var o=undefined&&undefined.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,o){function u(n){try{f(r.next(n))}catch(n){o(n)}}function a(n){try{f(r["throw"](n))}catch(n){o(n)}}function f(n){n.done?e(n.value):i(n.value).then(u,a)}f((r=r.apply(n,t||[])).next())}))};var u=undefined&&undefined.__generator||function(n,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(t){return f([n,t])}}function f(u){if(r)throw new TypeError("Generator is already executing.");while(e)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;i=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1];o=u;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(u);break}if(o[2])e.ops.pop();e.trys.pop();continue}u=t.call(n,e)}catch(n){u=[6,n];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var a=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.post("/documents/summary",{page:t}).then((function(n){return n.data}))]}))}))};var f=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.post("/documents/search",t).then((function(n){return n.data}))]}))}))};var c=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.get("/documents/".concat(t.documentId,"/recipients/").concat(encodeURIComponent(t.roleId),"/invitation/").concat(t.inviteCode)).then((function(t){var e,r;var o=((e=t.headers)===null||e===void 0?void 0:e.signer_token)||"";var u=i(o);n.setToken((r=t.headers)===null||r===void 0?void 0:r.signer_token);return{recipient:t.data,session:u,signerToken:o}}))]}))}))};var s=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.get("/documents/".concat(t,"/recipients")).then((function(n){return n.data}))]}))}))};var l=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.get("/documents/".concat(t)).then((function(n){return n.data}))]}))}))};var v=function(n,t){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n.api.put("/documents/".concat(t),{action:"cancel"}).then((function(n){return n.data}))]}))}))};var d=function(n){return!["submitted","canceled","declined"].includes(n.status)};var h=function(n){return((n===null||n===void 0?void 0:n.recipients)||[]).filter(d)};var p=function(n,t){var e;return n.sequence===((e=t===null||t===void 0?void 0:t[0])===null||e===void 0?void 0:e.sequence)};var m=function(n,t){var e;var r=t.find((function(t){return t.email===n}));return r&&r.sequence===((e=t===null||t===void 0?void 0:t[0])===null||e===void 0?void 0:e.sequence)};var b=function(n,t,e){return o(void 0,void 0,void 0,(function(){return u(this,(function(r){return[2,n.api.get("/documents/".concat(t,"/envelope_documents/").concat(e,"?file=true"),{responseType:"arraybuffer"}).then((function(n){return Buffer.from(n.data,"binary").toString("base64")}))]}))}))};var y=function(n,t,e,r){return o(void 0,void 0,void 0,(function(){return u(this,(function(i){return[2,n.api.put("/documents/".concat(t,"/fields/").concat(e),r).then((function(n){return n.data}))]}))}))};var w=function(n,t,e,r){return o(void 0,void 0,void 0,(function(){return u(this,(function(i){return[2,n.api.put("/documents/".concat(t,"/fields/").concat(e,"/signature/").concat(r)).then((function(n){return n.data}))]}))}))};const g=Object.freeze({__proto__:null,getSummary:a,searchDocuments:f,getSigningSession:c,getDocumentRecipients:s,getDocument:l,cancelDocument:v,recipientHasAction:d,getRecipientsWithActions:h,recipientCanAct:p,userCanAct:m,getDocumentFile:b,updateDocumentField:y,updateDocumentFieldSignature:w});var _=undefined&&undefined.__assign||function(){_=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))n[i]=t[i]}return n};return _.apply(this,arguments)};var O=undefined&&undefined.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,o){function u(n){try{f(r.next(n))}catch(n){o(n)}}function a(n){try{f(r["throw"](n))}catch(n){o(n)}}function f(n){n.done?e(n.value):i(n.value).then(u,a)}f((r=r.apply(n,t||[])).next())}))};var S=undefined&&undefined.__generator||function(n,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(t){return f([n,t])}}function f(u){if(r)throw new TypeError("Generator is already executing.");while(e)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;i=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1];o=u;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(u);break}if(o[2])e.ops.pop();e.trys.pop();continue}u=t.call(n,e)}catch(n){u=[6,n];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var j=function(n,t,e,r,i){return O(void 0,void 0,void 0,(function(){return S(this,(function(o){return[2,n.api.put("/documents/".concat(t,"/recipients/").concat(e),_({role_name:e,action:r},i||{})).then((function(n){return n.data}))]}))}))};var R=function(n,t,e){return n.api.get("/documents/".concat(t,"/recipients/").concat(encodeURIComponent(e),"/signer-token"))};const E=Object.freeze({__proto__:null,updateRecipientStatus:j,getSignerToken:R});var A=function(n,t,e){var r=new FormData;r.append("signature",e,t);return n.api.post("/signatures",r).then((function(n){return n.data}))};var D=function(n){return n.api.get("/signatures").then((function(n){return n.data}))};var T=function(n,t){return n.api.get("/signatures/".concat(t)).then((function(n){return n.data}))};var N=function(n,t){return n.api.delete("/signatures/".concat(t)).then((function(n){return n.data}))};const x=Object.freeze({__proto__:null,createSignature:A,getSignatures:D,getSignature:T,deleteSignature:N});var C=function(n,t,e){var r=new FormData;r.append("initial",e,t);return n.api.post("/initials",r).then((function(n){return n.data}))};const B=Object.freeze({__proto__:null,createInitials:C});const k=Object.freeze({__proto__:null});const F=Object.freeze({__proto__:null,Documents:g,Recipients:E,Signatures:x,Initials:B,Types:k});var P;(function(n){n["TEMPLATE_CREATOR_CREATE_PUBLIC"]="template:creator:create:public";n["TEMPLATE_CREATOR_CREATE_ORG"]="template:creator:create:org";n["TEMPLATE_CREATOR_CREATE_PERSONAL"]="template:creator:create:personal";n["TEMPLATE_CREATOR_DELETE"]="template:creator:delete";n["TEMPLATE_CREATOR_VISIBILITY"]="template:creator:visibility";n["TEMPLATE_MEMBER_READ"]="template:member:read";n["TEMPLATE_MEMBER_WRITE"]="template:member:write";n["TEMPLATE_MEMBER_DELETE"]="template:member:delete";n["TEMPLATE_MEMBER_VISIBILITY"]="template:member:visibility"})(P||(P={}));var U;(function(n){n["CREATOR"]="creator";n["ORGANIZATION_MEMBER"]="organization_member";n["ORGANIZATION_MEMBER_AS_CREATOR"]="organization_member_as_creator";n["EVERYONE"]="everyone";n["EVERYONE_AS_CREATOR"]="everyone_as_creator"})(U||(U={}));var J;(function(n){n["CREATE_PERSONAL"]="create_personal";n["CREATE_ORG"]="create_org";n["CREATE_PUBLIC"]="create_public";n["READ"]="read";n["WRITE"]="write";n["DELETE"]="delete";n["CHANGE_VISIBILITY_PERSONAL"]="change_visibility_personal";n["CHANGE_VISIBILITY_ORG"]="change_visibility_org";n["CHANGE_VISIBILITY_PUBLIC"]="change_visibility_public"})(J||(J={}));var L;(function(n){n["CREATED_AT"]="created_at";n["UPDATED_AT"]="updated_at";n["NAME"]="name";n["LAST_USED_AT"]="last_used_at";n["COUNTER"]="counter";n["STAR_COUNTER"]="star_counter"})(L||(L={}));var I=function n(t,e){return function n(){var r=new Array(arguments.length);for(var i=0;i<r.length;i++){r[i]=arguments[i]}return t.apply(e,r)}};var z=Object.prototype.toString;var q=function(n){return function(t){var e=z.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function M(n){n=n.toLowerCase();return function t(e){return q(e)===n}}function H(n){return Array.isArray(n)}function K(n){return typeof n==="undefined"}function W(n){return n!==null&&!K(n)&&n.constructor!==null&&!K(n.constructor)&&typeof n.constructor.isBuffer==="function"&&n.constructor.isBuffer(n)}var X=M("ArrayBuffer");function $(n){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(n)}else{t=n&&n.buffer&&X(n.buffer)}return t}function V(n){return typeof n==="string"}function Z(n){return typeof n==="number"}function G(n){return n!==null&&typeof n==="object"}function Q(n){if(q(n)!=="object"){return false}var t=Object.getPrototypeOf(n);return t===null||t===Object.prototype}var Y=M("Date");var nn=M("File");var tn=M("Blob");var en=M("FileList");function rn(n){return z.call(n)==="[object Function]"}function on(n){return G(n)&&rn(n.pipe)}function un(n){var t="[object FormData]";return n&&(typeof FormData==="function"&&n instanceof FormData||z.call(n)===t||rn(n.toString)&&n.toString()===t)}var an=M("URLSearchParams");function fn(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function cn(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function sn(n,t){if(n===null||typeof n==="undefined"){return}if(typeof n!=="object"){n=[n]}if(H(n)){for(var e=0,r=n.length;e<r;e++){t.call(null,n[e],e,n)}}else{for(var i in n){if(Object.prototype.hasOwnProperty.call(n,i)){t.call(null,n[i],i,n)}}}}function ln(){var n={};function t(t,e){if(Q(n[e])&&Q(t)){n[e]=ln(n[e],t)}else if(Q(t)){n[e]=ln({},t)}else if(H(t)){n[e]=t.slice()}else{n[e]=t}}for(var e=0,r=arguments.length;e<r;e++){sn(arguments[e],t)}return n}function vn(n,t,e){sn(t,(function t(r,i){if(e&&typeof r==="function"){n[i]=I(r,e)}else{n[i]=r}}));return n}function dn(n){if(n.charCodeAt(0)===65279){n=n.slice(1)}return n}function hn(n,t,e,r){n.prototype=Object.create(t.prototype,r);n.prototype.constructor=n;e&&Object.assign(n.prototype,e)}function pn(n,t,e){var r;var i;var o;var u={};t=t||{};do{r=Object.getOwnPropertyNames(n);i=r.length;while(i-- >0){o=r[i];if(!u[o]){t[o]=n[o];u[o]=true}}n=Object.getPrototypeOf(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t}function mn(n,t,e){n=String(n);if(e===undefined||e>n.length){e=n.length}e-=t.length;var r=n.indexOf(t,e);return r!==-1&&r===e}function bn(n){if(!n)return null;var t=n.length;if(K(t))return null;var e=new Array(t);while(t-- >0){e[t]=n[t]}return e}var yn=function(n){return function(t){return n&&t instanceof n}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var wn={isArray:H,isArrayBuffer:X,isBuffer:W,isFormData:un,isArrayBufferView:$,isString:V,isNumber:Z,isObject:G,isPlainObject:Q,isUndefined:K,isDate:Y,isFile:nn,isBlob:tn,isFunction:rn,isStream:on,isURLSearchParams:an,isStandardBrowserEnv:cn,forEach:sn,merge:ln,extend:vn,trim:fn,stripBOM:dn,inherits:hn,toFlatObject:pn,kindOf:q,kindOfTest:M,endsWith:mn,toArray:bn,isTypedArray:yn,isFileList:en};function gn(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var _n=function n(t,e,r){if(!e){return t}var i;if(r){i=r(e)}else if(wn.isURLSearchParams(e)){i=e.toString()}else{var o=[];wn.forEach(e,(function n(t,e){if(t===null||typeof t==="undefined"){return}if(wn.isArray(t)){e=e+"[]"}else{t=[t]}wn.forEach(t,(function n(t){if(wn.isDate(t)){t=t.toISOString()}else if(wn.isObject(t)){t=JSON.stringify(t)}o.push(gn(e)+"="+gn(t))}))}));i=o.join("&")}if(i){var u=t.indexOf("#");if(u!==-1){t=t.slice(0,u)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function On(){this.handlers=[]}On.prototype.use=function n(t,e,r){this.handlers.push({fulfilled:t,rejected:e,synchronous:r?r.synchronous:false,runWhen:r?r.runWhen:null});return this.handlers.length-1};On.prototype.eject=function n(t){if(this.handlers[t]){this.handlers[t]=null}};On.prototype.forEach=function n(t){wn.forEach(this.handlers,(function n(e){if(e!==null){t(e)}}))};var Sn=On;var jn=function n(t,e){wn.forEach(t,(function n(r,i){if(i!==e&&i.toUpperCase()===e.toUpperCase()){t[e]=r;delete t[i]}}))};function Rn(n,t,e,r,i){Error.call(this);this.message=n;this.name="AxiosError";t&&(this.code=t);e&&(this.config=e);r&&(this.request=r);i&&(this.response=i)}wn.inherits(Rn,Error,{toJSON:function n(){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 En=Rn.prototype;var An={};["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(n){An[n]={value:n}}));Object.defineProperties(Rn,An);Object.defineProperty(En,"isAxiosError",{value:true});Rn.from=function(n,t,e,r,i,o){var u=Object.create(En);wn.toFlatObject(n,u,(function n(t){return t!==Error.prototype}));Rn.call(u,n.message,t,e,r,i);u.name=n.name;o&&Object.assign(u,o);return u};var Dn=Rn;var Tn={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function Nn(n,t){t=t||new FormData;var e=[];function r(n){if(n===null)return"";if(wn.isDate(n)){return n.toISOString()}if(wn.isArrayBuffer(n)||wn.isTypedArray(n)){return typeof Blob==="function"?new Blob([n]):Buffer.from(n)}return n}function i(n,o){if(wn.isPlainObject(n)||wn.isArray(n)){if(e.indexOf(n)!==-1){throw Error("Circular reference detected in "+o)}e.push(n);wn.forEach(n,(function n(e,u){if(wn.isUndefined(e))return;var a=o?o+"."+u:u;var f;if(e&&!o&&typeof e==="object"){if(wn.endsWith(u,"{}")){e=JSON.stringify(e)}else if(wn.endsWith(u,"[]")&&(f=wn.toArray(e))){f.forEach((function(n){!wn.isUndefined(n)&&t.append(a,r(n))}));return}}i(e,a)}));e.pop()}else{t.append(o,r(n))}}i(n);return t}var xn=Nn;var Cn=function n(t,e,r){var i=r.config.validateStatus;if(!r.status||!i||i(r.status)){t(r)}else{e(new Dn("Request failed with status code "+r.status,[Dn.ERR_BAD_REQUEST,Dn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}};var Bn=wn.isStandardBrowserEnv()?function n(){return{write:function n(t,e,r,i,o,u){var a=[];a.push(t+"="+encodeURIComponent(e));if(wn.isNumber(r)){a.push("expires="+new Date(r).toGMTString())}if(wn.isString(i)){a.push("path="+i)}if(wn.isString(o)){a.push("domain="+o)}if(u===true){a.push("secure")}document.cookie=a.join("; ")},read:function n(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function n(t){this.write(t,"",Date.now()-864e5)}}}():function n(){return{write:function n(){},read:function n(){return null},remove:function n(){}}}();var kn=function n(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var Fn=function n(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t};var Pn=function n(t,e){if(t&&!kn(e)){return Fn(t,e)}return e};var Un=["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 Jn=function n(t){var e={};var r;var i;var o;if(!t){return e}wn.forEach(t.split("\n"),(function n(t){o=t.indexOf(":");r=wn.trim(t.substr(0,o)).toLowerCase();i=wn.trim(t.substr(o+1));if(r){if(e[r]&&Un.indexOf(r)>=0){return}if(r==="set-cookie"){e[r]=(e[r]?e[r]:[]).concat([i])}else{e[r]=e[r]?e[r]+", "+i:i}}}));return e};var Ln=wn.isStandardBrowserEnv()?function n(){var t=/(msie|trident)/i.test(navigator.userAgent);var e=document.createElement("a");var r;function i(n){var r=n;if(t){e.setAttribute("href",r);r=e.href}e.setAttribute("href",r);return{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}r=i(window.location.href);return function n(t){var e=wn.isString(t)?i(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function n(){return function n(){return true}}();function In(n){Dn.call(this,n==null?"canceled":n,Dn.ERR_CANCELED);this.name="CanceledError"}wn.inherits(In,Dn,{__CANCEL__:true});var zn=In;var qn=function n(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""};var Mn=function n(t){return new Promise((function n(e,r){var i=t.data;var o=t.headers;var u=t.responseType;var a;function f(){if(t.cancelToken){t.cancelToken.unsubscribe(a)}if(t.signal){t.signal.removeEventListener("abort",a)}}if(wn.isFormData(i)&&wn.isStandardBrowserEnv()){delete o["Content-Type"]}var c=new XMLHttpRequest;if(t.auth){var s=t.auth.username||"";var l=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(s+":"+l)}var v=Pn(t.baseURL,t.url);c.open(t.method.toUpperCase(),_n(v,t.params,t.paramsSerializer),true);c.timeout=t.timeout;function d(){if(!c){return}var n="getAllResponseHeaders"in c?Jn(c.getAllResponseHeaders()):null;var i=!u||u==="text"||u==="json"?c.responseText:c.response;var o={data:i,status:c.status,statusText:c.statusText,headers:n,config:t,request:c};Cn((function n(t){e(t);f()}),(function n(t){r(t);f()}),o);c=null}if("onloadend"in c){c.onloadend=d}else{c.onreadystatechange=function n(){if(!c||c.readyState!==4){return}if(c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)){return}setTimeout(d)}}c.onabort=function n(){if(!c){return}r(new Dn("Request aborted",Dn.ECONNABORTED,t,c));c=null};c.onerror=function n(){r(new Dn("Network Error",Dn.ERR_NETWORK,t,c,c));c=null};c.ontimeout=function n(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||Tn;if(t.timeoutErrorMessage){e=t.timeoutErrorMessage}r(new Dn(e,i.clarifyTimeoutError?Dn.ETIMEDOUT:Dn.ECONNABORTED,t,c));c=null};if(wn.isStandardBrowserEnv()){var h=(t.withCredentials||Ln(v))&&t.xsrfCookieName?Bn.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in c){wn.forEach(o,(function n(t,e){if(typeof i==="undefined"&&e.toLowerCase()==="content-type"){delete o[e]}else{c.setRequestHeader(e,t)}}))}if(!wn.isUndefined(t.withCredentials)){c.withCredentials=!!t.withCredentials}if(u&&u!=="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){a=function(n){if(!c){return}r(!n||n&&n.type?new zn:n);c.abort();c=null};t.cancelToken&&t.cancelToken.subscribe(a);if(t.signal){t.signal.aborted?a():t.signal.addEventListener("abort",a)}}if(!i){i=null}var p=qn(v);if(p&&["http","https","file"].indexOf(p)===-1){r(new Dn("Unsupported protocol "+p+":",Dn.ERR_BAD_REQUEST,t));return}c.send(i)}))};var Hn=null;var Kn={"Content-Type":"application/x-www-form-urlencoded"};function Wn(n,t){if(!wn.isUndefined(n)&&wn.isUndefined(n["Content-Type"])){n["Content-Type"]=t}}function Xn(){var n;if(typeof XMLHttpRequest!=="undefined"){n=Mn}else if(typeof process!=="undefined"&&Object.prototype.toString.call(process)==="[object process]"){n=Mn}return n}function $n(n,t,e){if(wn.isString(n)){try{(t||JSON.parse)(n);return wn.trim(n)}catch(n){if(n.name!=="SyntaxError"){throw n}}}return(e||JSON.stringify)(n)}var Vn={transitional:Tn,adapter:Xn(),transformRequest:[function n(t,e){jn(e,"Accept");jn(e,"Content-Type");if(wn.isFormData(t)||wn.isArrayBuffer(t)||wn.isBuffer(t)||wn.isStream(t)||wn.isFile(t)||wn.isBlob(t)){return t}if(wn.isArrayBufferView(t)){return t.buffer}if(wn.isURLSearchParams(t)){Wn(e,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var r=wn.isObject(t);var i=e&&e["Content-Type"];var o;if((o=wn.isFileList(t))||r&&i==="multipart/form-data"){var u=this.env&&this.env.FormData;return xn(o?{"files[]":t}:t,u&&new u)}else if(r||i==="application/json"){Wn(e,"application/json");return $n(t)}return t}],transformResponse:[function n(t){var e=this.transitional||Vn.transitional;var r=e&&e.silentJSONParsing;var i=e&&e.forcedJSONParsing;var o=!r&&this.responseType==="json";if(o||i&&wn.isString(t)&&t.length){try{return JSON.parse(t)}catch(n){if(o){if(n.name==="SyntaxError"){throw Dn.from(n,Dn.ERR_BAD_RESPONSE,this,null,this.response)}throw n}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hn},validateStatus:function n(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};wn.forEach(["delete","get","head"],(function n(t){Vn.headers[t]={}}));wn.forEach(["post","put","patch"],(function n(t){Vn.headers[t]=wn.merge(Kn)}));var Zn=Vn;var Gn=function n(t,e,r){var i=this||Zn;wn.forEach(r,(function n(r){t=r.call(i,t,e)}));return t};var Qn=function n(t){return!!(t&&t.__CANCEL__)};function Yn(n){if(n.cancelToken){n.cancelToken.throwIfRequested()}if(n.signal&&n.signal.aborted){throw new zn}}var nt=function n(t){Yn(t);t.headers=t.headers||{};t.data=Gn.call(t,t.data,t.headers,t.transformRequest);t.headers=wn.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);wn.forEach(["delete","get","head","post","put","patch","common"],(function n(e){delete t.headers[e]}));var e=t.adapter||Zn.adapter;return e(t).then((function n(e){Yn(t);e.data=Gn.call(t,e.data,e.headers,t.transformResponse);return e}),(function n(e){if(!Qn(e)){Yn(t);if(e&&e.response){e.response.data=Gn.call(t,e.response.data,e.response.headers,t.transformResponse)}}return Promise.reject(e)}))};var tt=function n(t,e){e=e||{};var r={};function i(n,t){if(wn.isPlainObject(n)&&wn.isPlainObject(t)){return wn.merge(n,t)}else if(wn.isPlainObject(t)){return wn.merge({},t)}else if(wn.isArray(t)){return t.slice()}return t}function o(n){if(!wn.isUndefined(e[n])){return i(t[n],e[n])}else if(!wn.isUndefined(t[n])){return i(undefined,t[n])}}function u(n){if(!wn.isUndefined(e[n])){return i(undefined,e[n])}}function a(n){if(!wn.isUndefined(e[n])){return i(undefined,e[n])}else if(!wn.isUndefined(t[n])){return i(undefined,t[n])}}function f(n){if(n in e){return i(t[n],e[n])}else if(n in t){return i(undefined,t[n])}}var c={url:u,method:u,data:u,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:f};wn.forEach(Object.keys(t).concat(Object.keys(e)),(function n(t){var e=c[t]||o;var i=e(t);wn.isUndefined(i)&&e!==f||(r[t]=i)}));return r};var et={version:"0.27.2"};var rt=et.version;var it={};["object","boolean","number","function","string","symbol"].forEach((function(n,t){it[n]=function e(r){return typeof r===n||"a"+(t<1?"n ":" ")+n}}));var ot={};it.transitional=function n(t,e,r){function i(n,t){return"[Axios v"+rt+"] Transitional option '"+n+"'"+t+(r?". "+r:"")}return function(n,r,o){if(t===false){throw new Dn(i(r," has been removed"+(e?" in "+e:"")),Dn.ERR_DEPRECATED)}if(e&&!ot[r]){ot[r]=true;console.warn(i(r," has been deprecated since v"+e+" and will be removed in the near future"))}return t?t(n,r,o):true}};function ut(n,t,e){if(typeof n!=="object"){throw new Dn("options must be an object",Dn.ERR_BAD_OPTION_VALUE)}var r=Object.keys(n);var i=r.length;while(i-- >0){var o=r[i];var u=t[o];if(u){var a=n[o];var f=a===undefined||u(a,o,n);if(f!==true){throw new Dn("option "+o+" must be "+f,Dn.ERR_BAD_OPTION_VALUE)}continue}if(e!==true){throw new Dn("Unknown option "+o,Dn.ERR_BAD_OPTION)}}}var at={assertOptions:ut,validators:it};var ft=at.validators;function ct(n){this.defaults=n;this.interceptors={request:new Sn,response:new Sn}}ct.prototype.request=function n(t,e){if(typeof t==="string"){e=e||{};e.url=t}else{e=t||{}}e=tt(this.defaults,e);if(e.method){e.method=e.method.toLowerCase()}else if(this.defaults.method){e.method=this.defaults.method.toLowerCase()}else{e.method="get"}var r=e.transitional;if(r!==undefined){at.assertOptions(r,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function n(t){if(typeof t.runWhen==="function"&&t.runWhen(e)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var u=[];this.interceptors.response.forEach((function n(t){u.push(t.fulfilled,t.rejected)}));var a;if(!o){var f=[nt,undefined];Array.prototype.unshift.apply(f,i);f=f.concat(u);a=Promise.resolve(e);while(f.length){a=a.then(f.shift(),f.shift())}return a}var c=e;while(i.length){var s=i.shift();var l=i.shift();try{c=s(c)}catch(n){l(n);break}}try{a=nt(c)}catch(n){return Promise.reject(n)}while(u.length){a=a.then(u.shift(),u.shift())}return a};ct.prototype.getUri=function n(t){t=tt(this.defaults,t);var e=Pn(t.baseURL,t.url);return _n(e,t.params,t.paramsSerializer)};wn.forEach(["delete","get","head","options"],(function n(t){ct.prototype[t]=function(n,e){return this.request(tt(e||{},{method:t,url:n,data:(e||{}).data}))}}));wn.forEach(["post","put","patch"],(function n(t){function e(n){return function e(r,i,o){return this.request(tt(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}ct.prototype[t]=e();ct.prototype[t+"Form"]=e(true)}));var st=ct;function lt(n){if(typeof n!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function n(e){t=e}));var e=this;this.promise.then((function(n){if(!e._listeners)return;var t;var r=e._listeners.length;for(t=0;t<r;t++){e._listeners[t](n)}e._listeners=null}));this.promise.then=function(n){var t;var r=new Promise((function(n){e.subscribe(n);t=n})).then(n);r.cancel=function n(){e.unsubscribe(t)};return r};n((function n(r){if(e.reason){return}e.reason=new zn(r);t(e.reason)}))}lt.prototype.throwIfRequested=function n(){if(this.reason){throw this.reason}};lt.prototype.subscribe=function n(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};lt.prototype.unsubscribe=function n(t){if(!this._listeners){return}var e=this._listeners.indexOf(t);if(e!==-1){this._listeners.splice(e,1)}};lt.source=function n(){var t;var e=new lt((function n(e){t=e}));return{token:e,cancel:t}};var vt=lt;var dt=function n(t){return function n(e){return t.apply(null,e)}};var ht=function n(t){return wn.isObject(t)&&t.isAxiosError===true};function pt(n){var t=new st(n);var e=I(st.prototype.request,t);wn.extend(e,st.prototype,t);wn.extend(e,t);e.create=function t(e){return pt(tt(n,e))};return e}var mt=pt(Zn);mt.Axios=st;mt.CanceledError=zn;mt.CancelToken=vt;mt.isCancel=Qn;mt.VERSION=et.version;mt.toFormData=xn;mt.AxiosError=Dn;mt.Cancel=mt.CanceledError;mt.all=function n(t){return Promise.all(t)};mt.spread=dt;mt.isAxiosError=ht;var bt=mt;var yt=mt;bt.default=yt;var wt=bt;var gt=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};var _t=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(n){return gt()}try{if(!__global__)return gt();return __global__}finally{delete Object.prototype.__global__}}();var Ot=Symbol.for("verdocs-default-endpoint");var St=function(n){console.debug("[JS-SDK] ".concat(n.method.toUpperCase()," ").concat(n.baseURL).concat(n.url),n.data?JSON.stringify(n.data):"");return n};var jt=function(){function n(n){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=F;this.baseURL=(n===null||n===void 0?void 0:n.baseURL)||"https://api.verdocs.com";this.timeout=(n===null||n===void 0?void 0:n.timeout)||3e3;this.environment=(n===null||n===void 0?void 0:n.environment)||"verdocs";this.sessionType=(n===null||n===void 0?void 0:n.sessionType)||"user";this.clientID=(n===null||n===void 0?void 0:n.clientID)||"not-set";this.api=wt.create({baseURL:this.baseURL,timeout:this.timeout})}n.prototype.setDefault=function(){_t[Ot]=this};n.getDefault=function(){if(!_t[Ot]){_t[Ot]=new n;window.console.debug("[JS_SDK] Created default endpoint",_t[Ot])}else{window.console.debug("[JS SDK] Re-using existing endpoint",_t[Ot])}return _t[Ot]};n.prototype.getEnvironment=function(){return this.environment};n.prototype.getSessionType=function(){return this.sessionType};n.prototype.getBaseURL=function(){return this.baseURL};n.prototype.getClientID=function(){return this.clientID};n.prototype.getTimeout=function(){return this.timeout};n.prototype.getSession=function(){return this.session};n.prototype.setEnvironment=function(n){this.environment=n;return this};n.prototype.setSessionType=function(n){this.sessionType=n;return this};n.prototype.setBaseURL=function(n){this.api.defaults.baseURL=n;return this};n.prototype.setClientID=function(n){this.clientID=n;this.api.defaults.headers.common["X-Client-ID"]=n;return this};n.prototype.setTimeout=function(n){this.timeout=n;this.api.defaults.timeout=n;return this};n.prototype.logRequests=function(n){if(n&&this.requestLoggerId===null){this.requestLoggerId=this.api.interceptors.request.use(St)}else if(!n&&this.requestLoggerId!==null){this.api.interceptors.request.eject(this.requestLoggerId)}return this};n.prototype.setToken=function(n){if(!n){return this.clearSession()}var t=i(n);if(t===null||t.exp&&t.exp*1e3<(new Date).getTime()){return this.clearSession()}this.token=n;this.session=t;this.api.defaults.headers.common.Authorization="Bearer ".concat(n);localStorage.setItem(this.sessionStorageKey(),n);this.notifySessionListeners();return this};n.prototype.getToken=function(){return this.token};n.prototype.sessionStorageKey=function(){return"verdocs-session-".concat(this.getSessionType(),"-").concat(this.getEnvironment())};n.prototype.clearSession=function(){localStorage.removeItem(this.sessionStorageKey());delete this.api.defaults.headers.common.Authorization;this.session=null;this.token=null;this.notifySessionListeners();return this};n.prototype.notifySessionListeners=function(){var n=this;this.sessionListeners.forEach((function(t){try{t(n,n.session)}catch(n){}}))};n.prototype.onSessionChanged=function(n){var t=this;this.nextListenerId++;var e=Symbol.for(""+this.nextListenerId);this.sessionListeners.set(e,n);return function(){t.sessionListeners.delete(e)}};n.prototype.loadSession=function(){var n=localStorage.getItem(this.sessionStorageKey());if(!n){return this.clearSession()}return this.setToken(n)};return n}();export{jt as V,l as a,b,y as c,c as g,j as u};
2
+ //# sourceMappingURL=p-a10c13cd.js.map