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.9.0.js";import{u as I,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as L}from"./SnackMsg.DYSD96P4.js";import{S as z}from"./Steps.BYe8zHkm.js";import{I as F,g as M}from"./Integrations.DL8wqGct.js";import R from"./DemioAuthorization.BUf5FAhi.js";import{b as T,c as _}from"./DemioCommonFunc.BEeLbAh1.js";import{D as A}from"./DemioIntegLayout.De6x5yzk.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
