import{j as e,_ as m}from"./main.2.9.0.js";import{u as b,e as j,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as v}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{S as L}from"./Steps.BYe8zHkm.js";import{I as S,g as k}from"./Integrations.DL8wqGct.js";import _ from"./LemlistAuthorization.BbFTLv52.js";import{c as y}from"./LemlistCommonFunc.Dh52GHoU.js";import{L as N}from"./LemlistIntegLayout.CWoLmpOu.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";function K({formFields:c,setFlow:d,flow:g,allIntegURL:u}){const f=b(),{formID:p}=j(),[o,n]=i.useState(!1),[s,l]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Lemlist",type:"Lemlist",api_key:"",field_map:[{formField:"",lemlistField:""}],actions:{}}),h=w=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!y(t)){a({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.campaignId)){a({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:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(L,{step:3,active:s})}),e.jsx(_,{formID:p,lemlistConf:t,setLemlistConf:r,step:s,setstep:l,isLoading:o,setIsLoading:n,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(N,{formID:p,formFields:c,lemlistConf:t,setLemlistConf:r,isLoading:o,setIsLoading:n,setSnackbar:a}),e.jsxs("button",{onClick:()=>h(),disabled:!(t!=null&&t.campaignId)||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(v,{className:"ml-1 rev-icn"})]})]}),e.jsx(S,{step:s,saveConfig:()=>k(g,d,u,t,f,"","",n),isLoading:o,dataConf:t,setDataConf:r,formFields:c})]})}export{K as default};
