var w=Object.defineProperty;var y=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var A=(a,t,i)=>t in a?w(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,m=(a,t)=>{for(var i in t||(t={}))P.call(t,i)&&A(a,i,t[i]);if(y)for(var i of y(t))T.call(t,i)&&A(a,i,t[i]);return a};import{_ as s,j as e,b as K}from"./main.2.8.10.js";import{b}from"./react-router.DMwpH23k.js";import{B}from"./BackIcn.BFDZx8No.js";import{y as f,a9 as E}from"./Note.DalStCGz.js";import{r as C}from"./BenchMarkCommonFunc.C4otc7zJ.js";import{T as F}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function O({formID:a,benchMarkConf:t,setBenchMarkConf:i,step:u,setstep:N,setSnackbar:x,isInfo:d,isLoading:c,setIsLoading:h}){const[o,k]=b.useState(!1),[p,g]=b.useState({name:"",api_secret:""}),[I,S]=b.useState(!1),_=()=>{const r=m({},t);if(!r.name||!r.api_secret){g({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}h("auth");const l={api_secret:r.api_secret};K(l,"benchMark_authorize").then(n=>{n!=null&&n.success&&(k(!0),x({show:!0,msg:s("Authorized Successfully","bit-integrations")})),S(!0),h(!1)})},j=r=>{const l=m({},t),n=m({},p);n[r.target.name]="",l[r.target.name]=r.target.value,g(n),i(l)},v=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),C(t,i,h,x),N(2)},z=`
            <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 e.jsxs("div",{className:"btcd-stp-page",style:{width:u===1&&900,height:u===1&&"auto"},children:[e.jsx(F,{linkKey:"benchMark"}),e.jsx("div",{className:"mt-3 wdt-200",children:e.jsx("b",{children:s("Integration Name:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:j,name:"name",value:t.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:d}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.name}),e.jsx("div",{className:"mt-3 wdt-200",children:e.jsx("b",{children:s("Access API Secret Key:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:j,name:"api_secret",value:t.api_secret,type:"text",placeholder:s("Access API Secret Key...","bit-integrations"),disabled:d}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.api_secret}),e.jsxs("small",{className:"d-blk mt-3",children:[s("To Get API Secret Key, Please Visit","bit-integrations")," ",e.jsx("a",{className:"btcd-link",href:"https://ui.benchmarkemail.com/Integrate#API",target:"_blank",rel:"noreferrer",children:s("BenchMark API Token","bit-integrations")})]}),e.jsx("br",{}),e.jsx("br",{}),c==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(f,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Secret Key!!!"]}),I&&!o&&!c&&e.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[e.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),s("Sorry, API Secret key is invalid","bit-integrations")]}),!d&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:_,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||c,children:[o?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),c&&e.jsx(f,{size:20,clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:()=>v(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[s("Next","bit-integrations"),e.jsx(B,{className:"ml-1 rev-icn"})]})]}),e.jsx(E,{note:z})]})}export{O as default};
