var w=Object.defineProperty;var f=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var k=(n,e,i)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,d=(n,e)=>{for(var i in e||(e={}))P.call(e,i)&&k(n,i,e[i]);if(f)for(var i of f(e))T.call(e,i)&&k(n,i,e[i]);return n};import{j as t,_ as s,d as E}from"./main.2.8.1.js";import{d as p}from"./react-router-dom.9mCuUg3q.js";import{B as K}from"./BackIcn._kGL_vVw.js";import{z as N}from"./Note.BeM7sN-p.js";import{a as C}from"./SendinBlueCommonFunc.DKY2QbR0.js";import{t as F}from"./tutorialLinks.kMkIDzcD.js";import{T as v}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function Q({formID:n,sendinBlueConf:e,setSendinBlueConf:i,step:g,setstep:A,setSnackbar:x,isInfo:b}){const[l,z]=p.useState(!1),[h,y]=p.useState({name:"",api_key:""}),[_,S]=p.useState(!1),[c,u]=p.useState(!1),{sendinBlue:r}=F,I=()=>{const a=d({},e);if(!a.name||!a.api_key){y({name:a.name?"":s("Integration name can't be empty","bit-integrations"),api_key:a.api_key?"":s("API Key can't be empty","bit-integrations")});return}u("auth");const m={api_key:a.api_key};E(m,"sblue_authorize").then(o=>{o!=null&&o.success&&(z(!0),x({show:!0,msg:s("Authorized Successfully","bit-integrations")})),S(!0),u(!1)})},j=a=>{const m=d({},e),o=d({},h);o[a.target.name]="",m[a.target.name]=a.target.value,y(o),i(m)},L=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),A(2),C(e,i,u,x)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:g===1&&900,height:g===1&&"auto"},children:[t.jsx(v,{title:"Brevo (Sendinblue)",youTubeLink:r==null?void 0:r.youTubeLink}),t.jsx(v,{title:"Brevo (Sendinblue)",docLink:r==null?void 0:r.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("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:s("Integration Name...","bit-integrations"),disabled:b}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.name}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("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:s("API Key...","bit-integrations"),disabled:b}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.api_key}),t.jsxs("small",{className:"d-blk mt-5",children:[s("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:s("Brevo(Sendinblue) API Console","bit-integrations")})]}),c==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(N,{size:25,clr:"#022217",className:"mr-2"}),s("Checking API Key!!!","bit-integrations")]}),_&&!l&&!c&&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:"×"}),s("Sorry, Api key is invalid","bit-integrations")]}),!b&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:I,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||c,children:[l?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),c&&t.jsx(N,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>L(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[s("Next","bit-integrations"),t.jsx(K,{className:"ml-1 rev-icn"})]})]})]})}export{Q as default};
