var S=Object.defineProperty;var N=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var y=(n,t,a)=>t in n?S(n,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[t]=a,h=(n,t)=>{for(var a in t||(t={}))Z.call(t,a)&&y(n,a,t[a]);if(N)for(var a of N(t))I.call(t,a)&&y(n,a,t[a]);return n};import{r as k,h as $,j as e}from"./main-406.js";import{k as P,_ as s,X as L,Y as D,L as O}from"./bi.394.85.js";import{g as R}from"./bi.912.717.js";import{T as w,t as U}from"./bi.150.760.js";function Y({formID:n,crmConf:t,setCrmConf:a,step:b,setstep:A,isLoading:u,setIsLoading:p,setSnackbar:r,redirectLocation:T,isInfo:l}){const[o,E]=k.useState(!1),[c,x]=k.useState({dataCenter:"",clientId:"",clientSecret:""}),j=$(P),{zohoCRM:i}=U,_="ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.Read,zohocrm.files.CREATE",z=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),A(2),!t.module&&R(n,t,a,p,r)},d=m=>{const g=h({},t),v=h({},c);v[m.target.name]="",g[m.target.name]=m.target.value,x(v),a(g)};return e.jsxs("div",{className:"btcd-stp-page",style:{width:b===1&&900,height:b===1&&"auto"},children:[(i==null?void 0:i.youTubeLink)&&e.jsx(w,{title:i==null?void 0:i.title,youTubeLink:i==null?void 0:i.youTubeLink}),(i==null?void 0:i.docLink)&&e.jsx(w,{title:i==null?void 0:i.title,docLink:i==null?void 0:i.docLink}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Integration Name:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:d,name:"name",value:t.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:l}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Data Center:","bit-integrations")})}),e.jsxs("select",{onChange:d,name:"dataCenter",value:t.dataCenter,className:"btcd-paper-inp w-6 mt-1",disabled:l,children:[e.jsx("option",{value:"",children:s("--Select a data center--","bit-integrations")}),e.jsx("option",{value:"com",children:"zoho.com"}),e.jsx("option",{value:"eu",children:"zoho.eu"}),e.jsx("option",{value:"com.cn",children:"zoho.com.cn"}),e.jsx("option",{value:"in",children:"zoho.in"}),e.jsx("option",{value:"com.au",children:"zoho.com.au"})]}),e.jsx("div",{style:{color:"red"},children:c.dataCenter}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Homepage URL:","bit-integrations")})}),e.jsx(L,{value:`${window.location.origin}`,setSnackbar:r,className:"field-key-cpy w-6 ml-0",readOnly:l}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Authorized Redirect URIs:","bit-integrations")})}),e.jsx(L,{value:T||`${j.api.base}/redirect`,setSnackbar:r,className:"field-key-cpy w-6 ml-0",readOnly:l}),e.jsxs("small",{className:"d-blk mt-5",children:[s("To get Client ID and SECRET , Please Visit","bit-integrations")," ",e.jsx("a",{className:"btcd-link",href:`https://api-console.zoho.${(t==null?void 0:t.dataCenter)||"com"}/`,target:"_blank",rel:"noreferrer",children:s("Zoho API Console","bit-integrations")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Client id:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:d,name:"clientId",value:t.clientId,type:"text",placeholder:s("Client id...","bit-integrations"),disabled:l}),e.jsx("div",{style:{color:"red"},children:c.clientId}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:s("Client secret:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:d,name:"clientSecret",value:t.clientSecret,type:"text",placeholder:s("Client secret...","bit-integrations"),disabled:l}),e.jsx("div",{style:{color:"red"},children:c.clientSecret}),!l&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>D("zohoCRM","zcrm",_,t,a,x,E,p,r,j),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||u,children:[o?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),u&&e.jsx(O,{size:"20",clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:z,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[s("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]})]})}export{Y as default};
