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.8.10.js";import{u as k,e as _,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as N}from"./SnackMsg.7BjcJK1j.js";import{S as Z}from"./Steps.B84Ui3GU.js";import{l as E,I as T,s as z}from"./Integrations.BFhED4ck.js";import F from"./ZohoCRMAuthorization.IQzkecMI.js";import{h as L,c as P}from"./ZohoCRMCommonFunc.C0ZSOjdz.js";import{Z as A}from"./ZohoCRMIntegLayout.CK5sbSlJ.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./CheckBox.CJ75Ftxb.js";import"./TitleModal.i_o1jzAL.js";import"./EditIcn.CsPP2qkf.js";import"./TagifyInput.C4ilRm4k.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};
