import{j as t,_ as a,s as j,d as N}from"./main.2.8.1.js";import{d as h}from"./react-router-dom.9mCuUg3q.js";import{B as y}from"./BackIcn._kGL_vVw.js";import{z as k,y as v}from"./Note.BeM7sN-p.js";import{a as w,p as z}from"./MemberpressCommonFunc.tt3rW2tb.js";import{t as S}from"./tutorialLinks.kMkIDzcD.js";import{T as A}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function F({formID:M,memberpressConf:i,setMemberpressConf:r,step:c,setStep:u,isLoading:l,setIsLoading:n,setSnackbar:d}){const[o,p]=h.useState(!1),[b,x]=h.useState(!1),{memberpress:e}=S,g=()=>{n("auth"),N({},"memberpress_authorize").then(s=>{s!=null&&s.success&&(p(!0),d({show:!0,msg:a("Connected with Memberpress Successfully","bit-integrations")})),n(!1),x(!0),w(i,r,n),z(i,r,n)})},f=s=>{const m=v(i);m[s.target.name]=s.target.value,r(m)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:c===1&&900,height:c===1&&"auto"},children:[e==null?void 0:e.youTubeLink,t.jsx(A,{title:"MemberPress",docLink:e==null?void 0:e.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:f,name:"name",value:i.name,type:"text",placeholder:a("Integration Name...","bit-integrations")}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(k,{size:25,clr:"#022217",className:"mr-2"}),"Checking if Memberpress is active!!!"]}),b&&!o&&!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:"×"}),j(a("%s plugin must be activated to integrate with Bit Integrations","bit-integrations"),"Memberpress")]}),!o&&t.jsx("button",{onClick:g,className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:a("Connect","bit-integrations")}),o&&t.jsxs("button",{onClick:()=>u(2),className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",disabled:!o,children:[a("Next","bit-integrations"),t.jsx(y,{className:"ml-1 rev-icn"})]})]})}export{F as default};
