var z=Object.defineProperty;var j=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var k=(t,n,a)=>n in t?z(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a,b=(t,n)=>{for(var a in n||(n={}))I.call(n,a)&&k(t,a,n[a]);if(j)for(var a of j(n))P.call(n,a)&&k(t,a,n[a]);return t};import{r as g,j as e}from"./main-406.js";import{_ as i,L as _,N as f}from"./bi.394.85.js";import{m as M}from"./bi.662.796.js";import{T as v,t as S}from"./bi.150.760.js";function $({mailerLiteConf:t,setMailerLiteConf:n,step:a,setstep:N,loading:o,setLoading:y,setSnackbar:E,isInfo:l}){const[c,T]=g.useState(!1),[h,u]=g.useState({name:"",auth_token:""}),{mailerLite:s}=S,m=t.version==="v2"?"https://dashboard.mailerlite.com/integrations/api":"https://app.mailerlite.com/integrations/api/",A=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),t!=null&&t.default,N(2)},r=d=>{const p=b({},t),x=b({},h);x[d.target.name]="",p[d.target.name]=d.target.value,u(x),n(p)},w=`
    <h4> Step of generate API token:</h4>
    <ul>
      <li>Goto <a href=${m}>Generate API Token</a></li>
      <li>Copy the <b>Token</b> and paste into <b>API Token</b> field of your authorization form.</li>
      <li>Finally, click <b>Authorize</b> button.</li>
  </ul>
  `;return e.jsxs("div",{className:"btcd-stp-page",style:{width:a===1&&900,height:a===1&&"auto"},children:[(s==null?void 0:s.youTubeLink)&&e.jsx(v,{title:s==null?void 0:s.title,youTubeLink:s==null?void 0:s.youTubeLink}),(s==null?void 0:s.docLink)&&e.jsx(v,{title:s==null?void 0:s.title,docLink:s==null?void 0:s.docLink}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Integration Name:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"name",value:t.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:l}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Select Version:")})}),e.jsxs("div",{className:"flex items-center w-6 mt-3",children:[e.jsx("input",{id:"MailerLiteClassic",type:"radio",name:"version",value:"v1",className:"hidden",checked:t.version==="v1",onChange:r}),e.jsxs("label",{for:"MailerLiteClassic",children:[e.jsx("span",{className:"w-4 h-4 inline-block mr-1 border border-grey"}),"MailerLite Classic"]})]}),e.jsxs("div",{className:"flex items-center mr-4 mt-2 mb-4",children:[e.jsx("input",{id:"MailerLiteNew",type:"radio",name:"version",value:"v2",className:"hidden",checked:t.version==="v2",onChange:r}),e.jsxs("label",{for:"MailerLiteNew",children:[e.jsx("span",{className:"w-4 h-4 inline-block mr-1 border border-grey"}),"MailerLite New"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("API Token:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"auth_token",value:t.auth_token,type:"text",placeholder:i("API Token...","bit-integrations"),disabled:l}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.auth_token}),e.jsxs("small",{className:"d-blk mt-3",children:[i("To Get API token, Please Visit","bit-integrations")," ",e.jsx("a",{className:"btcd-link",href:m,target:"_blank",rel:"noreferrer",children:i("MailerLite API Token","bit-integrations")})]}),e.jsx("br",{}),e.jsx("br",{}),!l&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>M(t,n,u,T,o,y,"authorization"),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:c||o.auth||t.version===void 0||t.version==="",children:[c?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),o.auth&&e.jsx(_,{size:"20",clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:A,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",disabled:!c,children:[i("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),e.jsx(f,{note:w})]})}export{$ as default};
