var w=Object.defineProperty;var h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var u=(i,e,s)=>e in i?w(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,b=(i,e)=>{for(var s in e||(e={}))y.call(e,s)&&u(i,s,e[s]);if(h)for(var s of h(e))A.call(e,s)&&u(i,s,e[s]);return i};import{j as t,_ as a,b as z}from"./main.2.9.0.js";import{b as x}from"./react-router.DMwpH23k.js";import{B as W}from"./BackIcn._8Wofmn2.js";import{y as f}from"./Note.NSUdvR3c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function F({wcAffiliateConf:i,setWCAffiliateConf:e,step:s,nextPage:p,isLoading:c,setIsLoading:o,setSnackbar:j,isInfo:l}){const[r,N]=x.useState(!1),[d,g]=x.useState(!1),v=()=>{l||(o("auth"),z({},"wc_affiliate_authorize").then(n=>{n!=null&&n.success&&(N(!0),j({show:!0,msg:a("Connected with WC Affiliate successfully","bit-integrations")})),o(!1),g(!0)}))},C=n=>{if(!e)return;const m=b({},i);m[n.target.name]=n.target.value,e(m)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:s===1&&900,height:s===1&&"auto"},children:[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:C,name:"name",value:i.name,type:"text",placeholder:a("Integration Name...","bit-integrations")}),c==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(f,{size:25,clr:"#022217",className:"mr-2"}),a("Checking if WC Affiliate is authorized...","bit-integrations")]}),d&&!r&&!c&&t.jsx("div",{className:"flx mt-5",style:{width:900,justifyContent:"center"},children:t.jsxs("div",{className:"txt-center",children:[t.jsx("div",{className:"btcd-icn btcd-icn-err",children:t.jsx("span",{children:"✕"})}),t.jsx("div",{className:"mt-2",children:a("WC Affiliate is not activated or not installed","bit-integrations")})]})}),d&&r&&!c&&t.jsxs("div",{className:"flx mt-5",style:{width:900},children:[t.jsx("div",{className:"btcd-icn btcd-icn-success",children:t.jsx("span",{children:"✓"})}),t.jsx("div",{className:"mt-2",children:a("WC Affiliate is activated","bit-integrations")})]}),t.jsxs("button",{onClick:v,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||r||c==="auth",children:[r?a("Connected","bit-integrations"):a("Connect to WC Affiliate","bit-integrations"),c==="auth"&&t.jsx(f,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),!l&&t.jsxs("button",{onClick:()=>p(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!r,children:[a("Next","bit-integrations"),t.jsx(W,{className:"ml-1 rev-icn"})]})]})}export{F as default};
