var z=Object.defineProperty;var x=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var g=(t,a,i)=>a in t?z(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i,b=(t,a)=>{for(var i in a||(a={}))f.call(a,i)&&g(t,i,a[i]);if(x)for(var i of x(a))I.call(a,i)&&g(t,i,a[i]);return t};import{_ as s,j as e}from"./main.2.8.1.js";import{d as j}from"./react-router-dom.9mCuUg3q.js";import{t as M}from"./tutorialLinks.kMkIDzcD.js";import{z as P,a9 as _}from"./Note.BeM7sN-p.js";import{T as k}from"./TutorialLink.BAFX--T3.js";import{a as S}from"./MailerLiteCommonFunc.C7trWZsR.js";import"./CopyIcn.3gZpHton.js";function D({mailerLiteConf:t,setMailerLiteConf:a,step:i,setstep:v,loading:o,setLoading:N,setSnackbar:E,isInfo:l}){const[c,y]=j.useState(!1),[h,T]=j.useState({name:"",auth_token:""}),{mailerLite:n}=M,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,v(2)},r=d=>{const u=b({},t),p=b({},h);p[d.target.name]="",u[d.target.name]=d.target.value,T(p),a(u)},w=`
    <h4>${s("Step of generate API token:","bit-integrations")}</h4>
    <ul>
      <li>${s("Goto","bit-integrations")} <a href=${m}>Generate API Token</a></li>
      <li>${s("Copy the <b>Token</b> and paste into <b>API Token</b> field of your authorization form.","bit-integrations")}</li>
      <li>${s("Finally, click <b>Authorize</b> button.","bit-integrations")}</li>
  </ul>
  `;return e.jsxs("div",{className:"btcd-stp-page",style:{width:i===1&&900,height:i===1&&"auto"},children:[e.jsx(k,{title:"MailerLite",youTubeLink:n==null?void 0:n.youTubeLink}),e.jsx(k,{title:"MailerLite",docLink:n==null?void 0:n.docLink}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("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:s("Integration Name...","bit-integrations"),disabled:l}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("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:s("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:s("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:[s("To Get API Token, Please Visit","bit-integrations")," ",e.jsx("a",{className:"btcd-link",href:m,target:"_blank",rel:"noreferrer",children:s("MailerLite API Token","bit-integrations")})]}),e.jsx("br",{}),e.jsx("br",{}),!l&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>S(t,y,o,N),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:c||o.auth||t.version===void 0||t.version==="",children:[c?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),o.auth&&e.jsx(P,{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:[s("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),e.jsx(_,{note:w})]})}export{D as default};
