@verdocs/web-sdk 4.2.102 → 4.2.106

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 (29) hide show
  1. package/dist/cjs/verdocs-auth.cjs.entry.js +5 -1
  2. package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-sign.cjs.entry.js +5 -0
  4. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +5 -1
  5. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +6 -1
  6. package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.css +4 -2
  7. package/dist/components/verdocs-auth.js +5 -1
  8. package/dist/components/verdocs-contact-picker2.js +1 -1
  9. package/dist/components/verdocs-sign.js +6 -1
  10. package/dist/esm/verdocs-auth.entry.js +5 -1
  11. package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
  12. package/dist/esm/verdocs-sign.entry.js +6 -1
  13. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  14. package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
  15. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  16. package/dist/verdocs-web-sdk/p-267df026.system.js +1 -1
  17. package/dist/verdocs-web-sdk/p-3007fa21.entry.js +1 -0
  18. package/dist/verdocs-web-sdk/p-4ae0fd79.system.entry.js +1 -0
  19. package/dist/verdocs-web-sdk/p-afcde3c3.entry.js +1 -0
  20. package/dist/verdocs-web-sdk/p-b7fdf5cb.system.entry.js +1 -0
  21. package/dist/verdocs-web-sdk/p-c33ecae3.system.entry.js +1 -0
  22. package/dist/verdocs-web-sdk/{p-fbcf4277.entry.js → p-ef8aafa1.entry.js} +1 -1
  23. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  24. package/package.json +2 -2
  25. package/dist/verdocs-web-sdk/p-0226144d.system.entry.js +0 -1
  26. package/dist/verdocs-web-sdk/p-08d272d2.entry.js +0 -1
  27. package/dist/verdocs-web-sdk/p-40b66b54.system.entry.js +0 -1
  28. package/dist/verdocs-web-sdk/p-7da5f9e6.entry.js +0 -1
  29. package/dist/verdocs-web-sdk/p-b055bec1.system.entry.js +0 -1
