diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 0a82a07b722..bb89eff1147 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -136,6 +136,7 @@ import { DialogService, ToastService, } from "@bitwarden/components"; +import { GeneratorServicesModule } from "@bitwarden/generator-components"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy"; import { BiometricsService, @@ -743,7 +744,7 @@ const safeProviders: SafeProvider[] = [ ]; @NgModule({ - imports: [JslibServicesModule], + imports: [JslibServicesModule, GeneratorServicesModule], declarations: [], // Do not register your dependency here! Add it to the typesafeProviders array using the helper function providers: safeProviders, diff --git a/apps/desktop/src/app/services/services.module.ts b/apps/desktop/src/app/services/services.module.ts index 5e20b2fa921..1b373f08881 100644 --- a/apps/desktop/src/app/services/services.module.ts +++ b/apps/desktop/src/app/services/services.module.ts @@ -102,6 +102,7 @@ import { GlobalStateProvider, StateProvider } from "@bitwarden/common/platform/s import { SyncService } from "@bitwarden/common/platform/sync"; import { CipherService as CipherServiceAbstraction } from "@bitwarden/common/vault/abstractions/cipher.service"; import { DialogService, ToastService } from "@bitwarden/components"; +import { GeneratorServicesModule } from "@bitwarden/generator-components"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy"; import { KdfConfigService, @@ -499,7 +500,7 @@ const safeProviders: SafeProvider[] = [ ]; @NgModule({ - imports: [JslibServicesModule], + imports: [JslibServicesModule, GeneratorServicesModule], declarations: [], // Do not register your dependency here! Add it to the typesafeProviders array using the helper function providers: safeProviders, diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index ab8f06dcf32..fb42e19f863 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -112,6 +112,7 @@ import { } from "@bitwarden/common/platform/theming/theme-state.service"; import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service"; import { DialogService, ToastService } from "@bitwarden/components"; +import { GeneratorServicesModule } from "@bitwarden/generator-components"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy"; import { KdfConfigService, @@ -484,7 +485,7 @@ const safeProviders: SafeProvider[] = [ @NgModule({ declarations: [], - imports: [CommonModule, JslibServicesModule], + imports: [CommonModule, JslibServicesModule, GeneratorServicesModule], // Do not register your dependency here! Add it to the typesafeProviders array using the helper function providers: safeProviders, }) diff --git a/libs/tools/generator/components/src/catchall-settings.component.ts b/libs/tools/generator/components/src/catchall-settings.component.ts index 0fb953b86dc..a30a1c65b8c 100644 --- a/libs/tools/generator/components/src/catchall-settings.component.ts +++ b/libs/tools/generator/components/src/catchall-settings.component.ts @@ -8,15 +8,18 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { map, ReplaySubject, skip, Subject, takeUntil, withLatestFrom } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; +import { FormFieldModule } from "@bitwarden/components"; import { CatchallGenerationOptions, CredentialGeneratorService, BuiltIn, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; /** Options group for catchall emails */ // FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush @@ -24,7 +27,7 @@ import { @Component({ selector: "tools-catchall-settings", templateUrl: "catchall-settings.component.html", - standalone: false, + imports: [ReactiveFormsModule, FormFieldModule, JslibModule, I18nPipe], }) export class CatchallSettingsComponent implements OnInit, OnDestroy, OnChanges { /** Instantiates the component diff --git a/libs/tools/generator/components/src/credential-generator-history-dialog.component.html b/libs/tools/generator/components/src/credential-generator-history-dialog.component.html index e107e33ca50..c392b323a6b 100644 --- a/libs/tools/generator/components/src/credential-generator-history-dialog.component.html +++ b/libs/tools/generator/components/src/credential-generator-history-dialog.component.html @@ -1,8 +1,11 @@ {{ "generatorHistory" | i18n }} - - + @if (hasHistory$ | async) { + + } @else { + + } - - - +@for (credential of credentials$ | async; track credential) { + + + +
+ {{ credential.generationDate | date: "medium" }} +
+
+ + + + + +
+} diff --git a/libs/tools/generator/components/src/credential-generator-history.component.ts b/libs/tools/generator/components/src/credential-generator-history.component.ts index a09a82c74b8..e732aa0198e 100644 --- a/libs/tools/generator/components/src/credential-generator-history.component.ts +++ b/libs/tools/generator/components/src/credential-generator-history.component.ts @@ -23,7 +23,6 @@ import { import { AlgorithmsByType, CredentialGeneratorService } from "@bitwarden/generator-core"; import { GeneratedCredential, GeneratorHistoryService } from "@bitwarden/generator-history"; -import { GeneratorModule } from "./generator.module"; import { translate } from "./util"; // FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush @@ -32,13 +31,12 @@ import { translate } from "./util"; selector: "bit-credential-generator-history", templateUrl: "credential-generator-history.component.html", imports: [ - ColorPasswordModule, CommonModule, + ColorPasswordModule, IconButtonModule, NoItemsModule, JslibModule, ItemModule, - GeneratorModule, ], }) export class CredentialGeneratorHistoryComponent implements OnChanges, OnInit, OnDestroy { diff --git a/libs/tools/generator/components/src/credential-generator.component.html b/libs/tools/generator/components/src/credential-generator.component.html index 124de1e3c45..f97e1500b33 100644 --- a/libs/tools/generator/components/src/credential-generator.component.html +++ b/libs/tools/generator/components/src/credential-generator.component.html @@ -6,9 +6,11 @@ (selectedChange)="onRootChanged({ nav: $event })" attr.aria-label="{{ 'type' | i18n }}" > - - {{ option.label }} - + @for (option of rootOptions$ | async; track option) { + + {{ option.label }} + + } @@ -40,69 +42,80 @@ > - - - - -

{{ "options" | i18n }}

-
-
- -
- - {{ "type" | i18n }} - - - {{ - credentialTypeHint$ | async - }} - -
-
- - {{ "service" | i18n }} - - - -
- - - - -
-
-
+@let showAlgorithm = showAlgorithm$ | async; +@let account = account$ | async; +@switch (showAlgorithm?.id) { + @case (Algorithm.password) { + + } + @case (Algorithm.passphrase) { + + } +} +@if ((category$ | async) !== "password") { + + +

{{ "options" | i18n }}

+
+
+ +
+ + {{ "type" | i18n }} + + + @if (credentialTypeHint$ | async) { + {{ credentialTypeHint$ | async }} + } + +
+ @if (showForwarder$ | async) { +
+ + {{ "service" | i18n }} + + + +
+ } + @if (showAlgorithm?.id === Algorithm.catchall) { + + } + @if (forwarderId$ | async; as forwarderId) { + + } + @if (showAlgorithm?.id === Algorithm.plusAddress) { + + } + @if (showAlgorithm?.id === Algorithm.username) { + + } +
+
+
+} diff --git a/libs/tools/generator/components/src/credential-generator.component.ts b/libs/tools/generator/components/src/credential-generator.component.ts index f48180d93bd..af6791f673b 100644 --- a/libs/tools/generator/components/src/credential-generator.component.ts +++ b/libs/tools/generator/components/src/credential-generator.component.ts @@ -1,4 +1,5 @@ import { LiveAnnouncer } from "@angular/cdk/a11y"; +import { AsyncPipe } from "@angular/common"; import { Component, EventEmitter, @@ -10,7 +11,7 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { BehaviorSubject, catchError, @@ -27,6 +28,7 @@ import { withLatestFrom, } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account, AccountService } 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"; @@ -37,7 +39,23 @@ import { ifEnabledSemanticLoggerProvider, } from "@bitwarden/common/tools/log"; import { UserId } from "@bitwarden/common/types/guid"; -import { ToastService, Option } from "@bitwarden/components"; +import { + ToastService, + Option, + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + CopyClickDirective, + SectionComponent, + SectionHeaderComponent, + ToggleGroupModule, + TypographyModule, + FormFieldModule, + SelectModule, +} from "@bitwarden/components"; import { CredentialType, CredentialGeneratorService, @@ -55,7 +73,15 @@ import { Type, } from "@bitwarden/generator-core"; import { GeneratorHistoryService } from "@bitwarden/generator-history"; +import { I18nPipe } from "@bitwarden/ui-common"; +import { CatchallSettingsComponent } from "./catchall-settings.component"; +import { ForwarderSettingsComponent } from "./forwarder-settings.component"; +import { NudgeGeneratorSpotlightComponent } from "./nudge-generator-spotlight.component"; +import { PassphraseSettingsComponent } from "./passphrase-settings.component"; +import { PasswordSettingsComponent } from "./password-settings.component"; +import { SubaddressSettingsComponent } from "./subaddress-settings.component"; +import { UsernameSettingsComponent } from "./username-settings.component"; import { translate } from "./util"; // constants used to identify navigation selections that are not @@ -69,7 +95,32 @@ const NONE_SELECTED = "none"; @Component({ selector: "tools-credential-generator", templateUrl: "credential-generator.component.html", - standalone: false, + imports: [ + ToggleGroupModule, + NudgeGeneratorSpotlightComponent, + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + CopyClickDirective, + PasswordSettingsComponent, + PassphraseSettingsComponent, + SectionComponent, + SectionHeaderComponent, + TypographyModule, + ReactiveFormsModule, + FormFieldModule, + SelectModule, + CatchallSettingsComponent, + ForwarderSettingsComponent, + SubaddressSettingsComponent, + UsernameSettingsComponent, + AsyncPipe, + JslibModule, + I18nPipe, + ], }) export class CredentialGeneratorComponent implements OnInit, OnChanges, OnDestroy { private readonly destroyed = new Subject(); diff --git a/libs/tools/generator/components/src/forwarder-settings.component.html b/libs/tools/generator/components/src/forwarder-settings.component.html index 8ad6eab1acf..0d213179c2b 100644 --- a/libs/tools/generator/components/src/forwarder-settings.component.html +++ b/libs/tools/generator/components/src/forwarder-settings.component.html @@ -1,28 +1,34 @@
- - {{ "forwarderDomainName" | i18n }} - - {{ "forwarderDomainNameHint" | i18n }} - - - {{ "apiKey" | i18n }} - - - - - {{ "selfHostBaseUrl" | i18n }} - - + @if (displayDomain) { + + {{ "forwarderDomainName" | i18n }} + + {{ "forwarderDomainNameHint" | i18n }} + + } + @if (displayToken) { + + {{ "apiKey" | i18n }} + + + + } + @if (displayBaseUrl) { + + {{ "selfHostBaseUrl" | i18n }} + + + }
diff --git a/libs/tools/generator/components/src/forwarder-settings.component.ts b/libs/tools/generator/components/src/forwarder-settings.component.ts index 32fa3effdf6..0f1c863b2f6 100644 --- a/libs/tools/generator/components/src/forwarder-settings.component.ts +++ b/libs/tools/generator/components/src/forwarder-settings.component.ts @@ -8,16 +8,24 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { map, ReplaySubject, skip, Subject, switchAll, takeUntil, withLatestFrom } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; import { VendorId } from "@bitwarden/common/tools/extension"; +import { + FormFieldModule, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, +} from "@bitwarden/components"; import { CredentialGeneratorService, ForwarderOptions, GeneratorMetadata, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; const Controls = Object.freeze({ domain: "domain", @@ -31,7 +39,15 @@ const Controls = Object.freeze({ @Component({ selector: "tools-forwarder-settings", templateUrl: "forwarder-settings.component.html", - standalone: false, + imports: [ + ReactiveFormsModule, + FormFieldModule, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + JslibModule, + I18nPipe, + ], }) export class ForwarderSettingsComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the component diff --git a/libs/tools/generator/components/src/generator.module.ts b/libs/tools/generator/components/src/generator.module.ts index d710f368106..795a5ffe972 100644 --- a/libs/tools/generator/components/src/generator.module.ts +++ b/libs/tools/generator/components/src/generator.module.ts @@ -1,67 +1,13 @@ -import { CommonModule } from "@angular/common"; import { NgModule } from "@angular/core"; -import { ReactiveFormsModule } from "@angular/forms"; -import { JslibModule } from "@bitwarden/angular/jslib.module"; -import { - CardComponent, - ColorPasswordModule, - CheckboxModule, - FormFieldModule, - IconButtonModule, - InputModule, - ItemModule, - SectionComponent, - SectionHeaderComponent, - SelectModule, - ToggleGroupModule, - TypographyModule, -} from "@bitwarden/components"; - -import { CatchallSettingsComponent } from "./catchall-settings.component"; import { CredentialGeneratorComponent } from "./credential-generator.component"; -import { ForwarderSettingsComponent } from "./forwarder-settings.component"; -import { GeneratorServicesModule } from "./generator-services.module"; -import { NudgeGeneratorSpotlightComponent } from "./nudge-generator-spotlight.component"; -import { PassphraseSettingsComponent } from "./passphrase-settings.component"; import { PasswordGeneratorComponent } from "./password-generator.component"; -import { PasswordSettingsComponent } from "./password-settings.component"; -import { SubaddressSettingsComponent } from "./subaddress-settings.component"; import { UsernameGeneratorComponent } from "./username-generator.component"; -import { UsernameSettingsComponent } from "./username-settings.component"; /** Shared module containing generator component dependencies */ +/** @deprecated Use individual components instead. */ @NgModule({ - imports: [ - CardComponent, - ColorPasswordModule, - CheckboxModule, - CommonModule, - FormFieldModule, - GeneratorServicesModule, - IconButtonModule, - InputModule, - ItemModule, - JslibModule, - ReactiveFormsModule, - SectionComponent, - SectionHeaderComponent, - SelectModule, - ToggleGroupModule, - TypographyModule, - NudgeGeneratorSpotlightComponent, - ], - declarations: [ - CatchallSettingsComponent, - CredentialGeneratorComponent, - ForwarderSettingsComponent, - SubaddressSettingsComponent, - PasswordGeneratorComponent, - PassphraseSettingsComponent, - PasswordSettingsComponent, - UsernameGeneratorComponent, - UsernameSettingsComponent, - ], + imports: [CredentialGeneratorComponent, PasswordGeneratorComponent, UsernameGeneratorComponent], exports: [CredentialGeneratorComponent, PasswordGeneratorComponent, UsernameGeneratorComponent], }) export class GeneratorModule { diff --git a/libs/tools/generator/components/src/index.ts b/libs/tools/generator/components/src/index.ts index 4ec32032de0..bfb19b07b05 100644 --- a/libs/tools/generator/components/src/index.ts +++ b/libs/tools/generator/components/src/index.ts @@ -1,5 +1,15 @@ +/** + * This file contains the public interface for the generator components library. + * + * Be mindful of what you export here, as those components should be considered stable + * and part of the public API contract. + */ + +export { CredentialGeneratorComponent } from "./credential-generator.component"; export { CredentialGeneratorHistoryComponent } from "./credential-generator-history.component"; export { CredentialGeneratorHistoryDialogComponent } from "./credential-generator-history-dialog.component"; export { EmptyCredentialHistoryComponent } from "./empty-credential-history.component"; export { GeneratorModule } from "./generator.module"; export { GeneratorServicesModule, SYSTEM_SERVICE_PROVIDER } from "./generator-services.module"; +export { PasswordGeneratorComponent } from "./password-generator.component"; +export { UsernameGeneratorComponent } from "./username-generator.component"; diff --git a/libs/tools/generator/components/src/nudge-generator-spotlight.component.html b/libs/tools/generator/components/src/nudge-generator-spotlight.component.html index 581825936be..74fa5eb484c 100644 --- a/libs/tools/generator/components/src/nudge-generator-spotlight.component.html +++ b/libs/tools/generator/components/src/nudge-generator-spotlight.component.html @@ -1,16 +1,18 @@ -
- -

- - {{ "generatorNudgeBodyAria" | i18n }} - - -

-
-
+@if (showGeneratorSpotlight$ | async) { +
+ +

+ + {{ "generatorNudgeBodyAria" | i18n }} + + +

+
+
+} diff --git a/libs/tools/generator/components/src/passphrase-settings.component.html b/libs/tools/generator/components/src/passphrase-settings.component.html index 0af27f7fdcb..d40e91f7013 100644 --- a/libs/tools/generator/components/src/passphrase-settings.component.html +++ b/libs/tools/generator/components/src/passphrase-settings.component.html @@ -1,7 +1,9 @@ - -
{{ "options" | i18n }}
-
+ @if (showHeader) { + +
{{ "options" | i18n }}
+
+ }
@@ -51,7 +53,9 @@ /> {{ "includeNumber" | i18n }} -

{{ "generatorPolicyInEffect" | i18n }}

+ @if (policyInEffect) { +

{{ "generatorPolicyInEffect" | i18n }}

+ }
diff --git a/libs/tools/generator/components/src/passphrase-settings.component.ts b/libs/tools/generator/components/src/passphrase-settings.component.ts index 7e4ae8b5af9..6ab3020c688 100644 --- a/libs/tools/generator/components/src/passphrase-settings.component.ts +++ b/libs/tools/generator/components/src/passphrase-settings.component.ts @@ -1,4 +1,5 @@ import { coerceBooleanProperty } from "@angular/cdk/coercion"; +import { AsyncPipe } from "@angular/common"; import { OnInit, Input, @@ -9,9 +10,10 @@ import { SimpleChanges, OnChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { skip, takeUntil, Subject, map, withLatestFrom, ReplaySubject, tap } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; 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"; @@ -20,11 +22,21 @@ import { disabledSemanticLoggerProvider, ifEnabledSemanticLoggerProvider, } from "@bitwarden/common/tools/log"; +import { + SectionComponent, + SectionHeaderComponent, + BaseCardDirective, + CardComponent, + TypographyModule, + FormFieldModule, + CheckboxModule, +} from "@bitwarden/components"; import { CredentialGeneratorService, PassphraseGenerationOptions, BuiltIn, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; const Controls = Object.freeze({ numWords: "numWords", @@ -39,7 +51,19 @@ const Controls = Object.freeze({ @Component({ selector: "tools-passphrase-settings", templateUrl: "passphrase-settings.component.html", - standalone: false, + imports: [ + SectionComponent, + SectionHeaderComponent, + TypographyModule, + ReactiveFormsModule, + BaseCardDirective, + CardComponent, + FormFieldModule, + CheckboxModule, + AsyncPipe, + JslibModule, + I18nPipe, + ], }) export class PassphraseSettingsComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the component diff --git a/libs/tools/generator/components/src/password-generator.component.html b/libs/tools/generator/components/src/password-generator.component.html index 9995613685b..0088628dff0 100644 --- a/libs/tools/generator/components/src/password-generator.component.html +++ b/libs/tools/generator/components/src/password-generator.component.html @@ -1,15 +1,18 @@ - - - {{ option.label }} - - +@if (showCredentialTypes$ | async) { + + @for (option of passwordOptions$ | async; track option) { + + {{ option.label }} + + } + +}
@@ -37,17 +40,19 @@ >
- - +@if ((algorithm$ | async)?.id === Algorithm.password) { + +} +@if ((algorithm$ | async)?.id === Algorithm.passphrase) { + +} diff --git a/libs/tools/generator/components/src/password-generator.component.ts b/libs/tools/generator/components/src/password-generator.component.ts index 2b1d5044651..52cf902293d 100644 --- a/libs/tools/generator/components/src/password-generator.component.ts +++ b/libs/tools/generator/components/src/password-generator.component.ts @@ -1,5 +1,6 @@ import { LiveAnnouncer } from "@angular/cdk/a11y"; import { coerceBooleanProperty } from "@angular/cdk/coercion"; +import { AsyncPipe } from "@angular/common"; import { Component, EventEmitter, @@ -24,6 +25,7 @@ import { withLatestFrom, } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account, AccountService } 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"; @@ -33,7 +35,18 @@ import { ifEnabledSemanticLoggerProvider, } from "@bitwarden/common/tools/log"; import { UserId } from "@bitwarden/common/types/guid"; -import { ToastService, Option } from "@bitwarden/components"; +import { + ToastService, + Option, + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + CopyClickDirective, + ToggleGroupModule, +} from "@bitwarden/components"; import { CredentialGeneratorService, GeneratedCredential, @@ -49,7 +62,10 @@ import { Profile, } from "@bitwarden/generator-core"; import { GeneratorHistoryService } from "@bitwarden/generator-history"; +import { I18nPipe } from "@bitwarden/ui-common"; +import { PassphraseSettingsComponent } from "./passphrase-settings.component"; +import { PasswordSettingsComponent } from "./password-settings.component"; import { toAlgorithmInfo, translate } from "./util"; /** Options group for passwords */ @@ -58,7 +74,21 @@ import { toAlgorithmInfo, translate } from "./util"; @Component({ selector: "tools-password-generator", templateUrl: "password-generator.component.html", - standalone: false, + imports: [ + ToggleGroupModule, + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + CopyClickDirective, + PasswordSettingsComponent, + PassphraseSettingsComponent, + AsyncPipe, + JslibModule, + I18nPipe, + ], }) export class PasswordGeneratorComponent implements OnInit, OnChanges, OnDestroy { constructor( diff --git a/libs/tools/generator/components/src/password-settings.component.html b/libs/tools/generator/components/src/password-settings.component.html index 13bf6822462..b435a13fe4c 100644 --- a/libs/tools/generator/components/src/password-settings.component.html +++ b/libs/tools/generator/components/src/password-settings.component.html @@ -1,7 +1,9 @@ - -

{{ "options" | i18n }}

-
+ @if (showHeader) { + +

{{ "options" | i18n }}

+
+ }
@@ -62,9 +64,9 @@ (change)="save('special')" /> + and is handled inconsistently across browsers. Angular template syntax is used to + ensure special characters are entity-encoded. + --> {{ "!@#$%^&*" }}
@@ -97,7 +99,9 @@ /> {{ "avoidAmbiguous" | i18n }} -

{{ "generatorPolicyInEffect" | i18n }}

+ @if (policyInEffect) { +

{{ "generatorPolicyInEffect" | i18n }}

+ }
diff --git a/libs/tools/generator/components/src/password-settings.component.ts b/libs/tools/generator/components/src/password-settings.component.ts index 5d5980edf1b..9445e655310 100644 --- a/libs/tools/generator/components/src/password-settings.component.ts +++ b/libs/tools/generator/components/src/password-settings.component.ts @@ -1,4 +1,5 @@ import { coerceBooleanProperty } from "@angular/cdk/coercion"; +import { AsyncPipe } from "@angular/common"; import { OnInit, Input, @@ -9,16 +10,27 @@ import { SimpleChanges, OnChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { takeUntil, Subject, map, filter, tap, skip, ReplaySubject, withLatestFrom } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { + SectionComponent, + SectionHeaderComponent, + BaseCardDirective, + CardComponent, + FormFieldModule, + TypographyModule, + CheckboxModule, +} from "@bitwarden/components"; import { CredentialGeneratorService, PasswordGenerationOptions, BuiltIn, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; import { hasRangeOfValues } from "./util"; @@ -39,7 +51,19 @@ const Controls = Object.freeze({ @Component({ selector: "tools-password-settings", templateUrl: "password-settings.component.html", - standalone: false, + imports: [ + SectionComponent, + SectionHeaderComponent, + TypographyModule, + ReactiveFormsModule, + BaseCardDirective, + CardComponent, + FormFieldModule, + CheckboxModule, + AsyncPipe, + JslibModule, + I18nPipe, + ], }) export class PasswordSettingsComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the component diff --git a/libs/tools/generator/components/src/subaddress-settings.component.ts b/libs/tools/generator/components/src/subaddress-settings.component.ts index f9cef2341ba..068511e29e5 100644 --- a/libs/tools/generator/components/src/subaddress-settings.component.ts +++ b/libs/tools/generator/components/src/subaddress-settings.component.ts @@ -8,15 +8,18 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { map, ReplaySubject, skip, Subject, takeUntil, withLatestFrom } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; +import { FormFieldModule } from "@bitwarden/components"; import { CredentialGeneratorService, BuiltIn, SubaddressGenerationOptions, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; /** Options group for plus-addressed emails */ // FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush @@ -24,7 +27,7 @@ import { @Component({ selector: "tools-subaddress-settings", templateUrl: "subaddress-settings.component.html", - standalone: false, + imports: [ReactiveFormsModule, FormFieldModule, JslibModule, I18nPipe], }) export class SubaddressSettingsComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the component diff --git a/libs/tools/generator/components/src/username-generator.component.html b/libs/tools/generator/components/src/username-generator.component.html index 0f3182118a1..9f74f5d1fea 100644 --- a/libs/tools/generator/components/src/username-generator.component.html +++ b/libs/tools/generator/components/src/username-generator.component.html @@ -42,42 +42,41 @@ data-testid="username-type" > - {{ - credentialTypeHint$ | async - }} + @if (credentialTypeHint$ | async) { + {{ credentialTypeHint$ | async }} + } -
- - {{ "service" | i18n }} - - - -
- - - - + @if (showForwarder$ | async) { +
+ + {{ "service" | i18n }} + + + +
+ } + @let showAlgorithm = showAlgorithm$ | async; + @let account = account$ | async; + @if (showAlgorithm?.id === Algorithm.catchall) { + + } + @if (forwarderId$ | async; as forwarderId) { + + } + @if (showAlgorithm?.id === Algorithm.plusAddress) { + + } + @if (showAlgorithm?.id === Algorithm.username) { + + }
diff --git a/libs/tools/generator/components/src/username-generator.component.ts b/libs/tools/generator/components/src/username-generator.component.ts index dc4b8d26e7e..faf9c4dde2c 100644 --- a/libs/tools/generator/components/src/username-generator.component.ts +++ b/libs/tools/generator/components/src/username-generator.component.ts @@ -1,5 +1,6 @@ import { LiveAnnouncer } from "@angular/cdk/a11y"; import { coerceBooleanProperty } from "@angular/cdk/coercion"; +import { NgClass, AsyncPipe } from "@angular/common"; import { Component, EventEmitter, @@ -11,7 +12,7 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { BehaviorSubject, catchError, @@ -28,6 +29,7 @@ import { withLatestFrom, } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account, AccountService } 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"; @@ -38,7 +40,22 @@ import { ifEnabledSemanticLoggerProvider, } from "@bitwarden/common/tools/log"; import { UserId } from "@bitwarden/common/types/guid"; -import { ToastService, Option } from "@bitwarden/components"; +import { + ToastService, + Option, + AriaDisableDirective, + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + CopyClickDirective, + BitIconButtonComponent, + TooltipDirective, + SectionComponent, + SectionHeaderComponent, + SelectComponent, + TypographyModule, + FormFieldModule, +} from "@bitwarden/components"; import { AlgorithmInfo, CredentialGeneratorService, @@ -55,7 +72,12 @@ import { Algorithm, } from "@bitwarden/generator-core"; import { GeneratorHistoryService } from "@bitwarden/generator-history"; +import { I18nPipe } from "@bitwarden/ui-common"; +import { CatchallSettingsComponent } from "./catchall-settings.component"; +import { ForwarderSettingsComponent } from "./forwarder-settings.component"; +import { SubaddressSettingsComponent } from "./subaddress-settings.component"; +import { UsernameSettingsComponent } from "./username-settings.component"; import { toAlgorithmInfo, translate } from "./util"; // constants used to identify navigation selections that are not @@ -69,7 +91,29 @@ const NONE_SELECTED = "none"; @Component({ selector: "tools-username-generator", templateUrl: "username-generator.component.html", - standalone: false, + imports: [ + BaseCardDirective, + CardComponent, + ColorPasswordComponent, + AriaDisableDirective, + TooltipDirective, + BitIconButtonComponent, + CopyClickDirective, + SectionComponent, + SectionHeaderComponent, + TypographyModule, + NgClass, + ReactiveFormsModule, + SelectComponent, + FormFieldModule, + CatchallSettingsComponent, + ForwarderSettingsComponent, + SubaddressSettingsComponent, + UsernameSettingsComponent, + AsyncPipe, + JslibModule, + I18nPipe, + ], }) export class UsernameGeneratorComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the username generator diff --git a/libs/tools/generator/components/src/username-settings.component.ts b/libs/tools/generator/components/src/username-settings.component.ts index fae1a3aca04..f4ccf362b69 100644 --- a/libs/tools/generator/components/src/username-settings.component.ts +++ b/libs/tools/generator/components/src/username-settings.component.ts @@ -8,15 +8,18 @@ import { Output, SimpleChanges, } from "@angular/core"; -import { FormBuilder } from "@angular/forms"; +import { FormBuilder, ReactiveFormsModule } from "@angular/forms"; import { map, ReplaySubject, skip, Subject, takeUntil, withLatestFrom } from "rxjs"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; +import { FormFieldModule, CheckboxModule } from "@bitwarden/components"; import { CredentialGeneratorService, EffUsernameGenerationOptions, BuiltIn, } from "@bitwarden/generator-core"; +import { I18nPipe } from "@bitwarden/ui-common"; /** Options group for usernames */ // FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush @@ -24,7 +27,7 @@ import { @Component({ selector: "tools-username-settings", templateUrl: "username-settings.component.html", - standalone: false, + imports: [ReactiveFormsModule, FormFieldModule, CheckboxModule, JslibModule, I18nPipe], }) export class UsernameSettingsComponent implements OnInit, OnChanges, OnDestroy { /** Instantiates the component