import{_ as t,j as s}from"./main.2.9.0.js";import{u as C,e as x,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as k}from"./BackIcn._8Wofmn2.js";import{S as j}from"./SnackMsg.DYSD96P4.js";import{S as q}from"./Steps.BYe8zHkm.js";import{I as v,s as S}from"./Integrations.DL8wqGct.js";import N from"./ConstantContactAuthorization.CGfHloRQ.js";import{c as I,s as w,h as B,d as E,e as L}from"./ConstantContactCommonFunc.Dsf6c4AN.js";import{C as M}from"./ConstantContactIntegLayout.D0MDvKnQ.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 Y({formFields:c,setFlow:u,flow:f,allIntegURL:b}){const g=C(),{id:h}=x(),[l,d]=n.useState({auth:!1,list:!1,tag:!1,update:!1}),[i,m]=n.useState(1),[y,a]=n.useState({show:!1}),p=[{key:"email_address",label:t("Email","bit-integrations"),required:!0},{key:"first_name",label:t("First Name","bit-integrations"),required:!1},{key:"last_name",label:t("Last Name","bit-integrations"),required:!1},{key:"job_title",label:t("Job Title","bit-integrations"),required:!1},{key:"company_name",label:t("Company Name","bit-integrations"),required:!1},{key:"phone_number",label:t("Phone Number","bit-integrations"),required:!1},{key:"anniversary",label:t("Anniversary","bit-integrations"),required:!1},{key:"birthday_month",label:t("Birthday Month","bit-integrations"),required:!1},{key:"birthday_day",label:t("Birthday Day","bit-integrations"),required:!1}],[e,r]=n.useState({name:"ConstantContact",type:"ConstantContact",clientId:"",clientSecret:"",list_ids:"",lists:[],default:{constantContactFields:p},source_type:"",tag_ids:"",tags:[],field_map:I(p),address_type:"",address_field:[],phone_type:"",phone_field:[],actions:{}});n.useEffect(()=>{window.opener&&w("constantContact")},[]);const _=()=>{var o;if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),(o=e.actions)!=null&&o.address&&!E(e)){a({show:!0,msg:t("Please map address required fields to continue.","bit-integrations")});return}if(!L(e)){a({show:!0,msg:t("Please map fields to continue.","bit-integrations")});return}m(3)};return s.jsxs("div",{children:[s.jsx(j,{snack:y,setSnackbar:a}),s.jsx("div",{className:"txt-center mt-2",children:s.jsx(q,{step:3,active:i})}),s.jsx(N,{constantContactConf:e,setConstantContactConf:r,step:i,setstep:m,isLoading:l,setIsLoading:d,setSnackbar:a}),s.jsxs("div",{className:"btcd-stp-page",style:{width:i===2&&900,height:i===2&&"auto"},children:[s.jsx(M,{id:h,formFields:c,handleInput:o=>B(o,e,r),constantContactConf:e,setConstantContactConf:r,isLoading:l,setIsLoading:d,setSnackbar:a}),s.jsxs("button",{onClick:()=>_(),disabled:(e==null?void 0:e.source_type)===""||e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[t("Next","bit-integrations"),s.jsx(k,{className:"ml-1 rev-icn"})]})]}),s.jsx(v,{step:i,saveConfig:()=>S({flow:f,setFlow:u,allIntegURL:b,navigate:g,conf:e,setIsLoading:d,setSnackbar:a}),isLoading:l===!0,dataConf:e,setDataConf:r,formFields:c})]})}export{Y as default};
