@verdocs/web-sdk 4.2.1 → 4.2.11

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 (79) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/verdocs-activity-box.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +30 -57
  4. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +12 -10
  5. package/dist/cjs/verdocs-preview_10.cjs.entry.js +10 -5
  6. package/dist/cjs/verdocs-sign.cjs.entry.js +3 -9
  7. package/dist/cjs/verdocs-status-indicator.cjs.entry.js +2 -2
  8. package/dist/cjs/verdocs-view.cjs.entry.js +3 -3
  9. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  10. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +33 -65
  11. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +3 -10
  12. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +4 -4
  13. package/dist/collection/components/envelopes/verdocs-activity-box/verdocs-activity-box.js +4 -4
  14. package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +13 -11
  15. package/dist/collection/components/envelopes/verdocs-status-indicator/verdocs-status-indicator.js +4 -9
  16. package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.js +2 -2
  17. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +9 -4
  18. package/dist/collection/utils/utils.js +1 -1
  19. package/dist/components/verdocs-activity-box.js +1 -1
  20. package/dist/components/verdocs-auth.js +37 -75
  21. package/dist/components/verdocs-envelopes-list.js +13 -11
  22. package/dist/components/verdocs-sign.js +3 -10
  23. package/dist/components/verdocs-status-indicator2.js +2 -2
  24. package/dist/components/verdocs-template-create2.js +2 -2
  25. package/dist/components/verdocs-template-roles2.js +9 -4
  26. package/dist/components/verdocs-view2.js +4 -4
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/verdocs-activity-box.entry.js +1 -1
  29. package/dist/esm/verdocs-auth.entry.js +30 -57
  30. package/dist/esm/verdocs-envelopes-list.entry.js +13 -11
  31. package/dist/esm/verdocs-preview_10.entry.js +11 -6
  32. package/dist/esm/verdocs-sign.entry.js +3 -9
  33. package/dist/esm/verdocs-status-indicator.entry.js +2 -2
  34. package/dist/esm/verdocs-view.entry.js +4 -4
  35. package/dist/esm/verdocs-web-sdk.js +1 -1
  36. package/dist/esm-es5/loader.js +1 -1
  37. package/dist/esm-es5/verdocs-activity-box.entry.js +1 -1
  38. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  39. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  40. package/dist/esm-es5/verdocs-preview_10.entry.js +1 -1
  41. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  42. package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
  43. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  44. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  45. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +4 -8
  46. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +0 -1
  47. package/dist/types/components/envelopes/verdocs-activity-box/verdocs-activity-box.d.ts +3 -3
  48. package/dist/types/components/envelopes/verdocs-status-indicator/verdocs-status-indicator.d.ts +2 -2
  49. package/dist/types/components.d.ts +6 -6
  50. package/dist/types/utils/utils.d.ts +2 -2
  51. package/dist/verdocs-web-sdk/p-18363901.entry.js +1 -0
  52. package/dist/verdocs-web-sdk/p-322fa613.system.js +1 -1
  53. package/dist/verdocs-web-sdk/p-4f90b641.entry.js +1 -0
  54. package/dist/verdocs-web-sdk/p-51544250.system.entry.js +1 -0
  55. package/dist/verdocs-web-sdk/p-8d0807ab.system.entry.js +1 -0
  56. package/dist/verdocs-web-sdk/p-a2a0c7b4.system.entry.js +1 -0
  57. package/dist/verdocs-web-sdk/p-a7dac539.entry.js +1 -0
  58. package/dist/verdocs-web-sdk/{p-27ab21de.system.entry.js → p-b96e571d.system.entry.js} +1 -1
  59. package/dist/verdocs-web-sdk/{p-a11d459d.system.entry.js → p-cef88396.system.entry.js} +1 -1
  60. package/dist/verdocs-web-sdk/{p-3dcdaf36.entry.js → p-cf1ae7bf.entry.js} +1 -1
  61. package/dist/verdocs-web-sdk/p-d6f6f255.entry.js +1 -0
  62. package/dist/verdocs-web-sdk/p-ee08c75b.system.entry.js +1 -0
  63. package/dist/verdocs-web-sdk/p-f0299a13.system.entry.js +1 -0
  64. package/dist/verdocs-web-sdk/p-fd2c9b30.entry.js +1 -0
  65. package/dist/verdocs-web-sdk/p-feddcfe3.entry.js +1 -0
  66. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  67. package/package.json +2 -2
  68. package/dist/custom-elements.json +0 -2086
  69. package/dist/verdocs-web-sdk/p-16beca12.entry.js +0 -1
  70. package/dist/verdocs-web-sdk/p-203d8ff0.entry.js +0 -1
  71. package/dist/verdocs-web-sdk/p-413ab8a1.system.entry.js +0 -1
  72. package/dist/verdocs-web-sdk/p-61257cb2.entry.js +0 -1
  73. package/dist/verdocs-web-sdk/p-687c07ad.entry.js +0 -1
  74. package/dist/verdocs-web-sdk/p-9bef9a21.system.entry.js +0 -1
  75. package/dist/verdocs-web-sdk/p-aedcd301.entry.js +0 -1
  76. package/dist/verdocs-web-sdk/p-b6b6f12a.system.entry.js +0 -1
  77. package/dist/verdocs-web-sdk/p-dc5ebc7c.entry.js +0 -1
  78. package/dist/verdocs-web-sdk/p-eb0c78af.system.entry.js +0 -1
  79. package/dist/verdocs-web-sdk/p-f1d41587.system.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i}from"./p-73a6f972.js";import{VerdocsEndpoint as s,createProfile as l,authenticate as o,decodeAccessTokenBody as a,resendVerification as n,resetPassword as r}from"@verdocs/js-sdk";import{V as u}from"./p-026b3103.js";import{S as d}from"./p-fd97809c.js";const c=[{value:"",label:""},{value:"Accounting & Tax",label:"Accounting & Tax"},{value:"Business Services / Consulting",label:"Business Services / Consulting"},{value:"Construction",label:"Construction"},{value:"Education",label:"Education"},{value:"Financial Services",label:"Financial Services"},{value:"Government",label:"Government"},{value:"Healthcare - Health Plans & Payers",label:"Healthcare - Health Plans & Payers"},{value:"Healthcare - Providers",label:"Healthcare - Providers"},{value:"Insurance",label:"Insurance"},{value:"Legal",label:"Legal"},{value:"Life Sciences",label:"Life Sciences"},{value:"Manufacturing",label:"Manufacturing"},{value:"Mortgage",label:"Mortgage"},{value:"Not For Profit",label:"Not For Profit"},{value:"Real Estate - Commercial",label:"Real Estate - Commercial"},{value:"Real Estate - Residential",label:"Real Estate - Residential"},{value:"Retail",label:"Retail"},{value:"Technology",label:"Technology"},{value:"Other",label:"Other"}],h=[{value:"",label:""},{value:"I want to send a document for signature.",label:"I want to send a document for signature."},{value:"I just need to sign a document today.",label:"I just need to sign a document today."},{value:"I'm evaluating it for my business.",label:"I'm evaluating it for my business."},{value:"I'm evaluating it for my personal use.",label:"I'm evaluating it for my personal use."},{value:"I'm a developer building an integration.",label:"I'm a developer building an integration."}],p=[{value:"",label:""},{value:"Solo",label:"Solo"},{value:"2-10",label:"2-10"},{value:"11-50",label:"11-50"},{value:"51-200",label:"51-200"},{value:"201-500",label:"201-500"},{value:"501-1000",label:"501-1000"},{value:"1000+",label:"1000+"}],v=class{constructor(i){e(this,i),this.authenticated=t(this,"authenticated",7),this.sdkError=t(this,"sdkError",7),this.recheckTimer=null,this.resendDisabledTimer=null,this.accessTokenForVerification=null,this.endpoint=s.getDefault(),this.visible=!0,this.logo="https://app.verdocs.com/assets/blue-logo.svg",this.isAuthenticated=!1,this.displayMode="login",this.orgname="",this.first="",this.last="",this.username="",this.phone="",this.password="",this.submitting=!1,this.activeSession=null,this.accountType="org",this.howHear="",this.industry="",this.companySize="",this.reason="",this.signupStep=1,this.resendDisabled=!1,this.checkingOrg=!1}componentWillLoad(){var e,t;this.endpoint.loadSession(),this.endpoint.session?(console.log("[AUTH] Authenticated"),this.isAuthenticated=!0,this.activeSession=this.endpoint.session,null===(e=this.authenticated)||void 0===e||e.emit({authenticated:!0,session:this.endpoint.session})):(console.log("[AUTH] Anonymous"),null===(t=this.authenticated)||void 0===t||t.emit({authenticated:!1,session:null}))}disconnectedCallback(){this.cancelRecheckTimer()}cancelRecheckTimer(){if(this.recheckTimer){try{clearTimeout(this.recheckTimer)}catch(e){}this.recheckTimer=null}if(this.resendDisabledTimer){try{clearTimeout(this.resendDisabledTimer)}catch(e){}this.resendDisabledTimer=null}}handleSignup(){this.submitting=!0,this.accessTokenForVerification=null,l(this.endpoint,{email:this.username,password:this.password,firstName:this.first,lastName:this.last,orgName:this.orgname}).then((e=>{console.log("Result",e),console.log("[AUTH] Created profile",e.profile),console.log("[AUTH] Created organization",e.organization),this.loginAndCheckVerification()})).catch((e=>{var t,i,s,l,o,a;console.log("[AUTH] Signup error",e.response),this.submitting=!1,this.activeSession=null,null===(t=this.authenticated)||void 0===t||t.emit({authenticated:!1,session:null}),null===(i=this.sdkError)||void 0===i||i.emit(new d(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(l=e.response)||void 0===l?void 0:l.data)),u("Signup failed: "+(null===(a=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===a?void 0:a.message)||"Unknown Error",{style:"error"})}))}loginAndCheckVerification(){this.submitting=!0,this.accessTokenForVerification=null,o(this.endpoint,{username:this.username,password:this.password,grant_type:"password"}).then((e=>{var t;this.cancelRecheckTimer(),this.submitting=!1;const i=a(e.access_token);console.log("[AUTH] Got access token body",i),(null==i?void 0:i.email_verified)?(console.log("[AUTH] Email address is verified, completing login"),this.displayMode="login",this.accessTokenForVerification=null,this.endpoint.setToken(e.access_token),this.activeSession=this.endpoint.session,this.isAuthenticated=!0,null===(t=this.authenticated)||void 0===t||t.emit({authenticated:!0,session:this.endpoint.session})):(console.log("[AUTH] Logged in, pending email address verification"),this.displayMode="verify",this.accessTokenForVerification=e.access_token,this.recheckTimer=setTimeout((()=>this.loginAndCheckVerification()),5e3))})).catch((e=>{var t,i,s,l;this.cancelRecheckTimer(),console.log("[AUTH] Authentication error",e.response,JSON.stringify(e)),this.displayMode="login",this.submitting=!1,this.activeSession=null,null===(t=this.authenticated)||void 0===t||t.emit({authenticated:!1,session:null}),null===(i=this.sdkError)||void 0===i||i.emit(new d(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(l=e.response)||void 0===l?void 0:l.data)),u("Login failed. Please check your username and password and try again.",{style:"error"})}))}handleLogout(){var e;this.endpoint.clearSession(),this.isAuthenticated=!1,this.accessTokenForVerification=null,null===(e=this.authenticated)||void 0===e||e.emit({authenticated:!1,session:null})}handleResend(){this.resendDisabled=!0,this.resendDisabledTimer=setTimeout((()=>{this.resendDisabled=!1,this.resendDisabledTimer=null}),3e4),n(this.endpoint,this.accessTokenForVerification).then((e=>{console.log("[AUTH] Verification request resent",e),u("Please check your email for a message with verification instructions.",{style:"info"})})).catch((e=>{console.log("[AUTH] Unable to resend verification",e)}))}handleReset(){this.submitting=!0,r(this.endpoint,{email:this.username}).then((e=>{console.log("[AUTH] Reset sent",e),this.submitting=!1,this.displayMode="login",u("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}))}render(){if(!this.visible)return i("div",{style:{display:"none"}},"Authenticated");if(this.isAuthenticated)return i("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||!this.last||!this.username||!this.password||!this.orgname;return i("div",{class:"form"},i("a",{href:"https://verdocs.com/en/"},i("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),i("h3",null,"Sign up for a trial account"),i("h4",null,"Already have an account?",i("verdocs-button",{label:"Log In",variant:"text",onClick:()=>this.displayMode="login",disabled:this.submitting})),1===this.signupStep&&i("form",{onSubmit:()=>this.handleSignup()},i("div",{style:{display:"flex",flexDirection:"row",columnGap:"20px"}},i("verdocs-text-input",{label:"First Name",autocomplete:"first",required:!0,value:this.first,onInput:e=>this.first=e.target.value,disabled:this.submitting}),i("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:!0,value:this.last,onInput:e=>this.last=e.target.value,disabled:this.submitting})),i("verdocs-text-input",{label:"Email",autocomplete:"email",required:!0,value:this.username,onInput:e=>this.username=e.target.value,disabled:this.submitting}),i("verdocs-text-input",{label:"Phone #",autocomplete:"phone",value:this.phone,onInput:e=>this.phone=e.target.value,disabled:this.submitting}),i("verdocs-text-input",{label:"Password",type:"password",required:!0,autocomplete:"current-password",value:this.password,onInput:e=>this.password=e.target.value,disabled:this.submitting}),i("verdocs-text-input",{label:"Organization Name",autocomplete:"org",required:!0,value:this.orgname,onInput:e=>this.orgname=e.target.value,disabled:this.submitting,style:{flex:"1"}}),i("div",{style:{marginTop:"30px"}}),i("verdocs-button",{label:"Next",disabled:e,onClick:()=>this.signupStep=2,style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),2===this.signupStep&&i("form",{onSubmit:()=>this.handleSignup()},i("verdocs-text-input",{label:"How did you hear about Verdocs?",value:this.howHear,onInput:e=>this.howHear=e.target.value,disabled:this.submitting}),i("verdocs-select-input",{label:"Your Industry",options:c,value:this.industry,onInput:e=>this.industry=e.target.value,disabled:this.submitting}),i("verdocs-select-input",{label:"Company Size",options:p,value:this.companySize,onInput:e=>this.companySize=e.target.value,disabled:this.submitting}),i("verdocs-select-input",{label:"Purpose",options:h,value:this.reason,onInput:e=>this.reason=e.target.value,disabled:this.submitting}),i("div",{style:{marginTop:"30px"}}),i("verdocs-button",{label:"Create Account",disabled:this.submitting,onClick:()=>this.handleSignup(),style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),3===this.signupStep&&i("form",{onSubmit:()=>this.handleSignup()},i("p",null,"Please check your e-mail inbox for a verification code and follow the instructions provided."),i("p",null,i("em",null,"Verification messages may take up to 1 hour to arrive. If you do not receive the invitation, ",i("a",{href:"#"},"Click Here")," to resend it. Be sure to check your spam folder.")),i("div",{style:{display:"flex",flexDirection:"row",gap:"20px"}},i("verdocs-button",{label:"Back",disabled:this.submitting,onClick:()=>{this.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}),i("verdocs-button",{label:"Go to Dashboard",disabled:!0,onClick:()=>this.handleSignup(),style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}))))}return"forgot"===this.displayMode?i("div",{class:"form"},i("a",{href:"https://verdocs.com/en/"},i("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),i("h3",null,"Forgot your password?"),i("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox."),i("p",null,i("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),i("form",{onSubmit:()=>this.handleSignup()},i("verdocs-text-input",{label:"Email",autocomplete:"email",required:!0,value:this.username,onInput:e=>this.username=e.target.value,disabled:this.submitting}),i("div",{style:{marginTop:"30px"}}),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:()=>this.displayMode="login"}),i("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:()=>this.handleReset()})))):"verify"===this.displayMode?i("div",{class:"form"},i("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),i("h3",null,"Please Verify your Email Address"),i("p",null,"Check your e-mail inbox for a verification email, and follow the instructions provided."),i("p",null,i("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),i("div",{class:"buttons"},i("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:()=>{this.username="",this.password="",this.cancelRecheckTimer(),this.displayMode="login"}}),i("verdocs-button",{label:"Resend Email",disabled:this.resendDisabled,onClick:()=>this.handleResend()}))):i("div",{class:"form"},i("a",{href:"https://verdocs.com/en/"},i("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),i("h3",null,"Log in to your account"),i("h4",null,"Don't have an account?",i("verdocs-button",{label:"Sign Up",variant:"text",onClick:()=>{this.displayMode="signup",this.signupStep=1},disabled:this.submitting})),i("form",{onSubmit:()=>this.loginAndCheckVerification()},i("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onInput:e=>this.username=e.target.value,disabled:this.submitting}),i("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onInput:e=>this.password=e.target.value,disabled:this.submitting}),i("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:()=>this.displayMode="forgot",disabled:this.submitting,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),i("verdocs-button",{label:"Login",disabled:this.submitting,onClick:()=>this.loginAndCheckVerification(),style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))}};v.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-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth h4 verdocs-button button.normal .button-label{padding:0}verdocs-auth .buttons{gap:20px;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+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}';export{v as verdocs_auth}
@@ -1 +0,0 @@
1
- import{r as e,c as i,h as t,H as s,F as o}from"./p-73a6f972.js";import{VerdocsEndpoint as n,getSigningSession as l,getEnvelope as a,envelopeRecipientAgree as r,envelopeRecipientDecline as d,updateEnvelopeField as h,createSignature as c,updateEnvelopeFieldSignature as u,createInitials as p,updateEnvelopeFieldInitials as v,isValidPhone as g,isValidEmail as m,envelopeRecipientSubmit as x,uploadEnvelopeFieldAttachment as b,fullNameToInitials as f,integerSequence as w}from"@verdocs/js-sdk";import{a as y,u as k,r as S,g as N}from"./p-cc32d84f.js";import{a as I}from"./p-f69d8d39.js";import{V as F}from"./p-026b3103.js";import{S as G}from"./p-fd97809c.js";import"./p-251c4106.js";import"./p-edaec1b6.js";import"./p-00b37c9a.js";const z=[{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"}],_=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.endpoint=null,this.recipientIndex=-1,this.envelopeId=null,this.roleId=null,this.inviteCode=null,this.headerTargetId=null,this.envelope=null,this.roleNames=[],this.sortedRecipients=[],this.recipient=null,this.signerToken=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=new n({sessionType:"signing"})}async componentWillRender(){var e,i,t,s,o,n,r;if(this.envelopeId)if(this.roleId)if(this.inviteCode)try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{session:e,recipient:i,signerToken:t}=await l(this.endpoint,{envelopeId:this.envelopeId,roleId:this.roleId,inviteCode:this.inviteCode});console.log(`[SIGN] Loaded signing session ${e.email} / ${e.profile_id}`),this.recipient=i,console.log("[SIGN] We are recipient",this.recipient),this.signerToken=t,this.endpoint.setToken(t),this.agreed&&(this.nextButtonLabel="Next"),this.envelope=await a(this.endpoint,this.envelopeId),I(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.log("[SIGN] Found our recipient in the envelope",this.recipientIndex,this.recipient)):console.log("[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("Error with signing session",e),null===(o=this.sdkError)||void 0===o||o.emit(new G(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(r=e.response)||void 0===r?void 0:r.data)),this.showLoadError=!0}else null===(t=this.sdkError)||void 0===t||t.emit(new G("[SIGN] Missing required inviteCode",500,""));else null===(i=this.sdkError)||void 0===i||i.emit(new G("[SIGN] Missing required roleId",500,""));else null===(e=this.sdkError)||void 0===e||e.emit(new G("[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,r(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("Update failure",e),this.submitting=!1,null===(i=this.sdkError)||void 0===i||i.emit(new G(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 d(this.endpoint,this.envelopeId,this.roleId);console.log("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&&(y(this.endpoint,this.envelope,e.id).catch((e=>{console.log("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.settings=i.settings,k(t),this.checkRecipientFields())}))}saveFieldChange(e,i){console.log("[SIGN] updateRecipientFieldValue",e),h(this.endpoint,this.envelopeId,e,i).then((i=>this.updateRecipientFieldValue(e,i))).catch((e=>{var i,t,s,o,n,l;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 G(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(l=e.response)||void 0===l?void 0:l.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_group":{const t=e.settings.options.map((e=>({id:e.id,checked:i.target.checked})));return this.saveFieldChange(e.name,{prepared:!1,value:{options:t}})}case"radio_button_group":{const t=e.settings.options.map((e=>({id:e.id,selected:i.target.value===e.id})));return this.saveFieldChange(e.name,{prepared:!1,value:{options:t}})}case"dropdown":return 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 v(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 u(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t)})).catch((e=>{console.warn("Error updating signature",e)}));case"date":const{date:l,formattedDate:a}=i.detail;if(a)return console.log("dt",{date:l,formattedDate:a}),this.saveFieldChange(e.name,{prepared:!1,value:a});break;case"timestamp":console.log("Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("Unhandled field update",{value:t,checked:s},e)}}isFieldFilled(e){var i,t,s,o,n,l;const{result:a="",value:r="",base64:d=""}=e.settings||{};switch(e.type){case"textbox":switch(e.validator||""){case"email":return m(a);case"phone":return g(a);default:return""!==a}case"signature":case"initial":return""!==d;case"timestamp":return!0;case"textarea":case"date":case"attachment":return""!==a;case"dropdown":return""!==r;case"checkbox_group":const h=((null===(t=null===(i=e.settings)||void 0===i?void 0:i.options)||void 0===t?void 0:t.filter((e=>e.checked)))||[]).length;return h>=((null===(s=e.settings)||void 0===s?void 0:s.minimum_checked)||0)&&h<=((null===(o=e.settings)||void 0===o?void 0:o.maximum_checked)||999);case"radio_button_group":return((null===(l=null===(n=e.settings)||void 0===n?void 0:n.options)||void 0===l?void 0:l.filter((e=>e.selected)))||[]).length>0;default:return!1}}isFieldValid(e){const{required:i=!1}=e;return!i||this.isFieldFilled(e)}getSortedFillableFields(){const e=this.getRecipientFields().filter((e=>"timestamp"!==e.type));return e.sort(((e,i)=>{var t,s,o,n;const l=(null===(t=e.settings)||void 0===t?void 0:t.x)||0,a=(null===(s=e.settings)||void 0===s?void 0:s.y)||0,r=(null===(o=i.settings)||void 0===o?void 0:o.x)||0,d=(null===(n=i.settings)||void 0===n?void 0:n.y)||0,h=Math.floor(a/5),c=Math.floor(d/5);return c!==h?c-h:l-r})),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 x(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)=>{var t,s,o,n;const l=(null===(t=e.settings)||void 0===t?void 0:t.x)||0,a=(null===(s=e.settings)||void 0===s?void 0:s.y)||0,r=(null===(o=i.settings)||void 0===o?void 0:o.x)||0,d=(null===(n=i.settings)||void 0===n?void 0:n.y)||0,h=Math.floor(a/5),c=Math.floor(d/5);return c!==h?c-h:l-r}));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=N(o),i=document.getElementById(e);console.log("Jumping to next field",o),null==i||i.focusField(),null==i||i.scrollTo({behavior:"smooth",top:0}),this.focusedField=o.name}}getRecipientFields(){return this.envelope.fields.filter((e=>e.recipient_role===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){var s;t.addEventListener("input",(e=>{e.target.name.includes("date")||e.target.name.includes("checkbox_group")||e.target.name.includes("radio_button_group")?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 b(this.endpoint,this.envelopeId,this.roleId,i.name,e.detail);console.log("upload result",t),this.checkRecipientFields()})),t.addEventListener("removed",(e=>{console.log("[SIGN] onRemoved",e.detail,e.target.value)})),t.addEventListener("focusout",(e=>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),t.setAttribute("initials",this.recipient?f(this.recipient.full_name):""),t.setAttribute("name",(null===(s=this.recipient)||void 0===s?void 0:s.full_name)||"")}handlePageRendered(e){const i=e.detail;this.getSortedFillableFields().forEach(((e,t)=>{if(e.page!==i.pageNumber)return;const s=S(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=S(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.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:z,onOptionSelected:e=>this.handleOptionSelected(e)}))),t("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((e=>{const i=w(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"}]}))))}))),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.showLoadError&&t("verdocs-ok-dialog",{heading:"Error Loading Document",message:"Please check with the sender to ensure it has not been canceled, and try again later.",buttonLabel:"Retry",onNext:()=>{this.showLoadError=!1,window.location.reload()}}),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))}};_.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{_ as verdocs_sign}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,i,t){function o(e){return e instanceof i?e:new i((function(n){n(e)}))}return new(i||(i=Promise))((function(i,r){function s(e){try{c(t.next(e))}catch(e){r(e)}}function a(e){try{c(t["throw"](e))}catch(e){r(e)}}function c(e){e.done?i(e.value):o(e.value).then(s,a)}c((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},t,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(n){return c([e,n])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(t=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e];o=0}finally{t=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-e748b2d2.system.js","@verdocs/js-sdk","./p-85519037.system.js","./p-c8a15cb7.system.js","./p-1a180595.system.js","./p-f24d887c.system.js"],(function(e){"use strict";var n,i,t,o,r,s,a,c,l,d,u,f,h,v;return{setters:[function(e){n=e.r;i=e.c;t=e.h;o=e.H;r=e.F;s=e.g},function(e){a=e.VerdocsEndpoint;c=e.throttledGetEnvelope;l=e.getDocumentDownloadLink;d=e.cancelEnvelope;u=e.userCanCancelEnvelope;f=e.integerSequence},function(e){h=e.s},function(e){v=e.S},function(){},function(){}],execute:function(){var p='@-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-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .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)}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}@media all and (max-width: 500px){#verdocs-view-header{padding:0 10px}}#verdocs-view-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}@media all and (max-width: 500px){#verdocs-view-header .inner{padding:0 10px}}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}';var x=p;var w=e("verdocs_view",function(){function e(e){n(this,e);this.sdkError=i(this,"sdkError",7);this.envelopeUpdated=i(this,"envelopeUpdated",7);this.another=i(this,"another",7);this.view=i(this,"view",7);this.next=i(this,"next",7);this.endpoint=a.getDefault();this.envelopeId="";this.headerTargetId=null;this.canceling=false;this.envelope=null;this.roleNames=[];this.showCancelDone=false}e.prototype.componentWillLoad=function(){this.endpoint.loadSession()};e.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.envelopeId){console.error("[VIEW] Missing required envelopeId");return[2]}return[2,this.reloadEnvelope()]}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var n=document.getElementById("verdocs-view-header");if(e&&n){console.log("[VIEW] Moving header");n.remove();e.append(n)}};e.prototype.reloadEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,i,t,o;var r=this;return __generator(this,(function(s){switch(s.label){case 0:console.log("[VIEW] Loading envelope...");s.label=1;case 1:s.trys.push([1,3,,4]);t=this;return[4,c(this.endpoint,this.envelopeId)];case 2:t.envelope=s.sent();console.log("[VIEW] Loaded envelope",this.envelope);this.roleNames=this.envelope.recipients.map((function(e){return e.role_name}));setTimeout((function(){return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:console.log("[VIEW] Reloading envelope...");e=this;return[4,c(this.endpoint,this.envelopeId)];case 1:e.envelope=n.sent();console.log("[VIEW] Reloaded envelope",this.envelope);return[2]}}))}))}),2e3);return[3,4];case 3:o=s.sent();(e=this.sdkError)===null||e===void 0?void 0:e.emit(new v(o.message,(n=o.response)===null||n===void 0?void 0:n.status,(i=o.response)===null||i===void 0?void 0:i.data));return[3,4];case 4:return[2]}}))}))};e.prototype.handlePageRendered=function(e){var n=e.detail;console.log("[VIEW] Page rendered",n)};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var n,i,t,o,r,s,r;var a=this;return __generator(this,(function(u){switch(u.label){case 0:t=e.detail.id;switch(t){case"cancel":return[3,1];case"print":return[3,2];case"download-attachments":return[3,3];case"download-certificate":return[3,6];case"download-all":return[3,9]}return[3,10];case 1:if(confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")){this.canceling=true;d(this.endpoint,this.envelopeId).then((function(e){a.canceling=false;console.log("[VIEW] Envelope canceled",e);return c(a.endpoint,a.envelopeId)})).then((function(e){console.log("[VIEW] Loaded new envelope details",e);a.envelope=e})).catch((function(e){var n,i,t;a.canceling=false;console.log("[VIEW] Error canceling envelope",e);(n=a.sdkError)===null||n===void 0?void 0:n.emit(new v(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(t=e.response)===null||t===void 0?void 0:t.data))}));this.showCancelDone=true;(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"})}return[3,10];case 2:window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,10];case 3:o=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(!o)return[3,5];return[4,l(this.endpoint,this.envelopeId,o.id)];case 4:r=u.sent();window.open(r,"_blank");u.label=5;case 5:return[3,10];case 6:s=this.envelope.documents.find((function(e){return e.type==="certificate"}));if(!s)return[3,8];return[4,l(this.endpoint,this.envelopeId,s.id)];case 7:r=u.sent();window.open(r,"_blank");u.label=8;case 8:return[3,10];case 9:h(this.endpoint,[this.envelope]).then((function(){var e;(e=a.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:a.endpoint,envelope:a.envelope,event:"downloaded"})})).catch((function(e){console.log("Error downloading Zip",e)}));return[3,10];case 10:return[2]}}))}))};e.prototype.render=function(){var e=this;var n;if(!this.envelope){return t(o,null,t("img",{src:"https://verdocs-public-assets.s3.amazonaws.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}))}var i=[{id:"print",label:"Print"}];if(u(this.endpoint.profile,this.envelope)){i.push({id:"cancel",label:"Cancel"})}var s=this.envelope.documents.length>0;var a=this.envelope.documents.filter((function(e){return e.type==="attachment"})).length;var c=this.envelope.documents.find((function(e){return e.type==="certificate"}))!==undefined;if(s||c){i.push({label:""});if(s){i.push({id:"download-attachments",label:a>1?"Download Documents":"Download Document"})}if(c){i.push({id:"download-certificate",label:"Download Certificate"})}if(s&&c){i.push({id:"download-all",label:"Download All Files"})}}return t(o,null,t("div",{id:"verdocs-view-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"}}),t("div",{style:{marginLeft:"10px"}}),t("verdocs-dropdown",{options:i,onOptionSelected:function(n){return e.handleOptionSelected(n)}}))),t("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((n=this.envelope)===null||n===void 0?void 0:n.documents)||[]).filter((function(e){return e.type!=="certificate"})).map((function(n){var i=f(1,n.pages);return t(r,null,i.map((function(i){return t("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:n.id,endpoint:e.endpoint,type:"filled",virtualWidth:612,virtualHeight:792,pageNumber:i,onPageRendered:function(n){return e.handlePageRendered(n)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showCancelDone&&t("verdocs-ok-dialog",{heading:"Cancelled",message:"This envelope has been cancelled successfully.",onNext:function(){e.showCancelDone=false}}),this.canceling&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)))};Object.defineProperty(e.prototype,"component",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());w.style=x}}}));
@@ -1 +0,0 @@
1
- import{r as e,c as s,h as i,H as l}from"./p-73a6f972.js";import{VerdocsEndpoint as t,listEnvelopes as a,integerSequence as o,getRecipientsWithActions as n,userCanCancelEnvelope as d,userCanAct as r,cancelEnvelope as c}from"@verdocs/js-sdk";import{s as p}from"./p-cc32d84f.js";import{V as h}from"./p-026b3103.js";import{S as v}from"./p-fd97809c.js";import"./p-251c4106.js";import"./p-edaec1b6.js";const f=[{value:"all",label:"All"},{value:"inbox",label:"Inbox"},{value:"sent",label:"Sent"},{value:"completed",label:"Completed"},{value:"action",label:"Action Required"},{value:"waiting",label:"Waiting on Others"}],x=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"in progress",label:"In Progress"},{value:"complete",label:"Completed"},{value:"declined",label:"Declined"},{value:"canceled",label:"Canceled"}],b=[{value:"created_at",label:"Created"},{value:"updated_at",label:"Updated"},{value:"canceled_at",label:"Canceled"},{value:"envelope_name",label:"Name"},{value:"envelope_status",label:"Status"}],m=class{constructor(i){e(this,i),this.changeView=s(this,"changeView",7),this.changeStatus=s(this,"changeStatus",7),this.changeSort=s(this,"changeSort",7),this.changeMatch=s(this,"changeMatch",7),this.sdkError=s(this,"sdkError",7),this.viewEnvelope=s(this,"viewEnvelope",7),this.finishEnvelope=s(this,"finishEnvelope",7),this.endpoint=t.getDefault(),this.view=void 0,this.status="all",this.sort="created_at",this.match="",this.showPagination=!0,this.rowsPerPage=10,this.selectedPage=0,this.count=0,this.initiallyLoaded=!1,this.loading=!0,this.selectedEnvelopes=[],this.envelopes=[]}handleViewUpdated(){return this.queryEnvelopes()}handleStatusUpdated(){return this.queryEnvelopes()}handleSortUpdated(){return this.queryEnvelopes()}handleMatchUpdated(){return this.queryEnvelopes()}handlePageUpdated(){return this.queryEnvelopes()}componentWillLoad(){this.endpoint.onSessionChanged(((e,s,i)=>{console.log("[ENVELOPES_LIST] onSessionChanged",s,i)})),this.endpoint.loadSession()}async componentDidLoad(){await this.queryEnvelopes(),this.initiallyLoaded=!0}async queryEnvelopes(){var e,s,i;try{this.loading=!0;let e={page:this.selectedPage,rows:this.rowsPerPage};switch(this.view){case"all":default:e={...e,status:"all"===this.status?["pending","in progress","complete","declined","canceled"]:[this.status]};break;case"inbox":e={...e};break;case"sent":e={...e,is_owner:!0};break;case"action":e={...e,status:["pending","in progress"]};break;case"waiting":e={...e,is_owner:!0,status:["pending","in progress"]};break;case"completed":e={...e,status:["complete"]}}"all"===this.view&&"all"!==this.status&&(e.status=[this.status]),this.match.trim();const s=await a(this.endpoint,e);this.envelopes=s.envelopes,this.count=s.total,this.loading=!1}catch(l){this.loading=!1,console.log("[ENVELOPES] Error listing envelopes",l),null===(e=this.sdkError)||void 0===e||e.emit(new v(l.message,null===(s=l.response)||void 0===s?void 0:s.status,null===(i=l.response)||void 0===i?void 0:i.data))}}handleDownload(){p(this.endpoint,this.selectedEnvelopes).then((()=>{this.selectedEnvelopes=[]})).catch((e=>{console.log("[ENVELOPES] Download error",e),h("Download error: "+e.message,{style:"error"})}))}downloadEnvelope(e){p(this.endpoint,[e]).catch((e=>{console.log("[ENVELOPES] Download error",e),h("Download error: "+e.message,{style:"error"})}))}render(){return i(l,{key:"fa39f66d3d2c557bf70bdf51b8232920da5f17c3"},i("div",{key:"88681a60242e65fc5f60546dcedc0b90bb2866ab",class:"header"},i("div",{key:"7e881cff0962a3867776aefb92b8045571fd3537",class:"filter"},i("verdocs-text-input",{key:"a8387f075c6c6f107d46c2879bd2bd557af97838",id:"verdocs-filter-name",value:this.match,clearable:!0,autocomplete:"off",placeholder:"Filter by Name, Recipient, or Field...",onFocusout:e=>{var s;this.match=e.target.value.trim(),null===(s=this.changeMatch)||void 0===s||s.emit(this.match)}})),i("verdocs-quick-filter",{key:"70f3794df71c00ab7cd76558ae2661caddd54b53",label:"View",value:this.view,options:f,onOptionSelected:e=>{this.view=e.detail.value}}),"all"===this.view&&i("verdocs-quick-filter",{key:"02145f9b41a95655c7456520352ab7395c02a518",label:"Status",value:this.status,options:x,onOptionSelected:e=>{this.status=e.detail.value}}),"all"===this.view&&i("verdocs-quick-filter",{key:"271a35272e0ea4e5c079e30a4f61fafca207097f",label:"Sort By",value:this.sort,options:b,onOptionSelected:e=>{this.sort=e.detail.value}}),this.loading&&i("verdocs-spinner",{key:"4a885f1f7c7513a3941847313a4e41616b3c841c",mode:"dark",size:24}),i("div",{key:"055587fbd6bc0e9aa9c38dc5c067d5d0bd6923a4",style:{display:"flex",flex:"1"}}),this.selectedEnvelopes.length>0&&i("verdocs-button",{key:"feb763f42c31aebfcd2b74761431212206691b28",label:`Download (${this.selectedEnvelopes.length})`,onClick:()=>this.handleDownload()})),this.envelopes.map((e=>{var s;const l=n(e),t=d(this.endpoint.profile,e),a=l.find((e=>{var s;return e.email===(null===(s=this.endpoint.session)||void 0===s?void 0:s.email)||""})),o=[{label:"View Envelope",id:"view"},{label:"Finish Envelope",id:"finish",disabled:!(a&&t&&r((null===(s=this.endpoint.session)||void 0===s?void 0:s.email)||"",l))},{label:"Download",id:"download"},{label:"Cancel",id:"cancel",disabled:!t}];return i("div",{class:"envelope",key:e.id,onClick:()=>{var s;return null===(s=this.viewEnvelope)||void 0===s?void 0:s.emit({endpoint:this.endpoint,envelope:e})}},i("div",{class:"inner"},i("verdocs-checkbox",{checked:-1!==this.selectedEnvelopes.findIndex((s=>s.id===e.id)),onClick:e=>e.stopPropagation(),onInput:s=>{this.selectedEnvelopes=s.target.checked?[...this.selectedEnvelopes,e]:this.selectedEnvelopes.filter((s=>s.id!==e.id))}}),i("div",{class:"vert-spacer"}),i("span",{innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000000" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>',class:"envelope-icon"}),i("div",{class:"envelope-name"},e.name,":  ",i("div",{class:"envelope-recipients"},e.recipients.map((e=>e.full_name)).join(", "))),i("div",{class:"vert-spacer"}),i("verdocs-status-indicator",{envelope:e,style:{width:"125px"}}),i("div",{class:"vert-spacer"}),i("div",{class:"last-modified"},new Date(e.updated_at).toLocaleString()),i("div",{class:"vert-spacer"}),i("verdocs-dropdown",{options:o,onOptionSelected:s=>{var i,l;switch(s.detail.id){case"view":null===(i=this.viewEnvelope)||void 0===i||i.emit({endpoint:this.endpoint,envelope:e});break;case"finish":null===(l=this.finishEnvelope)||void 0===l||l.emit({endpoint:this.endpoint,envelope:e});break;case"download":this.downloadEnvelope(e);break;case"cancel":window.confirm("Are you sure you want to cancel this envelope?")&&(c(this.endpoint,e.id).then((()=>h("Envelope canceled"))).catch((e=>h("Unable to cancel envelope: "+e.messabge,{style:"error"}))),this.queryEnvelopes().catch((()=>{})))}}})))})),!this.initiallyLoaded&&i("div",{key:"19835ba9dbe9c56ef8c45c08f38c537a7c70bebd",style:{width:"100%"}},o(0,this.rowsPerPage).map((()=>i("div",{class:"envelope-placeholder"})))),this.initiallyLoaded&&!this.envelopes.length&&i("div",{key:"5844f2a1576d7c574865c01b3e7af99eb82b4303",class:"empty-text"},"No matching envelopes found. Please adjust your filters and try again."),this.initiallyLoaded&&this.envelopes.length&&this.showPagination?i("div",{style:{marginTop:"20px"}},i("verdocs-pagination",{selectedPage:this.selectedPage,perPage:this.rowsPerPage,itemCount:this.count,onSelectPage:e=>{this.selectedPage=e.detail.selectedPage}})):i("div",null))}static get watchers(){return{view:["handleViewUpdated"],status:["handleStatusUpdated"],sort:["handleSortUpdated"],match:["handleMatchUpdated"],selectedPage:["handlePageUpdated"]}}};m.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-envelopes-list{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", "Barlow", sans-serif}@media screen and (max-width: 800px){verdocs-envelopes-list{font-size:14px}}verdocs-envelopes-list .envelope-placeholder{height:48px;-ms-flex:0 0 48px;flex:0 0 48px;margin:5px 0;border-radius:5px;background:#f5f5fa}verdocs-envelopes-list .header{width:100%;row-gap:4px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:12px;-moz-column-gap:12px;column-gap:12px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-envelopes-list .header .filter{width:300px}verdocs-envelopes-list .header verdocs-text-input{margin:0}verdocs-envelopes-list .header verdocs-text-input input{height:32px}verdocs-envelopes-list .filter{-ms-flex-align:center;align-items:center}verdocs-envelopes-list .envelope{width:100%;margin:3px 0;background:#ffffff}verdocs-envelopes-list .envelope:hover{cursor:pointer;background:#f5f5fa}verdocs-envelopes-list .envelope .inner{gap:12px;display:-ms-flexbox;display:flex;padding:8px 14px;border-radius:5px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;container-type:inline-size}verdocs-envelopes-list .envelope .inner svg{width:24px;height:24px}verdocs-envelopes-list .vert-spacer{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 1px;flex:0 0 1px;border-right:1px solid #dad8dd}@media screen and (max-width: 800px){verdocs-envelopes-list .vert-spacer{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list .envelope-icon{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-checkbox{display:none}}verdocs-envelopes-list .last-modified{color:#444;display:-ms-flexbox;display:flex;-ms-flex:0 0 180px;flex:0 0 180px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;white-space:nowrap}@media screen and (max-width: 800px){verdocs-envelopes-list .last-modified{display:none}}verdocs-envelopes-list .envelope-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;color:#000000;line-height:28px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .envelope-recipients{color:#4b5563;font-weight:700;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .empty-text{text-align:center;margin:16px 0 0 0;padding:80px 80px;border:2px solid #ccc}verdocs-envelopes-list .containing{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-status-indicator{font-size:14px}}';export{m as verdocs_envelopes_list}
@@ -1 +0,0 @@
1
- import{r as e,c as i,h as o,H as t,F as s,g as n}from"./p-73a6f972.js";import{VerdocsEndpoint as l,throttledGetEnvelope as d,getDocumentDownloadLink as a,cancelEnvelope as r,userCanCancelEnvelope as c,integerSequence as h}from"@verdocs/js-sdk";import{s as p}from"./p-cc32d84f.js";import{S as v}from"./p-fd97809c.js";import"./p-251c4106.js";import"./p-edaec1b6.js";const x=class{constructor(o){e(this,o),this.sdkError=i(this,"sdkError",7),this.envelopeUpdated=i(this,"envelopeUpdated",7),this.another=i(this,"another",7),this.view=i(this,"view",7),this.next=i(this,"next",7),this.endpoint=l.getDefault(),this.envelopeId="",this.headerTargetId=null,this.canceling=!1,this.envelope=null,this.roleNames=[],this.showCancelDone=!1}componentWillLoad(){this.endpoint.loadSession()}async componentWillRender(){if(this.envelopeId)return this.reloadEnvelope();console.error("[VIEW] Missing required envelopeId")}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null,i=document.getElementById("verdocs-view-header");e&&i&&(console.log("[VIEW] Moving header"),i.remove(),e.append(i))}async reloadEnvelope(){var e,i,o;console.log("[VIEW] Loading envelope...");try{this.envelope=await d(this.endpoint,this.envelopeId),console.log("[VIEW] Loaded envelope",this.envelope),this.roleNames=this.envelope.recipients.map((e=>e.role_name)),setTimeout((async()=>{console.log("[VIEW] Reloading envelope..."),this.envelope=await d(this.endpoint,this.envelopeId),console.log("[VIEW] Reloaded envelope",this.envelope)}),2e3)}catch(t){null===(e=this.sdkError)||void 0===e||e.emit(new v(t.message,null===(i=t.response)||void 0===i?void 0:i.status,null===(o=t.response)||void 0===o?void 0:o.data))}}handlePageRendered(e){console.log("[VIEW] Page rendered",e.detail)}async handleOptionSelected(e){var i,o;switch(e.detail.id){case"cancel":confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")&&(this.canceling=!0,r(this.endpoint,this.envelopeId).then((e=>(this.canceling=!1,console.log("[VIEW] Envelope canceled",e),d(this.endpoint,this.envelopeId)))).then((e=>{console.log("[VIEW] Loaded new envelope details",e),this.envelope=e})).catch((e=>{var i,o,t;this.canceling=!1,console.log("[VIEW] Error canceling envelope",e),null===(i=this.sdkError)||void 0===i||i.emit(new v(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(t=e.response)||void 0===t?void 0:t.data))})),this.showCancelDone=!0,null===(i=this.envelopeUpdated)||void 0===i||i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"}));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-attachments":{const e=this.envelope.documents.find((e=>"attachment"===e.type));if(e){const i=await a(this.endpoint,this.envelopeId,e.id);window.open(i,"_blank")}}break;case"download-certificate":{const e=this.envelope.documents.find((e=>"certificate"===e.type));if(e){const i=await a(this.endpoint,this.envelopeId,e.id);window.open(i,"_blank")}}break;case"download-all":p(this.endpoint,[this.envelope]).then((()=>{var e;null===(e=this.envelopeUpdated)||void 0===e||e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})})).catch((e=>{console.log("Error downloading Zip",e)}))}}render(){var e;if(!this.envelope)return o(t,null,o("img",{src:"https://verdocs-public-assets.s3.amazonaws.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}));const i=[{id:"print",label:"Print"}];c(this.endpoint.profile,this.envelope)&&i.push({id:"cancel",label:"Cancel"});const n=this.envelope.documents.length>0,l=this.envelope.documents.filter((e=>"attachment"===e.type)).length,d=void 0!==this.envelope.documents.find((e=>"certificate"===e.type));return(n||d)&&(i.push({label:""}),n&&i.push({id:"download-attachments",label:l>1?"Download Documents":"Download Document"}),d&&i.push({id:"download-certificate",label:"Download Certificate"}),n&&d&&i.push({id:"download-all",label:"Download All Files"})),o(t,null,o("div",{id:"verdocs-view-header"},o("div",{class:"inner"},o("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),o("div",{class:"title"},this.envelope.name),o("div",{style:{flex:"1"}}),o("div",{style:{marginLeft:"10px"}}),o("verdocs-dropdown",{options:i,onOptionSelected:e=>this.handleOptionSelected(e)}))),o("div",{class:"document",style:{paddingTop:this.headerTargetId?"70px":"15px"}},((null===(e=this.envelope)||void 0===e?void 0:e.documents)||[]).filter((e=>"certificate"!==e.type)).map((e=>{const i=h(1,e.pages);return o(s,null,i.map((i=>o("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,type:"filled",virtualWidth:612,virtualHeight:792,pageNumber:i,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))))}))),this.showCancelDone&&o("verdocs-ok-dialog",{heading:"Cancelled",message:"This envelope has been cancelled successfully.",onNext:()=>{this.showCancelDone=!1}}),this.canceling&&o("div",{class:"loading-indicator"},o("verdocs-loader",null)))}get component(){return n(this)}};x.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-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .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)}#verdocs-view-header{width:100%;color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 20px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}@media all and (max-width: 500px){#verdocs-view-header{padding:0 10px}}#verdocs-view-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}@media all and (max-width: 500px){#verdocs-view-header .inner{padding:0 10px}}#verdocs-view-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-view-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}';export{x as verdocs_view}
@@ -1 +0,0 @@
1
- System.register(["./p-e748b2d2.system.js","@verdocs/js-sdk","./p-7ce23c90.system.js","./p-c8a15cb7.system.js"],(function(e){"use strict";var t,i,n,o,l,s,a,r,u,c,d;return{setters:[function(e){t=e.r;i=e.c;n=e.h},function(e){o=e.VerdocsEndpoint;l=e.createProfile;s=e.authenticate;a=e.decodeAccessTokenBody;r=e.resendVerification;u=e.resetPassword},function(e){c=e.V},function(e){d=e.S}],execute:function(){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-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth h4 verdocs-button button.normal .button-label{padding:0}verdocs-auth .buttons{gap:20px;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+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}';var f=h;var v=5e3;var p=[{value:"",label:""},{value:"Accounting & Tax",label:"Accounting & Tax"},{value:"Business Services / Consulting",label:"Business Services / Consulting"},{value:"Construction",label:"Construction"},{value:"Education",label:"Education"},{value:"Financial Services",label:"Financial Services"},{value:"Government",label:"Government"},{value:"Healthcare - Health Plans & Payers",label:"Healthcare - Health Plans & Payers"},{value:"Healthcare - Providers",label:"Healthcare - Providers"},{value:"Insurance",label:"Insurance"},{value:"Legal",label:"Legal"},{value:"Life Sciences",label:"Life Sciences"},{value:"Manufacturing",label:"Manufacturing"},{value:"Mortgage",label:"Mortgage"},{value:"Not For Profit",label:"Not For Profit"},{value:"Real Estate - Commercial",label:"Real Estate - Commercial"},{value:"Real Estate - Residential",label:"Real Estate - Residential"},{value:"Retail",label:"Retail"},{value:"Technology",label:"Technology"},{value:"Other",label:"Other"}];var b=[{value:"",label:""},{value:"I want to send a document for signature.",label:"I want to send a document for signature."},{value:"I just need to sign a document today.",label:"I just need to sign a document today."},{value:"I'm evaluating it for my business.",label:"I'm evaluating it for my business."},{value:"I'm evaluating it for my personal use.",label:"I'm evaluating it for my personal use."},{value:"I'm a developer building an integration.",label:"I'm a developer building an integration."}];var m=[{value:"",label:""},{value:"Solo",label:"Solo"},{value:"2-10",label:"2-10"},{value:"11-50",label:"11-50"},{value:"51-200",label:"51-200"},{value:"201-500",label:"201-500"},{value:"501-1000",label:"501-1000"},{value:"1000+",label:"1000+"}];var g=e("verdocs_auth",function(){function e(e){t(this,e);this.authenticated=i(this,"authenticated",7);this.sdkError=i(this,"sdkError",7);this.recheckTimer=null;this.resendDisabledTimer=null;this.accessTokenForVerification=null;this.endpoint=o.getDefault();this.visible=true;this.logo="https://app.verdocs.com/assets/blue-logo.svg";this.isAuthenticated=false;this.displayMode="login";this.orgname="";this.first="";this.last="";this.username="";this.phone="";this.password="";this.submitting=false;this.activeSession=null;this.accountType="org";this.howHear="";this.industry="";this.companySize="";this.reason="";this.signupStep=1;this.resendDisabled=false;this.checkingOrg=false}e.prototype.componentWillLoad=function(){var e,t;this.endpoint.loadSession();if(this.endpoint.session){console.log("[AUTH] Authenticated");this.isAuthenticated=true;this.activeSession=this.endpoint.session;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:true,session:this.endpoint.session})}else{console.log("[AUTH] Anonymous");(t=this.authenticated)===null||t===void 0?void 0:t.emit({authenticated:false,session:null})}};e.prototype.disconnectedCallback=function(){this.cancelRecheckTimer()};e.prototype.cancelRecheckTimer=function(){if(this.recheckTimer){try{clearTimeout(this.recheckTimer)}catch(e){}this.recheckTimer=null}if(this.resendDisabledTimer){try{clearTimeout(this.resendDisabledTimer)}catch(e){}this.resendDisabledTimer=null}};e.prototype.handleSignup=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;l(this.endpoint,{email:this.username,password:this.password,firstName:this.first,lastName:this.last,orgName:this.orgname}).then((function(t){console.log("Result",t);console.log("[AUTH] Created profile",t.profile);console.log("[AUTH] Created organization",t.organization);e.loginAndCheckVerification()})).catch((function(t){var i,n,o,l,s,a;console.log("[AUTH] Signup error",t.response);e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new d(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(l=t.response)===null||l===void 0?void 0:l.data));c("Signup failed: "+((a=(s=t.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)||"Unknown Error",{style:"error"})}))};e.prototype.loginAndCheckVerification=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;s(this.endpoint,{username:this.username,password:this.password,grant_type:"password"}).then((function(t){var i;e.cancelRecheckTimer();e.submitting=false;var n=a(t.access_token);console.log("[AUTH] Got access token body",n);if(n===null||n===void 0?void 0:n.email_verified){console.log("[AUTH] Email address is verified, completing login");e.displayMode="login";e.accessTokenForVerification=null;e.endpoint.setToken(t.access_token);e.activeSession=e.endpoint.session;e.isAuthenticated=true;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:true,session:e.endpoint.session})}else{console.log("[AUTH] Logged in, pending email address verification");e.displayMode="verify";e.accessTokenForVerification=t.access_token;e.recheckTimer=setTimeout((function(){return e.loginAndCheckVerification()}),v)}})).catch((function(t){var i,n,o,l;e.cancelRecheckTimer();console.log("[AUTH] Authentication error",t.response,JSON.stringify(t));e.displayMode="login";e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new d(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(l=t.response)===null||l===void 0?void 0:l.data));c("Login failed. Please check your username and password and try again.",{style:"error"})}))};e.prototype.handleLogout=function(){var e;this.endpoint.clearSession();this.isAuthenticated=false;this.accessTokenForVerification=null;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:false,session:null})};e.prototype.handleResend=function(){var e=this;this.resendDisabled=true;this.resendDisabledTimer=setTimeout((function(){e.resendDisabled=false;e.resendDisabledTimer=null}),3e4);r(this.endpoint,this.accessTokenForVerification).then((function(e){console.log("[AUTH] Verification request resent",e);c("Please check your email for a message with verification instructions.",{style:"info"})})).catch((function(e){console.log("[AUTH] Unable to resend verification",e)}))};e.prototype.handleReset=function(){var e=this;this.submitting=true;u(this.endpoint,{email:this.username}).then((function(t){console.log("[AUTH] Reset sent",t);e.submitting=false;e.displayMode="login";c("If your email address is registered, you will receive instructions on resetting your password shortly.",{style:"info"})})).catch((function(t){console.log("[AUTH] Unable to reset password",t);e.submitting=false}))};e.prototype.render=function(){var e=this;if(!this.visible){return n("div",{style:{display:"none"}},"Authenticated")}if(this.isAuthenticated){return n("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||!this.last||!this.username||!this.password||!this.orgname;return n("div",{class:"form"},n("a",{href:"https://verdocs.com/en/"},n("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),n("h3",null,"Sign up for a trial account"),n("h4",null,"Already have an account?",n("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return e.displayMode="login"},disabled:this.submitting})),this.signupStep===1&&n("form",{onSubmit:function(){return e.handleSignup()}},n("div",{style:{display:"flex",flexDirection:"row",columnGap:"20px"}},n("verdocs-text-input",{label:"First Name",autocomplete:"first",required:true,value:this.first,onInput:function(t){return e.first=t.target.value},disabled:this.submitting}),n("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:true,value:this.last,onInput:function(t){return e.last=t.target.value},disabled:this.submitting})),n("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),n("verdocs-text-input",{label:"Phone #",autocomplete:"phone",value:this.phone,onInput:function(t){return e.phone=t.target.value},disabled:this.submitting}),n("verdocs-text-input",{label:"Password",type:"password",required:true,autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.target.value},disabled:this.submitting}),n("verdocs-text-input",{label:"Organization Name",autocomplete:"org",required:true,value:this.orgname,onInput:function(t){return e.orgname=t.target.value},disabled:this.submitting,style:{flex:"1"}}),n("div",{style:{marginTop:"30px"}}),n("verdocs-button",{label:"Next",disabled:t,onClick:function(){return e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===2&&n("form",{onSubmit:function(){return e.handleSignup()}},n("verdocs-text-input",{label:"How did you hear about Verdocs?",value:this.howHear,onInput:function(t){return e.howHear=t.target.value},disabled:this.submitting}),n("verdocs-select-input",{label:"Your Industry",options:p,value:this.industry,onInput:function(t){return e.industry=t.target.value},disabled:this.submitting}),n("verdocs-select-input",{label:"Company Size",options:m,value:this.companySize,onInput:function(t){return e.companySize=t.target.value},disabled:this.submitting}),n("verdocs-select-input",{label:"Purpose",options:b,value:this.reason,onInput:function(t){return e.reason=t.target.value},disabled:this.submitting}),n("div",{style:{marginTop:"30px"}}),n("verdocs-button",{label:"Create Account",disabled:this.submitting,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===3&&n("form",{onSubmit:function(){return e.handleSignup()}},n("p",null,"Please check your e-mail inbox for a verification code and follow the instructions provided."),n("p",null,n("em",null,"Verification messages may take up to 1 hour to arrive. If you do not receive the invitation, ",n("a",{href:"#"},"Click Here")," to resend it. Be sure to check your spam folder.")),n("div",{style:{display:"flex",flexDirection:"row",gap:"20px"}},n("verdocs-button",{label:"Back",disabled:this.submitting,onClick:function(){e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}),n("verdocs-button",{label:"Go to Dashboard",disabled:true,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}))))}if(this.displayMode==="forgot"){return n("div",{class:"form"},n("a",{href:"https://verdocs.com/en/"},n("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),n("h3",null,"Forgot your password?"),n("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox."),n("p",null,n("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),n("form",{onSubmit:function(){return e.handleSignup()}},n("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),n("div",{style:{marginTop:"30px"}}),n("div",{class:"buttons"},n("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:function(){return e.displayMode="login"}}),n("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:function(){return e.handleReset()}}))))}if(this.displayMode==="verify"){return n("div",{class:"form"},n("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),n("h3",null,"Please Verify your Email Address"),n("p",null,"Check your e-mail inbox for a verification email, and follow the instructions provided."),n("p",null,n("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),n("div",{class:"buttons"},n("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:function(){e.username="";e.password="";e.cancelRecheckTimer();e.displayMode="login"}}),n("verdocs-button",{label:"Resend Email",disabled:this.resendDisabled,onClick:function(){return e.handleResend()}})))}return n("div",{class:"form"},n("a",{href:"https://verdocs.com/en/"},n("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),n("h3",null,"Log in to your account"),n("h4",null,"Don't have an account?",n("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){e.displayMode="signup";e.signupStep=1},disabled:this.submitting})),n("form",{onSubmit:function(){return e.loginAndCheckVerification()}},n("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),n("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}),n("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"}}),n("verdocs-button",{label:"Login",disabled:this.submitting,onClick:function(){return e.loginAndCheckVerification()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))};return e}());g.style=f}}}));
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i,H as s,F as o,g as l}from"./p-73a6f972.js";import{VerdocsEndpoint as a,integerSequence as r,createEnvelope as n,isValidEmail as d,isValidPhone as c,getRGBA as p,createTemplateDocument as h,deleteTemplateDocument as v,createTemplatev2 as m,updateField as u,createField as g,updateTemplate as f,createTemplateReminder as x,updateTemplateReminder as b,deleteTemplateReminder as w,updateTemplateRole as y,createTemplateRole as k}from"@verdocs/js-sdk";import{g as C,u as E}from"./p-f69d8d39.js";import{g as q,b as S,a as z,u as M}from"./p-316fc185.js";import{g as L}from"./p-fc2ae858.js";import{r as I,b as T,c as H,g as Z,d as V,e as D,f as R}from"./p-cc32d84f.js";import{S as _}from"./p-fd97809c.js";import{D as U,P as N,J as A,a as B,F as P,b as j,T as F}from"./p-b0766439.js";import{V as $}from"./p-026b3103.js";import{d as O}from"./p-edaec1b6.js";import{i as Q}from"./p-627f774b.js";import"./p-00b37c9a.js";import"./p-a706bac9.js";import"./p-251c4106.js";const W=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateStore=null,this.fieldStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId=null,this.loading=!0}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i,s,o,l;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[PREVIEW] Unable to start builder session, must be authenticated");if(!this.templateId)return void console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);try{L(this.endpoint,this.templateId,!0).then((e=>{this.templateStore=e,this.fieldStore=C(this.templateId),this.roleStore=q(this.templateId),this.loading=!1})).catch((e=>{console.log(e)}))}catch(s){console.log("[PREVIEW] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[PREVIEW] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}async loadTemplate(e){e&&(this.templateStore=await L(this.endpoint,e,!1))}handlePageRendered(e){var t,i;const s=e.detail;(null===(i=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===i?void 0:i.fields.filter((e=>e.page===s.pageNumber))).forEach((e=>I(e,s,{disabled:!0,editable:!1,draggable:!1})))}render(){var e,t;return i(s,null,this.loading?i("verdocs-loader",null):((null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.documents)||[]).map((e=>{const t=r(1,e.pages);return i(o,null,t.map((t=>i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:612,virtualHeight:792,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};W.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-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const Y='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>',X=class{constructor(i){e(this,i),this.sendingEnvelope=t(this,"sendingEnvelope",7),this.send=t(this,"send",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.searchContacts=t(this,"searchContacts",7),this.templateStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId=null,this.environment="web",this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.rolesAtLevel={},this.showPickerForId="",this.sessionContacts=[],this.sending=!1,this.rolesCompleted={}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i;try{return this.endpoint.loadSession(),this.endpoint.session?this.templateId?this.loadTemplate(this.templateId):void console.log(`[SEND] Missing required template ID ${this.templateId}`):void console.log("[SEND] Unable to start Send operation, must be authenticated")}catch(s){console.log("[SEND] Error with send session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}async loadTemplate(e){var t,i,s,o,l;if(e)try{this.endpoint.onSessionChanged(((e,t,i)=>{i&&(this.sessionContacts=[],this.sessionContacts.push({id:i.id,name:`${i.first_name} ${i.last_name}`,email:i.email,phone:i.phone}))})),this.templateStore=await L(this.endpoint,e,!1),this.roleStore=q(e),this.recomputeRolesCompleted(),(null===(i=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===i?void 0:i.is_sendable)||console.warn("[SEND] Template is not sendable",e)}catch(e){console.log("[SEND] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}recomputeRolesCompleted(){const e=this.roleStore.get("roles")||[],t={};this.rolesCompleted={},e.forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const s=`r-${i}-${t[i].length}`;t[i].push({...e,id:s}),e.full_name&&(e.email||e.phone)&&(this.rolesCompleted[s]={...e,id:s})}))}getRoleLevels(){const e=this.roleStore.get("roles")||[],t={};this.rolesCompleted={},e.forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const s=`r-${i}-${t[i].length}`;t[i].push({...e,id:s})})),this.rolesAtLevel=t;const i=Object.keys(t).map((e=>+e));return i.sort(((e,t)=>e-t)),i}getLevelIcon(e){const t=this.getRoleLevels();return i("div",e<0?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}:e>=t.length?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}:{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'})}handleSelectContact(e,t){e.preventDefault(),this.rolesCompleted[t.id]={...t,...e.detail},this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation(),this.showPickerForId=t.id}handleSend(e){var t,i,s;if(this.sending)return void console.log("Skipping duplicate send",e);console.log("Sending",e),e.preventDefault(),e.stopPropagation(),this.sending=!0,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!0});const o={template_id:this.templateId,name:null===(s=null===(i=this.templateStore)||void 0===i?void 0:i.state)||void 0===s?void 0:s.name,environment:this.environment,roles:Object.values(this.rolesCompleted),prepared_fields:[]};console.log("[SEND] Creating envelope",o),n(this.endpoint,o).then((e=>{var t,i;console.log("[SEND] Send envelope",e),this.reset().catch((e=>console.log("Unknown Error",e))),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1}),null===(i=this.send)||void 0===i||i.emit({...o,envelope_id:e.id,envelope:e})})).catch((e=>{var t;console.log("Send error",e),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1})}))}handleCancel(e){var t;e.stopPropagation(),null===(t=this.exit)||void 0===t||t.emit()}render(){var e,t;if(!this.endpoint.session)return i(s,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const o=S(this.roleStore),l=Object.values(this.rolesCompleted).filter((e=>d(e.email)||c(e.phone))).length>=o.length,a=this.getRoleLevels();return i(s,{class:{sendable:null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),a.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),this.rolesAtLevel[e].map((e=>{var t,s,o,l,a,r;const n=`verdocs-send-recipient-${e.name}`;return e.email?i("div",{class:"recipient",style:{borderColor:p(z(this.roleStore,e.name))},onClick:t=>this.handleClickRole(t,e),id:n},null!==(a=null===(l=this.rolesCompleted[e.id])||void 0===l?void 0:l.full_name)&&void 0!==a?a:e.full_name,i("div",{class:"icon",innerHTML:Y}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(r=this.rolesCompleted[e.id])&&void 0!==r?r:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient",style:{backgroundColor:p(z(this.roleStore,e.name))},onClick:t=>this.handleClickRole(t,e),id:n},null!==(s=null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.full_name)&&void 0!==s?s:e.name,i("div",{class:"icon",innerHTML:Y}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(o=this.rolesCompleted[e.id])&&void 0!==o?o:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),i("div",{class:"level level-done"},this.getLevelIcon(a.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!l||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};X.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-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:none}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const K=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.templateUpdated=t(this,"templateUpdated",7),this.sdkError=t(this,"sdkError",7),this.endpoint=a.getDefault(),this.templateId="",this.uploading=!1,this.progressLabel="Uploading...",this.progressPercent=0,this.showDeleteError=!1,this.confirmDeleteDocument=null,this.store=null}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1)}catch(s){console.log("[TEMPLATE ATTACHMENTS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}handleCancel(e){e.stopPropagation(),this.exit.emit()}handleUploadProgress(e){e>=99?(this.progressPercent=100,this.progressLabel="Processing..."):this.progressPercent=e}async handleUpload(e){var t,i,s,o;e.stopPropagation();const l=e.detail.file;if(l){console.log("[ATTACHMENTS] Uploading...",l),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await h(this.endpoint,this.templateId,l,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.store=await L(this.endpoint,this.templateId,!1),console.log("[ATTACHMENTS] Updated template",this.store.state),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:this.store.state,event:"attachments"}),this.uploading=!1,this.progressLabel="",this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data)),this.uploading=!1}}}handleNext(e){var t;e.stopPropagation(),this.uploading=!1,this.progressLabel="",this.progressPercent=0,null===(t=this.next)||void 0===t||t.emit({template:this.store.state})}async confirmDelete(){await v(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.store=await L(this.endpoint,this.templateId,!1),console.log("[ATTACHMENTS] New template",this.store.state),this.confirmDeleteDocument=null}async handleDelete(e){var t;(null===(t=this.store.state)||void 0===t?void 0:t.documents.length)>1?this.confirmDeleteDocument=e:this.showDeleteError=!0}getFileIcon(e){switch(e.mime){case"application/pdf":return B;case"image/jpeg":return A;case"image/png":return N;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return U}return P}render(){var e,t,o;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const l=null===(e=this.store)||void 0===e?void 0:e.state;return l.isLoaded?this.endpoint.session&&l.profile_id?i(s,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},null===(t=this.store)||void 0===t?void 0:t.state.documents.map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:j})),i("div",{class:"trash-icon",innerHTML:F,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!(null===(o=this.store)||void 0===o?void 0:o.state.documents.length)||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:!0,onExit:()=>{this.confirmDeleteDocument=null}})):i(s,{class:"empty"}):i(s,{class:"loading"},i("verdocs-loader",null))}};K.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-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-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;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const J=["attachments","roles","settings","fields","preview"],G=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.endpoint=a.getDefault(),this.templateId=null,this.step="preview",this.templateStore=null}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e),this.loadTemplate(this.templateId).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,i,s,o,l;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");if(!this.templateId)return this.step="attachments",void console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");try{this.templateStore=await L(this.endpoint,this.templateId,!1)}catch(s){console.log("[BUILD_TABS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[BUILD_TABS] Error loading template",e),null===(s=this.sdkError)||void 0===s||s.emit(new _(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(l=e.response)||void 0===l?void 0:l.data))}}async loadTemplate(e){e&&(this.templateStore=await L(this.endpoint,e,!1))}setStep(e){var t;console.log("Selected step",e.detail.tab.id),e.stopPropagation(),e.preventDefault(),this.step=e.detail.tab.id,null===(t=this.stepChanged)||void 0===t||t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{$("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e),null===(t=this.sdkError)||void 0===t||t.emit(e)}))}render(){var e,t,o,l,a,r,n,d,c,p,h,v,m,u,g,f,x,b,w,y,k;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));let C=!1,E=!1,q=!1;this.templateId&&this.templateStore&&this.templateStore.state&&(q=(null===(o=null===(t=null===(e=this.templateStore)||void 0===e?void 0:e.state)||void 0===t?void 0:t.documents)||void 0===o?void 0:o.length)>0,E=q&&(null===(r=null===(a=null===(l=this.templateStore)||void 0===l?void 0:l.state)||void 0===a?void 0:a.roles)||void 0===r?void 0:r.length)>0,C=E&&(null===(c=null===(d=null===(n=this.templateStore)||void 0===n?void 0:n.state)||void 0===d?void 0:d.fields)||void 0===c?void 0:c.length)>0);let S=Math.max(J.indexOf(this.step),0);return!C&&S>=4&&(S=3),!E&&S>=3&&(S=1),!q&&S>=1&&(S=0),i(s,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:S,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!q,label:"Roles"},{id:"settings",disabled:!E,label:"Settings"},{id:"fields",disabled:!E,label:"Fields"},{id:"preview",disabled:!C,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>'},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>',onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},null===(h=null===(p=this.templateStore)||void 0===p?void 0:p.state)||void 0===h?void 0:h.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},(null===(m=null===(v=this.templateStore)||void 0===v?void 0:v.state)||void 0===m?void 0:m.is_public)?"Public":(null===(g=null===(u=this.templateStore)||void 0===u?void 0:u.state)||void 0===g?void 0:g.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},(null===(x=null===(f=this.templateStore)||void 0===f?void 0:f.state)||void 0===x?void 0:x.counter)?O.format(new Date(null===(w=null===(b=this.templateStore)||void 0===b?void 0:b.state)||void 0===w?void 0:w.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},null===(k=null===(y=this.templateStore)||void 0===y?void 0:y.state)||void 0===k?void 0:k.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};G.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-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const ee=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.sdkError=t(this,"sdkError",7),this.templateCreated=t(this,"templateCreated",7),this.endpoint=a.getDefault(),this.file=void 0,this.creating=!1,this.progressLabel="Uploading...",this.progressPercent=0}componentWillLoad(){this.endpoint.setTimeout(3e4),this.endpoint.loadSession()}handleFileChanged(e){var t;this.file=(null===(t=e.target.files)||void 0===t?void 0:t[0])||null,console.log("[CREATE] Selected file",this.file)}handleUpload(e){e.stopPropagation(),document.getElementById("verdocs-template-create-file").click()}handleCancel(e){e.stopPropagation(),this.exit.emit()}async handleSubmit(e){var t,i,s;if(e.stopPropagation(),console.log("Submitting"),this.file){this.creating=!0,this.progressLabel="Uploading...";try{const e=await m(this.endpoint,{name:this.file.name,documents:[this.file]},(e=>{e>=99?(this.progressLabel="Processing...",this.progressPercent=100):this.progressPercent=e}));console.log("[CREATE] Created template",e),L(this.endpoint,e.id,!0).then((()=>{var t,i;null===(t=this.templateCreated)||void 0===t||t.emit({endpoint:this.endpoint,template:e,templateId:e.id}),null===(i=this.next)||void 0===i||i.emit(e),this.creating=!1,this.progressLabel="",this.progressPercent=0})).catch((e=>{console.log(e)}))}catch(e){console.log("[CREATE] Error creating template",e),null===(t=this.sdkError)||void 0===t||t.emit(new _(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(s=e.response)||void 0===s?void 0:s.data)),this.creating=!1}}}render(){return i(s,null,this.endpoint.session?i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("input",{type:"file",id:"verdocs-template-create-file",multiple:!0,accept:".pdf,application/pdf,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:e=>this.handleFileChanged(e)}),this.creating?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("div",{class:"upload-box",onDrop:e=>{e.preventDefault(),e.target.classList.remove("drag-over"),this.file=e.dataTransfer.files[0]},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDragEnter:e=>e.target.classList.add("drag-over"),onDragLeave:e=>e.target.classList.remove("drag-over")},i("div",null,i("span",{innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>'})),i("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold",overflowWrap:"anywhere"}},this.file?this.file.name:"Drag a file here"),i("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?" ":"Or, if you prefer..."),i("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:e=>this.handleUpload(e)})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.creating}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleSubmit(e),disabled:!this.file||this.creating}))):i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};ee.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-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box.drag-over{border:2px solid #4c56cb}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .progress-wrapper{padding:20px}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';const te='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>',ie=[{id:"signature",tooltip:"Signature",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>'},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>'},{id:"sep1",tooltip:"",icon:te},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>'},{id:"textarea",tooltip:"Text Area",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z"/></svg>'},{id:"checkbox_group",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>'},{id:"radio_button_group",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>'},{id:"dropdown",tooltip:"Dropdown",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>'},{id:"sep2",tooltip:"",icon:te},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>'},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>'}],se=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.fieldsUpdated=t(this,"fieldsUpdated",7),this.pageHeights={},this.templateStore=null,this.fieldStore=null,this.roleStore=null,this.cachedPageInfo={},this.endpoint=a.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.showMustSelectRole=!1,this.selectedRoleName="",this.loading=!0}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[FIELDS] Unable to start builder session, must be authenticated");L(this.endpoint,this.templateId,!0).then((e=>{var t,i;this.templateStore=e,this.fieldStore=C(this.templateId),this.roleStore=q(this.templateId),this.selectedRoleName=(null===(i=null===(t=this.roleStore.get("roles"))||void 0===t?void 0:t[0])||void 0===i?void 0:i.name)||"",this.loading=!1,this.fieldStore.onChange("fields",(e=>{var t;console.log("[FIELDS] Fields changed",{fields:e}),null===(t=this.fieldsUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,fields:e})}))})).catch((e=>{console.log(e)}))}catch(s){console.log("[FIELDS] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}componentDidRender(){Q.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}componentWillUpdate(){var e;const t=this.roleStore.get("roles");this.selectedRoleName&&t.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(e=t[0])||void 0===e?void 0:e.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async handleFieldChange(e,t,i){console.log("[FIELDS] handleFieldChange",e,t,i)}attachFieldAttributes(e,t,i){i.addEventListener("input",(e=>this.handleFieldChange(t,e))),i.addEventListener("settingsChanged",(e=>{var t,i;console.log("Settings changed",e.detail),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:null===(i=this.templateStore)||void 0===i?void 0:i.state,event:"added-field"})})),i.addEventListener("deleted",(()=>{var e,s;console.log("[FIELDS] Deleted",this,t),i.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:null===(s=this.templateStore)||void 0===s?void 0:s.state,event:"updated-field"})})),i.setAttribute("templateid",this.templateId),i.setAttribute("fieldname",t.name),i.setAttribute("pageNumber",e.pageNumber),i.setAttribute("xScale",e.xScale),i.setAttribute("yScale",e.yScale),i.setAttribute("name",t.name)}handlePageRendered(e){const t=e.detail;this.cachedPageInfo[t.pageNumber]=t,this.pageHeights[t.pageNumber]=t.naturalHeight,this.fieldStore.get("fields").filter((e=>e&&e.page===t.pageNumber)).forEach((e=>{switch(e.type){case"checkbox_group":case"radio_button_group":(e.settings||{}).options.map(((t,i)=>{const s=V(e,i),o=document.getElementById(s);o&&(o.setAttribute("fieldname",e.name),o.setAttribute("pagenumber",String(e.page)),this.makeDraggable(o))}));break;default:const t=Z(e),i=document.getElementById(t);i&&(i.setAttribute("fieldname",e.name),i.setAttribute("pagenumber",String(e.page)),this.makeDraggable(i))}}))}makeDraggable(e){Q(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),s=+(e.target.getAttribute("xScale")||1),o=+(e.target.getAttribute("yScale")||1),l=e.dx/s+t,a=e.dy/o+i;e.target.setAttribute("posX",l),e.target.setAttribute("posy",a),T(e.target,"translate",`${l}px, ${a}px`)}async handleMoveEnd(e){var t,i;const s=e.target.getAttribute("fieldname"),o=+(e.target.getAttribute("option")||"0"),l=this.fieldStore.get("fields").find((e=>e.name===s));if(!l)return void console.log("[FIELDS] Unable to find field",s,e.target);const a=e.target.getAttribute("pagenumber"),{naturalWidth:r=612,naturalHeight:n=792,renderedHeight:d=792}=this.cachedPageInfo[a],c=e.target.getBoundingClientRect(),p=e.target.parentElement.getBoundingClientRect(),h=l.settings.width||D(l.type),v=l.settings.height||R(l.type),m=Math.max(c.left-p.left,0),g=Math.max(d-(p.bottom-c.bottom),0),{x:f,y:x}=this.viewCoordinatesToPageCoordinates(m,g,a,r-h,n-v);switch(l.type){case"attachment":case"payment":case"initial":case"signature":case"date":case"dropdown":case"textarea":case"textbox":case"timestamp":l.settings.x=f,l.settings.y=x;break;case"checkbox_group":case"radio_button_group":{const e=l.settings.options[o];e&&(e.x=f,e.y=x)}}console.log("[FIELDS] Will update",s,x,o,l);const b=await u(this.endpoint,this.templateId,s,l);E(this.fieldStore,s,b),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),H(e.target),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:null===(i=this.templateStore)||void 0===i?void 0:i.state,event:"updated-field"})}generateFieldName(e,t){let i,s=1;do{i=`${e}P${t}-${s}`,s++}while(this.fieldStore.get("fields").some((e=>e&&e.name===i)));return i}viewCoordinatesToPageCoordinates(e,t,i,s,o){const{xScale:l=1,yScale:a=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/l,s)),y:Math.floor(Math.min(Math.max(r-t,0)/a,o))}}async handleClickPage(e,t){var i,s;if(this.placing){const o=e.offsetX,l=e.offsetY,a=D(this.placing),r=R(this.placing),n=this.cachedPageInfo[t],{naturalWidth:d=612,naturalHeight:c=792}=n,p=this.viewCoordinatesToPageCoordinates(o,l,t,d-a,c-r),h=Math.floor(p.x),v=Math.floor(p.y),m={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:n.documentId,type:this.placing,required:!0,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{x:h,y:v},x:h,y:v,width:a,height:r};switch(console.log("[FIELDS] Will save new field",m),m.type){case"attachment":case"payment":m.settings={x:h,y:v};break;case"initial":case"signature":m.settings={x:h,y:v,result:""};break;case"checkbox_group":m.setting={minimum_checked:0,maximum_checked:1e3,options:[{id:`${m.name}-1`,value:"Option 1",checked:!1,x:h,y:v}]};break;case"date":m.settings={x:h,y:v,width:a,height:r,result:""};break;case"dropdown":m.required=!1,m.settings={x:h,y:v,width:a,height:r,value:null,placeholder:"Choose",options:[{id:"option-1",value:"Option 1"}]};break;case"radio_button_group":m.setting={options:[{id:`${m.name}-1`,value:"Option 1",selected:!1,x:h,y:v}]};break;case"textarea":case"textbox":m.settings={x:h,y:v,width:a,height:r,result:"",leading:0,alignment:0,upperCase:!1};break;case"timestamp":m.settings={x:h,y:v,width:a,height:r}}"textarea"===m.type&&(m.settings.leading=16,m.type="textbox");const u=await g(this.endpoint,this.templateId,m);console.log("[FIELDS] Saved field",u),this.fieldStore.set("fields",[...this.fieldStore.get("fields"),u]),this.placing=null,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:null===(s=this.templateStore)||void 0===s?void 0:s.state,event:"added-field"})}}render(){var e,t,o;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!(null===(e=this.templateStore)||void 0===e?void 0:e.state.isLoaded))return i(s,null,i("verdocs-loader",null));const l=this.roleStore.get("roles").map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(s,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:l,onInput:e=>this.selectedRoleName=e.target.value}),ie.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),i("div",{class:"pages"},((null===(o=null===(t=this.templateStore)||void 0===t?void 0:t.state)||void 0===o?void 0:o.documents)||[]).map((e=>r(1,e.pages).map((t=>i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:612,virtualHeight:792,disabled:!0,editable:!0,done:!1,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})))))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:this.roleStore.get("roles").length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=!1}))}};se.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-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio_button_group{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const oe=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.name="",this.dirty=!1}async componentWillLoad(){var e,t,i,s,o;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.name=null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.name,this.dirty=!1}catch(e){console.log("[TEMPLATE NAME] Error loading template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data))}}handleCancel(e){var t,i,s;e.stopPropagation(),this.name=null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.name,this.dirty=!1,console.log("Closing"),null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){var t,i,s;e.stopPropagation(),await f(this.endpoint,this.templateId,{name:this.name}),(null===(t=this.store)||void 0===t?void 0:t.state)&&(this.store.state.name=this.name),this.dirty=!1,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:this.store.state,event:"name"}),null===(s=this.close)||void 0===s||s.emit()}render(){var e,t;return this.endpoint.session?(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoading)?i(s,{class:"loading"},i("verdocs-loader",null)):i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("label",{htmlFor:"verdocs-template-name"},"Template Name"),i("verdocs-text-input",{id:"verdocs-template-name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:e=>{var t,i;this.name=e.target.value,this.dirty=this.name!==(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.name)}}),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};oe.style="";const le=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.showPlanBlocker=!1,this.sendReminders=!1,this.firstReminderDays="1",this.reminderDays="1",this.dirty=!1}async componentWillLoad(){var e,t,i,s,o;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.sendReminders=!!(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.reminder_id),this.dirty=!1}catch(e){console.log("[TEMPLATE REMINDERS] Error loading template",e),null===(i=this.sdkError)||void 0===i||i.emit(new _(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(o=e.response)||void 0===o?void 0:o.data))}}handleCancel(e){var t,i,s;e.stopPropagation(),this.sendReminders=!!(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.reminder_id),this.dirty=!1,null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){var t,i,s,o,l,a,r,n,d;e.stopPropagation();try{if(this.sendReminders){const e={setup_time:+this.firstReminderDays,interval_time:+this.reminderDays};(null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.reminder_id)?(await b(this.endpoint,this.templateId,null===(s=this.store)||void 0===s?void 0:s.state.reminder_id,e),this.store=await L(this.endpoint,this.templateId,!1)):(await x(this.endpoint,this.templateId,e),this.store=await L(this.endpoint,this.templateId,!1))}else await w(this.endpoint,this.templateId,null===(o=this.store)||void 0===o?void 0:o.state.reminder_id),this.store=await L(this.endpoint,this.templateId,!1);null===(l=this.templateUpdated)||void 0===l||l.emit({endpoint:this.endpoint,template:this.store.state,event:"attachments"})}catch(e){console.log("[TEMPLATE REMINDERS] Unable to update reminders",e),$(e.message),null===(a=this.sdkError)||void 0===a||a.emit(new _(e.message,null===(r=e.response)||void 0===r?void 0:r.status,null===(n=e.response)||void 0===n?void 0:n.data))}this.dirty=!1,null===(d=this.close)||void 0===d||d.emit()}render(){var e,t;return this.endpoint.session?this.endpoint.session&&(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoaded)?i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Reminders"),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-send-reminders"},"Send Automatic Reminders"),i("verdocs-checkbox",{id:"verdocs-send-reminders",name:"automatic-reminders",checked:this.sendReminders,value:"on",onInput:e=>{this.sendReminders=e.target.checked,this.dirty=!0}})),i("p",null,i("strong",null,"NOTE:")," Reminders will only be sent for up to 14 days."),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-first-reminder-days"},"Days Before First Reminder"),i("verdocs-text-input",{id:"verdocs-first-reminder-days",type:"number",value:this.firstReminderDays,onInput:e=>{this.firstReminderDays=e.target.value,this.dirty=!0},disabled:!this.sendReminders})),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-days-between-reminders"},"Days Between Reminders"),i("verdocs-text-input",{id:"verdocs-days-between-reminders",type:"number",value:this.reminderDays,onInput:e=>{this.reminderDays=e.target.value,this.dirty=!0},disabled:!this.sendReminders})),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)}))),this.showPlanBlocker&&i("verdocs-ok-dialog",{heading:"Upgrade to access this feature",message:"Please upgrade your plan to access this feature.",onNext:()=>this.showPlanBlocker=!1})):i(s,{class:"empty"}):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};le.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-template-reminders{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-reminders.loading{min-height:300px;position:relative;display:block}verdocs-template-reminders.empty{display:none}verdocs-template-reminders form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-reminders form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 20px 0}verdocs-template-reminders form label{font-size:16px;font-weight:500;margin:0 0 6px 0;color:#33364b}verdocs-template-reminders form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-reminders form input:focus{outline:none}verdocs-template-reminders form .input-row{display:-ms-flexbox;display:flex;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-reminders form .input-row label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-reminders form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px}verdocs-template-reminders form .input-row verdocs-text-input input{text-align:center}verdocs-template-reminders form .input-row verdocs-checkbox{display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px;-ms-flex-pack:center;justify-content:center}verdocs-template-reminders .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-reminders ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::-moz-placeholder{color:#aaaaaa}verdocs-template-reminders :-ms-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-reminders ::placeholder{color:#aaaaaa}';const ae={everyone:"Everyone",everyone_as_creator:"Everyone as Me",organization_member:"Organization member",organization_member_as_creator:"Organization Member as Me",creator:"Me"},re='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>',ne='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>',de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',ce='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>',pe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>',he=class{constructor(i){e(this,i),this.next=t(this,"next",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.rolesUpdated=t(this,"rolesUpdated",7),this.templateStore=null,this.roleStore=null,this.endpoint=a.getDefault(),this.templateId="",this.showingRoleDialog=null,this.showingSenderDialog=!1,this.sender=null,this.loading=!0}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");await L(this.endpoint,this.templateId,!1).then((e=>{var t;this.templateStore=e,this.roleStore=q(this.templateId),console.log("RS",null===(t=this.roleStore)||void 0===t?void 0:t.state),this.loading=!1,this.roleStore.onChange("roles",(e=>{var t;console.log("[ROLES] Roles changed",{roles:e}),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:e})}))})).catch((e=>{console.log(e)}))}catch(s){console.log("[FIELDS] Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new _(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}componentDidRender(){Q.dynamicDrop(!0),Q(".recipient").draggable({listeners:{start:function(e){e.target.classList.add("dragging"),this.el.classList.add("dragging")}.bind(this),move:function(e){const t=+(e.target.getAttribute("dX")||0),i=+(e.target.getAttribute("dY")||0),s=+(e.target.dataset.sequence||0),o=+(e.target.dataset.order||0),l=e.dx+t,a=e.dy+i;e.target.setAttribute("dX",l),e.target.setAttribute("dY",a);const r=e.target.getBoundingClientRect();console.log("w",r.width),e.target.style.transform=`translate(${l+r.width-(o+1)}px, ${a-r.height*s}px)`}.bind(this),end:function(e){e.target.classList.remove("dragging"),this.el.classList.remove("dragging"),e.target.removeAttribute("dX"),e.target.removeAttribute("dY"),e.target.style.transform=null}.bind(this)}}),Q(".dropzone").dropzone({overlap:.05,ondrop:async function(e){var t;console.log("dropped",e.target.classList),e.target.classList.remove("active"),M(this.roleStore,e.relatedTarget.dataset.rolename,{sequence:+e.target.dataset.sequence,order:+e.target.dataset.order}),await this.renumberTemplateRoles(),console.log("[ROLES] Updated roles",this.getSortedRoles()),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}.bind(this),ondropactivate:e=>{e.target.classList.add("visible")},ondropdeactivate:e=>{e.target.classList.remove("visible")},ondragenter:e=>{e.target.classList.add("active")},ondragleave:e=>{e.target.classList.remove("active")}})}handleCancel(){var e;null===(e=this.exit)||void 0===e||e.emit()}handleSubmit(){var e;null===(e=this.next)||void 0===e||e.emit()}getSortedRoles(){return this.roleStore.state.roles.sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e=[];return this.getSortedRoles().forEach((t=>{e.includes(t.sequence)||e.push(t.sequence)})),e.sort(((e,t)=>e-t))}getRoleNames(){return this.getSortedRoles().map((e=>e.name))}getRolesAtSequence(e){return this.roleStore.state.roles.filter((t=>t&&t.sequence===e))}renumberTemplateRoles(){const e=[],t=[];return this.getSequenceNumbers().forEach(((i,s)=>{this.getRolesAtSequence(i).forEach(((i,o)=>{e.includes(i.name)||(i.sequence=s+1,i.order=o+1,e.push(i.name),t.push(y(this.endpoint,this.templateId,i.name,{sequence:i.sequence,order:i.order})))}))})),Promise.all(t)}getNextRoleName(){let e="",t=Object.keys(this.roleStore.state).length-1;do{t++,e=`Recipient ${t}`}while(!e||this.roleStore.state.roles.some((t=>t&&t.name===e)));return e}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i}),k(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:"",email:"",phone:"",type:"signer",delegator:!1,kba_method:null}).then((async e=>{var t;console.log("[ROLES] Created role",e),this.roleStore.set("roles",[...this.roleStore.state.roles,e]),await this.renumberTemplateRoles(),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const i=this.getRolesAtSequence(t).length+1,s=this.getNextRoleName();this.callCreateRole(s,t,i)}handleAddStep(e,t){e.stopPropagation();const i=this.getNextRoleName();this.callCreateRole(i,t,1)}render(){var e,t,l,a;if(!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!(null===(e=this.templateStore)||void 0===e?void 0:e.state.isLoaded))return console.log("Loading",this.loading,null===(t=this.templateStore)||void 0===t?void 0:t.state.isLoaded),i(s,{class:"loading"},i("verdocs-loader",null));console.log("Rendering roles",this.roleStore.get("roles"));const r=this.getRoleNames(),n=this.getSequenceNumbers();return console.log("Rendering",r,n),i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"participants"},i("div",{class:"left-line"}),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"sender"},i("span",{class:"label"},"Sender:")," ",ae[null===(a=null===(l=this.templateStore)||void 0===l?void 0:l.state)||void 0===a?void 0:a.sender]," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingSenderDialog=!0,"aria-role":"button"})))),i("div",{class:"row add-sequence","data-sequence":0},i("div",{class:"icon",innerHTML:ne}),i("div",{class:"row-roles"},i("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),n.map((e=>i(o,null,i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"dropzone","data-order":.5,"data-sequence":e}),this.getRolesAtSequence(e).map((t=>i(o,null,t.email?i("div",{class:"recipient",style:{borderColor:p(z(this.roleStore,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("span",{class:"type-icon",innerHTML:"signer"===t.type?de:"cc"===t.type?pe:ce}),t.full_name," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})):i("div",{class:"recipient",style:{backgroundColor:p(z(this.roleStore,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("span",{class:"type-icon",innerHTML:"signer"===t.type?de:"cc"===t.type?pe:ce}),t.name," ",i("div",{class:"settings-button",innerHTML:re,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})),i("div",{class:"dropzone","data-order":t.order+.5,"data-sequence":e})))),i("button",{class:"add-role",innerHTML:ne,onClick:t=>this.handleAddRole(t,e)}))),n.length>0&&i("div",{class:"row add-sequence","data-sequence":e},i("div",{class:"row-roles"},i("div",{class:"icon",innerHTML:ne}),i("div",{class:"dropzone","data-sequence":e+1,"data-order":1},"Add Step")))))),i("div",{class:"row","data-sequence":n.length+1},i("div",{class:"row-roles"},i("div",{class:"icon",innerHTML:ne}),i("button",{class:"add-step",innerHTML:ne,onClick:e=>this.handleAddStep(e,n.length+1)}))),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}),i("div",{class:"row-roles"},i("div",{class:"complete"},"Document Complete")))),r.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:ne})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:r.length<1}))),this.showingRoleDialog&&i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null,await this.renumberTemplateRoles(),null===(e=this.rolesUpdated)||void 0===e||e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}}),this.showingSenderDialog&&i("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:()=>this.showingSenderDialog=!1}))}get el(){return l(this)}};he.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-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';const ve=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.store=null,this.endpoint=a.getDefault(),this.templateId="",this.dirty=!1,this.personal=!1,this.public=!1}async componentWillLoad(){var e,t,i,s,o,l,a;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[VISIBILITY] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[VISIBILITY] Unable to start builder session, must be authenticated");this.store=await L(this.endpoint,this.templateId,!1),this.personal=(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.is_personal)||!0,this.public=(null===(s=null===(i=this.store)||void 0===i?void 0:i.state)||void 0===s?void 0:s.is_public)||!1,this.dirty=!1}catch(e){console.log("[TEMPLATE VISIBILITY] Error loading template",e),null===(o=this.sdkError)||void 0===o||o.emit(new _(e.message,null===(l=e.response)||void 0===l?void 0:l.status,null===(a=e.response)||void 0===a?void 0:a.data))}}handleCancel(e){var t,i,s,o,l;e.stopPropagation(),this.personal=null===(i=null===(t=this.store)||void 0===t?void 0:t.state)||void 0===i?void 0:i.is_personal,this.public=null===(o=null===(s=this.store)||void 0===s?void 0:s.state)||void 0===o?void 0:o.is_public,this.dirty=!1,null===(l=this.close)||void 0===l||l.emit()}async handleSave(e){var t,i,s;e.stopPropagation(),await f(this.endpoint,this.templateId,{is_personal:this.personal,is_public:this.public}),(null===(t=this.store)||void 0===t?void 0:t.state)&&(this.store.state.is_personal=this.personal,this.store.state.is_public=this.public),this.dirty=!1,null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:this.store.state,event:"visibility"}),null===(s=this.close)||void 0===s||s.emit()}render(){var e,t;return this.endpoint.session?this.endpoint.session&&(null===(t=null===(e=this.store)||void 0===e?void 0:e.state)||void 0===t?void 0:t.isLoaded)?i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Visibility"),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-is-shared"},"Shared"),i("verdocs-checkbox",{id:"verdocs-is-shared",name:"is-shared",checked:!this.personal,value:"on",onInput:e=>{this.personal=!e.target.checked,this.dirty=!0}})),i("div",{class:"description"},"Shared templates are visible to other members of your Organization (if any)."),i("div",{class:"input-row"},i("label",{htmlFor:"verdocs-is-public"},"Public"),i("verdocs-checkbox",{id:"verdocs-is-public",name:"is-public",checked:this.public,value:"on",onInput:e=>{this.public=e.target.checked,this.dirty=!0}})),i("div",{class:"description"},"Public templates may appear in results when any other user searches for templates. Note that a template may be both Personal and Public, which may be useful if you want your template to be found via search but not otherwise displayed to other members of your Organization (if any)."),i("div",{class:"buttons"},i("verdocs-button",{size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{size:"small",label:"Save",disabled:!this.dirty,onClick:e=>this.handleSave(e)})))):i(s,{class:"empty"}):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};ve.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-template-visibility{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-visibility.loading{min-height:300px;position:relative;display:block}verdocs-template-visibility.empty{display:none}verdocs-template-visibility form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-visibility form .description{font-size:14px;text-align:justify;color:#5c6575}verdocs-template-visibility form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0}verdocs-template-visibility form label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:16px;font-weight:500;margin:0 0 4px 0;color:#33364b}verdocs-template-visibility form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-visibility form input:focus{outline:none}verdocs-template-visibility form .input-row{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px}verdocs-template-visibility form .input-row verdocs-text-input input{text-align:center}verdocs-template-visibility form .input-row verdocs-checkbox{-ms-flex:0;flex:0;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}verdocs-template-visibility form .input-row verdocs-checkbox label>input[type=checkbox]+*::before{margin-right:0}verdocs-template-visibility .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:25px;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-moz-placeholder{color:#aaaaaa}verdocs-template-visibility :-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::placeholder{color:#aaaaaa}';export{W as verdocs_preview,X as verdocs_send,K as verdocs_template_attachments,G as verdocs_template_build_tabs,ee as verdocs_template_create,se as verdocs_template_fields,oe as verdocs_template_name,le as verdocs_template_reminders,he as verdocs_template_roles,ve as verdocs_template_visibility}
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++){n=arguments[i];for(var s in n)if(Object.prototype.hasOwnProperty.call(n,s))e[s]=n[s]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,n,i,t){function s(e){return e instanceof i?e:new i((function(n){n(e)}))}return new(i||(i=Promise))((function(i,a){function r(e){try{l(t.next(e))}catch(e){a(e)}}function o(e){try{l(t["throw"](e))}catch(e){a(e)}}function l(e){e.done?i(e.value):s(e.value).then(r,o)}l((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},t,s,a,r;return r={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function o(e){return function(n){return l([e,n])}}function l(o){if(t)throw new TypeError("Generator is already executing.");while(r&&(r=0,o[0]&&(i=0)),i)try{if(t=1,s&&(a=o[0]&2?s["return"]:o[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,o[1])).done)return a;if(s=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;s=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(o[0]===6&&i.label<a[1]){i.label=a[1];a=o;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(o);break}if(a[2])i.ops.pop();i.trys.pop();continue}o=n.call(e,i)}catch(e){o=[6,e];s=0}finally{t=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,i){if(i||arguments.length===2)for(var t=0,s=n.length,a;t<s;t++){if(a||!(t in n)){if(!a)a=Array.prototype.slice.call(n,0,t);a[t]=n[t]}}return e.concat(a||Array.prototype.slice.call(n))};System.register(["./p-e748b2d2.system.js","@verdocs/js-sdk","./p-85519037.system.js","./p-7ce23c90.system.js","./p-c8a15cb7.system.js","./p-1a180595.system.js","./p-f24d887c.system.js"],(function(e){"use strict";var n,i,t,s,a,r,o,l,c,d,f,p,u,v;return{setters:[function(e){n=e.r;i=e.c;t=e.h;s=e.H},function(e){a=e.VerdocsEndpoint;r=e.listEnvelopes;o=e.integerSequence;l=e.getRecipientsWithActions;c=e.userCanCancelEnvelope;d=e.userCanAct;f=e.cancelEnvelope},function(e){p=e.s},function(e){u=e.V},function(e){v=e.S},function(){},function(){}],execute:function(){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-envelopes-list{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", "Barlow", sans-serif}@media screen and (max-width: 800px){verdocs-envelopes-list{font-size:14px}}verdocs-envelopes-list .envelope-placeholder{height:48px;-ms-flex:0 0 48px;flex:0 0 48px;margin:5px 0;border-radius:5px;background:#f5f5fa}verdocs-envelopes-list .header{width:100%;row-gap:4px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:12px;-moz-column-gap:12px;column-gap:12px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-envelopes-list .header .filter{width:300px}verdocs-envelopes-list .header verdocs-text-input{margin:0}verdocs-envelopes-list .header verdocs-text-input input{height:32px}verdocs-envelopes-list .filter{-ms-flex-align:center;align-items:center}verdocs-envelopes-list .envelope{width:100%;margin:3px 0;background:#ffffff}verdocs-envelopes-list .envelope:hover{cursor:pointer;background:#f5f5fa}verdocs-envelopes-list .envelope .inner{gap:12px;display:-ms-flexbox;display:flex;padding:8px 14px;border-radius:5px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;container-type:inline-size}verdocs-envelopes-list .envelope .inner svg{width:24px;height:24px}verdocs-envelopes-list .vert-spacer{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 1px;flex:0 0 1px;border-right:1px solid #dad8dd}@media screen and (max-width: 800px){verdocs-envelopes-list .vert-spacer{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list .envelope-icon{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-checkbox{display:none}}verdocs-envelopes-list .last-modified{color:#444;display:-ms-flexbox;display:flex;-ms-flex:0 0 180px;flex:0 0 180px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;white-space:nowrap}@media screen and (max-width: 800px){verdocs-envelopes-list .last-modified{display:none}}verdocs-envelopes-list .envelope-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;color:#000000;line-height:28px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .envelope-recipients{color:#4b5563;font-weight:700;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .empty-text{text-align:center;margin:16px 0 0 0;padding:80px 80px;border:2px solid #ccc}verdocs-envelopes-list .containing{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-status-indicator{font-size:14px}}';var b=h;var x='<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000000" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>';var g=[{value:"all",label:"All"},{value:"inbox",label:"Inbox"},{value:"sent",label:"Sent"},{value:"completed",label:"Completed"},{value:"action",label:"Action Required"},{value:"waiting",label:"Waiting on Others"}];var m=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"in progress",label:"In Progress"},{value:"complete",label:"Completed"},{value:"declined",label:"Declined"},{value:"canceled",label:"Canceled"}];var w=[{value:"created_at",label:"Created"},{value:"updated_at",label:"Updated"},{value:"canceled_at",label:"Canceled"},{value:"envelope_name",label:"Name"},{value:"envelope_status",label:"Status"}];var y=e("verdocs_envelopes_list",function(){function e(e){n(this,e);this.changeView=i(this,"changeView",7);this.changeStatus=i(this,"changeStatus",7);this.changeSort=i(this,"changeSort",7);this.changeMatch=i(this,"changeMatch",7);this.sdkError=i(this,"sdkError",7);this.viewEnvelope=i(this,"viewEnvelope",7);this.finishEnvelope=i(this,"finishEnvelope",7);this.endpoint=a.getDefault();this.view=undefined;this.status="all";this.sort="created_at";this.match="";this.showPagination=true;this.rowsPerPage=10;this.selectedPage=0;this.count=0;this.initiallyLoaded=false;this.loading=true;this.selectedEnvelopes=[];this.envelopes=[]}e.prototype.handleViewUpdated=function(){return this.queryEnvelopes()};e.prototype.handleStatusUpdated=function(){return this.queryEnvelopes()};e.prototype.handleSortUpdated=function(){return this.queryEnvelopes()};e.prototype.handleMatchUpdated=function(){return this.queryEnvelopes()};e.prototype.handlePageUpdated=function(){return this.queryEnvelopes()};e.prototype.componentWillLoad=function(){this.endpoint.onSessionChanged((function(e,n,i){console.log("[ENVELOPES_LIST] onSessionChanged",n,i)}));this.endpoint.loadSession()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.queryEnvelopes()];case 1:e.sent();this.initiallyLoaded=true;return[2]}}))}))};e.prototype.queryEnvelopes=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,i,t,s,a;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);this.loading=true;t={page:this.selectedPage,rows:this.rowsPerPage};switch(this.view){case"all":t=__assign(__assign({},t),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]});break;case"inbox":t=__assign({},t);break;case"sent":t=__assign(__assign({},t),{is_owner:true});break;case"action":t=__assign(__assign({},t),{status:["pending","in progress"]});break;case"waiting":t=__assign(__assign({},t),{is_owner:true,status:["pending","in progress"]});break;case"completed":t=__assign(__assign({},t),{status:["complete"]});break;default:t=__assign(__assign({},t),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]})}if(this.view==="all"){if(this.status!=="all"){t.status=[this.status]}}if(this.match.trim());return[4,r(this.endpoint,t)];case 1:s=o.sent();this.envelopes=s.envelopes;this.count=s.total;this.loading=false;return[3,3];case 2:a=o.sent();this.loading=false;console.log("[ENVELOPES] Error listing envelopes",a);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new v(a.message,(n=a.response)===null||n===void 0?void 0:n.status,(i=a.response)===null||i===void 0?void 0:i.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleDownload=function(){var e=this;p(this.endpoint,this.selectedEnvelopes).then((function(){e.selectedEnvelopes=[]})).catch((function(e){console.log("[ENVELOPES] Download error",e);u("Download error: "+e.message,{style:"error"})}))};e.prototype.downloadEnvelope=function(e){p(this.endpoint,[e]).catch((function(e){console.log("[ENVELOPES] Download error",e);u("Download error: "+e.message,{style:"error"})}))};e.prototype.render=function(){var e=this;return t(s,{key:"fa39f66d3d2c557bf70bdf51b8232920da5f17c3"},t("div",{key:"88681a60242e65fc5f60546dcedc0b90bb2866ab",class:"header"},t("div",{key:"7e881cff0962a3867776aefb92b8045571fd3537",class:"filter"},t("verdocs-text-input",{key:"a8387f075c6c6f107d46c2879bd2bd557af97838",id:"verdocs-filter-name",value:this.match,clearable:true,autocomplete:"off",placeholder:"Filter by Name, Recipient, or Field...",onFocusout:function(n){var i;e.match=n.target.value.trim();(i=e.changeMatch)===null||i===void 0?void 0:i.emit(e.match)}})),t("verdocs-quick-filter",{key:"70f3794df71c00ab7cd76558ae2661caddd54b53",label:"View",value:this.view,options:g,onOptionSelected:function(n){e.view=n.detail.value}}),this.view==="all"&&t("verdocs-quick-filter",{key:"02145f9b41a95655c7456520352ab7395c02a518",label:"Status",value:this.status,options:m,onOptionSelected:function(n){e.status=n.detail.value}}),this.view==="all"&&t("verdocs-quick-filter",{key:"271a35272e0ea4e5c079e30a4f61fafca207097f",label:"Sort By",value:this.sort,options:w,onOptionSelected:function(n){e.sort=n.detail.value}}),this.loading&&t("verdocs-spinner",{key:"4a885f1f7c7513a3941847313a4e41616b3c841c",mode:"dark",size:24}),t("div",{key:"055587fbd6bc0e9aa9c38dc5c067d5d0bd6923a4",style:{display:"flex",flex:"1"}}),this.selectedEnvelopes.length>0&&t("verdocs-button",{key:"feb763f42c31aebfcd2b74761431212206691b28",label:"Download (".concat(this.selectedEnvelopes.length,")"),onClick:function(){return e.handleDownload()}})),this.envelopes.map((function(n){var i;var s=l(n);var a=c(e.endpoint.profile,n);var r=s.find((function(n){var i;return n.email===((i=e.endpoint.session)===null||i===void 0?void 0:i.email)||""}));var o=r&&a&&d(((i=e.endpoint.session)===null||i===void 0?void 0:i.email)||"",s);var p=[{label:"View Envelope",id:"view"},{label:"Finish Envelope",id:"finish",disabled:!o},{label:"Download",id:"download"},{label:"Cancel",id:"cancel",disabled:!a}];return t("div",{class:"envelope",key:n.id,onClick:function(){var i;return(i=e.viewEnvelope)===null||i===void 0?void 0:i.emit({endpoint:e.endpoint,envelope:n})}},t("div",{class:"inner"},t("verdocs-checkbox",{checked:e.selectedEnvelopes.findIndex((function(e){return e.id===n.id}))!==-1,onClick:function(e){return e.stopPropagation()},onInput:function(i){if(i.target.checked){e.selectedEnvelopes=__spreadArray(__spreadArray([],e.selectedEnvelopes,true),[n],false)}else{e.selectedEnvelopes=e.selectedEnvelopes.filter((function(e){return e.id!==n.id}))}}}),t("div",{class:"vert-spacer"}),t("span",{innerHTML:x,class:"envelope-icon"}),t("div",{class:"envelope-name"},n.name,":  ",t("div",{class:"envelope-recipients"},n.recipients.map((function(e){return e.full_name})).join(", "))),t("div",{class:"vert-spacer"}),t("verdocs-status-indicator",{envelope:n,style:{width:"125px"}}),t("div",{class:"vert-spacer"}),t("div",{class:"last-modified"},new Date(n.updated_at).toLocaleString()),t("div",{class:"vert-spacer"}),t("verdocs-dropdown",{options:p,onOptionSelected:function(i){var t,s;switch(i.detail.id){case"view":(t=e.viewEnvelope)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:n});break;case"finish":(s=e.finishEnvelope)===null||s===void 0?void 0:s.emit({endpoint:e.endpoint,envelope:n});break;case"download":e.downloadEnvelope(n);break;case"cancel":if(window.confirm("Are you sure you want to cancel this envelope?")){f(e.endpoint,n.id).then((function(){return u("Envelope canceled")})).catch((function(e){return u("Unable to cancel envelope: "+e.messabge,{style:"error"})}));e.queryEnvelopes().catch((function(){}))}break}}})))})),!this.initiallyLoaded&&t("div",{key:"19835ba9dbe9c56ef8c45c08f38c537a7c70bebd",style:{width:"100%"}},o(0,this.rowsPerPage).map((function(){return t("div",{class:"envelope-placeholder"})}))),this.initiallyLoaded&&!this.envelopes.length&&t("div",{key:"5844f2a1576d7c574865c01b3e7af99eb82b4303",class:"empty-text"},"No matching envelopes found. Please adjust your filters and try again."),this.initiallyLoaded&&this.envelopes.length&&this.showPagination?t("div",{style:{marginTop:"20px"}},t("verdocs-pagination",{selectedPage:this.selectedPage,perPage:this.rowsPerPage,itemCount:this.count,onSelectPage:function(n){e.selectedPage=n.detail.selectedPage}})):t("div",null))};Object.defineProperty(e,"watchers",{get:function(){return{view:["handleViewUpdated"],status:["handleStatusUpdated"],sort:["handleSortUpdated"],match:["handleMatchUpdated"],selectedPage:["handlePageUpdated"]}},enumerable:false,configurable:true});return e}());y.style=b}}}));
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as e,H as o}from"./p-73a6f972.js";import{VerdocsEndpoint as a,getEnvelopesSummary as s,integerSequence as n,formatShortTimeAgo as r}from"@verdocs/js-sdk";import{S as l}from"./p-fd97809c.js";const d=class{constructor(e){i(this,e),this.sdkError=t(this,"sdkError",7),this.viewEnvelope=t(this,"viewEnvelope",7),this.viewAll=t(this,"viewAll",7),this.endpoint=a.getDefault(),this.items=5,this.view=void 0,this.header=void 0,this.title="",this.count=0,this.loading=!0,this.entries=[]}async componentWillLoad(){var i,t,e;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[ACTIVITIES] Must be authenticated");this.loadActivity()}catch(o){console.log("[ACTIVITIES] Error with preview session",o),null===(i=this.sdkError)||void 0===i||i.emit(new l(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(e=o.response)||void 0===e?void 0:e.data))}}handleItemsUpdated(){return this.loadActivity()}handleViewUpdated(){return this.loadActivity()}async loadActivity(){this.loading=!0;const i=await s(this.endpoint,0);let t;"action"===this.view?(t="Action Required",this.entries=i.action_required.result,this.count=i.action_required.total):"waiting"===this.view?(t="Waiting on Others",this.entries=i.waiting_others.result,this.count=i.waiting_others.total):"completed"===this.view&&(t="Completed",this.entries=i.completed.result,this.count=i.completed.total),this.title=void 0!==this.header?this.header:t,this.loading=!1}render(){return this.loading?e(o,{style:{minHeight:"300px"}},this.title&&e("div",{class:"box-title"},this.title," ",e("span",{class:"count"},"(0)")),n(0,this.items).map((()=>e("div",{class:"loading-placeholder"},e("div",{class:"loading-placeholder-bg"}))))):e(o,null,this.title&&e("div",{class:"box-title"},this.title," ",e("span",{class:"count"},"(",this.count,")"),e("div",{class:"spacer"}),e("verdocs-button",{label:"View All",size:"small",onClick:()=>{var i;return null===(i=this.viewAll)||void 0===i?void 0:i.emit({endpoint:this.endpoint,view:this.view})}})),this.count>0?this.entries.slice(0,Math.max(this.items,1)).map((i=>e("div",{class:"activity-entry",onClick:()=>{var t;null===(t=this.viewEnvelope)||void 0===t||t.emit({endpoint:this.endpoint,entry:i})}},e("div",{class:"title"},i.name,e("br",null)," ",e("strong",null,i.recipient.name)),e("div",{class:"time-ago"},r(i.updated_at))))):e("img",{src:"https://verdocs-public-assets.s3.amazonaws.com/no-verdocs.png",alt:"No documents to show",style:{width:"190px",margin:"0 auto"}}))}static get watchers(){return{items:["handleItemsUpdated"],view:["handleViewUpdated"]}}};d.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-activity-box{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:18px;min-width:300px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;color:#33364b;-ms-flex-align:center;align-items:center;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", "Barlow", sans-serif;background:#ffffff;padding:20px 20px 8px 20px}verdocs-activity-box .box-title{width:100%;display:-ms-flexbox;display:flex;color:#33364b;font-size:20px;font-weight:600;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin:0 0 20px 0;-ms-flex-align:center;align-items:center}verdocs-activity-box .box-title .count{margin:0 0 0 6px;font-weight:300}verdocs-activity-box .box-title verdocs-loader{margin:0 0 20px 0}@media screen and (max-width: 1200px){verdocs-activity-box .box-title{font-size:18px}verdocs-activity-box .box-title .count{display:none}}verdocs-activity-box .spacer{-ms-flex:1;flex:1}verdocs-activity-box .loading-placeholder{width:100%;height:62px;display:block;-ms-flex:0 0 62px;flex:0 0 62px;margin:0 0 10px 0;border-radius:6px;background-color:#f5f8f9}verdocs-activity-box .loading-placeholder .loading-placeholder-bg{height:62px;position:relative;background:#f5f8f9;-webkit-animation-duration:1.25s;animation-duration:1.25s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:loadingPlaceholderSwoop;animation-name:loadingPlaceholderSwoop;background:-webkit-gradient(linear, left top, right top, color-stop(10%, #f5f8f9), color-stop(18%, #eeeeee), color-stop(33%, #f5f8f9));background:linear-gradient(to right, #f5f8f9 10%, #eeeeee 18%, #f5f8f9 33%);background-size:800px 62px}verdocs-activity-box .activity-entry{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 62px;flex:0 0 62px;border-radius:6px;margin-bottom:10px;-ms-flex-direction:row;flex-direction:row;padding:0 16px 0 0;background:#f5f8f9;-ms-flex-align:center;align-items:center;border:1px solid #f5f8f9}verdocs-activity-box .activity-entry:hover{cursor:pointer;background:#f2f4f5;border:1px solid #ddd}verdocs-activity-box .activity-entry svg{width:32px;height:32px;margin-right:20px}@media screen and (max-width: 1300px){verdocs-activity-box .activity-entry svg{width:24px;height:24px;margin-right:15px}}verdocs-activity-box .activity-entry .title{-ms-flex:1;flex:1;color:black;font-size:16px;font-weight:500;margin-left:12px}@media screen and (max-width: 1300px){verdocs-activity-box .activity-entry .title{font-size:14px}}verdocs-activity-box .activity-entry .time-ago{height:24px;display:-ms-flexbox;display:flex;-ms-flex:0 0 24px;flex:0 0 24px;color:#7f8e92;font-size:16px;font-weight:500;padding-left:14px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-left:1px solid #d8e3e6}@media screen and (max-width: 1300px){verdocs-activity-box .activity-entry .time-ago{font-size:14px}}@-webkit-keyframes loadingPlaceholderSwoop{0%{background-position:-468px 0}100%{background-position:468px 0}}@keyframes loadingPlaceholderSwoop{0%{background-position:-468px 0}100%{background-position:468px 0}}';export{d as verdocs_activity_box}