var T=Object.defineProperty;var h=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var g=(e,s,a)=>s in e?T(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a,p=(e,s)=>{for(var a in s||(s={}))_.call(s,a)&&g(e,a,s[a]);if(h)for(var a of h(s))L.call(s,a)&&g(e,a,s[a]);return e};import{_ as i,j as t,q as w}from"./main.2.8.1.js";import{d as j}from"./react-router-dom.9mCuUg3q.js";import{z,a9 as S}from"./Note.BeM7sN-p.js";import{o as E}from"./OneHashCRMCommonFunc.BBcI7DZe.js";import{t as K}from"./tutorialLinks.kMkIDzcD.js";import{T as A}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function D({oneHashCRMConf:e,setOneHashCRMConf:s,step:a,setStep:y,loading:o,setLoading:k,isInfo:n}){const[d,N]=j.useState(!1),[l,b]=j.useState({api_token:""}),{oneHashCRM:r}=K,v=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),e!=null&&e.default,y(2)},c=m=>{const u=p({},e),x=p({},l);x[m.target.name]="",u[m.target.name]=m.target.value,b(x),s(u)},I=()=>{e.domain?window.open(`${e.domain}/app/user`,"_blank","noreferrer"):w.error(i("Access API URL is required!","bit-integrations"))},P=`
            <h4>${i("Get API Token","bit-integrations")}</h4>
            <ul>
                <li>${i("Go to your OneHash CRM's user dashboard and click the profile buttom from Right top corner","bit-integrations")}</li>
                <li>${i('Then select "My Settings"',"bit-integrations")}</li>
                <li>${i('Then go to "API Access → Generates Keys"',"bit-integrations")}</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:a===1&&900,height:a===1&&"auto"},children:[t.jsx(A,{title:"oneHashCRM",youTubeLink:r==null?void 0:r.youTubeLink}),t.jsx(A,{title:"oneHashCRM",docLink:r==null?void 0:r.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:c,name:"name",value:e.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:n}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("Access API URL:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:c,name:"domain",value:e.domain,type:"text",placeholder:i("Access API URL...","bit-integrations"),disabled:n}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.domain}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("API Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:c,name:"api_key",value:e.api_key,type:"text",placeholder:i("API Key...","bit-integrations"),disabled:n}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.api_key}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("API Secret:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:c,name:"api_secret",value:e.api_secret,type:"text",placeholder:i("API Token...","bit-integrations"),disabled:n}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.api_secret}),t.jsxs("small",{className:"d-blk mt-3",children:[i("To Get API Key & API Secret, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",onClick:I,children:i("OneHashCRM API Key & API Secret","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),!n&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>E(e,s,b,N,o,k),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:d||o.auth,children:[d?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),o.auth&&t.jsx(z,{size:"20",clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:v,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",disabled:!d,children:[i("Next","bit-integrations"),t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(S,{note:P})]})}export{D as default};
