var P=Object.defineProperty;var x=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var b=(t,a,s)=>a in t?P(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,o=(t,a)=>{for(var s in a||(a={}))T.call(a,s)&&b(t,s,a[s]);if(x)for(var s of x(a))z.call(a,s)&&b(t,s,a[s]);return t};import{r as j,j as e,_ as r}from"./main-343.js";import{t as v}from"./bf-974-82.js";import{N as f}from"./bf-750-180.js";import{a5 as I,a6 as _}from"./bf-659-81.js";import{N as M}from"./bf-713-109.js";import{m as S}from"./bf-310-181.js";import"./bf-684-182.js";import"./bf-649-79.js";function D({mailerLiteConf:t,setMailerLiteConf:a,step:s,setstep:k,isLoading:N,setIsLoading:g,isInfo:n}){const[d,y]=j.useState(!1),[c,h]=j.useState({name:"",auth_token:""}),A=()=>{t!=null&&t.default,k(2),document.querySelector(".btcd-s-wrp").scrollTop=0},i=l=>{const p=o({},t),u=o({},c);u[l.target.name]="",p[l.target.name]=l.target.value,h(u),a(p)},m=t.version==="v2"?"https://dashboard.mailerlite.com/integrations/api":"https://app.mailerlite.com/integrations/api/",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:s===1&&900,height:s===1&&"auto"},children:[e.jsx(I,{title:v.mailerlite.title,youTubeLink:v.mailerlite.link}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:r("Integration Name:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:i,name:"name",value:t.name,type:"text",placeholder:r("Integration Name..."),disabled:n}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:r("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:i}),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:i}),e.jsxs("label",{for:"MailerLiteNew",children:[e.jsx("span",{className:"w-4 h-4 inline-block mr-1 border border-grey"}),"MailerLite New"]})]}),e.jsxs("small",{className:"d-blk mt-3",children:[r("To Get API token, Please Visit")," ",e.jsx("a",{className:"btcd-link",href:m,target:"_blank",rel:"noreferrer",children:r("MailerLite API Token")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:r("API Token:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:i,name:"auth_token",value:t.auth_token,type:"text",placeholder:r("API Token..."),disabled:n}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:c.auth_token}),!n&&e.jsxs("div",{children:[e.jsx(_,{isAuthorized:d,isLoading:N,disabled:t.version===void 0||t.version==="",handleAuthorize:()=>S(t,a,h,y,g,"authorization")}),e.jsx("br",{}),e.jsx(M,{nextPageHandler:()=>A(),disabled:!d})]}),e.jsx(f,{note:w})]})}export{D as default};
