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