import{j as e,_ as c}from"./main.2.8.1.js";import{u as k,h as j,d as a}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as S}from"./BackIcn._kGL_vVw.js";import{S as I}from"./SnackMsg.S8DrwLlT.js";import{S as M}from"./Steps.1hz7v9Vj.js";import{I as v,g as Z}from"./Integrations.D2bgBas2.js";import H from"./ZohoMarketingHubAuthorization.fvni-sHg.js";import{s as N,h as _,c as w}from"./ZohoMarketingHubCommonFunc.jxunAV-M.js";import{Z as y}from"./ZohoMarketingHubIntegLayout.CKh_6uFZ.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:g,setFlow:u,flow:d,allIntegURL:f}){const h=k(),{formID:n}=j(),[r,i]=a.useState(!1),[s,l]=a.useState(1),[b,o]=a.useState({show:!1}),[t,m]=a.useState({name:"Zoho Marketing Automation(Zoho Marketing Hub)",type:"Zoho Marketing Automation(Zoho Marketing Hub)",clientId:"",clientSecret:"",list:"",field_map:[{formField:"",zohoFormField:""}]});a.useEffect(()=>{window.opener&&N()},[]);const x=p=>{{if(!w(t)){o({show:!0,msg:c("Please map mandatory fields","bit-integrations")});return}t.list!==""&&t.table!==""&&t.field_map.length>0&&l(p)}};return e.jsxs("div",{children:[e.jsx(I,{snack:b,setSnackbar:o}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(M,{step:3,active:s})}),e.jsx(H,{formID:n,marketingHubConf:t,setMarketingHubConf:m,step:s,setstep:l,isLoading:r,setIsLoading:i,setSnackbar:o}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(y,{formID:n,formFields:g,handleInput:p=>_(p,n,t,m,i,o),marketingHubConf:t,setMarketingHubConf:m,isLoading:r,setIsLoading:i,setSnackbar:o}),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:[c("Next","bit-integrations"),e.jsx(S,{className:"ml-1 rev-icn"})]})]}),e.jsx(v,{step:s,saveConfig:()=>Z(d,u,f,t,h,"","",i),isLoading:r})]})}export{U as default};
