var E=Object.defineProperty;var k=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var j=(a,t,s)=>t in a?E(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,N=(a,t)=>{for(var s in t||(t={}))w.call(t,s)&&j(a,s,t[s]);if(k)for(var s of k(t))P.call(t,s)&&j(a,s,t[s]);return a};import{u as C,r,j as i}from"./main-406.js";import{d as I,_ as L,I as F,G as M,c as l}from"./bi.394.85.js";import{S as R}from"./bi.68.941.js";import T from"./bi.968.325.js";import{b as A,c as _}from"./bi.259.907.js";import{D as G}from"./bi.464.908.js";import"./bi.150.760.js";function U({formFields:a,setFlow:t,flow:s,allIntegURL:p}){const u=C(),[b,c]=r.useState(!1),[f,g]=r.useState({}),[n,x]=r.useState(1),[S,d]=r.useState({show:!1}),h=[{label:"First Name",key:"name",required:!0},{label:"Email Address",key:"email",required:!0},{label:"Last Name",key:"last_name",required:!1},{label:"Phone Number",key:"phone_number",required:!1},{label:"Company",key:"company",required:!1},{label:"Website",key:"website",required:!1},{label:"GDPR",key:"gdpr",required:!1},{label:"Event Registration page URL",key:"ref_url",required:!1}],[e,m]=r.useState({name:"Demio",type:"Demio",api_key:"",api_secret:"",field_map:A(h),actionName:"registerPeopletoWabinar",demioFields:h,actions:{}}),D=()=>{c(!0),M(s,t,p,e,u,"","",c).then(o=>{var v;o.success?(l.success((v=o.data)==null?void 0:v.msg),u(p)):l.error(o.data||o)})},q=y=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!_(e)){l.error("Please map mandatory fields");return}if(!e.selectedEvent){l.error("Please select a Event");return}e.field_map.length>0&&x(y)};return i.jsxs("div",{children:[i.jsx(I,{snack:S,setSnackbar:d}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(R,{step:3,active:n})}),i.jsx(T,{demioConf:e,setDemioConf:m,step:n,setStep:x,loading:f,setLoading:g,setSnackbar:d}),i.jsxs("div",{className:"btcd-stp-page",style:N({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(G,{formFields:a,demioConf:e,setDemioConf:m,loading:f,setLoading:g,isLoading:b,setIsLoading:c,setSnackbar:d}),(e==null?void 0:e.actionName)&&i.jsxs("button",{onClick:()=>q(3),disabled:!_(e),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[L("Next","bit-integrations")," "," ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),(e==null?void 0:e.actionName)&&i.jsx(F,{step:n,saveConfig:()=>D(),isLoading:b,dataConf:e,setDataConf:m,formFields:a})]})}export{U as default};
