import{j as s,_ as c}from"./main.2.8.10.js";import{u as C,e as j,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{l as k,I as w,g as y}from"./Integrations.BFhED4ck.js";import N from"./ZohoCampaignsAuthorization.MWe85UYN.js";import{h as Z,c as _}from"./ZohoCampaignsCommonFunc.B1L6y0DX.js";import{Z as E}from"./ZohoCampaignsIntegLayout.cq2Tk6UM.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function U({formFields:p,setFlow:d,flow:g,allIntegURL:f}){const h=C(),{formID:r}=j(),[m,i]=o.useState(!1),[e,l]=o.useState(1),[u,a]=o.useState({show:!1}),[t,n]=o.useState({name:"Zoho Campaigns",type:"Zoho Campaigns",clientId:"",clientSecret:"",list:"",field_map:[{formField:"",zohoFormField:""}]});o.useEffect(()=>{window.opener&&k("zohoCampaigns")},[]);const x=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(t)){a({show:!0,msg:c("Please map mandatory fields","bit-integrations")});return}t.list!==""&&t.table!==""&&t.field_map.length>0&&l(3)};return s.jsxs("div",{children:[s.jsx(S,{snack:u,setSnackbar:a}),s.jsx("div",{className:"txt-center mt-2",children:s.jsx(v,{step:3,active:e})}),s.jsx(N,{formID:r,campaignsConf:t,setCampaignsConf:n,step:e,setstep:l,isLoading:m,setIsLoading:i,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:b=>Z(b,r,t,n,i,a),campaignsConf:t,setCampaignsConf:n,isLoading:m,setIsLoading:i,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:[c("Next","bit-integrations"),s.jsx(I,{className:"ml-1 rev-icn"})]})]}),s.jsx(w,{step:e,saveConfig:()=>y(g,d,f,t,h,"","",i),isLoading:m,dataConf:t,setDataConf:n,formFields:p})]})}export{U as default};
