mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
[PM-25879][PM-25881] - [Defect] Premium badges missing reusable component (#16461)
* clean up premium badge component
* add provider to desktop settings
* rename prop.
* add provider to send component
* fix storybook
* fix test
* move dependency to new send dropdown component
* Revert "move dependency to new send dropdown component"
This reverts commit f134526279.
* remove hasPremium
This commit is contained in:
@@ -7,6 +7,7 @@ import { RouterModule } from "@angular/router";
|
||||
import { BehaviorSubject, Observable, Subject, combineLatest, firstValueFrom, of } from "rxjs";
|
||||
import { concatMap, map, pairwise, startWith, switchMap, takeUntil, timeout } from "rxjs/operators";
|
||||
|
||||
import { PremiumBadgeComponent } from "@bitwarden/angular/billing/components/premium-badge";
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { VaultTimeoutInputComponent } from "@bitwarden/auth/angular";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
@@ -39,6 +40,7 @@ import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums/theme-type.e
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { ThemeStateService } from "@bitwarden/common/platform/theming/theme-state.service";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
|
||||
import {
|
||||
CheckboxModule,
|
||||
DialogService,
|
||||
@@ -51,7 +53,6 @@ import {
|
||||
SelectModule,
|
||||
ToastService,
|
||||
TypographyModule,
|
||||
BadgeComponent,
|
||||
} from "@bitwarden/components";
|
||||
import { KeyService, BiometricStateService, BiometricsStatus } from "@bitwarden/key-management";
|
||||
import { PermitCipherDetailsPopoverComponent } from "@bitwarden/vault";
|
||||
@@ -60,17 +61,22 @@ import { SetPinComponent } from "../../auth/components/set-pin.component";
|
||||
import { SshAgentPromptType } from "../../autofill/models/ssh-agent-setting";
|
||||
import { DesktopAutofillSettingsService } from "../../autofill/services/desktop-autofill-settings.service";
|
||||
import { DesktopAutotypeService } from "../../autofill/services/desktop-autotype.service";
|
||||
import { PremiumComponent } from "../../billing/app/accounts/premium.component";
|
||||
import { DesktopBiometricsService } from "../../key-management/biometrics/desktop.biometrics.service";
|
||||
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
|
||||
import { DesktopPremiumUpgradePromptService } from "../../services/desktop-premium-upgrade-prompt.service";
|
||||
import { NativeMessagingManifestService } from "../services/native-messaging-manifest.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-settings",
|
||||
templateUrl: "settings.component.html",
|
||||
standalone: true,
|
||||
providers: [
|
||||
{
|
||||
provide: PremiumUpgradePromptService,
|
||||
useClass: DesktopPremiumUpgradePromptService,
|
||||
},
|
||||
],
|
||||
imports: [
|
||||
BadgeComponent,
|
||||
CheckboxModule,
|
||||
CommonModule,
|
||||
FormFieldModule,
|
||||
@@ -87,6 +93,7 @@ import { NativeMessagingManifestService } from "../services/native-messaging-man
|
||||
TypographyModule,
|
||||
VaultTimeoutInputComponent,
|
||||
PermitCipherDetailsPopoverComponent,
|
||||
PremiumBadgeComponent,
|
||||
],
|
||||
})
|
||||
export class SettingsComponent implements OnInit, OnDestroy {
|
||||
@@ -134,8 +141,6 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
|
||||
pinEnabled$: Observable<boolean> = of(true);
|
||||
|
||||
hasPremium: boolean = false;
|
||||
|
||||
form = this.formBuilder.group({
|
||||
// Security
|
||||
vaultTimeout: [null as VaultTimeout | null],
|
||||
@@ -421,9 +426,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
.hasPremiumFromAnySource$(activeAccount.id)
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe((hasPremium) => {
|
||||
this.hasPremium = hasPremium;
|
||||
|
||||
if (this.hasPremium) {
|
||||
if (hasPremium) {
|
||||
this.form.controls.enableAutotype.enable();
|
||||
}
|
||||
});
|
||||
@@ -892,10 +895,6 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
async openPremiumDialog() {
|
||||
await this.dialogService.open(PremiumComponent);
|
||||
}
|
||||
|
||||
async saveEnableAutotype() {
|
||||
await this.desktopAutotypeService.setAutotypeEnabledState(this.form.value.enableAutotype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user