import{u as S,k as v,r as s,j as e}from"./main-333.js";import{Z as R,d as k,_ as p,I as w,F as y}from"./bi.636.93.js";import{B as C}from"./bi.429.767.js";import{S as Z}from"./bi.563.969.js";import N from"./bi.652.252.js";import{h as T,c as _}from"./bi.491.750.js";import{Z as E}from"./bi.750.751.js";import"./bi.318.783.js";import"./bi.416.735.js";import"./bi.535.730.js";import"./bi.286.731.js";function J({formFields:m,setFlow:u,flow:f,allIntegURL:h}){const g=S(),{formID:r}=v(),[c,n]=s.useState(!1),[o,l]=s.useState(1),[x,a]=s.useState({show:!1}),[d,b]=s.useState(0),[t,i]=s.useState({name:"Zoho Recruit",type:"Zoho Recruit",clientId:"",clientSecret:"",module:"",field_map:[{formField:"",zohoFormField:""}],relatedlists:[],actions:{}});s.useEffect(()=>{window.opener&&R("zohoRecruit")},[]);const j=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(t)){a({show:!0,msg:p("Please map mandatory fields","bit-integrations")});return}t.module!==""&&t.field_map.length>0&&l(3)};return e.jsxs("div",{children:[e.jsx(k,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(Z,{step:3,active:o})}),e.jsx(N,{formID:r,recruitConf:t,setRecruitConf:i,step:o,setstep:l,isLoading:c,setIsLoading:n,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"auto"},children:[e.jsx(E,{tab:d,settab:b,formID:r,formFields:m,handleInput:I=>T(I,d,t,i,r,n,a),recruitConf:t,setRecruitConf:i,isLoading:c,setIsLoading:n,setSnackbar:a}),e.jsxs("button",{onClick:()=>j(),disabled:t.module===""||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[p("Next","bit-integrations"),e.jsx(C,{className:"ml-1 rev-icn"})]})]}),e.jsx(w,{step:o,saveConfig:()=>y(f,u,h,t,g,"","",n),isLoading:c,dataConf:t,setDataConf:i,formFields:m})]})}export{J as default};
