import{j as e,_ as o,z as p}from"./main.2.8.10.js";import{u as v,e as I,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as D}from"./BackIcn.BFDZx8No.js";import{S}from"./Steps.B84Ui3GU.js";import{I as _,g as F}from"./Integrations.BFhED4ck.js";import N from"./DripAuthorization.JHWMYNQQ.js";import{s as y,c as d}from"./DripCommonFunc.CoteVUmk.js";import{D as T}from"./DripIntegLayout.Drw1xesK.js";import"./react-vendor.P7K3d6op.js";import"./SnackMsg.7BjcJK1j.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 U({formFields:r,setFlow:u,flow:g,allIntegURL:f}){const x=v(),{formID:n}=I(),[h,b]=a.useState(!1),[s,c]=a.useState(1),[l,m]=a.useState({auth:!1,customFields:!1,accounts:!1,tags:!1}),[t,i]=a.useState({name:"Drip",type:"Drip",api_token:"",accounts:[],field_map:[{formField:"",dripField:""}],actions:{},tags:[],selectedAccountId:"",dripFormFields:y,selectedTags:"",selectedStatus:"",selectedRemoveTags:""}),j=k=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!d(t)){p.error(o("Please map all required fields to continue","bit-integrations"));return}if(!(t!=null&&t.selectedAccountId)){p.error(o("Please select account to continue","bit-integrations"));return}t.name!==""&&t.field_map.length>0&&c(3)}};return e.jsxs("div",{children:[e.jsx("div",{className:"txt-center mt-2",children:e.jsx(S,{step:3,active:s})}),e.jsx(N,{formID:n,dripConf:t,setDripConf:i,step:s,setstep:c,loading:l,setLoading:m}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(T,{formID:n,formFields:r,dripConf:t,setDripConf:i,loading:l,setLoading:m}),e.jsxs("button",{onClick:()=>j(),disabled:!(t!=null&&t.selectedAccountId)||!d(t)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[o("Next","bit-integrations"),"  ",e.jsx(D,{className:"ml-1 rev-icn"})]})]}),e.jsx(_,{step:s,saveConfig:()=>F(g,u,f,t,x,"","",b),isLoading:h,dataConf:t,setDataConf:i,formFields:r})]})}export{U as default};
