var S=Object.defineProperty;var j=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var f=(n,e,i)=>e in n?S(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,m=(n,e)=>{for(var i in e||(e={}))w.call(e,i)&&f(n,i,e[i]);if(j)for(var i of j(e))P.call(e,i)&&f(n,i,e[i]);return n};import{j as t,_ as s,b as T}from"./main.2.8.10.js";import{b as d}from"./react-router.DMwpH23k.js";import{B as E}from"./BackIcn.BFDZx8No.js";import{y as k}from"./Note.DalStCGz.js";import{a as K}from"./SendinBlueCommonFunc.B6q5JU1k.js";import{T as L}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function H({formID:n,sendinBlueConf:e,setSendinBlueConf:i,step:g,setstep:N,setSnackbar:u,isInfo:p}){const[o,A]=d.useState(!1),[h,x]=d.useState({name:"",api_key:""}),[v,_]=d.useState(!1),[l,b]=d.useState(!1),z=()=>{const a=m({},e);if(!a.name||!a.api_key){x({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}b("auth");const c={api_key:a.api_key};T(c,"sblue_authorize").then(r=>{r!=null&&r.success&&(A(!0),u({show:!0,msg:s("Authorized Successfully","bit-integrations")})),_(!0),b(!1)})},y=a=>{const c=m({},e),r=m({},h);r[a.target.name]="",c[a.target.name]=a.target.value,x(r),i(c)},I=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),N(2),K(e,i,b,u)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:g===1&&900,height:g===1&&"auto"},children:[t.jsx(L,{linkKey:"sendinBlue"}),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:y,name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:p}),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:y,name:"api_key",value:e.api_key,type:"text",placeholder:s("API Key...","bit-integrations"),disabled:p}),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")})]}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(k,{size:25,clr:"#022217",className:"mr-2"}),s("Checking API Key!!!","bit-integrations")]}),v&&!o&&!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:"×"}),s("Sorry, Api key is invalid","bit-integrations")]}),!p&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:z,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||l,children:[o?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(k,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>I(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[s("Next","bit-integrations"),t.jsx(E,{className:"ml-1 rev-icn"})]})]})]})}export{H as default};
