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.1.js";import{u as I,d as n}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as L}from"./SnackMsg.S8DrwLlT.js";import{S as z}from"./Steps.1hz7v9Vj.js";import{I as F,g as M}from"./Integrations.D2bgBas2.js";import R from"./DemioAuthorization.Dg0B-D3N.js";import{b as T,c as _}from"./DemioCommonFunc.CwhlkKok.js";import{D as A}from"./DemioIntegLayout.B-RDcOy3.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.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};
