import{v as j,w as C,r as o,j as s,S,_ as I}from"./main-40.js";/* empty css          */import{S as w}from"./bf-679-136.js";import{s as v,b}from"./bf-132-75.js";import{I as y}from"./bf-94-335.js";import{N as Z}from"./bf-504-404.js";import _ from"./bf-940-256.js";import{h as k,c as N}from"./bf-130-341.js";import{Z as P}from"./bf-148-342.js";import"./bf-860-126.js";import"./bf-892-199.js";import"./bf-141-80.js";import"./bf-586-70.js";import"./bf-541-403.js";import"./bf-200-122.js";import"./bf-689-131.js";function O({formFields:l,setIntegration:c,integrations:d,allIntegURL:f}){const g=j(),{formID:i}=C(),[m,n]=o.useState(!1),[e,p]=o.useState(1),[h,a]=o.useState({show:!1}),[t,r]=o.useState({name:"Zoho Campaigns API",type:"Zoho Campaigns",clientId:"",clientSecret:"",list:"",field_map:[{formField:"",zohoFormField:""}]});o.useEffect(()=>{window.opener&&v("zohoCampaigns")},[]);const u=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!N(t)){a({show:!0,msg:I("Please map mandatory fields")});return}t.list!==""&&t.table!==""&&t.field_map.length>0&&p(3)};return s.jsxs("div",{children:[s.jsx(S,{snack:h,setSnackbar:a}),s.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:s.jsx(w,{step:3,active:e})}),s.jsx(_,{formID:i,campaignsConf:t,setCampaignsConf:r,step:e,setstep:p,isLoading:m,setisLoading:n,setSnackbar:a}),s.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"100%"},children:[s.jsx(P,{formID:i,formFields:l,handleInput:x=>k(x,i,t,r,n,a),campaignsConf:t,setCampaignsConf:r,isLoading:m,setisLoading:n,setSnackbar:a}),s.jsx(Z,{nextPageHandler:()=>u(),disabled:t.list===""||t.table===""||t.field_map.length<1})]}),s.jsx(y,{step:e,saveConfig:()=>b(d,c,f,t,g)})]})}export{O as default};
