var I=Object.defineProperty;var j=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var b=(t,s,a)=>s in t?I(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,l=(t,s)=>{for(var a in s||(s={}))S.call(s,a)&&b(t,a,s[a]);if(j)for(var a of j(s))P.call(s,a)&&b(t,a,s[a]);return t};import{r as c,j as e,_ as i,L as w,bs as L,c as T}from"./main-634.js";import{t as f}from"./bf-275-83.js";import{a5 as E,a6 as K}from"./bf-746-82.js";import{N as F}from"./bf-123-109.js";import{r as C}from"./bf-34-174.js";import"./bf-822-108.js";import"./bf-25-81.js";function G({sendinBlueConf:t,setSendinBlueConf:s,step:a,setstep:k,setSnackbar:x,isInfo:m}){const[d,A]=c.useState(!1),[h,y]=c.useState({name:"",api_key:""}),[N,_]=c.useState(!1),[p,u]=c.useState(!1),v=()=>{const r=l({},t);if(!r.name||!r.api_key){y({name:r.name?"":i("Integration name cann't be empty"),api_key:r.api_key?"":i("API Key cann't be empty")});return}u("auth");const o={api_key:r.api_key};T(o,"bitforms_sblue_authorize").then(n=>{n!=null&&n.success&&(A(!0),x({show:!0,msg:i("Authorized Successfully")})),_(!0),u(!1)})},g=r=>{const o=l({},t),n=l({},h);n[r.target.name]="",o[r.target.name]=r.target.value,y(n),s(o)},z=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),k(2),C(t,s,u,x)};return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:f.sendinblue.title,youTubeLink:f.sendinblue.link}),e.jsxs("div",{className:"btcd-stp-page",style:{width:a===1&&900,height:a===1&&"100%"},children:[e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Integration Name:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:g,name:"name",value:t.name,type:"text",placeholder:i("Integration Name..."),disabled:m}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.name}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("API Key:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:g,name:"api_key",value:t.api_key,type:"text",placeholder:i("API Key..."),disabled:m}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.api_key}),e.jsxs("small",{className:"d-blk mt-5",children:[i("To get API , Please Visit")," ",e.jsx("a",{className:"btcd-link",href:"https://account.sendinblue.com/advanced/api",target:"_blank",rel:"noreferrer",children:i("Brevo(SendinBlue) API Console")})]}),p==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(w,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Key!!!"]}),N&&!d&&!p&&e.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[e.jsx("span",{className:"mr-2",style:{fontSize:30,marginTop:-5},children:e.jsx(L,{size:"15"})}),"Sorry, API key is invalid"]}),!m&&e.jsxs(e.Fragment,{children:[e.jsx(K,{isAuthorized:d,handleAuthorize:()=>v(),isLoading:p}),e.jsx("br",{}),e.jsx(F,{nextPageHandler:()=>z(),disabled:!d})]})]})]})}export{G as default};
