import{j as s,_ as c}from"./main.2.8.1.js";import{u as b,h as j,d as o}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as I}from"./BackIcn._kGL_vVw.js";import{S}from"./SnackMsg.S8DrwLlT.js";import{S as v}from"./Steps.1hz7v9Vj.js";import{l as k,I as w,g as y}from"./Integrations.D2bgBas2.js";import N from"./ZohoCampaignsAuthorization.BCt1Z25X.js";import{h as Z,c as _}from"./ZohoCampaignsCommonFunc.D_VFP2u1.js";import{Z as E}from"./ZohoCampaignsIntegLayout.DJmedo6z.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function U({formFields:p,setFlow:d,flow:g,allIntegURL:f}){const h=b(),{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:C=>Z(C,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};
