var k=Object.defineProperty;var h=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var g=(o,t,e)=>t in o?k(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,x=(o,t)=>{for(var e in t||(t={}))w.call(t,e)&&g(o,e,t[e]);if(h)for(var e of h(t))M.call(t,e)&&g(o,e,t[e]);return o};import{u as R,k as Z,r as i,j as a}from"./main-406.js";import{Z as _,d as N,_ as b,I as E,s as T}from"./bi.394.85.js";import{S as z}from"./bi.68.941.js";import F from"./bi.210.231.js";import{h as L,c as P}from"./bi.912.717.js";import{Z as A}from"./bi.662.718.js";import"./bi.150.760.js";import"./bi.492.719.js";import"./bi.285.720.js";import"./bi.840.704.js";import"./bi.704.707.js";import"./bi.701.708.js";function Y({formFields:o,setFlow:t,flow:e,allIntegURL:C}){const v=R(),{formID:m}=Z(),[d,r]=i.useState(!1),[c,u]=i.useState(1),[j,n]=i.useState({show:!1}),[f,S]=i.useState(0),[s,l]=i.useState({name:"Zoho CRM",type:"Zoho CRM",clientId:"",clientSecret:"",module:"",layout:"",field_map:[{formField:"",zohoFormField:""}],relatedlists:[],actions:{}});i.useEffect(()=>{window.opener&&_("zohoCRM")},[]);const y=()=>{T({flow:e,setFlow:t,allIntegURL:C,conf:s,navigate:v,setIsLoading:r,setSnackbar:n})},I=p=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!P(s)){n({show:!0,msg:b("Please map mandatory fields","bit-integrations")});return}s.module&&s.layout&&s.field_map.length>0&&u(p)};return a.jsxs("div",{children:[a.jsx(N,{snack:j,setSnackbar:n}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(z,{step:3,active:c})}),a.jsx(F,{formID:m,crmConf:s,setCrmConf:l,step:c,setstep:u,isLoading:d,setIsLoading:r,setSnackbar:n}),a.jsxs("div",{className:"btcd-stp-page",style:x({},c===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(A,{tab:f,settab:S,formID:m,formFields:o,handleInput:p=>L(p,f,s,l,m,r,n),crmConf:s,setCrmConf:l,isLoading:d,setIsLoading:r,setSnackbar:n}),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:[b("Next","bit-integrations")," "," ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(E,{step:c,saveConfig:()=>y(),isLoading:d,dataConf:s,setDataConf:l,formFields:o})]})}export{Y as default};
