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