var T=Object.defineProperty;var v=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var N=(r,t,a)=>t in r?T(r,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[t]=a,m=(r,t)=>{for(var a in t||(t={}))R.call(t,a)&&N(r,a,t[a]);if(v)for(var a of v(t))S.call(t,a)&&N(r,a,t[a]);return r};import{k as I,f as _,j as e,_ as i}from"./main.2.8.10.js";import{b as y}from"./react-router.DMwpH23k.js";import{a2 as z,y as D}from"./Note.DalStCGz.js";import{r as Z}from"./ZohoCampaignsCommonFunc.B1L6y0DX.js";import{B as P}from"./BackIcn.BFDZx8No.js";import{k as $}from"./Integrations.BFhED4ck.js";import{T as B}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 W({formID:r,campaignsConf:t,setCampaignsConf:a,step:h,setstep:C,isLoading:p,setIsLoading:x,setSnackbar:n,redirectLocation:w,isInfo:s}){const[c,A]=y.useState(!1),[l,b]=y.useState({dataCenter:"",clientId:"",clientSecret:""}),u=I(_),E="ZohoCampaigns.contact.READ,ZohoCampaigns.contact.CREATE,ZohoCampaigns.contact.UPDATE",k=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),C(2),Z(r,t,a,x,n)},o=d=>{const j=m({},t),g=m({},l);g[d.target.name]="",j[d.target.name]=d.target.value,b(g),a(j)};return e.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[e.jsx(B,{linkKey:"zohoCampaigns"}),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:s}),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:s,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:l.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",setSnackbar:n,readOnly:s}),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`,className:"field-key-cpy w-6 ml-0",setSnackbar:n,readOnly:s}),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:s}),e.jsx("div",{style:{color:"red"},children:l.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:s}),e.jsx("div",{style:{color:"red"},children:l.clientSecret}),!s&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>$("zohoCampaigns","zcampaigns",E,t,a,b,A,x,n,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(D,{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(P,{className:"ml-1 rev-icn"})]})]})]})}export{W as default};
