import{j as e,_ as l}from"./main.2.8.10.js";import{u as j,e as S,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as M}from"./BackIcn.BFDZx8No.js";import{S as v}from"./SnackMsg.7BjcJK1j.js";import{S as k}from"./Steps.B84Ui3GU.js";import{I as w,s as N}from"./Integrations.BFhED4ck.js";import _ from"./MailChimpAuthorization.B7jmjeTH.js";import{s as y,h as L,f as E,c as P}from"./MailChimpCommonFunc.BWlyyYbz.js";import{M as T}from"./MailChimpIntegLayout.w15nUUxj.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./MailChimpIntegrationHelpers.D6dD8hCL.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function $({formFields:d,setFlow:h,flow:g,allIntegURL:x}){const C=j(),{formID:m}=S(),[p,o]=i.useState(!1),[c,f]=i.useState({}),[a,u]=i.useState(1),[b,s]=i.useState({show:!1}),[t,n]=i.useState({name:"Mail Chimp",type:"Mail Chimp",clientId:"",clientSecret:"",listId:"",listName:"",tags:"",field_map:[{formField:"",mailChimpField:""}],address_field:[],module:"",actions:{},moduleLists:[]});i.useEffect(()=>{window.opener&&y("mailChimp")},[]);const I=()=>{var r;if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),(r=t.actions)!=null&&r.address&&!E(t)){s({show:!0,msg:l("Please map address required fields to continue.","bit-integrations")});return}if(!P(t)){s({show:!0,msg:l("Please map fields to continue.","bit-integrations")});return}t.listId!==""&&u(3)};return e.jsxs("div",{children:[e.jsx(v,{snack:b,setSnackbar:s}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(k,{step:3,active:a})}),e.jsx(_,{formID:m,mailChimpConf:t,setMailChimpConf:n,step:a,setstep:u,isLoading:p,setIsLoading:o,setSnackbar:s}),e.jsxs("div",{className:"btcd-stp-page",style:{width:a===2&&900,height:a===2&&"auto"},children:[e.jsx(T,{formID:m,formFields:d,handleInput:r=>L(r,t,n,m,c,f,s,o),mailChimpConf:t,setMailChimpConf:n,isLoading:p,setIsLoading:o,setSnackbar:s,loading:c,setLoading:f}),e.jsxs("button",{onClick:()=>I(),disabled:!t.listId||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),e.jsx(M,{className:"ml-1 rev-icn"})]})]}),e.jsx(w,{step:a,saveConfig:()=>N({flow:g,setFlow:h,allIntegURL:x,navigate:C,conf:t,setIsLoading:o,setSnackbar:s}),isLoading:p,dataConf:t,setDataConf:n,formFields:d})]})}export{$ as default};
