import{_ as a,j as e}from"./main.2.9.0.js";import{u as j,e as v,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as C}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{S}from"./Steps.BYe8zHkm.js";import{I as k,g as y}from"./Integrations.DL8wqGct.js";import N from"./CampaignMonitorAuthorization.Dz0XEF1m.js";import{c as _}from"./CampaignMonitorCommonFunc.DqevWaHC.js";import{C as M}from"./CampaignMonitorIntegLayout.CdS3lHGS.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 U({formFields:l,setFlow:d,flow:g,allIntegURL:u}){const f=j(),{formID:p}=v(),[r,n]=o.useState(!1),[s,c]=o.useState(1),[b,i]=o.useState({show:!1}),x=[{key:"Name",label:a("Name","bit-integrations"),required:!1},{key:"EmailAddress",label:a("Email Address","bit-integrations"),required:!0}],[t,m]=o.useState({name:"CampaignMonitor",type:"CampaignMonitor",client_id:"",api_key:"",field_map:[{formField:"",campaignMonitorField:""}],subscriberFields:x,actions:{}}),h=w=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!_(t)){i({show:!0,msg:a("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){i({show:!0,msg:a("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&c(3)}};return e.jsxs("div",{children:[e.jsx(I,{snack:b,setSnackbar:i}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(S,{step:3,active:s})}),e.jsx(N,{formID:p,campaignMonitorConf:t,setCampaignMonitorConf:m,step:s,setstep:c,isLoading:r,setIsLoading:n,setSnackbar:i}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(M,{formID:p,formFields:l,campaignMonitorConf:t,setCampaignMonitorConf:m,isLoading:r,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:[a("Next","bit-integrations"),"  ",e.jsx(C,{className:"ml-1 rev-icn"})]})]}),e.jsx(k,{step:s,saveConfig:()=>y(g,d,u,t,f,"","",n),isLoading:r,dataConf:t,setDataConf:m,formFields:l})]})}export{U as default};
