import{j as s,_ as c}from"./main.2.9.0.js";import{u as C,e as j,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S}from"./SnackMsg.DYSD96P4.js";import{S as v}from"./Steps.BYe8zHkm.js";import{l as k,I as w,g as y}from"./Integrations.DL8wqGct.js";import N from"./ZohoCampaignsAuthorization.IkAJR8hT.js";import{h as Z,c as _}from"./ZohoCampaignsCommonFunc.D2GsA_ed.js";import{Z as E}from"./ZohoCampaignsIntegLayout.CZSGqHIC.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
