import{_ as t,j as s}from"./main.2.8.10.js";import{u as C,e as x,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as k}from"./BackIcn.BFDZx8No.js";import{S as j}from"./SnackMsg.7BjcJK1j.js";import{S as q}from"./Steps.B84Ui3GU.js";import{I as v,s as S}from"./Integrations.BFhED4ck.js";import N from"./ConstantContactAuthorization.Bote-9_S.js";import{c as I,s as w,h as B,d as E,e as L}from"./ConstantContactCommonFunc.Dr0pZhTL.js";import{C as M}from"./ConstantContactIntegLayout.CoxlPr39.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.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};
