var E=Object.defineProperty;var v=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var N=(s,t,a)=>t in s?E(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,m=(s,t)=>{for(var a in t||(t={}))S.call(t,a)&&N(s,a,t[a]);if(v)for(var a of v(t))T.call(t,a)&&N(s,a,t[a]);return s};import{k as M,f as _,j as e,_ as i}from"./main.2.9.0.js";import{b as y}from"./react-router.DMwpH23k.js";import{a2 as z,y as I}from"./Note.NSUdvR3c.js";import{g as L}from"./ZohoCRMCommonFunc.BIG3eSW6.js";import{k as Z}from"./Integrations.DL8wqGct.js";import{T as $}from"./TutorialLink.CFG7bS5c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";import"./SnackMsg.DYSD96P4.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";function J({formID:s,crmConf:t,setCrmConf:a,step:h,setstep:R,isLoading:p,setIsLoading:b,setSnackbar:l,redirectLocation:w,isInfo:n}){const[c,A]=y.useState(!1),[o,x]=y.useState({dataCenter:"",clientId:"",clientSecret:""}),u=M(_),C="ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.Read,zohocrm.files.CREATE",k=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),R(2),!t.module&&L(s,t,a,b,l)},r=d=>{const j=m({},t),g=m({},o);g[d.target.name]="",j[d.target.name]=d.target.value,x(g),a(j)};return e.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[e.jsx($,{linkKey:"zohoCRM"}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Integration Name:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"name",value:t.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:n}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Data Center:","bit-integrations")})}),e.jsxs("select",{onChange:r,name:"dataCenter",value:t.dataCenter,className:"btcd-paper-inp w-6 mt-1",disabled:n,children:[e.jsx("option",{value:"",children:i("--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:o.dataCenter}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Homepage URL:","bit-integrations")})}),e.jsx(z,{value:`${window.location.origin}`,setSnackbar:l,className:"field-key-cpy w-6 ml-0",readOnly:n}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Authorized Redirect URIs:","bit-integrations")})}),e.jsx(z,{value:w||`${u.api}/redirect`,setSnackbar:l,className:"field-key-cpy w-6 ml-0",readOnly:n}),e.jsxs("small",{className:"d-blk mt-5",children:[i("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:i("Zoho API Console","bit-integrations")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Client id:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"clientId",value:t.clientId,type:"text",placeholder:i("client ID...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:o.clientId}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Client secret:","bit-integrations")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:r,name:"clientSecret",value:t.clientSecret,type:"text",placeholder:i("client Secret...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:o.clientSecret}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>Z("zohoCRM","zcrm",C,t,a,x,A,b,l,u),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:c||p,children:[c?i("Authorized ✔","bit-integrations"):i("Authorize","bit-integrations"),p&&e.jsx(I,{size:"20",clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:k,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!c,children:[i("Next","bit-integrations"),e.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]})]})}export{J as default};
