"use strict";(self.webpackChunkkoality_signup=self.webpackChunkkoality_signup||[]).push([[179],{9386:(P,I,l)=>{var M=l(4497),t=l(2560),V=l(1154),f=l(124),k=l(3160),v=l(4666),s=l(4301),h=(()=>{return(i=h||(h={})).Staging="staging",i.Production="production",i.Local="local",h;var i})();const R=new t.OlP("cpanel.defaultContactEmail"),L=new t.OlP("cpanel.domains"),Q=new t.OlP("koality.environment"),T=new t.OlP("koality.defaultRoute"),B=window?.PAGE?.base??"",N=(window,window?.PAGE?.default_contact_email??""),$=window?.PAGE?.domains??"",X=((i,o)=>{const n=Object.values(h).indexOf(i);if(n>=0){const r=Object.keys(h)[n];return h[r]}return o})(window?.PAGE?.environment,h.Production),tt={route:window?.PAGE?.defaultRoute};let et=(()=>{class i{constructor(e){this.contactEmail=e}getContactEmail(){return this.contactEmail}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(R))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();class Y{constructor(o,e){this.domain=o,this.type=e,this.sortKey=this.domain.split(".").reverse().join(".")}}var g=(()=>{return(i=g||(g={}))[i.Primary=1]="Primary",i[i.Main=1]="Main",i[i.Sub=2]="Sub",i[i.Addon=3]="Addon",i[i.Alias=4]="Alias",i[i.Parked=4]="Parked",i[i.Unknown=0]="Unknown",g;var i})();let J=(()=>{class i{constructor(e){this._domains=this._normalize(e)}getMainDomain(){return this._domains.find(n=>n.type===g.Primary)}getDomains(){return this._domains}_normalize(e){const n=[];return["main_domain","addon_domains","parked_domains","sub_domains"].forEach(a=>{const u=e[a],p=this._getDomainTypeFromKey(a);"main_domain"===a?n.push(new Y(u,p)):u.forEach(O=>{n.push(new Y(O,p))})}),n.sort((a,u)=>a.domain<u.domain?-1:a.domain>u.domain?1:0)}_getDomainTypeFromKey(e){switch(e){case"main_domain":return g.Primary;case"addon_domains":return g.Addon;case"parked_domains":return g.Alias;case"sub_domains":return g.Sub;default:return g.Unknown}}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(L))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();var b=l(6996),w=l(444),D=l(4858),it=l(9727),y=l(6942),nt=l(4671),G=l(522),x=l(2137),Z=l(1801);let ot=(()=>{class i{constructor(e){this.http=e}get(e){return this.http.post(new w.j({namespace:"Personalization",method:"get",arguments:[new b.h("names",e)],config:{json:!0}})).pipe((0,y.U)(n=>{const r=n?.data?.personalization;if(!r)return{};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(r[a].success=(0,x.s)(r[a].success));return r}))}save(e){return this.http.post(new w.j({namespace:"Personalization",method:"set",arguments:[new b.h("personalization",e)],config:{json:!0}})).pipe((0,y.U)(n=>(0,x.s)(n.status)))}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(Z.Tr))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();var d=(()=>{return(i=d||(d={}))[i.Initial=0]="Initial",i[i.WaitingOnAccountCreation=1]="WaitingOnAccountCreation",i[i.AccountCreated=2]="AccountCreated",i[i.AccountCreationFailed=3]="AccountCreationFailed",i[i.WaitingOnCodeVerification=4]="WaitingOnCodeVerification",i[i.CodeVerified=5]="CodeVerified",i[i.CodeVerificationFailed=6]="CodeVerificationFailed",i[i.WaitingOnProjectCreation=7]="WaitingOnProjectCreation",i[i.ProjectCreated=8]="ProjectCreated",i[i.ProjectCreationFailed=9]="ProjectCreationFailed",d;var i})();let F=(()=>{class i{constructor(e){this.personalization=e,this.email="",this.domain="",this.step=d.Initial}url(e="",n="https"){return this.domain?`${n}://${this.domain}/${e}`:""}load(){return this.personalization.get(["koalitySignupEmail","koalitySignupDomain","koalitySignupStep"]).pipe((0,y.U)(e=>(this.email=e.koalitySignupEmail.value||"",this.domain=e.koalitySignupDomain.value||"",this.step=parseInt(e.koalitySignupStep.value,10)||d.Initial,e)))}reset(){return this.step=d.Initial,this.email="",this.domain="",this.save()}save(){return this.personalization.save({koalitySignupEmail:this.email,koalitySignupDomain:this.domain,koalitySignupStep:this.step})}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(ot))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();const rt=new RegExp("[0-9]{6}");class st{constructor(o){this.username=o.username,this.enabled=!!o.enabled}}class at{constructor(o){this.status=(0,x.s)(o.status)}}class lt{constructor(o){this.url=o.url}}class ct{constructor(o){this.sent=(0,x.s)(o.send_activation_email)}}let U=(()=>{class i{constructor(e,n,r,a,u){this.locale=e,this._http=n,this._domainService=r,this._stateService=u,this.environment=a}createUser(e){if(!e.email)throw new Error(this.locale.maketext("This service requires a contact email address."));if(!e.acceptAgreements)throw new Error(this.locale.maketext("The user must accept the agreement to use this service."));const n=new w.j({namespace:"SiteQuality",method:"create_site_quality_user"});return n.addArgument(new b.h("email",e.email)),this._http.post(n).pipe((0,y.U)(r=>{if(1===r.status)return new st(r.data);throw r.errors.pop().message}))}verifyCode(e){if(!e)throw new Error(this.locale.maketext("The verification code is required."));if(!rt.test(e))throw new Error(this.locale.maketext("The verification code must be exactly [_1] characters in length and composed of only numbers.",6));const n=new w.j({namespace:"SiteQuality",method:"verify_code"});return n.addArgument(new b.h("code",e)),this._http.post(n).pipe((0,y.U)(r=>{if(1===r.status)return new at(r.data);throw r.errors.pop().message}))}resendCode(){const e=new w.j({namespace:"SiteQuality",method:"send_activation_email"});return this._http.post(e).pipe((0,y.U)(n=>{if(1===n.status)return new ct(n.data);throw n.errors.pop().message}))}addUrls(e){if(!e.length)throw new Error(this.locale.maketext("You must provide one or more URLs to monitor."));return new Set(this._domainService.getDomains().map(r=>r.domain)),(0,D.D)(e).pipe((0,nt.n)(r=>!r),(0,G.zg)(r=>{if(!/^http(s)?:[/][/]/.test(r))throw this.locale.maketext("The URL must start with either [asis,http://] or [asis,https://] protocols.");const a=new w.j({namespace:"SiteQuality",method:"create_project"});return a.addArgument(new b.h("name",r.replace(/^http(s)?:[/][/]/,"").replace(/[/]/g,"-"))),a.addArgument(new b.h("url",r)),a.addArgument(new b.h("system_type",this.getProjectType())),a.addArgument(new b.h("standard_alerting",!0)),this._http.post(a).pipe((0,y.U)(u=>{if(1===u.status)return new lt(u.data);throw u.errors.pop().message}))}))}getProjectType(){return this.environment===h.Production||this.environment===h.Staging?"Custom project":void 0}resetConfig(){const e=new w.j({namespace:"SiteQuality",method:"delete_site_quality_user"});return this._stateService.reset(),(0,it.$R)(this._http.post(e).pipe((0,y.U)(n=>{if(1===n.status)return!0;throw n.errors.pop().message})),this._stateService.save())}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(k.g),t.LFG(Z.Tr),t.LFG(J),t.LFG(Q),t.LFG(F))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();class ut{constructor(o,e){this.email=o,this.acceptAgreements=e}}var _=l(2359),m=l(2508);let dt=(()=>{class i{constructor(e,n,r,a,u,p,O,j,At,Tt,Zt){this.document=e,this.alertService=n,this.contactService=r,this.domainsService=a,this.monitoringService=u,this.formBuilder=p,this.locale=O,this.application=j,this._router=At,this.route=Tt,this.window=Zt,this.isLoading=!0,this.isSubmitting=!1,this.showAllHelp=!0,this.showInfoToggle=!0,this.application.reset().subscribe(),this.mainDomain=a.getMainDomain(),this.domains=a.getDomains(),this.signupForm=this.formBuilder.group({domain:[this.mainDomain?this.mainDomain.domain:"",{updateOn:"change",validators:[_.dt.required(this.locale.maketext("Select a domain to monitor."))]}],email:[r.getContactEmail(),{updateOn:"blur",validators:[_.dt.required(this.locale.maketext("You must provide an email address.")),_.Tt.validateEmail(this.locale.maketext("Invalid email address."))]}],acceptAgreement:[!1,{updateOn:"change",validators:[_.dt.requiredTrue(this.locale.maketext("You must agree to receive notifications at this email address to use Site Quality Monitoring."))]}]})}ngOnInit(){this.isLoading=!1,this.submitting=s.FP.disabled,this.signupFormStatusChangeSubscription=this.signupForm.statusChanges.subscribe(e=>{this.submitting="VALID"===e?s.FP.enabled:s.FP.disabled})}ngOnDestroy(){this.signupFormStatusChangeSubscription&&(this.signupFormStatusChangeSubscription.unsubscribe(),this.signupFormStatusChangeSubscription=null)}signup(){this.signupForm.invalid||this.isSubmitting||(this.window.mixpanel?.track("Koality-SignupStart",{}),this.isSubmitting=!0,this.alertService.clear(),this.submitting=s.FP.loading,this.application.step=d.WaitingOnAccountCreation,this.application.save().subscribe(()=>{this.monitoringService.createUser(new ut(this.signupForm.controls.email.value,this.signupForm.controls.acceptAgreement.value)).subscribe(e=>{this.alertService.clear(),this.application.step=d.AccountCreated,this.application.domain=this.signupForm.controls.domain.value,this.application.email=this.signupForm.controls.email.value,this.submitting=s.FP.disabled,this.window.mixpanel?.track("Koality-SignupStartSuccess",{}),this.application.save().subscribe(()=>{this._router.navigate(["confirm"])})},e=>{this.window.mixpanel?.track("Koality-SignupStartError",{}),this.alertService.clear(),this.alertService.error(this.locale.maketext("Failed to register your cPanel account with Site Quality Monitoring: [_1]",e)),this.submitting=s.FP.enabled,this.isSubmitting=!1,this.application.step=d.AccountCreationFailed})}))}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(v.K0),t.Y36(s.c9),t.Y36(et),t.Y36(J),t.Y36(U),t.Y36(m.qu),t.Y36(k.g),t.Y36(F),t.Y36(f.F0),t.Y36(f.gz),t.Y36(Window))},i.\u0275cmp=t.Xpm({type:i,selectors:[["cp-koality-signup-signup-form-view"]],viewQuery:function(e,n){if(1&e&&t.Gf(s.hg,5),2&e){let r;t.iGM(r=t.CRH())&&(n.formFieldComponent=r.first)}},inputs:{signupForm:"signupForm"},decls:56,vars:33,consts:[[1,"row","koality-signup__description"],[1,"col-sm-8","col-md-9"],[1,"container-fluid"],[1,"row-fluid"],[1,"col-sm-12","col-md-6"],[1,"far","fa-check-circle"],[1,"row"],[1,"col-xs-12","col-sm-9","col-md-8","koality-signup__form-container"],["autocomplete","off","id","koality_signup-form",1,"form-layout-medium",3,"formGroup","submit"],[1,"panel","panel-default"],[1,"panel-heading"],[1,"widget-title","pull-left","flip"],[1,"clearfix"],[1,"panel-body"],[1,"form-group"],["idPrefix","koality_signup-domain_field",1,"required-on-label",3,"control","showAllHelp","showInfoToggle","labelText","labelFor"],["field-label-help-text",""],["form-field-input-content",""],["id","koality_signup-domain","bindLabel","domain","bindValue","domain","cpValidationStrategy","","formControlName","domain",3,"items","placeholder"],["idPrefix","koality_signup-email_field",1,"required-on-label",3,"control","showAllHelp","showInfoToggle","labelText","labelFor"],["id","koality_signup-email","type","text","cpValidationStrategy","","formControlName","email",1,"form-control"],["id","agree","idPrefix","koality_signup-agree_field",3,"control","showAllHelp","showInfoToggle"],["id","koality_signup-agree-label",1,"required"],["id","koality_signup-agree","type","checkbox","formControlName","acceptAgreement"],[1,"panel-footer","koality-signup__panel-footer"],["type","submit",3,"id","buttonClass","buttonState","title","click"],["aria-hidden","true",1,"fas","fa-plus"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"p",1),t._uU(2),t.qZA(),t.TgZ(3,"div",1)(4,"div",2)(5,"div",3)(6,"div",4)(7,"ul")(8,"li"),t._UZ(9,"i",5),t._uU(10),t.qZA(),t.TgZ(11,"li"),t._UZ(12,"i",5),t._uU(13),t.qZA(),t.TgZ(14,"li"),t._UZ(15,"i",5),t._uU(16),t.qZA(),t.TgZ(17,"li"),t._UZ(18,"i",5),t._uU(19),t.qZA()()()()()(),t.TgZ(20,"div",1)(21,"h3"),t._uU(22),t.qZA()(),t.TgZ(23,"p",1),t._uU(24),t.qZA()(),t.TgZ(25,"div",6)(26,"div",7)(27,"form",8),t.NdJ("submit",function(){return n.signup()}),t.TgZ(28,"div",9)(29,"div",10)(30,"div",11),t._uU(31),t.qZA(),t._UZ(32,"div",12),t.qZA(),t.TgZ(33,"div",13)(34,"div",14)(35,"cp-form-field",15)(36,"div",16),t._uU(37),t.qZA(),t.TgZ(38,"div",17),t._UZ(39,"ng-select",18),t.qZA()()(),t.TgZ(40,"div",14)(41,"cp-form-field",19)(42,"div",16),t._uU(43),t.qZA(),t.TgZ(44,"div",17),t._UZ(45,"input",20),t.qZA()()(),t.TgZ(46,"div",14)(47,"cp-form-field",21)(48,"div",17)(49,"label",22),t._UZ(50,"input",23),t._uU(51),t.qZA()()()()(),t.TgZ(52,"div",24)(53,"cp-action-button",25),t.NdJ("click",function(){return n.signup()}),t._UZ(54,"i",26),t._uU(55),t.qZA()()()()()()),2&e&&(t.xp6(2),t.AsE(" ",n.locale.maketext("Site Quality Monitoring ensures that your website is accessible and discoverable by scanning it for common issues. This helps you diagnose and fix items.")," ",n.locale.maketext("Site Quality Monitoring gives you the following benefits:")," "),t.xp6(8),t.hij("",n.locale.maketext("1 monitored domain")," "),t.xp6(3),t.hij("",n.locale.maketext("Uptime scans every 1 hour")," "),t.xp6(3),t.hij("",n.locale.maketext("Full health and performance scans every 1 week")," "),t.xp6(3),t.hij("",n.locale.maketext("The ability to manually scan (crawl) 20 pages")," "),t.xp6(3),t.Oqu(n.locale.maketext("Ready to start?")),t.xp6(2),t.hij(" ",n.locale.maketext("Fill out the form below to monitor one of your websites.")," "),t.xp6(3),t.Q6J("formGroup",n.signupForm),t.xp6(4),t.hij(" ",n.locale.maketext("Create your first Site Quality Monitoring project.")," "),t.xp6(4),t.Q6J("control",n.signupForm.controls.domain)("showAllHelp",n.showAllHelp)("showInfoToggle",n.showInfoToggle)("labelText",n.locale.maketext("Monitored domain"))("labelFor","koality_signup-domain"),t.xp6(2),t.hij(" ",n.locale.maketext("Which domain would you like to monitor?")," "),t.xp6(2),t.s9C("placeholder",n.locale.maketext("Select a domain.")),t.Q6J("items",n.domains),t.xp6(2),t.Q6J("control",n.signupForm.controls.email)("showAllHelp",n.showAllHelp)("showInfoToggle",n.showInfoToggle)("labelText",n.locale.maketext("Email Address"))("labelFor","koality_signup-email"),t.xp6(2),t.hij(" ",n.locale.maketext("Send notification emails to this address.")," "),t.xp6(4),t.Q6J("control",n.signupForm.controls.acceptAgreement)("showAllHelp",!1)("showInfoToggle",!1),t.xp6(4),t.hij(" ",n.locale.maketext("I agree to receive notifications from Site Quality Monitoring at the above email address.")," "),t.xp6(2),t.s9C("title",n.locale.maketext("Sign up for Site Quality Monitoring.")),t.Q6J("id","signup-submit")("buttonClass","btn-primary")("buttonState",n.submitting),t.xp6(2),t.hij(" ",n.locale.maketext("Create project")," "))},directives:[m._Y,m.JL,m.sg,s.hg,V.w9,s.ln,m.JJ,m.u,m.Fj,m.Wl,s.xV],styles:['ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .fa-check-circle[_ngcontent-%COMP%]{color:#198754;padding:var(--cp-spacer-1)}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{padding:var(--cp-spacer-1)}ul[_ngcontent-%COMP%]{list-style-type:none}html[dir=ltr][_ngcontent-%COMP%] ul[_ngcontent-%COMP%], [dir=ltr][_ngcontent-%COMP%] ul[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] ul[_ngcontent-%COMP%], html[dir=ltr][_nghost-%COMP%] ul[_ngcontent-%COMP%], html[dir=ltr] [_nghost-%COMP%] ul[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] ul[_ngcontent-%COMP%], [dir=ltr] [_nghost-%COMP%] ul[_ngcontent-%COMP%]{padding-left:0}html[dir=rtl][_ngcontent-%COMP%] ul[_ngcontent-%COMP%], [dir=rtl][_ngcontent-%COMP%] ul[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] ul[_ngcontent-%COMP%], html[dir=rtl][_nghost-%COMP%] ul[_ngcontent-%COMP%], html[dir=rtl] [_nghost-%COMP%] ul[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] ul[_ngcontent-%COMP%], [dir=rtl] [_nghost-%COMP%] ul[_ngcontent-%COMP%]{padding-right:0}.required[_ngcontent-%COMP%]:after{content:"*";color:#dc3545;padding:var(--cp-spacer-1)}#koality_signup-agree-label[_ngcontent-%COMP%]{padding-top:var(--cp-spacer-2)}']}),i})();const mt=new class pt extends _.uZ{constructor(){super(),this.prefix="pattern"}match(o,e){let n;return n="string"==typeof e||e instanceof String?new RegExp(n):e,r=>{let a={},u=r.value;return u&&(u=u.toString()),n.test(u)?null:(a=this.addError(a,"match",o),a)}}};class S{constructor(o,e,n,r,a,u,p,O,j){this.document=o,this.alertService=e,this.monitoringService=n,this.formBuilder=r,this.locale=a,this.application=u,this._router=p,this.defaultRoute=O,this.window=j,this.isLoading=!0,this.isSubmitting=!1,this.showAllHelp=!0,this.showInfoToggle=!0,this.verifyForm=this.formBuilder.group({code:["",{updateOn:"change",validators:[_.dt.maxLength(a.maketext("The security code must contain six digits."),6),_.dt.minLength(a.maketext("The security code must contain six digits."),6),mt.match(a.maketext("The security code must contain six numeric digits."),/[0-9]{6}/)]}]})}ngOnInit(){S._allowedEntryStates.has(this.application.step)?(this.isLoading=!1,this.submitting=s.FP.disabled,this.verifyFormStatusChangeSubscription=this.verifyForm.statusChanges.subscribe(o=>{this.submitting="VALID"===o?s.FP.enabled:s.FP.disabled})):this._router.navigate(["/signup"])}ngOnDestroy(){this.verifyFormStatusChangeSubscription&&(this.verifyFormStatusChangeSubscription.unsubscribe(),this.verifyFormStatusChangeSubscription=null)}verify(){this.verifyForm.invalid||this.isSubmitting||(this.window.mixpanel?.track("Koality-SubmitEmailVerification",{}),this.isSubmitting=!0,this.alertService.clear(),this.submitting=s.FP.loading,this.cancelSubmitting=s.FP.disabled,this.application.step=d.WaitingOnCodeVerification,this.application.save().subscribe(()=>this.verifyCodeSubscription=this.monitoringService.verifyCode(this.verifyForm.controls.code.value).subscribe(o=>(this.alertService.clear(),this.submitting=s.FP.disabled,this.application.step=d.CodeVerified,this.window.mixpanel?.track("Koality-SubmitEmailVerificationSuccess",{}),this.application.save().subscribe(()=>{this._router.navigate(["/provision"])})),o=>(this.alertService.clear(),this.alertService.error(this.locale.maketext("The code you provided is invalid. Enter the six-digit code in the latest email from Site Quality Monitoring.",o)),this.verifyForm.get("code").reset(),this.submitting=s.FP.enabled,setTimeout(()=>{this.submitting=s.FP.disabled},0),this.isSubmitting=!1,this.cancelSubmitting=s.FP.enabled,this.application.step=d.CodeVerificationFailed,this.window.mixpanel?.track("Koality-SubmitEmailVerificationError",{}),this.application.save().subscribe()))))}resend(){this.isSubmitting||(this.isSubmitting=!1,this.submitting=s.FP.disabled,this.cancelSubmitting=s.FP.disabled,this.resendSubmitting=s.FP.loading,this.alertService.clear(),this.window.mixpanel?.track("Koality-SubmitResendEmail",{}),this.monitoringService.resendCode().subscribe(o=>(this.verifyForm.get("code").reset(),this.application.step=d.AccountCreated,this.application.save().subscribe(()=>{o.sent?(this.alertService.clear(),this.alertService.success(this.locale.maketext("We sent a new security code to your email address.")),this.window.mixpanel?.track("Koality-SubmitResendEmailSuccess",{})):(this.alertService.clear(),this.alertService.error(this.locale.maketext("Failed to resend the activation code.")),this.window.mixpanel?.track("Koality-SubmitResendEmailError",{})),this.resendSubmitting=s.FP.enabled,this.cancelSubmitting=s.FP.enabled})),o=>{this.alertService.clear(),this.alertService.error(this.locale.maketext("Failed to resend the activation code with the following error: [_1]",o)),this.window.mixpanel?.track("Koality-SubmitResendEmailError",{}),this.resendSubmitting=s.FP.enabled,this.cancelSubmitting=s.FP.enabled,this.isSubmitting=!1}))}startover(){this.isSubmitting||(this.isSubmitting=!0,this.cancelSubmitting=s.FP.loading,this.resendSubmitting=s.FP.disabled,this.alertService.clear(),this.window.mixpanel?.track("Koality-SubmitStartOver",{}),this.monitoringService.resetConfig().subscribe(([o,e])=>{this.defaultRoute.route="",this.isSubmitting=!1,this.cancelSubmitting=s.FP.enabled,this.resendSubmitting=s.FP.enabled,this.window.mixpanel?.track("Koality-SubmitStartOverSuccess",{}),this._router.navigate(["/signup"])},o=>{this.alertService.clear(),this.alertService.error(this.locale.maketext("Failed to reset the user\u2019s configuration with the following error: [_1]",o)),this.isSubmitting=!1,this.cancelSubmitting=s.FP.enabled,this.resendSubmitting=s.FP.enabled,this.window.mixpanel?.track("Koality-SubmitStartOverError",{})}))}}S._allowedEntryStates=new Set([d.AccountCreated,d.CodeVerificationFailed]),S.\u0275fac=function(o){return new(o||S)(t.Y36(v.K0),t.Y36(s.c9),t.Y36(U),t.Y36(m.qu),t.Y36(k.g),t.Y36(F),t.Y36(f.F0),t.Y36(T),t.Y36(Window))},S.\u0275cmp=t.Xpm({type:S,selectors:[["cp-koality-signup-code-entry-view"]],viewQuery:function(o,e){if(1&o&&t.Gf(s.hg,5),2&o){let n;t.iGM(n=t.CRH())&&(e.formFieldComponent=n.first)}},inputs:{verifyForm:"verifyForm"},decls:30,vars:26,consts:[[1,"row","description","koality-verfiy__description"],[1,"col-xs-12","col-sm-8","col-md-8","col-lg-6"],[1,"row","description","koality-verfiy__description2"],[1,"row"],[1,"col-xs-12","col-sm-9","col-md-8","col-lg-6","koality-code-entry__form-container"],["autocomplete","off","id","koality_code_entry-form",1,"form-layout-medium",3,"formGroup","submit"],[1,"panel","panel-default"],[1,"panel-body"],[1,"form-group"],["idPrefix","koality_code_entry-code_field",3,"control","showAllHelp","showInfoToggle","labelText","labelFor"],["field-label-help-text",""],["form-field-input-content",""],["id","koality_code_entry-code","cpValidationStrategy","","type","text","maxlength","6","formControlName","code",1,"form-control"],[1,"form-group-resend","pull-right"],["type","button",3,"id","buttonClass","buttonState","title","click"],[1,"panel-footer","koality-code-entry__panel-footer"],["type","submit",3,"id","buttonClass","buttonState","title"],["aria-hidden","true",1,"fas","fa-plus"],["id","koality_code_entry-cancel","type","button",1,"pull-right",3,"buttonClass","buttonState","title","click"],["aria-hidden","true",1,"fas","fa-ban"]],template:function(o,e){1&o&&(t.TgZ(0,"div",0)(1,"p",1),t._uU(2),t.qZA()(),t.TgZ(3,"div",2)(4,"p",1),t._uU(5),t.qZA()(),t.TgZ(6,"div",3)(7,"div",4)(8,"form",5),t.NdJ("submit",function(){return e.verify()}),t.TgZ(9,"div",6)(10,"div",7)(11,"div",8)(12,"cp-form-field",9)(13,"div",10),t._uU(14),t.qZA(),t.TgZ(15,"div",11),t._UZ(16,"input",12),t.qZA()()(),t.TgZ(17,"div",8)(18,"div",13)(19,"div"),t._uU(20),t.qZA(),t.TgZ(21,"cp-action-button",14),t.NdJ("click",function(){return e.resend()}),t._uU(22),t.qZA()()()(),t.TgZ(23,"div",15)(24,"cp-action-button",16),t._UZ(25,"i",17),t._uU(26),t.qZA(),t.TgZ(27,"cp-action-button",18),t.NdJ("click",function(){return e.startover()}),t._UZ(28,"i",19),t._uU(29),t.qZA()()()()()()),2&o&&(t.xp6(2),t.hij(" ",e.locale.maketext("Your account is not completely set up. We sent a security code to the email address that you provided. Enter it in the form below.")," "),t.xp6(3),t.hij(" ",e.locale.maketext("If you cannot find the email in your inbox, check your spam folder.")," "),t.xp6(3),t.Q6J("formGroup",e.verifyForm),t.xp6(4),t.Q6J("control",e.verifyForm.controls.code)("showAllHelp",e.showAllHelp)("showInfoToggle",e.showInfoToggle)("labelText",e.locale.maketext("Security Code"))("labelFor","koality_code_entry-code_field"),t.xp6(2),t.hij(" ",e.locale.maketext("Enter the security code sent to the following email address: [_1]",e.application.email)," "),t.xp6(2),t.uIk("disabled",!!e.isSubmitting||null),t.xp6(4),t.hij(" ",e.locale.maketext("Didn\u2019t get the email?")," "),t.xp6(1),t.s9C("title",e.locale.maketext("Click to send a new security code to the requested email address.")),t.Q6J("id","koality_code_entry-resend")("buttonClass","btn-link")("buttonState",e.resendSubmitting),t.xp6(1),t.hij(" ",e.locale.maketext("Click to Resend")," "),t.xp6(2),t.s9C("title",e.locale.maketext("Activate Site Quality Monitoring.")),t.Q6J("id","koality_code_entry-activate")("buttonClass","btn-primary")("buttonState",e.submitting),t.xp6(2),t.hij(" ",e.locale.maketext("Activate")," "),t.xp6(1),t.s9C("title",e.locale.maketext("Start over")),t.Q6J("buttonClass","btn-link")("buttonState",e.cancelSubmitting),t.uIk("disabled",!!e.isSubmitting||null),t.xp6(2),t.hij(" ",e.locale.maketext("Cancel")," "))},directives:[m._Y,m.JL,m.sg,s.hg,m.Fj,s.ln,m.nD,m.JJ,m.u,s.xV],styles:[".description[_ngcontent-%COMP%]{padding-bottom:var(--cp-spacer-2)}html[dir=ltr][_ngcontent-%COMP%] .description[_ngcontent-%COMP%], [dir=ltr][_ngcontent-%COMP%] .description[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .description[_ngcontent-%COMP%], html[dir=ltr][_nghost-%COMP%] .description[_ngcontent-%COMP%], html[dir=ltr] [_nghost-%COMP%] .description[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .description[_ngcontent-%COMP%], [dir=ltr] [_nghost-%COMP%] .description[_ngcontent-%COMP%]{padding-left:var(--cp-spacer-2)}html[dir=rtl][_ngcontent-%COMP%] .description[_ngcontent-%COMP%], [dir=rtl][_ngcontent-%COMP%] .description[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .description[_ngcontent-%COMP%], html[dir=rtl][_nghost-%COMP%] .description[_ngcontent-%COMP%], html[dir=rtl] [_nghost-%COMP%] .description[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .description[_ngcontent-%COMP%], [dir=rtl] [_nghost-%COMP%] .description[_ngcontent-%COMP%]{padding-right:var(--cp-spacer-2)}.description[_ngcontent-%COMP%]:last-child{padding-bottom:var(--cp-spacer-4)}"]});var ht=l(4505),gt=l(3491),ft=l(8310),q=l(4139),vt=l(7716),H=l(2692),bt=l(1133),yt=l(5152),A=l(9306),K=l(3505);function St(i,o){if(1&i){const e=t.EpF();t.TgZ(0,"div",2)(1,"div",3)(2,"button",11),t.NdJ("click",function(){return t.CHM(e),t.oxw().provision()}),t._uU(3),t.qZA()()()}if(2&i){const e=t.oxw();t.xp6(3),t.hij(" ",e.locale.maketext("Try Again")," ")}}var c=(()=>{return(i=c||(c={}))[i.Init=0]="Init",i[i.Spin=1]="Spin",i[i.Done=2]="Done",c;var i})();class C{constructor(o,e,n,r,a,u,p){this.document=o,this.alertService=e,this.monitoringService=n,this.locale=r,this.application=a,this._router=u,this.window=p,this.faCog=A.b7W,this.faCheck=A.LEp,this.AnimationState=c,this.showRetry=!1,this.isLoading=!0,this.isSubmitting=!1,this.setupService=c.Init,this.createProject=c.Init,this.addUrl=c.Init,this.login=c.Init,this.animation$=new ht.X(void 0),this.animationStep=0,this.animationSteps=[{label:"service",start:()=>{this.setupService=c.Spin}},{label:"project",stop:()=>{this.setupService=c.Done},start:()=>{this.createProject=c.Spin}},{label:"home page",stop:()=>{this.createProject=c.Done},start:()=>{this.addUrl=c.Spin}},{label:"done",stop:()=>{this.addUrl=c.Done},start:()=>{this.login=c.Spin}},{label:"done",stop:()=>{this.login=c.Done}}]}ngOnInit(){this.isLoading=!1,C._allowedEntryStates.has(this.application.step)?this.provision():this._router.navigate(["/verify"])}resetAnimation(){this.setupService=c.Init,this.createProject=c.Init,this.addUrl=c.Init,this.login=c.Init}getLabelClass(o){switch(o){case c.Init:return"step step-label-init";case c.Spin:return"step step-label-spin";case c.Done:return"step step-label-done"}}getIcon(o){switch(o){case c.Init:case c.Spin:return A.b7W;case c.Done:return A.LEp}}startAnimation(){const o=r=>{r.stop&&r.stop(),r.start&&r.start()};this.animationStep=0;const e=this.animationSteps[this.animationStep++];return o(e),(0,gt.F)(2e3,ft.Z).pipe((0,H.b)(()=>{if(this.animationStep>this.animationSteps.length-1)return;const r=this.animationSteps[this.animationStep++];!r||o(r)}))}provision(){if(this.isSubmitting)return;this.window.mixpanel?.track("Koality-ProvisionStart",{}),this.isSubmitting=!0,this.alertService.clear();const o=[`https://${this.application.domain}`],e=[()=>{this.alertService.clear()},()=>{this.window.mixpanel?.track("Koality-ProvisionSuccess",{}),this.redirectToSpa()}],n=this.startAnimation();return this.application.step=d.WaitingOnProjectCreation,this.application.save().subscribe(()=>{const r=(0,q.of)(1).pipe((0,G.zg)(()=>this.monitoringService.addUrls(o).pipe((0,H.b)(p=>p,p=>{throw this.alertService.error(this.locale.maketext("Failed to set up your monitored URLs with the following error: [_1]",p)),p})),2)),a=(0,vt.aj)([n,r]).subscribe(u=>{u[1]&&this.animationStep>this.animationSteps.length-1&&(a?.unsubscribe(),this.isSubmitting=!1,(0,D.D)(e).pipe((0,bt.b)(p=>(0,q.of)(p).pipe((0,yt.g)(200)))).subscribe(p=>{p()}))},u=>(this.application.step=d.ProjectCreationFailed,this.showRetry=!0,this.isSubmitting=!1,this.window.mixpanel?.track("Koality-ProvisionFailed",{}),a?.unsubscribe(),this.resetAnimation(),this.application.save().subscribe()))})}redirectToSpa(){this.document.location.href="../index.html#/"}}C._allowedEntryStates=new Set([d.CodeVerified]),C.\u0275fac=function(o){return new(o||C)(t.Y36(v.K0),t.Y36(s.c9),t.Y36(U),t.Y36(k.g),t.Y36(F),t.Y36(f.F0),t.Y36(Window))},C.\u0275cmp=t.Xpm({type:C,selectors:[["cp-koality-signup-provision-view"]],decls:23,vars:18,consts:[[1,"row","description","koality-provision__description"],[1,"col-xs-12","col-sm-8","col-md-9"],[1,"row"],[1,"col-xs-12","col-sm-9","col-md-8"],[1,"steps"],["id","step--setup",3,"ngClass"],[3,"icon","spin"],["id","step--create-project",3,"ngClass"],["id","step--add-url",3,"ngClass"],["id","step--login",3,"ngClass"],["class","row",4,"ngIf"],["id","create-project_retry_button",1,"btn","btn-primary",3,"click"]],template:function(o,e){1&o&&(t.TgZ(0,"div",0)(1,"p",1),t._uU(2),t.qZA()(),t.TgZ(3,"div",2)(4,"div",3)(5,"ul",4)(6,"li",5),t._UZ(7,"fa-icon",6),t.TgZ(8,"span"),t._uU(9),t.qZA()(),t.TgZ(10,"li",7),t._UZ(11,"fa-icon",6),t.TgZ(12,"span"),t._uU(13),t.qZA()(),t.TgZ(14,"li",8),t._UZ(15,"fa-icon",6),t.TgZ(16,"span"),t._uU(17),t.qZA()(),t.TgZ(18,"li",9),t._UZ(19,"fa-icon",6),t.TgZ(20,"span"),t._uU(21),t.qZA()()()()(),t.YNc(22,St,4,1,"div",10)),2&o&&(t.xp6(2),t.hij(" ",e.locale.maketext("We have activated your account. We will now set up your Site Quality Monitoring project.")," "),t.xp6(4),t.Q6J("ngClass",e.getLabelClass(e.setupService)),t.xp6(1),t.Q6J("icon",e.getIcon(e.setupService))("spin",e.setupService===e.AnimationState.Spin),t.xp6(2),t.Oqu(e.locale.maketext("Setting up the service.")),t.xp6(1),t.Q6J("ngClass",e.getLabelClass(e.createProject)),t.xp6(1),t.Q6J("icon",e.getIcon(e.createProject))("spin",e.createProject===e.AnimationState.Spin),t.xp6(2),t.Oqu(e.locale.maketext("Creating a project for the domain [_1].",e.application.domain)),t.xp6(1),t.Q6J("ngClass",e.getLabelClass(e.addUrl)),t.xp6(1),t.Q6J("icon",e.getIcon(e.addUrl))("spin",e.addUrl===e.AnimationState.Spin),t.xp6(2),t.Oqu(e.locale.maketext("Starting to monitor your homepage at [_1].",e.application.url())),t.xp6(1),t.Q6J("ngClass",e.getLabelClass(e.login)),t.xp6(1),t.Q6J("icon",e.getIcon(e.login))("spin",e.login===e.AnimationState.Spin),t.xp6(2),t.Oqu(e.locale.maketext("You\u2019re ready to use Site Quality Monitoring.")),t.xp6(1),t.Q6J("ngIf",e.showRetry))},directives:[v.mk,K.BN,v.O5],styles:[".steps[_ngcontent-%COMP%]{list-style-type:none}.step[_ngcontent-%COMP%]{padding:var(--cp-spacer-2);white-space:nowrap}.step[_ngcontent-%COMP%] .ng-fa-icon[_ngcontent-%COMP%]{vertical-align:top}.step[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;padding-left:var(--cp-spacer-2);padding-right:var(--cp-spacer-2);text-wrap:balance;white-space:normal}.step-label-init[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{color:#858f98;width:24px;height:24px}.step-label-init[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#858f98;font-weight:400}.step-label-spin[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{color:default;width:24px;height:24px}.step-label-spin[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:700}.step-label-done[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{color:#83b655;width:24px;height:24px}.step-label-done[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:400}.description[_ngcontent-%COMP%]{padding-bottom:var(--cp-spacer-2)}.description[_ngcontent-%COMP%]:last-child{padding-bottom:var(--cp-spacer-4)}"]});let _t=(()=>{class i{constructor(e,n){this.router=e,this.defaultRoute=n}canActivate(e){const n=this.defaultRoute.route||"signup";if(!n||n===e.url[0].path)return!0;this.router.navigate([n])}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(f.F0),t.LFG(T))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})(),E=(()=>{class i{constructor(e){this.stateService=e}resolve(e,n){return this.stateService.load()}}return i.\u0275fac=function(e){return new(e||i)(t.LFG(F))},i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),i})();const Pt=[{path:"signup",canActivate:[_t],component:dt,resolve:{state:E}},{path:"confirm",component:S,resolve:{state:E}},{path:"provision",component:C,resolve:{state:E}},{path:"**",redirectTo:"signup"}];let kt=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i}),i.\u0275inj=t.cJS({imports:[[f.Bz.forRoot(Pt,{useHash:!0})],f.Bz]}),i})(),Ft=(()=>{class i{constructor(e){this.locale=e,this.title=e.maketext("Site Quality Monitoring")}}return i.\u0275fac=function(e){return new(e||i)(t.Y36(k.g))},i.\u0275cmp=t.Xpm({type:i,selectors:[["cp-koality-signup-root"]],decls:3,vars:0,consts:[[1,"body-content"],["id","koalSignup",1,"section","animate-view","ng-cloak"]],template:function(e,n){1&e&&(t._UZ(0,"cp-alert-list"),t.TgZ(1,"div",0),t._UZ(2,"router-outlet",1),t.qZA())},directives:[s.hF,f.lC],styles:[""]}),i})(),Ot=(()=>{class i extends v.Do{prepareExternalUrl(e){return this.getBaseHref()+"#"+e}}return i.\u0275fac=function(){let o;return function(n){return(o||(o=t.n5z(i)))(n||i)}}(),i.\u0275prov=t.Yz7({token:i,factory:i.\u0275fac}),i})();var Mt=l(3371);let xt=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=t.oAB({type:i,bootstrap:[Ft]}),i.\u0275inj=t.cJS({providers:[{provide:v.mr,useValue:B},{provide:Window,useValue:window},{provide:R,useValue:N},{provide:L,useValue:$},{provide:Q,useValue:X},{provide:T,useValue:tt},{provide:v.S$,useClass:Ot}],imports:[[M.b2,K.uH,kt,Z.au,m.UX,V.A0,s.zr,s.CQ,s.Sw,s.wH,s.kx,s.kM,s.wL,s.RU,Mt.m]]}),i})();(0,t.G48)(),M.q6().bootstrapModule(xt).catch(i=>console.error(i))}},P=>{P.O(0,[647,781],()=>P(P.s=9386)),P.O()}]);
//# sourceMappingURL=main.0bc7a1ca6fae93f4.js.map