import{j as e,_ as o,z as p}from"./main.2.9.0.js";import{u as v,e as I,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as D}from"./BackIcn._8Wofmn2.js";import{S}from"./Steps.BYe8zHkm.js";import{I as _,g as F}from"./Integrations.DL8wqGct.js";import N from"./DripAuthorization.CP_aejWO.js";import{s as y,c as d}from"./DripCommonFunc.U3JxiS4r.js";import{D as T}from"./DripIntegLayout.B20TflCW.js";import"./react-vendor.P7K3d6op.js";import"./SnackMsg.DYSD96P4.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 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};
