import{j as e,_ as f}from"./main.2.9.0.js";import{u as k,e as j,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as S}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{S as M}from"./Steps.BYe8zHkm.js";import{I as v,g as Z}from"./Integrations.DL8wqGct.js";import C from"./ZohoMarketingHubAuthorization.BMRash75.js";import{s as H,h as N,c as _}from"./ZohoMarketingHubCommonFunc.BF65tR0D.js";import{Z as w}from"./ZohoMarketingHubIntegLayout.CZaTz7zj.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:l,setFlow:g,flow:u,allIntegURL:d}){const h=k(),{formID:r}=j(),[m,i]=o.useState(!1),[s,c]=o.useState(1),[b,a]=o.useState({show:!1}),[t,n]=o.useState({name:"Zoho Marketing Automation(Zoho Marketing Hub)",type:"Zoho Marketing Automation(Zoho Marketing Hub)",clientId:"",clientSecret:"",list:"",field_map:[{formField:"",zohoFormField:""}]});o.useEffect(()=>{window.opener&&H()},[]);const x=p=>{{if(!_(t)){a({show:!0,msg:f("Please map mandatory fields","bit-integrations")});return}t.list!==""&&t.table!==""&&t.field_map.length>0&&c(p)}};return e.jsxs("div",{children:[e.jsx(I,{snack:b,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(M,{step:3,active:s})}),e.jsx(C,{formID:r,marketingHubConf:t,setMarketingHubConf:n,step:s,setstep:c,isLoading:m,setIsLoading:i,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(w,{formID:r,formFields:l,handleInput:p=>N(p,r,t,n,i,a),marketingHubConf:t,setMarketingHubConf:n,isLoading:m,setIsLoading:i,setSnackbar:a}),e.jsxs("button",{onClick:()=>x(3),disabled:t.list===""||t.table===""||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),e.jsx(S,{className:"ml-1 rev-icn"})]})]}),e.jsx(v,{step:s,saveConfig:()=>Z(u,g,d,t,h,"","",i),isLoading:m,dataConf:t,setDataConf:n,formFields:l})]})}export{U as default};
