var _=Object.defineProperty;var y=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var g=(s,t,r)=>t in s?_(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r,m=(s,t)=>{for(var r in t||(t={}))z.call(t,r)&&g(s,r,t[r]);if(y)for(var r of y(t))I.call(t,r)&&g(s,r,t[r]);return s};import{r as k,h as Z,j as e}from"./main-406.js";import{k as D,_ as l,X as T,Y as P,L as $}from"./bi.394.85.js";import{r as B}from"./bi.576.715.js";import{B as U}from"./bi.46.744.js";import{T as w,t as O}from"./bi.150.760.js";function q({formID:s,campaignsConf:t,setCampaignsConf:r,step:b,setstep:A,isLoading:u,setIsLoading:x,setSnackbar:a,redirectLocation:E,isInfo:n}){const[d,L]=k.useState(!1),[c,j]=k.useState({dataCenter:"",clientId:"",clientSecret:""}),p=Z(D),R="ZohoCampaigns.contact.READ,ZohoCampaigns.contact.CREATE,ZohoCampaigns.contact.UPDATE",{zohoCampaigns:i}=O,S=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),A(2),B(s,t,r,x,a)},o=h=>{const v=m({},t),N=m({},c);N[h.target.name]="",v[h.target.name]=h.target.value,j(N),r(v)};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:l("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:l("Integration Name...","bit-integrations"),disabled:n}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:l("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:l("--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:l("Homepage URL:","bit-integrations")})}),e.jsx(T,{value:`${window.location.origin}`,className:"field-key-cpy w-6 ml-0",setSnackbar:a,readOnly:n}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:l("Authorized Redirect URIs:","bit-integrations")})}),e.jsx(T,{value:E||`${p.api.base}/redirect`,className:"field-key-cpy w-6 ml-0",setSnackbar:a,readOnly:n}),e.jsxs("small",{className:"d-blk mt-5",children:[l("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:l("Zoho API Console","bit-integrations")})]}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:l("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:l("Client id...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:c.clientId}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:l("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:l("Client secret...","bit-integrations"),disabled:n}),e.jsx("div",{style:{color:"red"},children:c.clientSecret}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>P("zohoCampaigns","zcampaigns",R,t,r,j,L,x,a,p),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:d||u,children:[d?l("Authorized ✔","bit-integrations"):l("Authorize","bit-integrations"),u&&e.jsx($,{size:20,clr:"#022217",className:"ml-2"})]}),e.jsx("br",{}),e.jsxs("button",{onClick:S,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!d,children:[l("Next","bit-integrations"),e.jsx(U,{className:"ml-1 rev-icn"})]})]})]})}export{q as default};
