import{j as e,_ as m}from"./main.2.8.1.js";import{u as b,h as j,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as S}from"./BackIcn._kGL_vVw.js";import{S as v}from"./SnackMsg.S8DrwLlT.js";import{S as y}from"./Steps.1hz7v9Vj.js";import{I,g as M}from"./Integrations.D2bgBas2.js";import _ from"./MailifyAuthorization.DemYMqOX.js";import{c as k}from"./MailifyCommonFunc.CudAWY6J.js";import{M as N}from"./MailifyIntegLayout.bKd_cZiS.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";function K({formFields:c,setFlow:d,flow:f,allIntegURL:u}){const g=b(),{formID:l}=j(),[o,n]=i.useState(!1),[s,p]=i.useState(1),[h,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Sarbacane(Mailify)",type:"Sarbacane(Mailify)",account_id:"",api_key:"",field_map:[{formField:"",mailifyField:""}],actions:{}}),x=w=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!k(t)){a({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){a({show:!0,msg:m("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(3)}};return e.jsxs("div",{children:[e.jsx(v,{snack:h,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(y,{step:3,active:s})}),e.jsx(_,{formID:l,mailifyConf:t,setMailifyConf:r,step:s,setstep:p,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:l,formFields:c,mailifyConf:t,setMailifyConf:r,isLoading:o,setIsLoading:n,setSnackbar:a}),e.jsxs("button",{onClick:()=>x(),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(S,{className:"ml-1 rev-icn"})]})]}),e.jsx(I,{step:s,saveConfig:()=>M(f,d,u,t,g,"","",n),isLoading:o,dataConf:t,setDataConf:r,formFields:c})]})}export{K as default};
