import{u as b,k as j,r as o,j as s}from"./main-406.js";import{Z as I,d as S,_ as l,I as v,G as k}from"./bi.394.85.js";import{B as Z}from"./bi.46.744.js";import{S as w}from"./bi.68.941.js";import y from"./bi.334.239.js";import{h as N,c as _}from"./bi.576.715.js";import{Z as E}from"./bi.224.716.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function A({formFields:p,setFlow:d,flow:g,allIntegURL:f}){const h=b(),{formID:r}=j(),[m,n]=o.useState(!1),[e,c]=o.useState(1),[u,a]=o.useState({show:!1}),[t,i]=o.useState({name:"Zoho Campaigns",type:"Zoho Campaigns",clientId:"",clientSecret:"",list:"",field_map:[{formField:"",zohoFormField:""}]});o.useEffect(()=>{window.opener&&I("zohoCampaigns")},[]);const x=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(t)){a({show:!0,msg:l("Please map mandatory fields","bit-integrations")});return}t.list!==""&&t.table!==""&&t.field_map.length>0&&c(3)};return s.jsxs("div",{children:[s.jsx(S,{snack:u,setSnackbar:a}),s.jsx("div",{className:"txt-center mt-2",children:s.jsx(w,{step:3,active:e})}),s.jsx(y,{formID:r,campaignsConf:t,setCampaignsConf:i,step:e,setstep:c,isLoading:m,setIsLoading:n,setSnackbar:a}),s.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto"},children:[s.jsx(E,{formID:r,formFields:p,handleInput:C=>N(C,r,t,i,n,a),campaignsConf:t,setCampaignsConf:i,isLoading:m,setIsLoading:n,setSnackbar:a}),s.jsxs("button",{onClick:()=>x(),disabled:t.list===""||t.table===""||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),s.jsx(Z,{className:"ml-1 rev-icn"})]})]}),s.jsx(v,{step:e,saveConfig:()=>k(g,d,f,t,h,"","",n),isLoading:m,dataConf:t,setDataConf:i,formFields:p})]})}export{A as default};
