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