import{j as e,_ as m}from"./main.2.9.0.js";import{u as v,e as b,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as j}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{S}from"./Steps.BYe8zHkm.js";import{I as A,g as _}from"./Integrations.DL8wqGct.js";import k from"./ActiveCampaignAuthorization.CmFvd3Ko.js";import{d as C}from"./ActiveCampaignCommonFunc.CHcF-bNJ.js";import{A as y}from"./ActiveCampaignIntegLayout.B8-zYGws.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function Q({formFields:p,setFlow:d,flow:g,allIntegURL:u}){const f=v(),{formID:c}=b(),[o,n]=a.useState(!1),[s,l]=a.useState(1),[x,i]=a.useState({show:!1}),[t,r]=a.useState({name:"Active Campaign",type:"ActiveCampaign",api_url:"",api_key:"",field_map:[{formField:"",activeCampaignField:""}],actions:{}}),h=N=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!C(t)){i({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){i({show:!0,msg:m("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&l(3)}};return e.jsxs("div",{children:[e.jsx(I,{snack:x,setSnackbar:i}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(S,{step:3,active:s})}),e.jsx(k,{formID:c,activeCampaingConf:t,setActiveCampaingConf:r,step:s,setstep:l,isLoading:o,setIsLoading:n,setSnackbar:i}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(y,{formID:c,formFields:p,activeCampaingConf:t,setActiveCampaingConf:r,isLoading:o,setIsLoading:n,setSnackbar:i}),e.jsxs("button",{onClick:()=>h(),disabled:!(t!=null&&t.listId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",e.jsx(j,{className:"ml-1 rev-icn"})]})]}),e.jsx(A,{step:s,saveConfig:()=>_(g,d,u,t,f,"","",n),isLoading:o,dataConf:t,setDataConf:r,formFields:p})]})}export{Q as default};
