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