@@ -1 +0,0 @@
1
- System.register(["./p-59073837.system.js","@verdocs/js-sdk","./p-ae347813.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js","./p-f24d887c.system.js"],(function(e){"use strict";var t,o,i,a,c,s,n,r;return{setters:[function(e){t=e.r;o=e.c;i=e.h;a=e.F;c=e.H},function(e){s=e.VerdocsEndpoint;n=e.formatFullName},function(e){r=e.f},function(){},function(){},function(){}],execute:function(){var d='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-contact-picker{display:block;border:1px solid #ebebeb;background-color:#ffffff;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form{display:-ms-flexbox;display:flex;gap:14px;width:300px;padding:12px;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#f5f5fa}verdocs-contact-picker form .row{gap:8px;width:300px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-contact-picker form .row.message{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}verdocs-contact-picker form .names-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .names-row>input{width:110px}verdocs-contact-picker form .kba-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .kba-row>input{width:110px}verdocs-contact-picker form .kba-row verdocs-select-input{margin:0}verdocs-contact-picker form label{display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;font-size:14px;font-weight:500;color:#5c6575}verdocs-contact-picker form .row.message label{-ms-flex:0;flex:0}verdocs-contact-picker form .row.message input{width:100%}verdocs-contact-picker form input{-ms-flex:1;flex:1;border:none;font-size:16px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-contact-picker form input:focus{outline:none}verdocs-contact-picker form .dropdown{left:0;right:0;top:49px;z-index:1000000;max-height:225px;overflow-y:scroll;position:absolute;background:#ffffff;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form .dropdown .suggestion{display:-ms-flexbox;display:flex;padding:6px 12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .dropdown .suggestion svg{width:32px;height:32px}verdocs-contact-picker form .dropdown .suggestion .avatar{width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px;margin-right:8px;border-radius:100%}verdocs-contact-picker form .dropdown .suggestion .details{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-contact-picker form .dropdown .suggestion .name{font-size:16px;font-weight:500;margin-bottom:3px;color:#092c4c}verdocs-contact-picker form .dropdown .suggestion .destination{font-size:14px;margin-bottom:3px;color:#33364b}verdocs-contact-picker form .dropdown .suggestion:hover{background:#eee;cursor:pointer}verdocs-contact-picker .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-contact-picker ::-webkit-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-moz-placeholder{color:#aaaaaa}verdocs-contact-picker :-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::placeholder{color:#aaaaaa}verdocs-contact-picker [data-lastpass-icon-root]{display:none !important}';var l=d;var f='<svg focusable="false" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"></path></svg>';var u='<svg focusable="false" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z" clip-rule="evenodd" /></svg>';var p='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-user"><path d="M15 13a3 3 0 1 0-6 0"/><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"/><circle cx="12" cy="8" r="2"/></svg>';var b=e("verdocs_contact_picker",function(){function e(e){t(this,e);this.searchContacts=o(this,"searchContacts",7);this.exit=o(this,"exit",7);this.next=o(this,"next",7);this.endpoint=s.getDefault();this.templateRole=null;this.contactSuggestions=[];this.first_name=undefined;this.last_name=undefined;this.email=undefined;this.phone=undefined;this.message=undefined;this.showSuggestions=false;this.showMessage=false;this.delegator=false;this.showKba=false;this.kbaMethod="";this.pinCode="";this.nameFieldId="verdocs-contact-picker-name-".concat(Math.random().toString(36).substring(2,11));this.firstNameFieldId="verdocs-contact-picker-firstname-".concat(Math.random().toString(36).substring(2,11));this.lastNameFieldId="verdocs-contact-picker-lastname-".concat(Math.random().toString(36).substring(2,11));this.emailFieldId="verdocs-contact-picker-email-".concat(Math.random().toString(36).substring(2,11));this.phoneFieldId="verdocs-contact-picker-phone-".concat(Math.random().toString(36).substring(2,11))}e.prototype.componentWillLoad=function(){if(this.templateRole){var e=n(this.templateRole);var t=e.split(" ");var o=this.templateRole.first_name||t.shift()||"";var i=this.templateRole.last_name||t.join(" ")||"";this.first_name=o;this.last_name=i;this.email=this.templateRole.email||"";this.phone=this.templateRole.phone||"";this.delegator=this.templateRole.delegator||false;this.message=this.templateRole.message||"";this.showMessage=this.message!=="";this.kbaMethod=this.templateRole.kba_method||"";this.showKba=!!this.kbaMethod;this.pinCode=""}};e.prototype.handleFirstNameChange=function(e){var t;this.first_name=e.target.value;(t=this.searchContacts)===null||t===void 0?void 0:t.emit({query:this.first_name})};e.prototype.handleLastNameChange=function(e){var t;this.last_name=e.target.value;(t=this.searchContacts)===null||t===void 0?void 0:t.emit({query:this.last_name})};e.prototype.handleCancel=function(e){var t;e.stopPropagation();this.showSuggestions=false;(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.handleSubmit=function(e){var t;e.stopPropagation();this.showSuggestions=false;(t=this.next)===null||t===void 0?void 0:t.emit({first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,message:this.message,delegator:this.delegator})};e.prototype.handleSelectSuggestion=function(e,t){e.stopPropagation();this.first_name=t.first_name;this.last_name=t.last_name;this.email=t.email;this.phone=t.phone;this.showSuggestions=false};e.prototype.render=function(){var e=this;return i("form",{key:"8c7cb46336302d309187ca68d7e38ebb3d001468",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},i("div",{key:"8bc7c876bb89ee84dc14978560c6198d31983261",class:"row"},i("label",{key:"b57ac6d694661a48397afc6ab37fbf5cbca8cbc6",htmlFor:this.nameFieldId},"Name:"),i("div",{key:"197fbb1e998f52d0df3fe9040fd5d9d640b0237a",class:"names-row"},i("input",{key:"343aa3e3c8bb31edfc43c4bd51bed1928ea29d49",id:this.firstNameFieldId,name:this.firstNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.first_name,placeholder:"First...",onFocus:function(){var t;return e.showSuggestions=((t=e.contactSuggestions)===null||t===void 0?void 0:t.length)>0},onInput:function(t){return e.handleFirstNameChange(t)}}),i("input",{key:"78e830e80650f52d72e5c35523fa111df228c86b",id:this.lastNameFieldId,name:this.lastNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.last_name,placeholder:"Last...",onFocus:function(){return e.showSuggestions=false},onInput:function(t){return e.handleLastNameChange(t)}})),this.showSuggestions&&i("div",{key:"9b35e34eba14d6ff17c29b7bb334e5a5d8080595",class:"dropdown"},this.contactSuggestions.filter((function(t){return!e.first_name||t.first_name.toLowerCase().includes(e.first_name.toLowerCase())})).map((function(t){var o;return i("div",{key:(o=t.id)!==null&&o!==void 0?o:t.email,class:"suggestion",onClick:function(o){return e.handleSelectSuggestion(o,t)}},t.picture?i("img",{alt:"Avatar",class:"avatar",src:t.picture}):i("div",{class:"avatar",innerHTML:p}),i("div",{class:"details"},i("div",{class:"name"},n(t)),t.email&&i("div",{class:"destination"},t.email),t.phone&&i("div",{class:"destination"},t.phone)))})))),i("div",{key:"4e37f340b40e14e1469742856b9d9f2ea79add97",class:"row"},i("label",{key:"0778e1b56c175a1a5077726fbba30280e5052773",htmlFor:this.emailFieldId},"Email:"),i("input",{key:"9f6806efb77821579c5eee7bf020e0219212761a",id:this.emailFieldId,name:this.emailFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.email,placeholder:"Email address...",onFocus:function(){return e.showSuggestions=false},onInput:function(t){return e.email=t.target.value}})),i("div",{key:"6e99f4b3a76f5696f39d721784be7ca0350a42bb",class:"row"},i("label",{key:"cdbfcb45cb531b203d4417f21daffe82a2b4974a",htmlFor:this.phoneFieldId},"Phone:"),i("input",{key:"384b2d948efacbdbb44bad6e8da4174035a63ad3",id:this.phoneFieldId,name:this.phoneFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.phone,placeholder:"Phone (SMS)...",onFocus:function(){return e.showSuggestions=false},onInput:function(e){return r(e.target.value)}})),this.showKba&&i(a,{key:"3824ab85ac446ee579279c034d44c9c7d9f80f44"},i("div",{key:"253b5ce372f405f20dda62f889eb791dbc958d8c",class:"kba-row"},i("label",{key:"6714f992e2f7710d1fe93ed34596f99c54d8e9b0"},"KBA:"),i("verdocs-select-input",{key:"06107cc54709178c007a5416d0c8dcf9c206a1ca",value:this.kbaMethod,onInput:function(t){return e.kbaMethod=t.target.value},options:[{label:"None",value:""},{label:"PIN Code",value:"pin"},{label:"Full Verification",value:"kba"}]}),i("div",{key:"2d898124db289daada4f174e3fe4b557716ef563",style:{flex:"1"}}),i("verdocs-help-icon",{key:"17c58ed5bedaffa1a0bc1f72f7830076dd46502e",text:"Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature."})),this.kbaMethod==="pin"&&i("div",{key:"caf64fae166a136aebfcce7ed96bfe015a3cdeb4",class:"row pin-code"},i("input",{key:"545918a43fbb7464dcf5f1aa19a7654899071017",id:"verdocs-pin-code",name:"verdocs-pin-code",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.pinCode,placeholder:"KBA PIN Code...",onFocus:function(){return e.showSuggestions=false},onInput:function(t){return e.pinCode=t.target.value}}))),this.showMessage&&i("div",{key:"a747e2260ae8224b5b871ddbf1e8423d0da5e0be",class:"row message"},i("label",{key:"2ff918a32677e81887639120cc5ab09be09e27f3",htmlFor:"verdocs-contact-picker-message"},"Message:"),i("input",{key:"9c4c90117ca81c97f359e4b66dfde17d77506b98",id:"verdocs-contact-picker-message",name:"verdocs-contact-picker-message",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.message,placeholder:"Message shown in invitation...",onFocus:function(){return e.showSuggestions=false},onInput:function(t){return e.message=t.target.value}})),i("div",{key:"3c043c21f0fd8e202de82782ed5d9beec1fa9f2f",class:"buttons"},i("verdocs-toggle-button",{key:"e4e7261482091d4ba73ca11ee0f5b1f738562339",icon:u,size:"small",active:this.showKba,onToggle:function(t){e.showKba=t.detail.active;if(!t.detail.active){e.pinCode="";e.kbaMethod=""}e.showSuggestions=false}}),i("verdocs-toggle-button",{key:"d4fb36d6031a641bf056ee8ef022665bd1655e27",icon:f,size:"small",active:this.showMessage,onToggle:function(t){e.showMessage=t.detail.active;e.showSuggestions=false}}),i("div",{key:"954cbf03867afb74ba9589f0c817541e410dd20c",class:"flex-fill"}),i("verdocs-button",{key:"1b02d3280ab090332a31cd200eed4f2d76d3df4e",variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)}}),i("verdocs-button",{key:"6213ec5d1b337771d53ab8daee0818662666df9f",label:"OK",size:"small",onClick:function(t){return e.handleSubmit(t)}})))};return e}());b.style=l;var h='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-toggle-button{font-family:"Inter", "Barlow", sans-serif}verdocs-toggle-button button{border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#cccccc;color:#33364b}verdocs-toggle-button button svg{max-width:100%;max-height:100%;fill:#33364b}verdocs-toggle-button button.active{background:#55bc81;color:#f5f5fa}verdocs-toggle-button button.active svg{fill:#f5f5fa}verdocs-toggle-button button:focus{border:none;outline:none}verdocs-toggle-button.size-normal button{width:40px;height:40px;padding:6px;border-radius:4px}verdocs-toggle-button.size-small button{width:34px;height:34px;padding:4px;border-radius:2px}';var v=h;var m=e("verdocs_toggle_button",function(){function e(e){t(this,e);this.toggle=o(this,"toggle",7);this.active=false;this.icon=null;this.label=null;this.size="normal";this._active=false}e.prototype.componentWillLoad=function(){this._active=this.active};e.prototype.handleToggle=function(e){var t;e.stopPropagation();var o=!this._active;this._active=o;(t=this.toggle)===null||t===void 0?void 0:t.emit({active:o})};e.prototype.render=function(){var e=this;return i(c,{key:"32eb5cccbb9687200cf1b57266ceb09143d4a478",class:"size-".concat(this.size)},this.icon?i("button",{innerHTML:this.icon,class:{active:this._active},onClick:function(t){return e.handleToggle(t)}}):i("button",{class:{active:this._active},onClick:function(t){return e.handleToggle(t)}},this.label))};return e}());m.style=v}}}));
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as s}from"./p-5207d80c.js";import{VerdocsEndpoint as i,createProfile as o,verifyEmail as a,authenticate as r,getMyUser as l,resendVerification as n,resetPassword as d}from"@verdocs/js-sdk";import{V as c}from"./p-04c07b7b.js";import{S as h}from"./p-fd97809c.js";const u=class{constructor(s){e(this,s),this.authenticated=t(this,"authenticated",7),this.sdkError=t(this,"sdkError",7),this.resendDisabledTimer=null,this.tempAuthEndpoint=new i({baseURL:i.getDefault().getBaseURL(),persist:!1}),this.endpoint=i.getDefault(),this.visible=!0,this.logo="https://app.verdocs.com/assets/blue-logo.svg",this.displayMode="login",this.org_name="",this.first_name="",this.last_name="",this.email="",this.verificationCode="",this.newPassword="",this.password="",this.confirmpass="",this.submitting=!1,this.resendDisabled=!1,this.session=null,this.profile=null}componentWillLoad(){this.endpoint.loadSession(),i.getDefault().onSessionChanged(((e,t,s)=>{var i,o;this.session=t,this.profile=s,t?null===(i=this.authenticated)||void 0===i||i.emit({authenticated:!0,session:t,profile:s}):null===(o=this.authenticated)||void 0===o||o.emit({authenticated:!1,session:t,profile:s})}))}isPasswordComplex(e){const t=e=>/[A-Z]/.test(e),s=e=>/[a-z]/.test(e),i=e=>/[`!@#$%^&*()_\-+=\[\]{};':"\\|,.<>\/?~ ]/.test(e);let o=0,a=0,r=0;for(let l=0;l<e.length;l++){let n=e.charAt(l);t(n)?o++:s(n)?a++:i(n)&&r++}return e.length>=8&&a>0&&o>0&&r>0}handleSignup(){this.isPasswordComplex(this.password)?this.password===this.confirmpass?(this.submitting=!0,this.tempAuthEndpoint.clearSession(),o(this.tempAuthEndpoint,{email:this.email,password:this.password,first_name:this.first_name,last_name:this.last_name,org_name:this.org_name}).then((e=>{console.log("[AUTH] Profile creation result",e),this.tempAuthEndpoint.setToken(e.access_token),this.clearForms(),this.displayMode="verify"})).catch((e=>{var t,s,i,o,a,r;console.log("[AUTH] Signup error",e.response),this.submitting=!1,null===(t=this.authenticated)||void 0===t||t.emit({authenticated:!1,profile:null,session:null}),null===(s=this.sdkError)||void 0===s||s.emit(new h(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(o=e.response)||void 0===o?void 0:o.data)),c("Signup failed: "+(null===(r=null===(a=e.response)||void 0===a?void 0:a.data)||void 0===r?void 0:r.error)||"Unknown Error",{style:"error"})}))):c("Passwords do not match.",{style:"error"}):c("Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.",{style:"error"})}async handleVerification(){this.submitting=!0;try{this.submitting=!1;const e=await a(this.tempAuthEndpoint,{email:this.email,token:this.verificationCode});c("Thank you for verifying your email address.",{style:"success"}),this.completeLogin(e)}catch(e){this.submitting=!1,console.log("Verification error",e),c("Verification error, please check the code and try again.")}}completeLogin(e){this.clearForms(),this.tempAuthEndpoint.clearSession(),this.endpoint.setToken(e.access_token)}async loginAndCheckVerification(){var e;if(!this.submitting){this.submitting=!0,this.tempAuthEndpoint.clearSession();try{this.submitting=!1;const e=await r(this.tempAuthEndpoint,{username:this.email,password:this.password,grant_type:"password"});console.log("[AUTH] Authenticated, checking email verification"),this.tempAuthEndpoint.setToken(e.access_token);const t=await l(this.tempAuthEndpoint);console.log("Got user",t),t.email_verified?(console.log("[AUTH] Email address is verified, completing login"),this.completeLogin(e)):(console.log("[AUTH] Logged in, pending email address verification"),this.displayMode="verify")}catch(t){this.submitting=!1,console.log("[AUTH] Auth failure",(null===(e=t.response)||void 0===e?void 0:e.data)||t),c("Login failed. Please check your credentials and try again.",{style:"error"})}}}clearForms(){this.submitting=!1,this.resendDisabled=!1,this.email="",this.password="",this.newPassword="",this.confirmpass="",this.verificationCode="",this.first_name="",this.last_name="",this.org_name=""}handleLogout(){console.log("logging out"),this.endpoint.clearSession(),this.tempAuthEndpoint.clearSession(),this.clearForms(),this.displayMode="login"}handleResendVerification(){this.resendDisabled=!0,this.resendDisabledTimer=setTimeout((()=>{this.resendDisabled=!1,this.resendDisabledTimer=null}),3e4),n(this.tempAuthEndpoint).then((e=>{console.log("[AUTH] Verification request resent",e),c("Please check your email for a verification code.",{style:"info"})})).catch((e=>{console.log("[AUTH] Unable to resend verification",e),c("Unable to resend code. Please try again later.",{style:"error"})}))}handleResendReset(){this.resendDisabled=!0,this.resendDisabledTimer=setTimeout((()=>{this.resendDisabled=!1,this.resendDisabledTimer=null}),3e4),d(this.tempAuthEndpoint,{email:this.email}).then((e=>{console.log("[AUTH] Resend-code request resent",e),c("Please check your email again for a verification code.",{style:"info"})})).catch((e=>{console.log("[AUTH] Unable to resend reset request",e),c("Unable to resend code. Please try again later.",{style:"error"})}))}async handleResetGetCode(){this.submitting=!0,this.confirmpass="",this.newPassword="";try{this.submitting=!1;const e=await d(this.endpoint,{email:this.email});console.log("[AUTH] Reset result",e),c("Please check your email inbox for a password reset code.",{style:"success"}),this.verificationCode="",this.confirmpass="",this.newPassword="",this.displayMode="reset"}catch(e){this.submitting=!1,console.log("Reset request error",e),c("Request failed. Please check your email address and try again.")}}async handleResetPassword(){if(this.isPasswordComplex(this.newPassword))if(this.newPassword===this.confirmpass){this.submitting=!0;try{this.submitting=!1;const e=await d(this.endpoint,{email:this.email,code:this.verificationCode,new_password:this.newPassword});console.log("reset result",e),c("Your password has been reset. You may now use your new password to login.",{style:"success"}),this.verificationCode="",this.confirmpass="",this.newPassword="",this.password="",this.displayMode="login"}catch(e){this.submitting=!1,console.log("Verification error",e),c("Verification error, please check the code and try again.")}}else c("Passwords do not match.",{style:"error"});else c("Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.",{style:"error"})}async handleReset(){this.submitting=!0;try{const e=await d(this.endpoint,{email:this.email});console.log("[AUTH] Reset sent",e),this.submitting=!1,this.displayMode="login",c("If your email address is registered, you will receive instructions on resetting your password shortly.",{style:"info"})}catch(e){console.log("[AUTH] Unable to reset password",e),this.submitting=!1,c("Unable to reset password. Please check your email address and try again.",{style:"error"})}}render(){if(!this.visible)return s("div",{style:{display:"none"}},"Authenticated");if(this.session)return s("verdocs-button",{label:"Sign Out",disabled:this.submitting,onClick:()=>this.handleLogout(),style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}});if("signup"===this.displayMode){const e=this.submitting||!this.first_name||!this.last_name||!this.email||!this.password||!this.confirmpass||!this.org_name;return s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Sign up for a free account"),s("div",{class:"already-have"},"Already have an account?",s("verdocs-button",{label:"Log In",variant:"text",onClick:()=>this.displayMode="login",disabled:this.submitting})),s("form",{onSubmit:()=>this.handleSignup()},s("div",{style:{display:"flex",flexDirection:"row",columnGap:"20px"}},s("verdocs-text-input",{label:"First Name",autocomplete:"first",required:!0,value:this.first_name,onInput:e=>this.first_name=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:!0,value:this.last_name,onInput:e=>this.last_name=e.target.value,disabled:this.submitting})),s("verdocs-text-input",{label:"Email Address",autocomplete:"email",required:!0,value:this.email,onInput:e=>this.email=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",required:!0,autocomplete:"new-password",value:this.password,onInput:e=>this.password=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Confirm Password",type:"password",required:!0,autocomplete:"off",value:this.confirmpass,onInput:e=>this.confirmpass=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Organization Name",autocomplete:"org",required:!0,value:this.org_name,onInput:e=>this.org_name=e.target.value,disabled:this.submitting,style:{flex:"1"}}),s("div",{style:{marginTop:"30px"}}),s("verdocs-button",{label:"Next",disabled:e,onClick:e?()=>{}:()=>this.handleSignup(),style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return"verify"===this.displayMode?s("div",{class:"form"},s("form",{onSubmit:()=>this.handleVerification()},s("p",null,"Please check your e-mail inbox for a verification code and enter it below."),s("verdocs-text-input",{label:"Verification Code",required:!0,value:this.verificationCode,onInput:e=>this.verificationCode=e.target.value,disabled:this.submitting}),s("div",{class:"buttons"},s("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:()=>this.handleLogout()}),s("verdocs-button",{label:"Verify",disabled:this.submitting||!this.verificationCode||6!==this.verificationCode.length,onClick:()=>this.handleVerification()})),s("div",{class:"buttons"},s("verdocs-button",{variant:"text",label:"Resend Code",disabled:this.resendDisabled||this.submitting,onClick:()=>this.handleResendVerification()})))):"forgot"===this.displayMode?s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Forgot your password?"),s("p",null,"Enter your e-mail address below. If the e-mail address is valid, a password reset code will be sent to your inbox. Please allow up to 15 minutes to arrive, and check your spam folder if you do not receive the message."),s("form",{onSubmit:()=>this.handleResetGetCode()},s("verdocs-text-input",{label:"Email Address",autocomplete:"email",required:!0,value:this.email,onInput:e=>this.email=e.target.value,disabled:this.submitting}),s("div",{style:{marginTop:"30px"}}),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:()=>this.displayMode="login"}),s("verdocs-button",{label:"Request Code",disabled:this.submitting,onClick:()=>this.handleResetGetCode()})))):"reset"===this.displayMode?s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Forgot your password?"),s("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox. Please allow up to 15 minutes to arrive. Check your spam folder if you do not receive the message."),s("form",{onSubmit:()=>this.handleResetPassword()},s("verdocs-text-input",{label:"Verification Code",required:!0,value:this.verificationCode,onInput:e=>this.verificationCode=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",required:!0,autocomplete:"off",value:this.newPassword,onInput:e=>this.newPassword=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Confirm Password",type:"password",required:!0,autocomplete:"off",value:this.confirmpass,onInput:e=>this.confirmpass=e.target.value,disabled:this.submitting}),s("div",{style:{marginTop:"30px"}}),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:()=>this.displayMode="login"}),s("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:()=>this.handleResetPassword()})),s("div",{class:"buttons"},s("verdocs-button",{variant:"text",label:"Resend Code",disabled:this.resendDisabled||this.submitting,onClick:()=>this.handleResendReset()})))):s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Log in to your account"),s("div",{class:"already-have"},"Don't have an account?",s("verdocs-button",{label:"Sign Up",variant:"text",onClick:()=>this.displayMode="signup",disabled:this.submitting})),s("form",{onSubmit:()=>this.loginAndCheckVerification()},s("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.email,onInput:e=>this.email=e.target.value,disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onInput:e=>this.password=e.target.value,disabled:this.submitting}),s("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:()=>this.displayMode="forgot",disabled:this.submitting,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),s("verdocs-button",{label:"Login",disabled:this.submitting,onClick:()=>this.loginAndCheckVerification(),style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))}};u.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}verdocs-auth .form{width:320px;display:-ms-flexbox;display:flex;padding:20px;max-width:90%;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-pack:center;justify-content:center;background:#ffffff}verdocs-auth .logo{width:128px;max-width:100%;margin:20px 0 30px}verdocs-auth h3{text-align:center;font-weight:400;font-size:18px;line-height:1.75;margin:0}verdocs-auth em{font-size:14px;margin:15px 0}verdocs-auth .buttons{gap:20px;margin:20px 0 0 0;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}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}verdocs-auth .account-option{gap:8px;margin:20px 0 8px 0;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-auth p{margin:1em 0;font-size:14px}verdocs-auth p+p{margin-top:0}verdocs-auth verdocs-help-icon{margin-top:18px;display:-ms-flexbox;display:flex;width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px}verdocs-auth .already-have{margin:0.5em 0;font-size:14px}';export{u as verdocs_auth}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,i,t,n){function r(e){return e instanceof t?e:new t((function(i){i(e)}))}return new(t||(t=Promise))((function(t,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n["throw"](e))}catch(e){s(e)}}function c(e){e.done?t(e.value):r(e.value).then(o,a)}c((n=n.apply(e,i||[])).next())}))};var __generator=this&&this.__generator||function(e,i){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(i){return c([e,i])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(t=0)),t)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;r=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1];s=a;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(a);break}if(s[2])t.ops.pop();t.trys.pop();continue}a=i.call(e,t)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||arguments.length===2)for(var n=0,r=i.length,s;n<r;n++){if(s||!(n in i)){if(!s)s=Array.prototype.slice.call(i,0,n);s[n]=i[n]}}return e.concat(s||Array.prototype.slice.call(i))};System.register(["./p-59073837.system.js","@verdocs/js-sdk","./p-ae347813.system.js","./p-38c6897c.system.js","./p-9b26e4e0.system.js","./p-c8a15cb7.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js","./p-f24d887c.system.js","./p-38778553.system.js"],(function(e){"use strict";var i,t,n,r,s,o,a,c,l,u,d,h,f,v,p,g,m,x,b,w,y,k,S,_,N,I,G,z,A;return{setters:[function(e){i=e.r;t=e.c;n=e.h;r=e.H;s=e.F},function(e){o=e.VerdocsEndpoint;a=e.startSigningSession;c=e.envelopeRecipientAgree;l=e.envelopeRecipientDecline;u=e.updateEnvelopeField;d=e.createSignature;h=e.updateEnvelopeFieldSignature;f=e.createInitials;v=e.updateEnvelopeFieldInitials;p=e.isValidPhone;g=e.isValidEmail;m=e.envelopeRecipientSubmit;x=e.uploadEnvelopeFieldAttachment;b=e.deleteEnvelopeFieldAttachment;w=e.formatFullName;y=e.fullNameToInitials;k=e.integerSequence},function(e){S=e.a;_=e.u;N=e.r;I=e.g},function(e){G=e.a},function(e){z=e.V},function(e){A=e.S},function(){},function(){},function(){},function(){}],execute:function(){var E='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 20px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}';var j=E;var P=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var D=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var M=e("verdocs_sign",function(){function e(e){i(this,e);this.sdkError=t(this,"sdkError",7);this.envelopeLoaded=t(this,"envelopeLoaded",7);this.envelopeUpdated=t(this,"envelopeUpdated",7);this.recipientIndex=-1;this.endpoint=null;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.envelope=null;this.roleNames=[];this.sortedRecipients=[];this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.errorMessage="";this.focusedField="";this.submitting=false;this.isDone=false;this.showDone=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document"}e.prototype.componentWillLoad=function(){if(!this.endpoint){console.log("[SIGN] Creating signing endpoint");this.endpoint=new o({sessionType:"signing"})}};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t,n,r,s,o,c,l,u,d;var h=this;return __generator(this,(function(f){switch(f.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new A("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new A("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new A("[SIGN] Missing required inviteCode",500,""));return[2]}f.label=1;case 1:f.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:c=f.sent(),l=c.envelope,u=c.recipient;console.log("[SIGN] Loaded signing session",l,u);this.recipient=u;this.envelope=l;if(this.agreed){this.nextButtonLabel="Next"}G(this.envelope);this.sortedRecipients=__spreadArray([],this.envelope.recipients,true);this.sortedRecipients.sort((function(e,i){return e.sequence===i.sequence?e.order-i.order:e.sequence-i.sequence}));this.roleNames=this.sortedRecipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.roleNames.findIndex((function(e){return e==h.roleId}));if(this.recipientIndex>-1){this.recipient=this.sortedRecipients[this.recipientIndex];this.agreed=this.recipient.agreed}else{console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients)}this.isDone=["submitted","canceled","declined"].includes(this.recipient.status);this.checkRecipientFields();(n=this.envelopeLoaded)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope});return[3,4];case 3:d=f.sent();console.log("[SIGN] Error with signing session",d);(r=this.sdkError)===null||r===void 0?void 0:r.emit(new A(d.message,(s=d.response)===null||s===void 0?void 0:s.status,(o=d.response)===null||o===void 0?void 0:o.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var i=document.getElementById("verdocs-sign-header");if(e&&i){console.log("[SIGN] Moving header");i.remove();e.append(i)}};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;c(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var i;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(i=e.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(i){var t,n,r;console.log("[SIGN] Update failure",i);e.submitting=false;(t=e.sdkError)===null||t===void 0?void 0:t.emit(new A(i.message,(n=i.response)===null||n===void 0?void 0:n.status,(r=i.response)===null||r===void 0?void 0:r.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var i,t,n,r,s,o,a,c;return __generator(this,(function(u){switch(u.label){case 0:o=e.detail.id;switch(o){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:z("This feature will be available in an upcoming release.");(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:this.submitting=true;return[4,l(this.endpoint,this.envelopeId,this.roleId)];case 4:a=u.sent();console.log("[SIGN] Decline result",a);(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.submitting=false;this.isDone=true;return[3,7];case 5:window.print();(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:{c=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(c){S(this.endpoint,this.envelope,c.id).catch((function(e){console.log("[SIGN] Error downloading PDF",e)}));(s=this.envelopeUpdated)===null||s===void 0?void 0:s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,i){var t=this;console.log("[SIGN] updateRecipientFieldValue",e);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=i.value;n.settings=i.settings;_(n);t.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,i){var t=this;console.log("[SIGN] updateRecipientFieldValue",e);u(this.endpoint,this.envelopeId,e,i).then((function(i){return t.updateRecipientFieldValue(e,i)})).catch((function(e){var i,n,r,s,o,a;if(((i=e.response)===null||i===void 0?void 0:i.status)===401&&((r=(n=e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.error)==="jwt expired"){console.log("[SIGN] Signing session expired");t.errorMessage="Signing session expired. Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(s=t.sdkError)===null||s===void 0?void 0:s.emit(new A(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,i){return __awaiter(this,void 0,void 0,(function(){var t,n,r,s,o,a,c;var l=this;return __generator(this,(function(u){switch(u.label){case 0:t=i.target,n=t.value,r=t.checked;s=e.type;switch(s){case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:n})];case 2:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(i.target.checked)})]}u.label=3;case 3:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(i.target.checked)})]}u.label=4;case 4:console.log("Saving dropdown",e.name,i.detail);return[2,this.saveFieldChange(e.name,{prepared:false,value:i.detail})];case 5:if(!i.detail){return[2]}return[4,fetch(i.detail)];case 6:return[4,u.sent().blob()];case 7:o=u.sent();return[2,f(this.endpoint,"initial",o).then((function(i){return __awaiter(l,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:return[4,v(this.endpoint,this.envelopeId,e.name,i.id)];case 1:t=n.sent();this.updateRecipientFieldValue(e.name,t);return[2]}}))}))}))];case 8:if(!i.detail){return[2]}return[4,fetch(i.detail)];case 9:return[4,u.sent().blob()];case 10:a=u.sent();return[2,d(this.endpoint,"signature",a).then((function(i){return __awaiter(l,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",i);return[4,h(this.endpoint,this.envelopeId,e.name,i.id)];case 1:t=n.sent();this.updateRecipientFieldValue(e.name,t);return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e)}))];case 11:c=i.detail.formattedDate;if(c){return[2,this.saveFieldChange(e.name,{prepared:false,value:c})]}return[3,14];case 12:console.log("[SIGN] Updating timestamp",{value:n,ts:i.target.getAttribute("timestamp")});return[3,14];case 13:console.log("[SIGN] Unhandled field update",{value:n,checked:r},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldFilled=function(e){var i=e.value,t=i===void 0?"":i;switch(e.type){case"textbox":switch(e.validator||""){case"email":return g(t);case"phone":return p(t);default:return t!==""}case"signature":return t==="signed";case"initial":return t==="initialed";case"timestamp":return true;case"textarea":case"date":return t!=="";case"attachment":return t==="attached";case"dropdown":return t!=="";case"checkbox":return t==="true";case"radio":if(!!e.group){return this.getRecipientFields().filter((function(i){return i.group===e.group})).some((function(e){return e.value==="true"}))}return e.value==="true";default:return false}};e.prototype.isFieldValid=function(e){return!e.required||this.isFieldFilled(e)};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));e.sort((function(e,i){var t=e.x||0;var n=e.y||0;var r=i.x||0;var s=i.y||0;var o=Math.floor(n/5);var a=Math.floor(s/5);return a!==o?a-o:t-r}));return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t,n,r,s,o,a,c,l,u;var d=this;return __generator(this,(function(h){switch(h.label){case 0:if(!this.nextSubmits)return[3,5];h.label=1;case 1:h.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,m(this.endpoint,this.envelopeId,this.roleId)];case 2:t=h.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;this.isDone=true;return[3,4];case 3:n=h.sent();console.log("[SIGN] Error submitting",n);return[3,4];case 4:this.submitting=false;return[2];case 5:r=this.getSortedFillableFields().filter((function(e){return!d.isFieldFilled(e)}));r.sort((function(e,i){var t=e.x||0;var n=e.y||0;var r=i.x||0;var s=i.y||0;var o=Math.floor(n/5);var a=Math.floor(s/5);return a!==o?a-o:t-r}));s=r.findIndex((function(e){return e.name===d.focusedField}));o=s+1;if(o>=r.length){o=0}a=r[o];c=0;if(c<r.length&&["signature","initial"].includes(a.type)&&((i=a.settings)===null||i===void 0?void 0:i.result)==="signed"){c++;o++;if(o>=r.length){o=0}a=r[o]}if(c>=r.length){a=null}if(a){l=I(a);u=document.getElementById(l);u===null||u===void 0?void 0:u.focusField();u===null||u===void 0?void 0:u.scrollTo({behavior:"smooth",top:0});this.focusedField=a.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;return this.envelope.fields.filter((function(i){return i.role_name===e.recipient.role_name}))};e.prototype.checkRecipientFields=function(){var e=this;var i=this.getRecipientFields().filter((function(i){return!e.isFieldValid(i)}));if(i.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{console.log("[SIGN] Invalid fields remaining",i);this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,i,t){var n=this;t.addEventListener("input",(function(e){console.log("onInput",e.target.type,e.target.name);if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(i,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));t.addEventListener("attached",(function(e){return __awaiter(n,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:console.log("[SIGN] onAttached",e.detail,e.target.value);return[4,x(this.endpoint,this.envelopeId,i.name,e.detail)];case 1:t=n.sent();console.log("upload result",t);this.checkRecipientFields();return[2]}}))}))}));t.addEventListener("remove",(function(e){console.log("[SIGN] onRemoved",e.detail,e.target.value);b(n.endpoint,n.envelopeId,i.name).then((function(e){console.log("[SIGN] Deleted attachment",e)})).catch((function(e){return console.log("[SIGN] Error deleting attachment",e)}))}));t.addEventListener("focusout",(function(e){if(i.type!=="dropdown"){n.handleFieldChange(i,e).finally((function(){return n.checkRecipientFields()}))}}));t.addEventListener("fieldChange",(function(e){n.handleFieldChange(i,e).finally((function(){return n.checkRecipientFields()}))}));t.setAttribute("templateid",this.envelope.template_id);t.setAttribute("fieldname",i.name);t.setAttribute("page",e.pageNumber);t.setAttribute("xScale",e.xScale);t.setAttribute("yScale",e.yScale);var r=w(this.recipient);t.setAttribute("initials",y(r));t.setAttribute("name",r)};e.prototype.handlePageRendered=function(e){var i=this;var t=e.detail;var n=this.getSortedFillableFields();console.log("Recipient fields",n);n.forEach((function(e,n){if(e.page!==t.pageNumber){return}var r=N(e,t,{disabled:false,editable:false,draggable:false,done:i.isDone},n);if(!r){return}if(Array.isArray(r)){r.map((function(n){return i.attachFieldAttributes(t,e,n)}))}else{i.attachFieldAttributes(t,e,r)}}));this.sortedRecipients.filter((function(e){return e.role_name!==i.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){i.getRecipientFields().filter((function(e){return e.page===t.pageNumber})).forEach((function(e){var n=N(e,t,{disabled:true,editable:false,draggable:false,done:i.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return i.attachFieldAttributes(t,e,n)}))}else{i.attachFieldAttributes(t,e,n)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(this.showLoadError){return n(r,null,n("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return n(r,null,n("verdocs-loader",null))}if(this.isDone){return n(r,{class:{agreed:this.agreed}},n("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(i){var t;return(t=e.sdkError)===null||t===void 0?void 0:t.emit(i.detail)}}),this.errorMessage&&n("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&n("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.submitting&&n("div",{class:"loading-indicator"},n("verdocs-loader",null)))}return n(r,{class:{agreed:this.agreed}},n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name),n("div",{style:{flex:"1"}}),this.agreed&&!this.finishLater&&n("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),n("div",{style:{marginLeft:"10px"}}),this.agreed&&n("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?P:D,onOptionSelected:function(i){return e.handleOptionSelected(i)}}))),this.agreed?n("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((function(i){var t=k(1,i.pages);return n(s,null,t.map((function(t){return n("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:i.id,endpoint:e.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:t,onPageRendered:function(i){return e.handlePageRendered(i)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))):n("div",{class:"document",style:{paddingTop:"15px"}},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),this.showFinishLater&&n("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.errorMessage&&n("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:function(){return e.errorMessage=""}}),this.showDone&&n("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.submitting&&n("div",{class:"loading-indicator"},n("verdocs-loader",null)),!this.agreed&&n("div",{class:"cover"},n("div",{class:"agree"},n("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:function(){return e.handleClickAgree()}}),n("ul",null,n("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",n("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),n("li",null,"Agree to Verdocs"," ",n("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",n("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))))};return e}());M.style=j}}}));
@@ -1 +0,0 @@
1
- import{r as e,c as i,h as t,H as s,F as o}from"./p-5207d80c.js";import{VerdocsEndpoint as n,startSigningSession as a,envelopeRecipientAgree as l,envelopeRecipientDecline as r,updateEnvelopeField as d,createSignature as c,updateEnvelopeFieldSignature as h,createInitials as p,updateEnvelopeFieldInitials as u,isValidPhone as g,isValidEmail as v,envelopeRecipientSubmit as m,uploadEnvelopeFieldAttachment as x,deleteEnvelopeFieldAttachment as f,formatFullName as b,fullNameToInitials as w,integerSequence as y}from"@verdocs/js-sdk";import{a as k,u as S,r as N,g as I}from"./p-ca7ef3ff.js";import{a as G}from"./p-784ac100.js";import{V as F}from"./p-04c07b7b.js";import{S as z}from"./p-fd97809c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-edaec1b6.js";import"./p-83317d11.js";const D=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}],R=[{id:"print",label:"Print"},{id:"download",label:"Download"}],j=class{constructor(t){e(this,t),this.sdkError=i(this,"sdkError",7),this.envelopeLoaded=i(this,"envelopeLoaded",7),this.envelopeUpdated=i(this,"envelopeUpdated",7),this.recipientIndex=-1,this.endpoint=null,this.envelopeId=null,this.roleId=null,this.inviteCode=null,this.headerTargetId=null,this.envelope=null,this.roleNames=[],this.sortedRecipients=[],this.recipient=null,this.hasSignature=!1,this.nextButtonLabel="Start",this.nextSubmits=!1,this.errorMessage="",this.focusedField="",this.submitting=!1,this.isDone=!1,this.showDone=!1,this.showLoadError=!1,this.finishLater=!1,this.showFinishLater=!1,this.agreed=!1,this.documentsSingularPlural="document"}componentWillLoad(){this.endpoint||(console.log("[SIGN] Creating signing endpoint"),this.endpoint=new n({sessionType:"signing"}))}async componentDidLoad(){var e,i,t,s,o,n,l;if(this.envelopeId)if(this.roleId)if(this.inviteCode)try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{envelope:e,recipient:i}=await a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode);console.log("[SIGN] Loaded signing session",e,i),this.recipient=i,this.envelope=e,this.agreed&&(this.nextButtonLabel="Next"),G(this.envelope),this.sortedRecipients=[...this.envelope.recipients],this.sortedRecipients.sort(((e,i)=>e.sequence===i.sequence?e.order-i.order:e.sequence-i.sequence)),this.roleNames=this.sortedRecipients.map((e=>e.role_name)),this.envelope.documents.length>0&&(this.documentsSingularPlural="document(s)"),this.recipientIndex=this.roleNames.findIndex((e=>e==this.roleId)),this.recipientIndex>-1?(this.recipient=this.sortedRecipients[this.recipientIndex],this.agreed=this.recipient.agreed):console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients),this.isDone=["submitted","canceled","declined"].includes(this.recipient.status),this.checkRecipientFields(),null===(s=this.envelopeLoaded)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope})}catch(e){console.log("[SIGN] Error with signing session",e),null===(o=this.sdkError)||void 0===o||o.emit(new z(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(l=e.response)||void 0===l?void 0:l.data)),this.showLoadError=!0}else null===(t=this.sdkError)||void 0===t||t.emit(new z("[SIGN] Missing required inviteCode",500,""));else null===(i=this.sdkError)||void 0===i||i.emit(new z("[SIGN] Missing required roleId",500,""));else null===(e=this.sdkError)||void 0===e||e.emit(new z("[SIGN] Missing required envelopId",500,""))}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null,i=document.getElementById("verdocs-sign-header");e&&i&&(console.log("[SIGN] Moving header"),i.remove(),e.append(i))}handleClickAgree(){this.submitting=!0,l(this.endpoint,this.envelopeId,this.roleId,!0).then((()=>{var e;this.nextButtonLabel="Next",this.recipient.agreed=!0,this.submitting=!1,this.agreed=!0,null===(e=this.envelopeUpdated)||void 0===e||e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"agreed"})})).catch((e=>{var i,t,s;console.log("[SIGN] Update failure",e),this.submitting=!1,null===(i=this.sdkError)||void 0===i||i.emit(new z(e.message,null===(t=e.response)||void 0===t?void 0:t.status,null===(s=e.response)||void 0===s?void 0:s.data))}))}async handleOptionSelected(e){var i,t,s,o,n;switch(e.detail.id){case"later":this.finishLater=!0,this.showFinishLater=!0,null===(i=this.envelopeUpdated)||void 0===i||i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"claim":F("This feature will be available in an upcoming release."),null===(t=this.envelopeUpdated)||void 0===t||t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});break;case"decline":{this.submitting=!0;const e=await r(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Decline result",e),null===(s=this.envelopeUpdated)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"}),this.submitting=!1,this.isDone=!0}break;case"print":window.print(),null===(o=this.envelopeUpdated)||void 0===o||o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{const e=this.envelope.documents.find((e=>"attachment"===e.type));e&&(k(this.endpoint,this.envelope,e.id).catch((e=>{console.log("[SIGN] Error downloading PDF",e)})),null===(n=this.envelopeUpdated)||void 0===n||n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"}))}}}updateRecipientFieldValue(e,i){console.log("[SIGN] updateRecipientFieldValue",e),this.getRecipientFields().forEach((t=>{t.name===e&&(t.value=i.value,t.settings=i.settings,S(t),this.checkRecipientFields())}))}saveFieldChange(e,i){console.log("[SIGN] updateRecipientFieldValue",e),d(this.endpoint,this.envelopeId,e,i).then((i=>this.updateRecipientFieldValue(e,i))).catch((e=>{var i,t,s,o,n,a;401===(null===(i=e.response)||void 0===i?void 0:i.status)&&"jwt expired"===(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)?(console.log("[SIGN] Signing session expired"),this.errorMessage="Signing session expired. Please reload your browser to continue."):console.log("[SIGN] Server error",e),null===(o=this.sdkError)||void 0===o||o.emit(new z(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(a=e.response)||void 0===a?void 0:a.data))}))}async handleFieldChange(e,i){const{value:t,checked:s}=i.target;switch(e.type){case"textbox":return this.saveFieldChange(e.name,{prepared:!1,value:t});case"checkbox":case"radio":return this.saveFieldChange(e.name,{prepared:!1,value:String(i.target.checked)});case"dropdown":return console.log("Saving dropdown",e.name,i.detail),this.saveFieldChange(e.name,{prepared:!1,value:i.detail});case"initial":if(!i.detail)return;const o=await(await fetch(i.detail)).blob();return p(this.endpoint,"initial",o).then((async i=>{const t=await u(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t)}));case"signature":if(!i.detail)return;const n=await(await fetch(i.detail)).blob();return c(this.endpoint,"signature",n).then((async i=>{console.log("Signature update result",i);const t=await h(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t)})).catch((e=>{console.warn("[SIGN] Error updating signature",e)}));case"date":const{formattedDate:a}=i.detail;if(a)return this.saveFieldChange(e.name,{prepared:!1,value:a});break;case"timestamp":console.log("[SIGN] Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("[SIGN] Unhandled field update",{value:t,checked:s},e)}}isFieldFilled(e){const{value:i=""}=e;switch(e.type){case"textbox":switch(e.validator||""){case"email":return v(i);case"phone":return g(i);default:return""!==i}case"signature":return"signed"===i;case"initial":return"initialed"===i;case"timestamp":return!0;case"textarea":case"date":return""!==i;case"attachment":return"attached"===i;case"dropdown":return""!==i;case"checkbox":return"true"===i;case"radio":return e.group?this.getRecipientFields().filter((i=>i.group===e.group)).some((e=>"true"===e.value)):"true"===e.value;default:return!1}}isFieldValid(e){return!e.required||this.isFieldFilled(e)}getSortedFillableFields(){const e=this.getRecipientFields().filter((e=>"timestamp"!==e.type));return e.sort(((e,i)=>{const t=e.x||0,s=i.x||0,o=i.y||0,n=Math.floor((e.y||0)/5),a=Math.floor(o/5);return a!==n?a-n:t-s})),e}async handleNext(){var e,i;if(this.nextSubmits){try{null===(e=document.getElementById("air-datepicker-global-container"))||void 0===e||e.remove(),this.submitting=!0;const i=await m(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",i),this.recipient.status="submitted",this.showDone=!0,this.isDone=!0}catch(e){console.log("[SIGN] Error submitting",e)}return void(this.submitting=!1)}const t=this.getSortedFillableFields().filter((e=>!this.isFieldFilled(e)));t.sort(((e,i)=>{const t=e.x||0,s=i.x||0,o=i.y||0,n=Math.floor((e.y||0)/5),a=Math.floor(o/5);return a!==n?a-n:t-s}));let s=t.findIndex((e=>e.name===this.focusedField))+1;s>=t.length&&(s=0);let o=t[s],n=0;if(n<t.length&&["signature","initial"].includes(o.type)&&"signed"===(null===(i=o.settings)||void 0===i?void 0:i.result)&&(n++,s++,s>=t.length&&(s=0),o=t[s]),n>=t.length&&(o=null),o){const e=I(o),i=document.getElementById(e);null==i||i.focusField(),null==i||i.scrollTo({behavior:"smooth",top:0}),this.focusedField=o.name}}getRecipientFields(){return this.envelope.fields.filter((e=>e.role_name===this.recipient.role_name))}checkRecipientFields(){const e=this.getRecipientFields().filter((e=>!this.isFieldValid(e)));e.length<1?(this.nextButtonLabel="Finish",this.nextSubmits||(this.nextSubmits=!0)):(console.log("[SIGN] Invalid fields remaining",e),this.nextButtonLabel="Next",this.nextSubmits=!1)}attachFieldAttributes(e,i,t){t.addEventListener("input",(e=>{console.log("onInput",e.target.type,e.target.name),"radio"===e.target.type||"checkbox"===e.target.type?this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields())):this.checkRecipientFields()})),t.addEventListener("attached",(async e=>{console.log("[SIGN] onAttached",e.detail,e.target.value);const t=await x(this.endpoint,this.envelopeId,i.name,e.detail);console.log("upload result",t),this.checkRecipientFields()})),t.addEventListener("remove",(e=>{console.log("[SIGN] onRemoved",e.detail,e.target.value),f(this.endpoint,this.envelopeId,i.name).then((e=>{console.log("[SIGN] Deleted attachment",e)})).catch((e=>console.log("[SIGN] Error deleting attachment",e)))})),t.addEventListener("focusout",(e=>{"dropdown"!==i.type&&this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.addEventListener("fieldChange",(e=>{this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.setAttribute("templateid",this.envelope.template_id),t.setAttribute("fieldname",i.name),t.setAttribute("page",e.pageNumber),t.setAttribute("xScale",e.xScale),t.setAttribute("yScale",e.yScale);const s=b(this.recipient);t.setAttribute("initials",w(s)),t.setAttribute("name",s)}handlePageRendered(e){const i=e.detail,t=this.getSortedFillableFields();console.log("Recipient fields",t),t.forEach(((e,t)=>{if(e.page!==i.pageNumber)return;const s=N(e,i,{disabled:!1,editable:!1,draggable:!1,done:this.isDone},t);s&&(Array.isArray(s)?s.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,s))})),this.sortedRecipients.filter((e=>e.role_name!==this.recipient.role_name&&("invited"===e.status||"opened"===e.status||"pending"===e.status))).forEach((()=>{this.getRecipientFields().filter((e=>e.page===i.pageNumber)).forEach((e=>{const t=N(e,i,{disabled:!0,editable:!1,draggable:!1,done:this.isDone});t&&(Array.isArray(t)?t.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,t))}))})),this.checkRecipientFields()}render(){return this.showLoadError?t(s,null,t("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:()=>{window.location.reload()}})):this.envelope?this.isDone?t(s,{class:{agreed:this.agreed}},t("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:e=>{var i;return null===(i=this.sdkError)||void 0===i?void 0:i.emit(e.detail)}}),this.errorMessage&&t("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:()=>this.errorMessage=""}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:()=>{this.showDone=!1,this.isDone=!0}}),this.submitting&&t("div",{class:"loading-indicator"},t("verdocs-loader",null))):t(s,{class:{agreed:this.agreed}},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name),t("div",{style:{flex:"1"}}),this.agreed&&!this.finishLater&&t("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!this.agreed,onClick:()=>this.handleNext()}),t("div",{style:{marginLeft:"10px"}}),this.agreed&&t("verdocs-dropdown",{options:this.isDone||this.finishLater?R:D,onOptionSelected:e=>this.handleOptionSelected(e)}))),t("div",{class:"document",style:{paddingTop:"15px"}},this.agreed?(this.envelope.documents||[]).map((e=>{const i=y(1,e.pages);return t(o,null,i.map((i=>t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,virtualWidth:612,virtualHeight:792,pageNumber:i,onPageRendered:e=>this.handlePageRendered(e),type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))))})):t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),this.showFinishLater&&t("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:`To complete the ${this.documentsSingularPlural}, use the link in the original email notification inviting you to review and finish the document.`,onNext:()=>this.showFinishLater=!1}),this.errorMessage&&t("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:()=>this.errorMessage=""}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:()=>{this.showDone=!1,this.isDone=!0}}),this.submitting&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)),!this.agreed&&t("div",{class:"cover"},t("div",{class:"agree"},t("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:()=>this.handleClickAgree()}),t("ul",null,t("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",t("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),t("li",null,"Agree to Verdocs"," ",t("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",t("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),"."))))):t(s,null,t("verdocs-loader",null))}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 20px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}';export{j as verdocs_sign}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,s){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s["throw"](e))}catch(e){n(e)}}function l(e){e.done?i(e.value):r(e.value).then(o,a)}l((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,r,n,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(s)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(s=1,r&&(n=a[0]&2?r["return"]:a[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;if(r=0,n)a=[a[0]&2,n.value];switch(a[0]){case 0:case 1:n=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(n=i.trys,n=n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(a[0]===6&&i.label<n[1]){i.label=n[1];n=a;break}if(n&&i.label<n[2]){i.label=n[2];i.ops.push(a);break}if(n[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{s=n=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-59073837.system.js","@verdocs/js-sdk","./p-9b26e4e0.system.js","./p-c8a15cb7.system.js"],(function(e){"use strict";var t,i,s,r,n,o,a,l,u,c,d,h;return{setters:[function(e){t=e.r;i=e.c;s=e.h},function(e){r=e.VerdocsEndpoint;n=e.createProfile;o=e.verifyEmail;a=e.authenticate;l=e.getMyUser;u=e.resendVerification;c=e.resetPassword},function(e){d=e.V},function(e){h=e.S}],execute:function(){var f='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}verdocs-auth .form{width:320px;display:-ms-flexbox;display:flex;padding:20px;max-width:90%;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-pack:center;justify-content:center;background:#ffffff}verdocs-auth .logo{width:128px;max-width:100%;margin:20px 0 30px}verdocs-auth h3{text-align:center;font-weight:400;font-size:18px;line-height:1.75;margin:0}verdocs-auth em{font-size:14px;margin:15px 0}verdocs-auth .buttons{gap:20px;margin:20px 0 0 0;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}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}verdocs-auth .account-option{gap:8px;margin:20px 0 8px 0;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-auth p{margin:1em 0;font-size:14px}verdocs-auth p+p{margin-top:0}verdocs-auth verdocs-help-icon{margin-top:18px;display:-ms-flexbox;display:flex;width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px}verdocs-auth .already-have{margin:0.5em 0;font-size:14px}';var p=f;var v=e("verdocs_auth",function(){function e(e){t(this,e);this.authenticated=i(this,"authenticated",7);this.sdkError=i(this,"sdkError",7);this.resendDisabledTimer=null;this.tempAuthEndpoint=new r({baseURL:r.getDefault().getBaseURL(),persist:false});this.endpoint=r.getDefault();this.visible=true;this.logo="https://app.verdocs.com/assets/blue-logo.svg";this.displayMode="login";this.org_name="";this.first_name="";this.last_name="";this.email="";this.verificationCode="";this.newPassword="";this.password="";this.confirmpass="";this.submitting=false;this.resendDisabled=false;this.session=null;this.profile=null}e.prototype.componentWillLoad=function(){var e=this;this.endpoint.loadSession();r.getDefault().onSessionChanged((function(t,i,s){var r,n;e.session=i;e.profile=s;if(i){(r=e.authenticated)===null||r===void 0?void 0:r.emit({authenticated:true,session:i,profile:s})}else{(n=e.authenticated)===null||n===void 0?void 0:n.emit({authenticated:false,session:i,profile:s})}}))};e.prototype.isPasswordComplex=function(e){var t=function(e){return/[A-Z]/.test(e)};var i=function(e){return/[a-z]/.test(e)};var s=function(e){return/[`!@#$%^&*()_\-+=\[\]{};':"\\|,.<>\/?~ ]/.test(e)};var r=0,n=0,o=0;for(var a=0;a<e.length;a++){var l=e.charAt(a);if(t(l))r++;else if(i(l))n++;else if(s(l))o++}return e.length>=8&&n>0&&r>0&&o>0};e.prototype.handleSignup=function(){var e=this;if(!this.isPasswordComplex(this.password)){d("Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.",{style:"error"});return}if(this.password!==this.confirmpass){d("Passwords do not match.",{style:"error"});return}this.submitting=true;this.tempAuthEndpoint.clearSession();n(this.tempAuthEndpoint,{email:this.email,password:this.password,first_name:this.first_name,last_name:this.last_name,org_name:this.org_name}).then((function(t){console.log("[AUTH] Profile creation result",t);e.tempAuthEndpoint.setToken(t.access_token);e.clearForms();e.displayMode="verify"})).catch((function(t){var i,s,r,n,o,a;console.log("[AUTH] Signup error",t.response);e.submitting=false;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,profile:null,session:null});(s=e.sdkError)===null||s===void 0?void 0:s.emit(new h(t.message,(r=t.response)===null||r===void 0?void 0:r.status,(n=t.response)===null||n===void 0?void 0:n.data));d("Signup failed: "+((a=(o=t.response)===null||o===void 0?void 0:o.data)===null||a===void 0?void 0:a.error)||"Unknown Error",{style:"error"})}))};e.prototype.handleVerification=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:this.submitting=true;i.label=1;case 1:i.trys.push([1,3,,4]);this.submitting=false;return[4,o(this.tempAuthEndpoint,{email:this.email,token:this.verificationCode})];case 2:e=i.sent();d("Thank you for verifying your email address.",{style:"success"});this.completeLogin(e);return[3,4];case 3:t=i.sent();this.submitting=false;console.log("Verification error",t);d("Verification error, please check the code and try again.");return[3,4];case 4:return[2]}}))}))};e.prototype.completeLogin=function(e){this.clearForms();this.tempAuthEndpoint.clearSession();this.endpoint.setToken(e.access_token)};e.prototype.loginAndCheckVerification=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,s;return __generator(this,(function(r){switch(r.label){case 0:if(this.submitting){return[2]}this.submitting=true;this.tempAuthEndpoint.clearSession();r.label=1;case 1:r.trys.push([1,4,,5]);this.submitting=false;return[4,a(this.tempAuthEndpoint,{username:this.email,password:this.password,grant_type:"password"})];case 2:t=r.sent();console.log("[AUTH] Authenticated, checking email verification");this.tempAuthEndpoint.setToken(t.access_token);return[4,l(this.tempAuthEndpoint)];case 3:i=r.sent();console.log("Got user",i);if(!i.email_verified){console.log("[AUTH] Logged in, pending email address verification");this.displayMode="verify"}else{console.log("[AUTH] Email address is verified, completing login");this.completeLogin(t)}return[3,5];case 4:s=r.sent();this.submitting=false;console.log("[AUTH] Auth failure",((e=s.response)===null||e===void 0?void 0:e.data)||s);d("Login failed. Please check your credentials and try again.",{style:"error"});return[3,5];case 5:return[2]}}))}))};e.prototype.clearForms=function(){this.submitting=false;this.resendDisabled=false;this.email="";this.password="";this.newPassword="";this.confirmpass="";this.verificationCode="";this.first_name="";this.last_name="";this.org_name=""};e.prototype.handleLogout=function(){console.log("logging out");this.endpoint.clearSession();this.tempAuthEndpoint.clearSession();this.clearForms();this.displayMode="login"};e.prototype.handleResendVerification=function(){var e=this;this.resendDisabled=true;this.resendDisabledTimer=setTimeout((function(){e.resendDisabled=false;e.resendDisabledTimer=null}),3e4);u(this.tempAuthEndpoint).then((function(e){console.log("[AUTH] Verification request resent",e);d("Please check your email for a verification code.",{style:"info"})})).catch((function(e){console.log("[AUTH] Unable to resend verification",e);d("Unable to resend code. Please try again later.",{style:"error"})}))};e.prototype.handleResendReset=function(){var e=this;this.resendDisabled=true;this.resendDisabledTimer=setTimeout((function(){e.resendDisabled=false;e.resendDisabledTimer=null}),3e4);c(this.tempAuthEndpoint,{email:this.email}).then((function(e){console.log("[AUTH] Resend-code request resent",e);d("Please check your email again for a verification code.",{style:"info"})})).catch((function(e){console.log("[AUTH] Unable to resend reset request",e);d("Unable to resend code. Please try again later.",{style:"error"})}))};e.prototype.handleResetGetCode=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:this.submitting=true;this.confirmpass="";this.newPassword="";i.label=1;case 1:i.trys.push([1,3,,4]);this.submitting=false;return[4,c(this.endpoint,{email:this.email})];case 2:e=i.sent();console.log("[AUTH] Reset result",e);d("Please check your email inbox for a password reset code.",{style:"success"});this.verificationCode="";this.confirmpass="";this.newPassword="";this.displayMode="reset";return[3,4];case 3:t=i.sent();this.submitting=false;console.log("Reset request error",t);d("Request failed. Please check your email address and try again.");return[3,4];case 4:return[2]}}))}))};e.prototype.handleResetPassword=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:if(!this.isPasswordComplex(this.newPassword)){d("Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.",{style:"error"});return[2]}if(this.newPassword!==this.confirmpass){d("Passwords do not match.",{style:"error"});return[2]}this.submitting=true;i.label=1;case 1:i.trys.push([1,3,,4]);this.submitting=false;return[4,c(this.endpoint,{email:this.email,code:this.verificationCode,new_password:this.newPassword})];case 2:e=i.sent();console.log("reset result",e);d("Your password has been reset. You may now use your new password to login.",{style:"success"});this.verificationCode="";this.confirmpass="";this.newPassword="";this.password="";this.displayMode="login";return[3,4];case 3:t=i.sent();this.submitting=false;console.log("Verification error",t);d("Verification error, please check the code and try again.");return[3,4];case 4:return[2]}}))}))};e.prototype.handleReset=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:this.submitting=true;i.label=1;case 1:i.trys.push([1,3,,4]);return[4,c(this.endpoint,{email:this.email})];case 2:e=i.sent();console.log("[AUTH] Reset sent",e);this.submitting=false;this.displayMode="login";d("If your email address is registered, you will receive instructions on resetting your password shortly.",{style:"info"});return[3,4];case 3:t=i.sent();console.log("[AUTH] Unable to reset password",t);this.submitting=false;d("Unable to reset password. Please check your email address and try again.",{style:"error"});return[3,4];case 4:return[2]}}))}))};e.prototype.render=function(){var e=this;if(!this.visible){return s("div",{style:{display:"none"}},"Authenticated")}if(this.session){return s("verdocs-button",{label:"Sign Out",disabled:this.submitting,onClick:function(){return e.handleLogout()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})}if(this.displayMode==="signup"){var t=this.submitting||!this.first_name||!this.last_name||!this.email||!this.password||!this.confirmpass||!this.org_name;return s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Sign up for a free account"),s("div",{class:"already-have"},"Already have an account?",s("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return e.displayMode="login"},disabled:this.submitting})),s("form",{onSubmit:function(){return e.handleSignup()}},s("div",{style:{display:"flex",flexDirection:"row",columnGap:"20px"}},s("verdocs-text-input",{label:"First Name",autocomplete:"first",required:true,value:this.first_name,onInput:function(t){return e.first_name=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:true,value:this.last_name,onInput:function(t){return e.last_name=t.target.value},disabled:this.submitting})),s("verdocs-text-input",{label:"Email Address",autocomplete:"email",required:true,value:this.email,onInput:function(t){return e.email=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",required:true,autocomplete:"new-password",value:this.password,onInput:function(t){return e.password=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Confirm Password",type:"password",required:true,autocomplete:"off",value:this.confirmpass,onInput:function(t){return e.confirmpass=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Organization Name",autocomplete:"org",required:true,value:this.org_name,onInput:function(t){return e.org_name=t.target.value},disabled:this.submitting,style:{flex:"1"}}),s("div",{style:{marginTop:"30px"}}),s("verdocs-button",{label:"Next",disabled:t,onClick:t?function(){}:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}if(this.displayMode==="verify"){return s("div",{class:"form"},s("form",{onSubmit:function(){return e.handleVerification()}},s("p",null,"Please check your e-mail inbox for a verification code and enter it below."),s("verdocs-text-input",{label:"Verification Code",required:true,value:this.verificationCode,onInput:function(t){return e.verificationCode=t.target.value},disabled:this.submitting}),s("div",{class:"buttons"},s("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:function(){return e.handleLogout()}}),s("verdocs-button",{label:"Verify",disabled:this.submitting||!this.verificationCode||this.verificationCode.length!==6,onClick:function(){return e.handleVerification()}})),s("div",{class:"buttons"},s("verdocs-button",{variant:"text",label:"Resend Code",disabled:this.resendDisabled||this.submitting,onClick:function(){return e.handleResendVerification()}}))))}if(this.displayMode==="forgot"){return s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Forgot your password?"),s("p",null,"Enter your e-mail address below. If the e-mail address is valid, a password reset code will be sent to your inbox. Please allow up to 15 minutes to arrive, and check your spam folder if you do not receive the message."),s("form",{onSubmit:function(){return e.handleResetGetCode()}},s("verdocs-text-input",{label:"Email Address",autocomplete:"email",required:true,value:this.email,onInput:function(t){return e.email=t.target.value},disabled:this.submitting}),s("div",{style:{marginTop:"30px"}}),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:function(){return e.displayMode="login"}}),s("verdocs-button",{label:"Request Code",disabled:this.submitting,onClick:function(){return e.handleResetGetCode()}}))))}if(this.displayMode==="reset"){return s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Forgot your password?"),s("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox. Please allow up to 15 minutes to arrive. Check your spam folder if you do not receive the message."),s("form",{onSubmit:function(){return e.handleResetPassword()}},s("verdocs-text-input",{label:"Verification Code",required:true,value:this.verificationCode,onInput:function(t){return e.verificationCode=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",required:true,autocomplete:"off",value:this.newPassword,onInput:function(t){return e.newPassword=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Confirm Password",type:"password",required:true,autocomplete:"off",value:this.confirmpass,onInput:function(t){return e.confirmpass=t.target.value},disabled:this.submitting}),s("div",{style:{marginTop:"30px"}}),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:function(){return e.displayMode="login"}}),s("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:function(){return e.handleResetPassword()}})),s("div",{class:"buttons"},s("verdocs-button",{variant:"text",label:"Resend Code",disabled:this.resendDisabled||this.submitting,onClick:function(){return e.handleResendReset()}}))))}return s("div",{class:"form"},s("a",{href:"https://verdocs.com/en/"},s("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),s("h3",null,"Log in to your account"),s("div",{class:"already-have"},"Don't have an account?",s("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return e.displayMode="signup"},disabled:this.submitting})),s("form",{onSubmit:function(){return e.loginAndCheckVerification()}},s("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.email,onInput:function(t){return e.email=t.target.value},disabled:this.submitting}),s("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.target.value},disabled:this.submitting}),s("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return e.displayMode="forgot"},disabled:this.submitting,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),s("verdocs-button",{label:"Login",disabled:this.submitting,onClick:function(){return e.loginAndCheckVerification()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))};return e}());v.style=p}}}));