import{j as t,_ as p}from"./main.2.8.1.js";import{u as b,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as j}from"./BackIcn._kGL_vVw.js";import{S}from"./SnackMsg.S8DrwLlT.js";import{S as I}from"./Steps.1hz7v9Vj.js";import{I as v,s as M}from"./Integrations.D2bgBas2.js";import k from"./MauticAuthorization.C9J-2Q7x.js";import{s as C,h as w,c as N}from"./MauticCommonFunc.9NjHUbhi.js";import{M as y}from"./MauticIntegLayout.DuI_oxIF.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TutorialLink.BAFX--T3.js";import"./tutorialLinks.kMkIDzcD.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function O({formFields:c,setFlow:l,flow:u,allIntegURL:d}){const f=b(),[r,o]=i.useState(!1),[a,m]=i.useState(1),[g,s]=i.useState({show:!1}),[e,n]=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)){s({show:!0,msg:p("Please map fields to continue.","bit-integrations")});return}e.listId!==""&&m(3)};return t.jsxs("div",{children:[t.jsx(S,{snack:g,setSnackbar:s}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(I,{step:3,active:a})}),t.jsx(k,{mauticConf:e,setMauticConf:n,step:a,setstep:m,isLoading:r,setIsLoading:o,setSnackbar:s}),t.jsxs("div",{className:"btcd-stp-page",style:{width:a===2&&900,height:a===2&&"auto"},children:[t.jsx(y,{formFields:c,handleInput:x=>w(x,e,n,o,s),mauticConf:e,setMauticConf:n,isLoading:r,setIsLoading:o,setSnackbar:s}),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(v,{step:a,saveConfig:()=>M({flow:u,setFlow:l,allIntegURL:d,navigate:f,conf:e,setIsLoading:o,setSnackbar:s}),isLoading:r,dataConf:e,setDataConf:n,formFields:c})]})}export{O as default};
