var w=Object.defineProperty;var h=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var g=(o,t,e)=>t in o?w(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,b=(o,t)=>{for(var e in t||(t={}))M.call(t,e)&&g(o,e,t[e]);if(h)for(var e of h(t))R.call(t,e)&&g(o,e,t[e]);return o};import{j as a,_ as x}from"./main.2.9.0.js";import{u as k,e as _,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as N}from"./SnackMsg.DYSD96P4.js";import{S as Z}from"./Steps.BYe8zHkm.js";import{l as E,I as T,s as z}from"./Integrations.DL8wqGct.js";import F from"./ZohoCRMAuthorization.BPIWXYd-.js";import{h as L,c as P}from"./ZohoCRMCommonFunc.BIG3eSW6.js";import{Z as A}from"./ZohoCRMIntegLayout.BKBoPOSQ.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./CheckBox.EE_22KNp.js";import"./TitleModal.emRFbfw0.js";import"./EditIcn.ClgiZunh.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function it({formFields:o,setFlow:t,flow:e,allIntegURL:C}){const v=k(),{formID:p}=_(),[l,r]=n.useState(!1),[m,f]=n.useState(1),[j,i]=n.useState({show:!1}),[u,S]=n.useState(0),[s,c]=n.useState({name:"Zoho CRM",type:"Zoho CRM",clientId:"",clientSecret:"",module:"",layout:"",field_map:[{formField:"",zohoFormField:""}],relatedlists:[],actions:{}});n.useEffect(()=>{window.opener&&E("zohoCRM")},[]);const y=()=>{z({flow:e,setFlow:t,allIntegURL:C,conf:s,navigate:v,setIsLoading:r,setSnackbar:i})},I=d=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!P(s)){i({show:!0,msg:x("Please map mandatory fields","bit-integrations")});return}s.module&&s.layout&&s.field_map.length>0&&f(d)};return a.jsxs("div",{children:[a.jsx(N,{snack:j,setSnackbar:i}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(Z,{step:3,active:m})}),a.jsx(F,{formID:p,crmConf:s,setCrmConf:c,step:m,setstep:f,isLoading:l,setIsLoading:r,setSnackbar:i}),a.jsxs("div",{className:"btcd-stp-page",style:b({},m===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(A,{tab:u,settab:S,formID:p,formFields:o,handleInput:d=>L(d,u,s,c,p,r,i),crmConf:s,setCrmConf:c,isLoading:l,setIsLoading:r,setSnackbar:i}),a.jsxs("button",{onClick:()=>I(3),disabled:s.module===""||s.layout===""||s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[x("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(T,{step:m,saveConfig:()=>y(),isLoading:l,dataConf:s,setDataConf:c,formFields:o})]})}export{it as default};
