var I=Object.defineProperty;var g=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var k=(e,n,a)=>n in e?I(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,u=(e,n)=>{for(var a in n||(n={}))v.call(n,a)&&k(e,a,n[a]);if(g)for(var a of g(n))w.call(n,a)&&k(e,a,n[a]);return e};import{r as j,j as t}from"./main-406.js";import{_ as s,L as _,N as z,W as S}from"./bi.394.85.js";import{p as E}from"./bi.858.915.js";import{T as A,t as U}from"./bi.150.760.js";function F({perfexCRMConf:e,setPerfexCRMConf:n,step:a,setStep:x,loading:l,setLoading:N,isInfo:o}){const[r,T]=j.useState(!1),[c,b]=j.useState({api_token:""}),{perfexCRM:i}=U,y=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),e!=null&&e.default,x(2)},d=m=>{const h=u({},e),p=u({},c);p[m.target.name]="",h[m.target.name]=m.target.value,b(p),n(h)},L=()=>{e.domain?window.open(`${e.domain}/admin/api/api_management`,"_blank","noreferrer"):S.error(s("Access API URL is required!","bit-integrations"))},P=`
            <h4>Get API Token</h4>
            <ul>
                <li>Go to your Perfex CRM's Admin area and select the following menu item: "SETUP → MODULES".</li>
                <li>Select the extracted upload.zip at Module installation selection prompt and press "INSTALL".</li>
                <li>Find the newly installed module in the list, press "ACTIVATE" and enter your license key.</li>
                <li>Go to your Perfex's CRM backend as an admin, go to "API → API Management", and create a new token.</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:d,name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:o}),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:d,name:"domain",value:e.domain,type:"text",placeholder:s("Access API URL...","bit-integrations"),disabled:o}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:c.domain}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("API Token:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:d,name:"api_token",value:e.api_token,type:"text",placeholder:s("API Token...","bit-integrations"),disabled:o}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:c.api_token}),t.jsxs("small",{className:"d-blk mt-3",children:[s("To Get API Token, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",onClick:L,children:s("PerfexCRM API Token","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),!o&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>E(e,n,b,T,l,N),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:r||l.auth,children:[r?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l.auth&&t.jsx(_,{size:"20",clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:y,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",disabled:!r,children:[s("Next","bit-integrations"),t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(z,{note:P})]})}export{F as default};
