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 m,j as e,_ as i,L as w,aL as L,c as T}from"./main-40.js";import{t as f}from"./bf-892-199.js";import{T as E}from"./bf-679-136.js";import{A as K}from"./bf-541-403.js";import{N as F}from"./bf-504-404.js";import{a as C}from"./bf-447-379.js";/* empty css          */import"./bf-860-126.js";import"./bf-132-75.js";import"./bf-141-80.js";import"./bf-586-70.js";function U({sendinBlueConf:t,setSendinBlueConf:s,step:a,setstep:k,setSnackbar:x,isInfo:c}){const[d,A]=m.useState(!1),[p,y]=m.useState({name:"",api_key:""}),[N,_]=m.useState(!1),[h,u]=m.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({},p);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:c}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.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:c}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.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")})]}),h==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(w,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Key!!!"]}),N&&!d&&!h&&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"]}),!c&&e.jsxs(e.Fragment,{children:[e.jsx(K,{isAuthorized:d,handleAuthorize:()=>v(),isLoading:h}),e.jsx("br",{}),e.jsx(F,{nextPageHandler:()=>z(),disabled:!d})]})]})]})}export{U as default};
