import{j as e,_ as l}from"./main.2.9.0.js";import{u as j,e as S,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as M}from"./BackIcn._8Wofmn2.js";import{S as v}from"./SnackMsg.DYSD96P4.js";import{S as k}from"./Steps.BYe8zHkm.js";import{I as w,s as N}from"./Integrations.DL8wqGct.js";import _ from"./MailChimpAuthorization.C6vvZZmW.js";import{s as y,h as L,f as E,c as P}from"./MailChimpCommonFunc.c4Hokmvu.js";import{M as T}from"./MailChimpIntegLayout.DR6VHoAy.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./MailChimpIntegrationHelpers.D6dD8hCL.js";import"./ActionProFeatureLabels.gUp7_RXn.js";import"./TagifyInput.KPPRQJ1B.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};
