var w=Object.defineProperty;var k=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var f=(r,e,s)=>e in r?w(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,d=(r,e)=>{for(var s in e||(e={}))P.call(e,s)&&f(r,s,e[s]);if(k)for(var s of k(e))T.call(e,s)&&f(r,s,e[s]);return r};import{r as b,j as t}from"./main-333.js";import{B as E}from"./bi.429.767.js";import{_ as i,L as N,b as K}from"./bi.636.93.js";import{a as C}from"./bi.118.761.js";import{T as v,t as F}from"./bi.318.783.js";function H({formID:r,sendinBlueConf:e,setSendinBlueConf:s,step:g,setstep:A,setSnackbar:x,isInfo:h}){const[c,_]=b.useState(!1),[p,y]=b.useState({name:"",api_key:""}),[z,I]=b.useState(!1),[l,u]=b.useState(!1),{sendinBlue:a}=F,L=()=>{const n=d({},e);if(!n.name||!n.api_key){y({name:n.name?"":i("Integration name can't be empty","bit-integrations"),api_key:n.api_key?"":i("API Key can't be empty","bit-integrations")});return}u("auth");const m={api_key:n.api_key};K(m,"sblue_authorize").then(o=>{o!=null&&o.success&&(_(!0),x({show:!0,msg:i("Authorized Successfully","bit-integrations")})),I(!0),u(!1)})},j=n=>{const m=d({},e),o=d({},p);o[n.target.name]="",m[n.target.name]=n.target.value,y(o),s(m)},S=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),A(2),C(e,s,u,x)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:g===1&&900,height:g===1&&"auto"},children:[(a==null?void 0:a.youTubeLink)&&t.jsx(v,{title:"Brevo (Sendinblue)",youTubeLink:a==null?void 0:a.youTubeLink}),(a==null?void 0:a.docLink)&&t.jsx(v,{title:"Brevo (Sendinblue)",docLink:a==null?void 0:a.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:j,name:"name",value:e.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.name}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("API Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:j,name:"api_key",value:e.api_key,type:"text",placeholder:i("API Key...","bit-integrations"),disabled:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.api_key}),t.jsxs("small",{className:"d-blk mt-5",children:[i("To get API , Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://account.sendinblue.com/advanced/api",target:"_blank",rel:"noreferrer",children:i("Brevo(Sendinblue) API Console","bit-integrations")})]}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(N,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Key!!!"]}),z&&!c&&!l&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),"Sorry, API key is invalid"]}),!h&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:L,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:c||l,children:[c?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),l&&t.jsx(N,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>S(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!c,children:[i("Next","bit-integrations"),t.jsx(E,{className:"ml-1 rev-icn"})]})]})]})}export{H as default};
