var k=Object.defineProperty;var A=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var f=(n,s,i)=>s in n?k(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i,d=(n,s)=>{for(var i in s||(s={}))B.call(s,i)&&f(n,i,s[i]);if(A)for(var i of A(s))K.call(s,i)&&f(n,i,s[i]);return n};import{r as x,j as t}from"./main-406.js";import{B as L}from"./bi.46.744.js";import{_ as r,L as N,N as E,b as C}from"./bi.394.85.js";import{r as F}from"./bi.534.857.js";import{T as I,t as G}from"./bi.150.760.js";function O({formID:n,benchMarkConf:s,setBenchMarkConf:i,step:b,setstep:S,setSnackbar:g,isInfo:u,isLoading:o,setIsLoading:p}){const{benchMark:e}=G,[l,_]=x.useState(!1),[h,j]=x.useState({name:"",api_secret:""}),[v,z]=x.useState(!1),w=()=>{const a=d({},s);if(!a.name||!a.api_secret){j({name:a.name?"":r("Integration name cann't be empty","bit-integrations"),api_secret:a.api_secret?"":r("Access API Secret Key cann't be empty","bit-integrations")});return}p("auth");const m={api_secret:a.api_secret};C(m,"benchMark_authorize").then(c=>{c!=null&&c.success&&(_(!0),g({show:!0,msg:r("Authorized Successfully","bit-integrations")})),z(!0),p(!1)})},y=a=>{const m=d({},s),c=d({},h);c[a.target.name]="",m[a.target.name]=a.target.value,j(c),i(m)},P=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),F(s,i,p,g),S(2)},T=`
            <h4>Get api secret key</h4>
            <ul>
                <li>First go to your BenchMark dashboard.</li>
                <li>Click "Integrations", Then click "API Key"</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:b===1&&900,height:b===1&&"auto"},children:[(e==null?void 0:e.youTubeLink)&&t.jsx(I,{title:e==null?void 0:e.title,youTubeLink:e==null?void 0:e.youTubeLink}),(e==null?void 0:e.docLink)&&t.jsx(I,{title:e==null?void 0:e.title,docLink:e==null?void 0:e.docLink}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:r("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"name",value:s.name,type:"text",placeholder:r("Integration Name...","bit-integrations"),disabled:u}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.name}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:r("Access API Secret Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"api_secret",value:s.api_secret,type:"text",placeholder:r("Access API Secret Key...","bit-integrations"),disabled:u}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.api_secret}),t.jsxs("small",{className:"d-blk mt-3",children:[r("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:r("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!!!"]}),v&&!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:"×"}),"Sorry, API Secret key is invalid"]}),!u&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:w,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||o,children:[l?r("Authorized ✔","bit-integrations"):r("Authorize","bit-integrations"),o&&t.jsx(N,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>P(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[r("Next","bit-integrations"),t.jsx(L,{className:"ml-1 rev-icn"})]})]}),t.jsx(E,{note:T})]})}export{O as default};
