var M=Object.defineProperty;var g=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var p=(i,s,e)=>s in i?M(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e,m=(i,s)=>{for(var e in s||(s={}))w.call(s,e)&&p(i,e,s[e]);if(g)for(var e of g(s))T.call(s,e)&&p(i,e,s[e]);return i};import{j as t,_ as a,d as _}from"./main.2.8.1.js";import{d as c}from"./react-router-dom.9mCuUg3q.js";import{z as x}from"./Note.BeM7sN-p.js";import{B as C}from"./BackIcn._kGL_vVw.js";import{t as E}from"./tutorialLinks.kMkIDzcD.js";import{T as f}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function J({formID:i,mailPoetConf:s,setMailPoetConf:e,step:d,nextPage:j,setSnackbar:N,isInfo:z}){const[r,k]=c.useState(!1),[y,A]=c.useState({integrationName:""}),[L,v]=c.useState(!1),[l,u]=c.useState(!1),{mailPoet:o}=E,S=()=>{u("auth"),_({},"mail_poet_authorize").then(n=>{n!=null&&n.success&&(k(!0),N({show:!0,msg:a("Authorized Successfully","bit-integrations")})),v(!0),u(!1)})},I=n=>{const h=m({},s),b=m({},y);b[n.target.name]="",h[n.target.name]=n.target.value,A(b),e(h)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:d===1&&900,height:d===1&&"auto"},children:[t.jsx(f,{title:"MailPoet",youTubeLink:o==null?void 0:o.youTubeLink}),t.jsx(f,{title:"MailPoet",docLink:o==null?void 0:o.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:a("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:I,name:"name",value:s.name,type:"text",placeholder:a("Integration Name...","bit-integrations"),disabled:z}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(x,{size:25,clr:"#022217",className:"mr-2"}),a("Checking if MailPoet is active!!!","bit-integrations")]}),L&&!r&&!l&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),a("Please! First Install Mailpoet Plugins","bit-integrations")]}),t.jsxs("button",{onClick:S,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:r||l,children:[r?a("Authorized ✔","bit-integrations"):a("Authorize","bit-integrations"),l&&t.jsx(x,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>j(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!r,children:[a("Next","bit-integrations"),t.jsx(C,{className:"ml-1 rev-icn"})]})]})}export{J as default};
