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 n,L as w,bm as L,c as T}from"./main-343.js";import{t as f}from"./bf-974-82.js";import{a5 as E,a6 as K}from"./bf-659-81.js";import{N as F}from"./bf-713-109.js";import{r as C}from"./bf-252-174.js";import"./bf-649-79.js";function D({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?"":n("Integration name cann't be empty"),api_key:r.api_key?"":n("API Key cann't be empty")});return}u("auth");const o={api_key:r.api_key};T(o,"bitforms_sblue_authorize").then(i=>{i!=null&&i.success&&(A(!0),x({show:!0,msg:n("Authorized Successfully")})),_(!0),u(!1)})},g=r=>{const o=l({},t),i=l({},h);i[r.target.name]="",o[r.target.name]=r.target.value,y(i),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:n("Integration Name:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:g,name:"name",value:t.name,type:"text",placeholder:n("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:n("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:n("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:[n("To get API , Please Visit")," ",e.jsx("a",{className:"btcd-link",href:"https://account.sendinblue.com/advanced/api",target:"_blank",rel:"noreferrer",children:n("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{D as default};
