var F=Object.defineProperty;var j=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var I=(a,e,s)=>e in a?F(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,S=(a,e)=>{for(var s in e||(e={}))w.call(e,s)&&I(a,s,e[s]);if(j)for(var s of j(e))E.call(e,s)&&I(a,s,e[s]);return a};import{_ as p,j as i,z as d}from"./main.2.8.10.js";import{u as T,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as z}from"./SnackMsg.7BjcJK1j.js";import{S as L}from"./Steps.B84Ui3GU.js";import{I as R,g as q}from"./Integrations.BFhED4ck.js";import C from"./GetResponseAuthorization.BdnSbw9X.js";import{h as M,c as P}from"./GetResponseCommonFunc.DbhVUseh.js";import{G as A}from"./GetResponseIntegLayout.Du_Kg91G.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function it({formFields:a,setFlow:e,flow:s,allIntegURL:g}){const u=T(),[k,f]=o.useState(!1),[b,h]=o.useState({list:!1,field:!1,auth:!1,tags:!1,customFields:!1}),[n,x]=o.useState(1),[y,l]=o.useState({show:!1}),G=[{key:"email",label:p("Email","bit-integrations"),required:!0},{key:"name",label:p("Name","bit-integrations"),required:!1}],[t,r]=o.useState({name:"GetResponse",type:"GetResponse",auth_token:"",field_map:[{formField:"",getResponseFormField:""}],contactsFields:G,campaignId:"",getResponseFields:[],campaigns:[],tags:[],selectedTags:[],actions:{}}),N=()=>{f(!0),q(s,e,g,t,u,"","",f).then(m=>{var v;m.success?(d.success((v=m.data)==null?void 0:v.msg),u(g)):d.error(m.data||m)})},_=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!P(t)){d.error(p("Please map mandatory fields","bit-integrations"));return}t.field_map.length>0&&x(c)};return i.jsxs("div",{children:[i.jsx(z,{snack:y,setSnackbar:l}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(L,{step:3,active:n})}),i.jsx(C,{getResponseConf:t,setGetResponseConf:r,step:n,setstep:x,loading:b,setLoading:h,setSnackbar:l}),i.jsxs("div",{className:"btcd-stp-page",style:S({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(A,{formFields:a,handleInput:c=>M(c,t,r),getResponseConf:t,setGetResponseConf:r,loading:b,setLoading:h,setSnackbar:l}),(t==null?void 0:t.campaignId)&&i.jsxs("button",{onClick:()=>_(3),disabled:!(t!=null&&t.campaignId),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[p("Next","bit-integrations"),"  ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),(t==null?void 0:t.campaignId)&&i.jsx(R,{step:n,saveConfig:()=>N(),isLoading:k,dataConf:t,setDataConf:r,formFields:a})]})}export{it as default};
