var w=Object.defineProperty;var u=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var x=(t,a,i)=>a in t?w(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i,d=(t,a)=>{for(var i in a||(a={}))T.call(a,i)&&x(t,i,a[i]);if(u)for(var i of u(a))z.call(a,i)&&x(t,i,a[i]);return t};import{_ as s,j as e}from"./main.2.8.10.js";import{b as g}from"./react-router.DMwpH23k.js";import{y as I,a9 as f}from"./Note.DalStCGz.js";import{T as P}from"./TutorialLink.D6K_DiHL.js";import{a as _}from"./MailerLiteCommonFunc.CsKj5diu.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function R({mailerLiteConf:t,setMailerLiteConf:a,step:i,setstep:j,loading:r,setLoading:v,setSnackbar:M,isInfo:o}){const[l,k]=g.useState(!1),[b,N]=g.useState({name:"",auth_token:""}),m=t.version==="v2"?"https://dashboard.mailerlite.com/integrations/api":"https://app.mailerlite.com/integrations/api/",y=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),t!=null&&t.default,j(2)},n=c=>{const h=d({},t),p=d({},b);p[c.target.name]="",h[c.target.name]=c.target.value,N(p),a(h)},A=`
    <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(P,{linkKey:"mailerLite"}),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:n,name:"name",value:t.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:o}),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:n}),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:n}),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:n,name:"auth_token",value:t.auth_token,type:"text",placeholder:s("API Token...","bit-integrations"),disabled:o}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:b.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",{}),!o&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>_(t,k,r,v),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||r.auth||t.version===void 0||t.version==="",children:[l?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),r.auth&&e.jsx(I,{size:"20",clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:y,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[s("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),e.jsx(f,{note:A})]})}export{R as default};
