1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 05:53:42 +00:00

Replace account service with Input

This commit is contained in:
albertboyd
2025-01-23 21:16:15 -06:00
parent e060371c6f
commit 6d4c8e11d1
19 changed files with 138 additions and 106 deletions

View File

@@ -8,6 +8,7 @@
<vault-cipher-form-generator
[type]="params.type"
[account]="account"
(valueGenerated)="onValueGenerated($event)"
></vault-cipher-form-generator>

View File

@@ -4,7 +4,9 @@ import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog";
import { Overlay } from "@angular/cdk/overlay";
import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { Subject, takeUntil } from "rxjs";
import { AccountService, Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { ButtonModule, DialogService } from "@bitwarden/components";
import { CipherFormGeneratorComponent } from "@bitwarden/vault";
@@ -60,11 +62,26 @@ export class VaultGeneratorDialogComponent {
*/
protected generatedValue: string = "";
/**
* The currently active account.
*/
protected account: Account | null = null;
/**
* Emits when the component is destroyed to clean up subscriptions.
*/
private readonly destroyed$ = new Subject<void>();
constructor(
@Inject(DIALOG_DATA) protected params: GeneratorDialogParams,
private dialogRef: DialogRef<GeneratorDialogResult>,
private i18nService: I18nService,
) {}
private accountService: AccountService,
) {
this.accountService.activeAccount$.pipe(takeUntil(this.destroyed$)).subscribe((account) => {
this.account = account;
});
}
/**
* Close the dialog without selecting a value.

View File

@@ -6,6 +6,7 @@
<vault-cipher-form-generator
[type]="params.type"
(valueGenerated)="onValueGenerated($event)"
[account]="account"
disableMargin
></vault-cipher-form-generator>
</ng-container>

View File

@@ -3,7 +3,9 @@
import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { takeUntil, Subject } from "rxjs";
import { AccountService, Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { ButtonModule, DialogModule, DialogService } from "@bitwarden/components";
import { CipherFormGeneratorComponent } from "@bitwarden/vault";
@@ -48,11 +50,26 @@ export class WebVaultGeneratorDialogComponent {
*/
protected generatedValue: string = "";
/**
* The currently active account.
*/
protected account: Account | null = null;
/**
* Emits when the component is destroyed to clean up subscriptions.
*/
private readonly destroyed$ = new Subject<void>();
constructor(
@Inject(DIALOG_DATA) protected params: WebVaultGeneratorDialogParams,
private dialogRef: DialogRef<WebVaultGeneratorDialogResult>,
private i18nService: I18nService,
) {}
private accountService: AccountService,
) {
this.accountService.activeAccount$.pipe(takeUntil(this.destroyed$)).subscribe((account) => {
this.account = account;
});
}
/**
* Close the dialog without selecting a value.

View File

@@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angu
import { FormBuilder } from "@angular/forms";
import { BehaviorSubject, map, skip, Subject, takeUntil, withLatestFrom } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
CatchallGenerationOptions,
@@ -12,8 +12,6 @@ import {
Generators,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
/** Options group for catchall emails */
@Component({
selector: "tools-catchall-settings",
@@ -21,16 +19,16 @@ import { completeOnAccountSwitch } from "./util";
})
export class CatchallSettingsComponent implements OnInit, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param formBuilder reactive form controls
*/
constructor(
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private accountService: AccountService,
) {}
@Input() account: Account | null = null;
/** Binds the component to a specific user's settings.
* When this input is not provided, the form binds to the active
* user
@@ -84,10 +82,11 @@ export class CatchallSettingsComponent implements OnInit, OnDestroy {
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly destroyed$ = new Subject<void>();

View File

@@ -2,12 +2,12 @@
// @ts-strict-ignore
import { DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { Component, Input } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { BehaviorSubject, distinctUntilChanged, firstValueFrom, map, switchMap } from "rxjs";
import { BehaviorSubject, firstValueFrom, map, switchMap } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import { ButtonModule, DialogModule, DialogService } from "@bitwarden/components";
import { GeneratorHistoryService } from "@bitwarden/generator-history";
@@ -28,22 +28,18 @@ import { EmptyCredentialHistoryComponent } from "./empty-credential-history.comp
],
})
export class CredentialGeneratorHistoryDialogComponent {
@Input() account: Account | null = null;
protected readonly hasHistory$ = new BehaviorSubject<boolean>(false);
protected readonly userId$ = new BehaviorSubject<UserId>(null);
constructor(
private accountService: AccountService,
private history: GeneratorHistoryService,
private dialogService: DialogService,
private dialogRef: DialogRef,
) {
this.accountService.activeAccount$
.pipe(
takeUntilDestroyed(),
map(({ id }) => id),
distinctUntilChanged(),
)
.subscribe(this.userId$);
if (this.account) {
this.userId$.next(this.account.id);
}
this.userId$
.pipe(

View File

@@ -1,13 +1,13 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { Component, Input } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { RouterLink } from "@angular/router";
import { BehaviorSubject, distinctUntilChanged, map, switchMap } from "rxjs";
import { BehaviorSubject, map, switchMap } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
ColorPasswordModule,
@@ -40,21 +40,17 @@ import { GeneratorModule } from "./generator.module";
],
})
export class CredentialGeneratorHistoryComponent {
@Input() account: Account | null = null;
protected readonly userId$ = new BehaviorSubject<UserId>(null);
protected readonly credentials$ = new BehaviorSubject<GeneratedCredential[]>([]);
constructor(
private accountService: AccountService,
private generatorService: CredentialGeneratorService,
private history: GeneratorHistoryService,
) {
this.accountService.activeAccount$
.pipe(
takeUntilDestroyed(),
map(({ id }) => id),
distinctUntilChanged(),
)
.subscribe(this.userId$);
if (this.account) {
this.userId$.next(this.account.id);
}
this.userId$
.pipe(

View File

@@ -17,7 +17,7 @@ import {
withLatestFrom,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { IntegrationId } from "@bitwarden/common/tools/integration";
@@ -57,7 +57,6 @@ export class CredentialGeneratorComponent implements OnInit, OnDestroy {
private toastService: ToastService,
private logService: LogService,
private i18nService: I18nService,
private accountService: AccountService,
private zone: NgZone,
private formBuilder: FormBuilder,
) {}
@@ -68,6 +67,9 @@ export class CredentialGeneratorComponent implements OnInit, OnDestroy {
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
/** Emits credentials created from a generation request. */
@Output()
readonly onGenerated = new EventEmitter<GeneratedCredential>();
@@ -97,13 +99,9 @@ export class CredentialGeneratorComponent implements OnInit, OnDestroy {
if (this.userId) {
this.userId$.next(this.userId);
} else {
this.accountService.activeAccount$
.pipe(
map((acct) => acct.id),
distinctUntilChanged(),
takeUntil(this.destroyed),
)
.subscribe(this.userId$);
if (this.account) {
this.userId$.next(this.account.id);
}
}
this.generatorService

View File

@@ -23,7 +23,7 @@ import {
withLatestFrom,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { IntegrationId } from "@bitwarden/common/tools/integration";
import { UserId } from "@bitwarden/common/types/guid";
import {
@@ -34,8 +34,6 @@ import {
toCredentialGeneratorConfiguration,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
const Controls = Object.freeze({
domain: "domain",
token: "token",
@@ -49,14 +47,12 @@ const Controls = Object.freeze({
})
export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param formBuilder reactive form controls
*/
constructor(
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private accountService: AccountService,
) {}
/** Binds the component to a specific user's settings.
@@ -66,6 +62,9 @@ export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
@Input({ required: true })
forwarder: IntegrationId;
@@ -170,10 +169,11 @@ export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly refresh$ = new Subject<void>();

View File

@@ -13,7 +13,7 @@ import {
ReplaySubject,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
@@ -22,8 +22,6 @@ import {
PassphraseGenerationOptions,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
const Controls = Object.freeze({
numWords: "numWords",
includeNumber: "includeNumber",
@@ -38,7 +36,6 @@ const Controls = Object.freeze({
})
export class PassphraseSettingsComponent implements OnInit, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param i18nService localize hints
* @param formBuilder reactive form controls
@@ -47,7 +44,6 @@ export class PassphraseSettingsComponent implements OnInit, OnDestroy {
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private i18nService: I18nService,
private accountService: AccountService,
) {}
/** Binds the component to a specific user's settings.
@@ -57,6 +53,9 @@ export class PassphraseSettingsComponent implements OnInit, OnDestroy {
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
/** When `true`, an options header is displayed by the component. Otherwise, the header is hidden. */
@Input()
showHeader: boolean = true;
@@ -159,10 +158,11 @@ export class PassphraseSettingsComponent implements OnInit, OnDestroy {
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly destroyed$ = new Subject<void>();

View File

@@ -40,6 +40,7 @@
class="tw-mt-6"
*ngIf="(algorithm$ | async)?.id === 'password'"
[userId]="this.userId$ | async"
[account]="account"
[disableMargin]="disableMargin"
(onUpdated)="generate('password settings')"
/>
@@ -47,6 +48,7 @@
class="tw-mt-6"
*ngIf="(algorithm$ | async)?.id === 'passphrase'"
[userId]="this.userId$ | async"
[account]="account"
(onUpdated)="generate('passphrase settings')"
[disableMargin]="disableMargin"
/>

View File

@@ -15,7 +15,7 @@ import {
withLatestFrom,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { UserId } from "@bitwarden/common/types/guid";
@@ -43,10 +43,11 @@ export class PasswordGeneratorComponent implements OnInit, OnDestroy {
private toastService: ToastService,
private logService: LogService,
private i18nService: I18nService,
private accountService: AccountService,
private zone: NgZone,
) {}
@Input() account: Account | null = null;
/** Binds the component to a specific user's settings.
* When this input is not provided, the form binds to the active
* user
@@ -101,13 +102,9 @@ export class PasswordGeneratorComponent implements OnInit, OnDestroy {
if (this.userId) {
this.userId$.next(this.userId);
} else {
this.accountService.activeAccount$
.pipe(
map((acct) => acct.id),
distinctUntilChanged(),
takeUntil(this.destroyed),
)
.subscribe(this.userId$);
if (this.account) {
this.userId$.next(this.account.id);
}
}
this.generatorService

View File

@@ -15,7 +15,7 @@ import {
withLatestFrom,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
@@ -24,8 +24,6 @@ import {
PasswordGenerationOptions,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
const Controls = Object.freeze({
length: "length",
uppercase: "uppercase",
@@ -44,7 +42,6 @@ const Controls = Object.freeze({
})
export class PasswordSettingsComponent implements OnInit, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param i18nService localize hints
* @param formBuilder reactive form controls
@@ -53,7 +50,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private i18nService: I18nService,
private accountService: AccountService,
) {}
/** Binds the password component to a specific user's settings.
@@ -63,6 +59,9 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
/** When `true`, an options header is displayed by the component. Otherwise, the header is hidden. */
@Input()
showHeader: boolean = true;
@@ -250,10 +249,11 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly destroyed$ = new Subject<void>();

View File

@@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angu
import { FormBuilder } from "@angular/forms";
import { BehaviorSubject, map, skip, Subject, takeUntil, withLatestFrom } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
CredentialGeneratorService,
@@ -12,8 +12,6 @@ import {
SubaddressGenerationOptions,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
/** Options group for plus-addressed emails */
@Component({
selector: "tools-subaddress-settings",
@@ -21,14 +19,12 @@ import { completeOnAccountSwitch } from "./util";
})
export class SubaddressSettingsComponent implements OnInit, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param formBuilder reactive form controls
*/
constructor(
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private accountService: AccountService,
) {}
/** Binds the component to a specific user's settings.
@@ -38,6 +34,9 @@ export class SubaddressSettingsComponent implements OnInit, OnDestroy {
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
/** Emits settings updates and completes if the settings become unavailable.
* @remarks this does not emit the initial settings. If you would like
* to receive live settings updates including the initial update,
@@ -83,10 +82,11 @@ export class SubaddressSettingsComponent implements OnInit, OnDestroy {
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly destroyed$ = new Subject<void>();

View File

@@ -61,21 +61,25 @@
<tools-catchall-settings
*ngIf="(algorithm$ | async)?.id === 'catchall'"
[userId]="this.userId$ | async"
[account]="account"
(onUpdated)="generate('catchall settings')"
/>
<tools-forwarder-settings
*ngIf="!!(forwarderId$ | async)"
[forwarder]="forwarderId$ | async"
[userId]="this.userId$ | async"
[account]="account"
/>
<tools-subaddress-settings
*ngIf="(algorithm$ | async)?.id === 'subaddress'"
[userId]="this.userId$ | async"
[account]="account"
(onUpdated)="generate('subaddress settings')"
/>
<tools-username-settings
*ngIf="(algorithm$ | async)?.id === 'username'"
[userId]="this.userId$ | async"
[account]="account"
(onUpdated)="generate('username settings')"
/>
</bit-card>

View File

@@ -18,7 +18,7 @@ import {
withLatestFrom,
} from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { IntegrationId } from "@bitwarden/common/tools/integration";
@@ -53,7 +53,6 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy {
/** Instantiates the username generator
* @param generatorService generates credentials; stores preferences
* @param i18nService localizes generator algorithm descriptions
* @param accountService discovers the active user when one is not provided
* @param zone detects generator settings updates originating from the generator services
* @param formBuilder binds reactive form
*/
@@ -63,11 +62,12 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy {
private toastService: ToastService,
private logService: LogService,
private i18nService: I18nService,
private accountService: AccountService,
private zone: NgZone,
private formBuilder: FormBuilder,
) {}
@Input() account: Account | null = null;
/** Binds the component to a specific user's settings. When this input is not provided,
* the form binds to the active user
*/
@@ -98,13 +98,9 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy {
if (this.userId) {
this.userId$.next(this.userId);
} else {
this.accountService.activeAccount$
.pipe(
map((acct) => acct.id),
distinctUntilChanged(),
takeUntil(this.destroyed),
)
.subscribe(this.userId$);
if (this.account) {
this.userId$.next(this.account.id);
}
}
this.generatorService

View File

@@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angu
import { FormBuilder } from "@angular/forms";
import { BehaviorSubject, map, skip, Subject, takeUntil, withLatestFrom } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import {
CredentialGeneratorService,
@@ -12,8 +12,6 @@ import {
Generators,
} from "@bitwarden/generator-core";
import { completeOnAccountSwitch } from "./util";
/** Options group for usernames */
@Component({
selector: "tools-username-settings",
@@ -21,14 +19,12 @@ import { completeOnAccountSwitch } from "./util";
})
export class UsernameSettingsComponent implements OnInit, OnDestroy {
/** Instantiates the component
* @param accountService queries user availability
* @param generatorService settings and policy logic
* @param formBuilder reactive form controls
*/
constructor(
private formBuilder: FormBuilder,
private generatorService: CredentialGeneratorService,
private accountService: AccountService,
) {}
/** Binds the component to a specific user's settings.
@@ -38,6 +34,9 @@ export class UsernameSettingsComponent implements OnInit, OnDestroy {
@Input()
userId: UserId | null;
@Input()
account: Account | null = null;
/** Emits settings updates and completes if the settings become unavailable.
* @remarks this does not emit the initial settings. If you would like
* to receive live settings updates including the initial update,
@@ -84,10 +83,11 @@ export class UsernameSettingsComponent implements OnInit, OnDestroy {
return new BehaviorSubject(this.userId as UserId).asObservable();
}
return this.accountService.activeAccount$.pipe(
completeOnAccountSwitch(),
takeUntil(this.destroyed$),
);
if (this.account) {
return new BehaviorSubject(this.account.id as UserId).asObservable();
}
return new BehaviorSubject<UserId | null>(null).asObservable();
}
private readonly destroyed$ = new Subject<void>();

View File

@@ -1,12 +1,14 @@
<tools-password-generator
*ngIf="type === 'password'"
[disableMargin]="disableMargin"
[account]="account"
(onGenerated)="onCredentialGenerated($event)"
(onAlgorithm)="algorithm($event)"
></tools-password-generator>
<tools-username-generator
*ngIf="type === 'username'"
[disableMargin]="disableMargin"
[account]="account"
(onGenerated)="onCredentialGenerated($event)"
(onAlgorithm)="algorithm($event)"
></tools-username-generator>

View File

@@ -4,6 +4,7 @@ import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { CommonModule } from "@angular/common";
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { Account } from "@bitwarden/common/auth/abstractions/account.service";
import { GeneratorModule } from "@bitwarden/generator-components";
import { AlgorithmInfo, GeneratedCredential } from "@bitwarden/generator-core";
@@ -21,6 +22,11 @@ export class CipherFormGeneratorComponent {
@Input()
algorithm: (selected: AlgorithmInfo) => void;
/**
* The account object passed from the parent component.
*/
@Input() account: Account | null = null;
/**
* The type of generator form to show.
*/