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.1.js";import{u as T,d as o}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as z}from"./SnackMsg.S8DrwLlT.js";import{S as L}from"./Steps.1hz7v9Vj.js";import{I as R,g as q}from"./Integrations.D2bgBas2.js";import C from"./GetResponseAuthorization.w098jLfh.js";import{h as M,c as P}from"./GetResponseCommonFunc.rAT3AcM2.js";import{G as A}from"./GetResponseIntegLayout.-iQKfPl3.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./ActionProFeatureLabels.CuihmlQ8.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function it({formFields:a,setFlow:e,flow:s,allIntegURL:g}){const u=T(),[k,f]=o.useState(!1),[h,b]=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:h,setLoading:b,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:h,setLoading:b,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};
