import{j as t,_ as s,s as f,b as j}from"./main.2.9.0.js";import{b as i}from"./react-router.DMwpH23k.js";import{B as N}from"./BackIcn._8Wofmn2.js";import{y as C,x as y}from"./Note.NSUdvR3c.js";import{T as v}from"./TutorialLink.CFG7bS5c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function _({formID:w,wcConf:n,setWcConf:l,step:o,setStep:d,setSnackbar:h}){const[a,u]=i.useState(!1),[r,c]=i.useState(!1),[p,b]=i.useState(!1),g=()=>{c("auth"),j({},"wc_authorize").then(e=>{e!=null&&e.success&&(u(!0),h({show:!0,msg:s("Connected with WooCommerce Successfully","bit-integrations")})),c(!1),b(!0)})},x=e=>{const m=y(n);m[e.target.name]=e.target.value,l(m)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:o===1&&900,height:o===1&&"auto"},children:[t.jsx(v,{linkKey:"wooCommerce"}),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:x,name:"name",value:n.name,type:"text",placeholder:s("Integration Name...","bit-integrations")}),r==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(C,{size:25,clr:"#022217",className:"mr-2"}),"Checking if WooCommerce is active!!!"]}),p&&!a&&!r&&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"),"WooCommerce")]}),!a&&t.jsx("button",{onClick:g,className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:s("Connect","bit-integrations")}),a&&t.jsxs("button",{onClick:()=>d(2),className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",disabled:!a,children:[s("Next","bit-integrations"),t.jsx(N,{className:"ml-1 rev-icn"})]})]})}export{_ as default};
