Skip to content

Commit a6e2012

Browse files
authored
[PM-21600] Migrate account and security to standalone (#14762)
Migrates account and security settings components to standalone and removing them from the `LooseComponentsModule`.
1 parent beb00a2 commit a6e2012

13 files changed

+62
-54
lines changed

apps/web/src/app/auth/settings/account/account.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,27 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service";
88
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
99
import { DialogService } from "@bitwarden/components";
1010

11+
import { HeaderModule } from "../../../layouts/header/header.module";
12+
import { SharedModule } from "../../../shared";
1113
import { PurgeVaultComponent } from "../../../vault/settings/purge-vault.component";
1214

15+
import { ChangeEmailComponent } from "./change-email.component";
16+
import { DangerZoneComponent } from "./danger-zone.component";
1317
import { DeauthorizeSessionsComponent } from "./deauthorize-sessions.component";
1418
import { DeleteAccountDialogComponent } from "./delete-account-dialog.component";
19+
import { ProfileComponent } from "./profile.component";
1520
import { SetAccountVerifyDevicesDialogComponent } from "./set-account-verify-devices-dialog.component";
1621

1722
@Component({
18-
selector: "app-account",
1923
templateUrl: "account.component.html",
20-
standalone: false,
24+
standalone: true,
25+
imports: [
26+
SharedModule,
27+
HeaderModule,
28+
ProfileComponent,
29+
ChangeEmailComponent,
30+
DangerZoneComponent,
31+
],
2132
})
2233
export class AccountComponent implements OnInit, OnDestroy {
2334
private destroy$ = new Subject<void>();

apps/web/src/app/auth/settings/account/change-avatar-dialog.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ import {
2424
ToastService,
2525
} from "@bitwarden/components";
2626

27+
import { SharedModule } from "../../../shared";
28+
29+
import { SelectableAvatarComponent } from "./selectable-avatar.component";
30+
2731
type ChangeAvatarDialogData = {
2832
profile: ProfileResponse;
2933
};
3034

3135
@Component({
3236
templateUrl: "change-avatar-dialog.component.html",
3337
encapsulation: ViewEncapsulation.None,
34-
standalone: false,
38+
standalone: true,
39+
imports: [SharedModule, SelectableAvatarComponent],
3540
})
3641
export class ChangeAvatarDialogComponent implements OnInit, OnDestroy {
3742
profile: ProfileResponse;

apps/web/src/app/auth/settings/account/change-email.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ describe("ChangeEmailComponent", () => {
3333
accountService = mockAccountServiceWith("UserId" as UserId);
3434

3535
await TestBed.configureTestingModule({
36-
declarations: [ChangeEmailComponent],
37-
imports: [ReactiveFormsModule, SharedModule],
36+
imports: [ReactiveFormsModule, SharedModule, ChangeEmailComponent],
3837
providers: [
3938
{ provide: AccountService, useValue: accountService },
4039
{ provide: ApiService, useValue: apiService },

apps/web/src/app/auth/settings/account/change-email.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ import { UserId } from "@bitwarden/common/types/guid";
1414
import { ToastService } from "@bitwarden/components";
1515
import { KdfConfigService, KeyService } from "@bitwarden/key-management";
1616

17+
import { SharedModule } from "../../../shared";
18+
1719
@Component({
1820
selector: "app-change-email",
1921
templateUrl: "change-email.component.html",
20-
standalone: false,
22+
standalone: true,
23+
imports: [SharedModule],
2124
})
2225
export class ChangeEmailComponent implements OnInit {
2326
tokenSent = false;

apps/web/src/app/auth/settings/account/danger-zone.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import { CommonModule } from "@angular/common";
44
import { Component } from "@angular/core";
55

6-
import { JslibModule } from "@bitwarden/angular/jslib.module";
76
import { TypographyModule } from "@bitwarden/components";
7+
import { I18nPipe } from "@bitwarden/ui-common";
88

99
/**
1010
* Component for the Danger Zone section of the Account/Organization Settings page.
@@ -13,6 +13,6 @@ import { TypographyModule } from "@bitwarden/components";
1313
selector: "app-danger-zone",
1414
templateUrl: "danger-zone.component.html",
1515
standalone: true,
16-
imports: [TypographyModule, JslibModule, CommonModule],
16+
imports: [CommonModule, TypographyModule, I18nPipe],
1717
})
1818
export class DangerZoneComponent {}

apps/web/src/app/auth/settings/account/deauthorize-sessions.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component } from "@angular/core";
22
import { FormBuilder } from "@angular/forms";
33

4+
import { UserVerificationFormInputComponent } from "@bitwarden/auth/angular";
45
import { ApiService } from "@bitwarden/common/abstractions/api.service";
56
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
67
import { Verification } from "@bitwarden/common/auth/types/verification";
@@ -9,10 +10,12 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
910
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
1011
import { DialogService, ToastService } from "@bitwarden/components";
1112

13+
import { SharedModule } from "../../../shared";
14+
1215
@Component({
13-
selector: "app-deauthorize-sessions",
1416
templateUrl: "deauthorize-sessions.component.html",
15-
standalone: false,
17+
standalone: true,
18+
imports: [SharedModule, UserVerificationFormInputComponent],
1619
})
1720
export class DeauthorizeSessionsComponent {
1821
deauthForm = this.formBuilder.group({

apps/web/src/app/auth/settings/account/delete-account-dialog.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
import { Component } from "@angular/core";
44
import { FormBuilder } from "@angular/forms";
55

6+
import { UserVerificationFormInputComponent } from "@bitwarden/auth/angular";
67
import { AccountApiService } from "@bitwarden/common/auth/abstractions/account-api.service";
78
import { Verification } from "@bitwarden/common/auth/types/verification";
89
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
910
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
1011
import { DialogRef, DialogService, ToastService } from "@bitwarden/components";
1112

13+
import { SharedModule } from "../../../shared";
14+
1215
@Component({
1316
templateUrl: "delete-account-dialog.component.html",
14-
standalone: false,
17+
standalone: true,
18+
imports: [SharedModule, UserVerificationFormInputComponent],
1519
})
1620
export class DeleteAccountDialogComponent {
1721
deleteForm = this.formBuilder.group({

apps/web/src/app/auth/settings/account/profile.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ import { ProfileResponse } from "@bitwarden/common/models/response/profile.respo
1414
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
1515
import { DialogService, ToastService } from "@bitwarden/components";
1616

17+
import { DynamicAvatarComponent } from "../../../components/dynamic-avatar.component";
18+
import { SharedModule } from "../../../shared";
19+
import { AccountFingerprintComponent } from "../../../shared/components/account-fingerprint/account-fingerprint.component";
20+
1721
import { ChangeAvatarDialogComponent } from "./change-avatar-dialog.component";
1822

1923
@Component({
2024
selector: "app-profile",
2125
templateUrl: "profile.component.html",
22-
standalone: false,
26+
standalone: true,
27+
imports: [SharedModule, DynamicAvatarComponent, AccountFingerprintComponent],
2328
})
2429
export class ProfileComponent implements OnInit, OnDestroy {
2530
loading = true;

apps/web/src/app/auth/settings/account/selectable-avatar.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// FIXME: Update this file to be type safe and remove this and next line
22
// @ts-strict-ignore
3+
import { NgClass } from "@angular/common";
34
import { Component, EventEmitter, Input, Output } from "@angular/core";
45

6+
import { AvatarModule } from "@bitwarden/components";
7+
58
@Component({
69
selector: "selectable-avatar",
710
template: `<span
@@ -24,7 +27,8 @@ import { Component, EventEmitter, Input, Output } from "@angular/core";
2427
>
2528
</bit-avatar>
2629
</span>`,
27-
standalone: false,
30+
standalone: true,
31+
imports: [NgClass, AvatarModule],
2832
})
2933
export class SelectableAvatarComponent {
3034
@Input() id: string;

apps/web/src/app/auth/settings/security/api-key.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
import { Component, Inject } from "@angular/core";
44
import { FormBuilder, Validators } from "@angular/forms";
55

6+
import { UserVerificationFormInputComponent } from "@bitwarden/auth/angular";
67
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
78
import { SecretVerificationRequest } from "@bitwarden/common/auth/models/request/secret-verification.request";
89
import { ApiKeyResponse } from "@bitwarden/common/auth/models/response/api-key.response";
910
import { Verification } from "@bitwarden/common/auth/types/verification";
1011
import { DIALOG_DATA, DialogConfig, DialogService } from "@bitwarden/components";
1112

13+
import { SharedModule } from "../../../shared";
14+
1215
export type ApiKeyDialogData = {
1316
keyType: string;
1417
isRotation?: boolean;
@@ -21,9 +24,9 @@ export type ApiKeyDialogData = {
2124
apiKeyDescription: string;
2225
};
2326
@Component({
24-
selector: "app-api-key",
2527
templateUrl: "api-key.component.html",
26-
standalone: false,
28+
standalone: true,
29+
imports: [SharedModule, UserVerificationFormInputComponent],
2730
})
2831
export class ApiKeyComponent {
2932
clientId: string;

0 commit comments

Comments
 (0)