mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
[PM-8228] - Create new Premium Component (#10514)
* add new premium component * finish new premium component * revert change to config service * hide copy changes behind feature flag * revert keys back to original * remove stateService and translation key * add missing translation key * add missing key
This commit is contained in:
@@ -3,12 +3,13 @@ import { firstValueFrom, Observable } from "rxjs";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, SimpleDialogOptions } from "@bitwarden/components";
|
||||
|
||||
@Directive()
|
||||
export class PremiumComponent implements OnInit {
|
||||
@@ -16,13 +17,14 @@ export class PremiumComponent implements OnInit {
|
||||
price = 10;
|
||||
refreshPromise: Promise<any>;
|
||||
cloudWebVaultUrl: string;
|
||||
extensionRefreshFlagEnabled: boolean;
|
||||
|
||||
constructor(
|
||||
protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected apiService: ApiService,
|
||||
protected configService: ConfigService,
|
||||
private logService: LogService,
|
||||
protected stateService: StateService,
|
||||
protected dialogService: DialogService,
|
||||
private environmentService: EnvironmentService,
|
||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||
@@ -32,6 +34,9 @@ export class PremiumComponent implements OnInit {
|
||||
|
||||
async ngOnInit() {
|
||||
this.cloudWebVaultUrl = await firstValueFrom(this.environmentService.cloudWebVaultUrl$);
|
||||
this.extensionRefreshFlagEnabled = await this.configService.getFeatureFlag(
|
||||
FeatureFlag.ExtensionRefresh,
|
||||
);
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
@@ -45,11 +50,20 @@ export class PremiumComponent implements OnInit {
|
||||
}
|
||||
|
||||
async purchase() {
|
||||
const confirmed = await this.dialogService.openSimpleDialog({
|
||||
title: { key: "premiumPurchase" },
|
||||
content: { key: "premiumPurchaseAlert" },
|
||||
const dialogOpts: SimpleDialogOptions = {
|
||||
title: { key: "continueToBitwardenDotCom" },
|
||||
content: {
|
||||
key: this.extensionRefreshFlagEnabled ? "premiumPurchaseAlertV2" : "premiumPurchaseAlert",
|
||||
},
|
||||
type: "info",
|
||||
});
|
||||
};
|
||||
|
||||
if (this.extensionRefreshFlagEnabled) {
|
||||
dialogOpts.acceptButtonText = { key: "continue" };
|
||||
dialogOpts.cancelButtonText = { key: "close" };
|
||||
}
|
||||
|
||||
const confirmed = await this.dialogService.openSimpleDialog(dialogOpts);
|
||||
|
||||
if (confirmed) {
|
||||
this.platformUtilsService.launchUri(
|
||||
|
||||
Reference in New Issue
Block a user