import{j as t,_ as p}from"./main.2.8.10.js";import{u as b,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as j}from"./BackIcn.BFDZx8No.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{I,s as M}from"./Integrations.BFhED4ck.js";import k from"./MauticAuthorization.CtvcGBUu.js";import{s as C,h as w,c as N}from"./MauticCommonFunc.BxousfUl.js";import{M as y}from"./MauticIntegLayout.C2JraGpu.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function O({formFields:c,setFlow:l,flow:u,allIntegURL:d}){const f=b(),[n,r]=i.useState(!1),[s,m]=i.useState(1),[g,a]=i.useState({show:!1}),[e,o]=i.useState({name:"Mautic",type:"Mautic",clientId:"",clientSecret:"",baseUrl:"",field_map:[{formField:"",mauticField:""}],actions:{}});i.useEffect(()=>{window.opener&&C("mautic")},[]);const h=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!N(e)){a({show:!0,msg:p("Please map fields to continue.","bit-integrations")});return}m(3)};return t.jsxs("div",{children:[t.jsx(S,{snack:g,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:s})}),t.jsx(k,{mauticConf:e,setMauticConf:o,step:s,setstep:m,isLoading:n,setIsLoading:r,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[t.jsx(y,{formFields:c,handleInput:x=>w(x,e,o),mauticConf:e,setMauticConf:o,isLoading:n,setIsLoading:r,setSnackbar:a}),t.jsxs("button",{onClick:()=>h(),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[p("Next","bit-integrations"),t.jsx(j,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>M({flow:u,setFlow:l,allIntegURL:d,navigate:f,conf:e,setIsLoading:r,setSnackbar:a}),isLoading:n,dataConf:e,setDataConf:o,formFields:c})]})}export{O as default};
