const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WebSystemOutageMessaging-BgrN7nU6.mjs","./CmnEfQIC.js","./entry.Czs9t7YV.css","./WebSystemOutageMessaging.Cd-9fIgR.css"])))=>i.map(i=>d[i]); import{_ as L,bT as M,a1 as x,by as c,P as q,ak as T,o as n,b as _,c as w,d as P,s as S,a as t,l as h,t as R,N as D,M as O,F as B,x as W,q as I,aa as K,p as A,bY as z,f as H,b8 as j,bZ as Q,Q as Y,K as Z,L as J}from"./CmnEfQIC.js";import{_ as G}from"./WebMembershipFeatures-BS3mhgQJ.mjs";const X=Z(()=>J(()=>import("./WebSystemOutageMessaging-BgrN7nU6.mjs"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>e.default||e)),$={props:{recaptchaKey:{type:String}},async setup(e){return{recaptcha:await M(e.recaptchaKey)}},data(){return{membership:null,id:null,membershipId:null,promoCode:null,username:null,passwordValues:{password:null,confirmPassword:null},initialCommonValues:{firstName:null,lastName:null,title:null,company:null,locale:{countryCode:null,region:null,compliance:null}},commonValues:{firstName:null,lastName:null,title:null,company:null,locale:{countryCode:null,region:null,compliance:null}},demoValues:{},demoFieldInfo:null,hasFields:!1,errors:{},showErrors:!1,processing:!1,error:null,showPasswordFields:!1,showForm:!1,formKey:x(),message:null,subscribed:[],availableNewsletters:[]}},computed:{passwordFieldInfo(){return{rows:[{fields:{password:{type:"password",label:"Password",placeholder:"Enter Password",required:!0,disabled:this.processing,showErrors:this.showErrors,icon:!0,confirmation:{required:!0,placeholder:"Confirm Password",label:"Re-enter"}}}}]}},commonFieldInfo(){var e,s,r,o,i,a;if(this.membership){const p={},f={},u={};(e=this.membership.requiredUserCommonFields)!=null&&e.includes("firstName")&&(p.firstName={type:"text_input",label:"First Name",required:!0,showErrors:this.showErrors}),(s=this.membership.requiredUserCommonFields)!=null&&s.includes("lastName")&&(p.lastName={type:"text_input",label:"Last Name",required:!0,showErrors:this.showErrors}),(r=this.membership.requiredUserCommonFields)!=null&&r.includes("company")&&(f.company={type:"text_input",label:"Company Name",required:!0,showErrors:this.showErrors}),(o=this.membership.requiredUserCommonFields)!=null&&o.includes("city")&&(u.city={type:"text_input",label:"City",required:!0,showErrors:this.showErrors}),(i=this.membership.requiredUserCommonFields)!=null&&i.includes("postalCode")&&(u.postalCode={type:"text_input",label:"Postal/Zip code",required:!0,showErrors:this.showErrors}),(a=this.membership.requiredUserCommonFields)!=null&&a.includes("title")&&(f.title={type:"text_input",label:"Job Title",showErrors:this.showErrors});const b={};for(const l in p){const m=p[l];m.required=!0,b[l]=m}for(const l in u){const m=u[l];m.required=!0,b[l]=m}for(const l in f){const m=f[l];m.required=!0,b[l]=m}return{rows:[{numberOfColumns:2,fields:b}]}}else return null}},async mounted(){var a,p,f,u,b,l,m,E,g,v,C,F,k,d,V,U;let e=null;if(c.isLoggedIn())this.membershipId=(this._.provides[q]||this.$route).params.pathMatch.split("/")[1],e={data:await c.getUserInfo()},this.availableNewsletters=(a=this.$ss.newsletters)==null?void 0:a.enabledNewsletters.filter(({omedaProductId:y})=>{var N;return(((N=e.data)==null?void 0:N.newsletters)??[]).indexOf(y)<0}),this.showForm=!0,this.initialCommonValues.firstName=(p=e.data)==null?void 0:p.firstName,this.initialCommonValues.lastName=(f=e.data)==null?void 0:f.lastName,this.initialCommonValues.company=(u=e.data)==null?void 0:u.company,this.initialCommonValues.title=(b=e.data)==null?void 0:b.title,this.initialCommonValues.city=(l=e.data)==null?void 0:l.city,this.initialCommonValues.postalCode=(m=e.data)==null?void 0:m.postalCode;else{this.availableNewsletters=(E=this.$ss.newsletters)==null?void 0:E.enabledNewsletters;const y=(this._.provides[q]||this.$route).params.pathMatch.split("/")[1];e=await c.getSiteUserStub(y),e.error?(this.showForm=!1,this.message="Sorry, it appears the link you clicked has expired. Please register again"):this.showForm=!0,this.id=y,this.membershipId=e.data.membershipId,(g=e.data)!=null&&g.hasPassword||(this.showPasswordFields=!0),this.promoCode=(v=e.data)==null?void 0:v.omedaPromoCode,this.initialCommonValues.firstName=(C=e.data.omedaCustomer)==null?void 0:C.firstName,this.initialCommonValues.lastName=(F=e.data.omedaCustomer)==null?void 0:F.lastName,this.initialCommonValues.company=(k=e.data.omedaCustomer)==null?void 0:k.company,this.initialCommonValues.title=(d=e.data.omedaCustomer)==null?void 0:d.title,this.initialCommonValues.city=(V=e.data.omedaCustomer)==null?void 0:V.city,this.initialCommonValues.postalCode=(U=e.data.omedaCustomer)==null?void 0:U.postalCode}this.username=e.data.username,this.initialCommonValues.locale.countryCode=e.data.countryCode,this.initialCommonValues.locale.region=e.data.region,this.initialCommonValues.locale.compliance=e.data.consent;const s={id:this.membershipId},r=await this.$gql.query("getMembership",s);r.error||(this.membership=r.data);const o=await c.getDemographicQuestions(this.membership.requiredUserDemographicFields),i={};for(const y in o){const N=o[y];N.required=!0,i[y]=N}this.demoFieldInfo={rows:[{numberOfColumns:2,fields:i}]},this.hasFields=Object.keys(o).length>0||Object.keys(this.membership.requiredUserCommonFields).length>0,this.formKey=x()},methods:{submitForm(){this.showErrors=T(this.errors??{})>0,this.demoFieldInfoErrors(),this.showErrors||this.handleSubmit()},handlePayNow(e){var s;(s=this.membership)!=null&&s.paymentFormURL||(e.preventDefault(),console.log("Payment form URL not set for membership"),this.error="There is an unforeseen error in our membership form, please contact support for assistance")},async handleSubmit(){var e;this.processing=!0;try{this.error="";const s=await this.recaptcha("siteUserCompleteMembership");if(c.isLoggedIn()){const r=await c.getUserInfo(!1);if((e=this.membership)!=null&&e.isFree){const o=await this.$gql.mutate("addSiteUserMembershipSubscriptionToSelf",{membershipId:this.membershipId});if(o.error)throw new Error("Error adding site membership: "+o.message)}else{let o=!1;if(r.memberships.forEach(i=>{i===this.membershipId&&(o=!0)}),!o)throw new Error(`We cannot find a valid paid membership in our system. Please click "Pay Now" and complete the form or contact <a href="mailto:customerservice@${this.$ss.general.rootDomain}">customerservice@${this.$ss.general.rootDomain}</a> if you feel this is in error.`)}if(this.hasFields){const o={...this.commonValues,customerDemographics:this.demoValues};c.updateUserProfile(o)}for(let o=0;o<this.subscribed.length;o++){const i=this.availableNewsletters.find(a=>a.omedaProductId===this.subscribed[o]);await c.subscribeToNewsletter(this.subscribed[o],i.title,"registration",this.promoCode)}c.getUserInfo(!1),c.redirectAfterRegistration("registration")}else{const r={id:this.id,membershipId:this.membershipId,password:this.passwordValues.password,...this.commonValues,customerDemographics:this.demoValues,recaptchaToken:s};if(this.subscribed.length&&(r.newsletters=this.subscribed),this.showErrors)throw new Error("Please correct the issues with this form");const o=await c.signupUser(r);if(o!=null&&o.error)throw new Error(o.message);this.showForm=!1}}catch(s){this.error=s,this.processing=!1}this.processing=!1},updatePassword(e,s,r){this.passwordValues[e]=s,this.errors[e]={errorObj:r}},updateCommon(e,s,r){this.commonValues[e]=s,this.errors[e]={errorObj:r}},updateDemo(e,s,r){this.demoValues[e]=s,this.errors[e]={errorObj:r}},demoFieldInfoErrors(){this.demoFieldInfo.rows.forEach(e=>{for(const s in e.fields)e.fields[s].showErrors=this.showErrors})},toggleSubscription(e){this.subscribed.includes(e)?this.subscribed.splice(this.subscribed.indexOf(e),1):this.subscribed.push(e)}}},ee={class:"overview-wrapper"},se={class:"overview"},ie={key:0},oe=["innerHTML"],te={key:1},re={key:1,class:"divider"},ae={key:4},ne={key:0,class:"newsletter"},le={class:"toggle"},me={class:"text"},de={class:"name"},ue=["innerHTML"],ce={key:5},he={class:"submit"};function pe(e,s,r,o,i,a){var g;const p=X,f=G,u=z,b=H,l=j,m=Q,E=Y;return(g=e.$ss.systemOutage)!=null&&g.disableOmeda?(n(),_(p,{key:0})):(n(),w("div",{key:1,class:"complete-registration",style:A({fontFamily:e.$ss.primaryFontFamily})},[P(E,null,{default:S(()=>{var v;return[t("div",ee,[t("div",se,[i.membership?(n(),w("div",ie,[s[1]||(s[1]=t("h2",{class:"heading"}," Almost there! ",-1)),t("div",{innerHTML:(v=i.membership)==null?void 0:v.completeRegistrationPageText},null,8,oe),P(f,{membership:i.membership},null,8,["membership"])])):h("",!0),i.showForm?h("",!0):(n(),w("div",te,R(i.message),1))])]),i.showForm?(n(),_(m,{key:0,error:i.error,processing:i.processing,class:"form",padding:"0"},{default:S(()=>{var C,F,k;return[D(t("form",{onSubmit:s[0]||(s[0]=O((...d)=>a.submitForm&&a.submitForm(...d),["prevent"]))},[i.showPasswordFields?(n(),_(u,{key:0,"field-info":a.passwordFieldInfo,"field-values":i.passwordValues,onUpdate:a.updatePassword},null,8,["field-info","field-values","onUpdate"])):h("",!0),i.showPasswordFields?(n(),w("div",re)):h("",!0),a.commonFieldInfo?(n(),_(u,{key:i.formKey,"field-info":a.commonFieldInfo,"field-values":i.initialCommonValues,"hide-populated":!0,onUpdate:a.updateCommon},null,8,["field-info","field-values","onUpdate"])):h("",!0),i.demoFieldInfo?(n(),_(u,{key:3,"field-info":i.demoFieldInfo,"field-values":i.demoValues,onUpdate:a.updateDemo},null,8,["field-info","field-values","onUpdate"])):h("",!0),s[5]||(s[5]=t("div",{class:"divider"},null,-1)),i.availableNewsletters.length?(n(),w("div",ae,[s[2]||(s[2]=t("div",null,"Would you like to sign up for any of our following free newsletters?",-1)),s[3]||(s[3]=t("br",null,null,-1)),(n(!0),w(B,null,W(i.availableNewsletters,d=>(n(),w("div",{key:d.omedaProductId},[d.showAtRegistration?(n(),w("div",ne,[t("div",le,[P(b,{icon:i.subscribed.includes(d.omedaProductId)?"mdi:checkbox-outline":"mdi:checkbox-blank-outline",width:30,"icon-color":i.subscribed.includes(d.omedaProductId)?"green":"black",onClick:V=>a.toggleSubscription(d.omedaProductId)},null,8,["icon","icon-color","onClick"])]),t("div",me,[t("div",de,R(d.title),1),t("div",{class:"description",innerHTML:d.description},null,8,ue)])])):h("",!0)]))),128))])):h("",!0),i.membership&&!((C=i.membership)!=null&&C.isFree)?(n(),w("div",ce,s[4]||(s[4]=[t("br",null,null,-1),I(' If you have already paid, or are eligible for site registration because your employer has an existing site license, please click "Complete Registration". Otherwise, click "Pay Now" to continue. ')]))):h("",!0),t("div",he,[i.membership&&!((F=i.membership)!=null&&F.isFree)?(n(),_(l,{key:0,label:"Pay Now",type:"link",target:"_blank",size:"large",link:(k=i.membership)==null?void 0:k.paymentFormURL,disabled:i.processing,onClick:a.handlePayNow},null,8,["link","disabled","onClick"])):h("",!0),P(l,{size:"large",label:"Complete Registration",type:"submit",disabled:i.processing},null,8,["disabled"])])],544),[[K,i.showForm]]),s[6]||(s[6]=t("div",{class:"consent"},[I(" By creating an account, you are agreeing to Endeavor Business Media's "),t("a",{href:"https://www.endeavorbusinessmedia.com/endeavor-terms",target:"_blank",rel:"noopener"},"Terms of Service"),I(" and "),t("a",{href:"https://www.endeavorbusinessmedia.com/privacy-policy",target:"_blank",rel:"noopener"},"Privacy Policy"),t("br"),t("br"),I(" As part of our services, you will receive communication from Endeavor Business Media, its brands, affiliates and third-party partners about their services and opportunities consistent with Endeavor's Privacy Policy. You can unsubscribe from these communications at any time by emailing "),t("a",{href:"mailto:emailsolutions@endeavorb2b.com"},"emailsolutions@endeavorb2b.com"),I(". ")],-1))]}),_:1},8,["error","processing"])):h("",!0)]}),_:1})],4))}const fe=L($,[["render",pe],["__scopeId","data-v-bd43979e"]]),ye={__name:"SiteUserCompleteRegistrationBlock",props:{data:{type:Object,required:!0,validator(e){return["publicRecaptchaKey"].every(s=>s in e)}}},setup(e){return(s,r)=>{const o=fe;return n(),_(o,{"recaptcha-key":e.data.publicRecaptchaKey},null,8,["recaptcha-key"])}}};export{ye as default};