var L=Object.defineProperty;var g=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var j=(e,r,a)=>r in e?L(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,p=(e,r)=>{for(var a in r||(r={}))T.call(r,a)&&j(e,a,r[a]);if(g)for(var a of g(r))_.call(r,a)&&j(e,a,r[a]);return e};import{r as h,j as t}from"./main-406.js";import{_ as s,L as w,N as S,W as z}from"./bi.394.85.js";import{o as E}from"./bi.135.917.js";import{T as A,t as K}from"./bi.150.760.js";function V({oneHashCRMConf:e,setOneHashCRMConf:r,step:a,setStep:k,loading:d,setLoading:y,isInfo:n}){const[o,N]=h.useState(!1),[l,b]=h.useState({api_token:""}),{oneHashCRM:i}=K,v=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),e!=null&&e.default,k(2)},c=m=>{const u=p({},e),x=p({},l);x[m.target.name]="",u[m.target.name]=m.target.value,b(x),r(u)},I=()=>{e.domain?window.open(`${e.domain}/app/user`,"_blank","noreferrer"):z.error(s("Access API URL is required!","bit-integrations"))},P=`
            <h4>Get API Token</h4>
            <ul>
                <li>Go to your OneHash CRM's user dashboard and click the profile buttom from Right top corner</li>
                <li>Then select "My Settings"</li>
                <li>Then go to "API Access → Generates Keys"</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:a===1&&900,height:a===1&&"auto"},children:[(i==null?void 0:i.youTubeLink)&&t.jsx(A,{title:i==null?void 0:i.title,youTubeLink:i==null?void 0:i.youTubeLink}),(i==null?void 0:i.docLink)&&t.jsx(A,{title:i==null?void 0:i.title,docLink:i==null?void 0:i.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("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:s("Integration Name...","bit-integrations"),disabled:n}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("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:s("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:s("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:s("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:s("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:s("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:[s("To Get API Key & API Secret, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",onClick:I,children:s("OneHashCRM API Key & API Secret","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),!n&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>E(e,r,b,N,d,y),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||d.auth,children:[o?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),d.auth&&t.jsx(w,{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:!o,children:[s("Next","bit-integrations"),t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(S,{note:P})]})}export{V as default};
