mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
Auth/PM-7324 - Registration with Email Verification - Registration Start Component Implementation (#9573)
* PM-7324 - Register new registration start comp at signup route on web * PM-7324 - Add registerSendVerificationEmail logic in API service layer. * PM-7324 - Update registration start comp to actually send information to API and trigger email. * PM-7324 - progress on opt in for marketing emails redesign. * PM-7324 - Add feature flag and feature flag guard to sign up route. * PM-7324 - RegistrationEnvSelector - emit initial value * PM-7324 - Registration Start comp - wire up setReceiveMarketingEmailsByRegion logic. * PM-7324 - Registration start html - use proper link for email pref management. * PM-7324 - Translate text * PM-7324 - Design pass * PM-7324 - design pass v2 * PM-7324 - Update Tailwind config to add availability of anon layout to desktop and browser extension * PM-7324 - Desktop - AppRoutingModule - Add new signup route protected by the email verification feature flag. * PM-7324 - BrowserExtension - AppRoutingModule - Add signup route protected by feature flag * PM-7324 - Feature flag all register page navigations to redirect users to the new signup page. * PM-7324 - Update AnonLayoutWrapperComponent constructor logic to avoid passing undefined values into I18nService.t method * PM-7324 - Accept org invite web comp - adjust register url and qParams * PM-7324 - Add AnonLayoutWrapperData to desktop & browser since we don't need titleId. * PM-7324 - Revert anon layout wrapper comp changes as they were made separately and merged to main. * PM-7234 - Fix registration start component so the login route works for the browser extension. * PM-7324 - Registration start story now building again + fix storybook warning around BrowserAnimationsModule * PM-7324 - Registration Start - add missing tw-text-main to fix dark mode rendering. * PM-7324 - Update storybook docs * PM-7324 - Get stub of registration finish component so that the verify email has something to land on. * PM-7324 - Registration start - receive marketing materials should never be required. * PM-7324 - Add finish signup route + required translations to desktop & browser. * PM-7324 - AnonLayoutWrapperComponent - Resolve issues where navigating to a sibling anonymous route wouldn't update the AnonLayoutWrapperData. * PM-7324 - Remove unnecessary array * PM-7324 - Per PR feedback, improve setReceiveMarketingEmailsByRegion * PM-7324 - Per PR feedback, inject login routes via route data * PM-7324 - Document methods in account api service * PM-7324 - PR feedback - jsdoc tweaks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { ActivatedRoute, RouterModule } from "@angular/router";
|
||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute, Data, NavigationEnd, Router, RouterModule } from "@angular/router";
|
||||
import { Subject, filter, switchMap, takeUntil, tap } from "rxjs";
|
||||
|
||||
import { AnonLayoutComponent } from "@bitwarden/auth/angular";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
@@ -17,31 +18,64 @@ export interface AnonLayoutWrapperData {
|
||||
templateUrl: "anon-layout-wrapper.component.html",
|
||||
imports: [AnonLayoutComponent, RouterModule],
|
||||
})
|
||||
export class AnonLayoutWrapperComponent {
|
||||
export class AnonLayoutWrapperComponent implements OnInit, OnDestroy {
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
protected pageTitle: string;
|
||||
protected pageSubtitle: string;
|
||||
protected pageIcon: Icon;
|
||||
protected showReadonlyHostname: boolean;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private i18nService: I18nService,
|
||||
) {
|
||||
const routeData = this.route.snapshot.firstChild?.data;
|
||||
) {}
|
||||
|
||||
if (!routeData) {
|
||||
ngOnInit(): void {
|
||||
// Set the initial page data on load
|
||||
this.setAnonLayoutWrapperData(this.route.snapshot.firstChild?.data);
|
||||
|
||||
// Listen for page changes and update the page data appropriately
|
||||
this.router.events
|
||||
.pipe(
|
||||
filter((event) => event instanceof NavigationEnd),
|
||||
// reset page data on page changes
|
||||
tap(() => this.resetPageData()),
|
||||
switchMap(() => this.route.firstChild?.data || null),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((firstChildRouteData: Data | null) => {
|
||||
this.setAnonLayoutWrapperData(firstChildRouteData);
|
||||
});
|
||||
}
|
||||
|
||||
private setAnonLayoutWrapperData(firstChildRouteData: Data | null) {
|
||||
if (!firstChildRouteData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (routeData["pageTitle"] !== undefined) {
|
||||
this.pageTitle = this.i18nService.t(routeData["pageTitle"]);
|
||||
if (firstChildRouteData["pageTitle"] !== undefined) {
|
||||
this.pageTitle = this.i18nService.t(firstChildRouteData["pageTitle"]);
|
||||
}
|
||||
|
||||
if (routeData["pageSubtitle"] !== undefined) {
|
||||
this.pageSubtitle = this.i18nService.t(routeData["pageSubtitle"]);
|
||||
if (firstChildRouteData["pageSubtitle"] !== undefined) {
|
||||
this.pageSubtitle = this.i18nService.t(firstChildRouteData["pageSubtitle"]);
|
||||
}
|
||||
|
||||
this.pageIcon = routeData["pageIcon"];
|
||||
this.showReadonlyHostname = routeData["showReadonlyHostname"];
|
||||
this.pageIcon = firstChildRouteData["pageIcon"];
|
||||
this.showReadonlyHostname = firstChildRouteData["showReadonlyHostname"];
|
||||
}
|
||||
|
||||
private resetPageData() {
|
||||
this.pageTitle = null;
|
||||
this.pageSubtitle = null;
|
||||
this.pageIcon = null;
|
||||
this.showReadonlyHostname = null;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user