var I=Object.defineProperty;var x=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var h=(e,s,a)=>s in e?I(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a,m=(e,s)=>{for(var a in s||(s={}))P.call(s,a)&&h(e,a,s[a]);if(x)for(var a of x(s))_.call(s,a)&&h(e,a,s[a]);return e};import{_ as i,j as t,q as w}from"./main.2.8.10.js";import{b as g}from"./react-router.DMwpH23k.js";import{y as S,a9 as T}from"./Note.DalStCGz.js";import{o as z}from"./OneHashCRMCommonFunc.DhdwQoKV.js";import{T as K}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function B({oneHashCRMConf:e,setOneHashCRMConf:s,step:a,setStep:j,loading:c,setLoading:A,isInfo:r}){const[o,y]=g.useState(!1),[n,p]=g.useState({api_token:""}),N=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),e!=null&&e.default,j(2)},l=d=>{const b=m({},e),u=m({},n);u[d.target.name]="",b[d.target.name]=d.target.value,p(u),s(b)},k=()=>{e.domain?window.open(`${e.domain}/app/user`,"_blank","noreferrer"):w.error(i("Access API URL is required!","bit-integrations"))},v=`
            <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(K,{linkKey:"oneHashCRM"}),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:l,name:"name",value:e.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:r}),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:l,name:"domain",value:e.domain,type:"text",placeholder:i("Access API URL...","bit-integrations"),disabled:r}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:n.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:l,name:"api_key",value:e.api_key,type:"text",placeholder:i("API Key...","bit-integrations"),disabled:r}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:n.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:l,name:"api_secret",value:e.api_secret,type:"text",placeholder:i("API Token...","bit-integrations"),disabled:r}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:n.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:k,children:i("OneHashCRM API Key & API Secret","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),!r&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>z(e,s,p,y,c,A),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||c.auth,children:[o?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),c.auth&&t.jsx(S,{size:"20",clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:N,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[i("Next","bit-integrations"),t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(T,{note:v})]})}export{B as default};
