var C=Object.defineProperty;var p=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var f=(n,e,s)=>e in n?C(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,m=(n,e)=>{for(var s in e||(e={}))F.call(e,s)&&f(n,s,e[s]);if(p)for(var s of p(e))E.call(e,s)&&f(n,s,e[s]);return n};import{j as t,_ as a,s as T,d as M}from"./main.2.8.1.js";import{d as r}from"./react-router-dom.9mCuUg3q.js";import{z as _}from"./Note.BeM7sN-p.js";import{B as P}from"./BackIcn._kGL_vVw.js";import{T as x}from"./TutorialLink.BAFX--T3.js";import{t as B}from"./tutorialLinks.kMkIDzcD.js";import"./CopyIcn.3gZpHton.js";function Q({formID:n,autonamiConf:e,setAutonamiConf:s,step:u,nextPage:j,setSnackbar:N,isInfo:d}){const[l,A]=r.useState(!1),[k,y]=r.useState({integrationName:""}),[L,S]=r.useState(!1),{autonami:o}=B,[c,h]=r.useState(!1),[z,v]=r.useState(!0);r.useEffect(()=>()=>{v(!1)},[]);const I=()=>{h("auth"),M({},"autonami_authorize").then(i=>{z&&(i!=null&&i.success&&(A(!0),N({show:!0,msg:a("Connect Successfully","bit-integrations")})),S(!0),h(!1))})},w=i=>{const b=m({},e),g=m({},k);g[i.target.name]="",b[i.target.name]=i.target.value,y(g),s(b)};return t.jsx(t.Fragment,{children:t.jsxs("div",{className:"btcd-stp-page",style:{width:u===1&&900,height:u===1&&"auto"},children:[t.jsx(x,{title:"FunnelKit (Autonami)",youTubeLink:o==null?void 0:o.youTubeLink}),t.jsx(x,{title:"FunnelKit (Autonami)",docLink:o==null?void 0:o.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-5 mt-1",onChange:w,name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations"),disabled:d}),L&&!l&&!c&&t.jsxs("div",{className:"flx mt-4",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),T(a("Please! First Install or Active %s Plugin","bit-integrations"),"Autonami Pro")]}),!d&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:I,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||c,children:[l?a("Connected ✔","bit-integrations"):a("Connect to Autonami","bit-integrations"),c&&t.jsx(_,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>j(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[a("Next","bit-integrations"),t.jsx(P,{className:"ml-1 rev-icn"})]})]})]})})}export{Q as default};
