var T=Object.defineProperty;var f=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var A=(a,e,i)=>e in a?T(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,d=(a,e)=>{for(var i in e||(e={}))B.call(e,i)&&A(a,i,e[i]);if(f)for(var i of f(e))E.call(e,i)&&A(a,i,e[i]);return a};import{_ as s,j as t,d as K}from"./main.2.8.1.js";import{d as b}from"./react-router-dom.9mCuUg3q.js";import{B as C}from"./BackIcn._kGL_vVw.js";import{z as N,a9 as F}from"./Note.BeM7sN-p.js";import{r as L}from"./BenchMarkCommonFunc.BJL49Z5g.js";import{t as $}from"./tutorialLinks.kMkIDzcD.js";import{T as k}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function U({formID:a,benchMarkConf:e,setBenchMarkConf:i,step:x,setstep:I,setSnackbar:g,isInfo:h,isLoading:o,setIsLoading:p}){const{benchMark:n}=$,[l,S]=b.useState(!1),[u,j]=b.useState({name:"",api_secret:""}),[z,_]=b.useState(!1),v=()=>{const r=d({},e);if(!r.name||!r.api_secret){j({name:r.name?"":s("Integration name can't be empty","bit-integrations"),api_secret:r.api_secret?"":s("Access API Secret Key can't be empty","bit-integrations")});return}p("auth");const m={api_secret:r.api_secret};K(m,"benchMark_authorize").then(c=>{c!=null&&c.success&&(S(!0),g({show:!0,msg:s("Authorized Successfully","bit-integrations")})),_(!0),p(!1)})},y=r=>{const m=d({},e),c=d({},u);c[r.target.name]="",m[r.target.name]=r.target.value,j(c),i(m)},w=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),L(e,i,p,g),I(2)},P=`
            <h4>${s("Get api secret key","bit-integrations")}</h4>
            <ul>
                <li>${s("First go to your BenchMark dashboard.","bit-integrations")}</li>
                <li>${s('Click "Integrations", Then click "API Key"',"bit-integrations")}</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:x===1&&900,height:x===1&&"auto"},children:[t.jsx(k,{title:"Benchmark Email",youTubeLink:n==null?void 0:n.youTubeLink}),t.jsx(k,{title:"Benchmark Email",docLink:n==null?void 0:n.docLink}),t.jsx("div",{className:"mt-3 wdt-200",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:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:u.name}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:s("Access API Secret Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"api_secret",value:e.api_secret,type:"text",placeholder:s("Access API Secret Key...","bit-integrations"),disabled:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:u.api_secret}),t.jsxs("small",{className:"d-blk mt-3",children:[s("To Get API Secret Key, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://ui.benchmarkemail.com/Integrate#API",target:"_blank",rel:"noreferrer",children:s("BenchMark API Token","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),o==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(N,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Secret Key!!!"]}),z&&!l&&!o&&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 Secret key is invalid","bit-integrations")]}),!h&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:v,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||o,children:[l?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),o&&t.jsx(N,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>w(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[s("Next","bit-integrations"),t.jsx(C,{className:"ml-1 rev-icn"})]})]}),t.jsx(F,{note:P})]})}export{U as default};
