var R=Object.defineProperty;var v=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var N=(s,t,a)=>t in s?R(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))I.call(t,a)&&N(s,a,t[a]);return s};import{k as _,f as D,j as e,_ as i}from"./main.2.8.10.js";import{b as y}from"./react-router.DMwpH23k.js";import{B as Z}from"./BackIcn.BFDZx8No.js";import{a2 as z,y as M}from"./Note.DalStCGz.js";import{k as P}from"./Integrations.BFhED4ck.js";import{r as $}from"./ZohoMarketingHubCommonFunc.D9HOH5FN.js";import{T as k}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";import"./SnackMsg.7BjcJK1j.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";function X({formID:s,marketingHubConf:t,setMarketingHubConf:a,step:h,setstep:w,isLoading:p,setIsLoading:x,setSnackbar:l,redirectLocation:A,isInfo:n}){const[c,E]=y.useState(!1),[r,b]=y.useState({dataCenter:"",clientId:"",clientSecret:""}),j=_(D),T="ZohoMarketingHub.lead.READ,ZohoMarketingHub.lead.CREATE,ZohoMarketingHub.lead.UPDATE",C=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),w(2),$(s,t,a,x,l)},o=d=>{const u=m({},t),g=m({},r);g[d.target.name]="",u[d.target.name]=d.target.value,b(g),a(u)};return e.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[e.jsx(k,{linkKey:"zohoMarketingHub"}),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:o,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:o,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:r.dataCenter}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Homepage URL:","bit-integrations")})}),e.jsx(z,{value:`${window.location.origin}`,className:"field-key-cpy w-6 ml-0",readOnly:n,setSnackbar:l}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:i("Authorized Redirect URIs:","bit-integrations")})}),e.jsx(z,{value:A||`${j.api}/redirect`,className:"field-key-cpy w-6 ml-0",setSnackbar:l,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:o,name:"clientId",value:t.clientId,type:"text",placeholder:i("client ID...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:r.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:o,name:"clientSecret",value:t.clientSecret,type:"text",placeholder:i("client Secret...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:r.clientSecret}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>P("zohoMarkatingHub","zmarketingHub",T,t,a,b,E,x,l,j),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(M,{size:20,clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:C,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!c,children:[i("Next","bit-integrations"),e.jsx(Z,{className:"ml-1 rev-icn"})]})]})]})}export{X as default};
