mirror of
https://github.com/bitwarden/browser
synced 2026-02-02 17:53:41 +00:00
remove risk insights for premium feature flag (#18446)
This commit is contained in:
@@ -65,7 +65,6 @@ export enum FeatureFlag {
|
||||
PM22134SdkCipherListView = "pm-22134-sdk-cipher-list-view",
|
||||
PM22136_SdkCipherEncryption = "pm-22136-sdk-cipher-encryption",
|
||||
CipherKeyEncryption = "cipher-key-encryption",
|
||||
RiskInsightsForPremium = "pm-23904-risk-insights-for-premium",
|
||||
VaultLoadingSkeletons = "pm-25081-vault-skeleton-loaders",
|
||||
BrowserPremiumSpotlight = "pm-23384-browser-premium-spotlight",
|
||||
MigrateMyVaultToMyItems = "pm-20558-migrate-myvault-to-myitems",
|
||||
@@ -129,7 +128,6 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.PM19941MigrateCipherDomainToSdk]: FALSE,
|
||||
[FeatureFlag.PM22134SdkCipherListView]: FALSE,
|
||||
[FeatureFlag.PM22136_SdkCipherEncryption]: FALSE,
|
||||
[FeatureFlag.RiskInsightsForPremium]: FALSE,
|
||||
[FeatureFlag.VaultLoadingSkeletons]: FALSE,
|
||||
[FeatureFlag.BrowserPremiumSpotlight]: FALSE,
|
||||
[FeatureFlag.MigrateMyVaultToMyItems]: FALSE,
|
||||
|
||||
@@ -8,7 +8,6 @@ import { CollectionService } from "@bitwarden/admin-console/common";
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
import { AccountService, Account } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.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";
|
||||
@@ -42,11 +41,9 @@ describe("CipherViewComponent", () => {
|
||||
let mockLogService: LogService;
|
||||
let mockCipherRiskService: CipherRiskService;
|
||||
let mockBillingAccountProfileStateService: BillingAccountProfileStateService;
|
||||
let mockConfigService: ConfigService;
|
||||
|
||||
// Mock data
|
||||
let mockCipherView: CipherView;
|
||||
let featureFlagEnabled$: BehaviorSubject<boolean>;
|
||||
let hasPremiumFromAnySource$: BehaviorSubject<boolean>;
|
||||
let activeAccount$: BehaviorSubject<Account>;
|
||||
|
||||
@@ -57,7 +54,6 @@ describe("CipherViewComponent", () => {
|
||||
email: "test@example.com",
|
||||
} as Account);
|
||||
|
||||
featureFlagEnabled$ = new BehaviorSubject(false);
|
||||
hasPremiumFromAnySource$ = new BehaviorSubject(true);
|
||||
|
||||
// Create service mocks
|
||||
@@ -83,9 +79,6 @@ describe("CipherViewComponent", () => {
|
||||
.fn()
|
||||
.mockReturnValue(hasPremiumFromAnySource$);
|
||||
|
||||
mockConfigService = mock<ConfigService>();
|
||||
mockConfigService.getFeatureFlag$ = jest.fn().mockReturnValue(featureFlagEnabled$);
|
||||
|
||||
// Setup mock cipher view
|
||||
mockCipherView = new CipherView();
|
||||
mockCipherView.id = "cipher-id";
|
||||
@@ -110,7 +103,6 @@ describe("CipherViewComponent", () => {
|
||||
provide: BillingAccountProfileStateService,
|
||||
useValue: mockBillingAccountProfileStateService,
|
||||
},
|
||||
{ provide: ConfigService, useValue: mockConfigService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
@@ -145,7 +137,6 @@ describe("CipherViewComponent", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset observables to default values for this test suite
|
||||
featureFlagEnabled$.next(true);
|
||||
hasPremiumFromAnySource$.next(true);
|
||||
|
||||
// Setup default mock for computeCipherRiskForUser (individual tests can override)
|
||||
@@ -162,18 +153,6 @@ describe("CipherViewComponent", () => {
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it("returns false when feature flag is disabled", fakeAsync(() => {
|
||||
featureFlagEnabled$.next(false);
|
||||
|
||||
const cipher = createLoginCipherView();
|
||||
fixture.componentRef.setInput("cipher", cipher);
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
|
||||
expect(mockCipherRiskService.computeCipherRiskForUser).not.toHaveBeenCalled();
|
||||
expect(component.passwordIsAtRisk()).toBe(false);
|
||||
}));
|
||||
|
||||
it("returns false when cipher has no login password", fakeAsync(() => {
|
||||
const cipher = createLoginCipherView();
|
||||
cipher.login = {} as any; // No password
|
||||
|
||||
@@ -13,8 +13,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { isCardExpired } from "@bitwarden/common/autofill/utils";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { getByIds } from "@bitwarden/common/platform/misc";
|
||||
@@ -113,7 +111,6 @@ export class CipherViewComponent {
|
||||
private logService: LogService,
|
||||
private cipherRiskService: CipherRiskService,
|
||||
private billingAccountService: BillingAccountProfileStateService,
|
||||
private configService: ConfigService,
|
||||
) {}
|
||||
|
||||
readonly resolvedCollections = toSignal<CollectionView[] | undefined>(
|
||||
@@ -248,19 +245,9 @@ export class CipherViewComponent {
|
||||
* The password is only evaluated when the user is premium and has edit access to the cipher.
|
||||
*/
|
||||
readonly passwordIsAtRisk = toSignal(
|
||||
combineLatest([
|
||||
this.activeUserId$,
|
||||
this.cipher$,
|
||||
this.configService.getFeatureFlag$(FeatureFlag.RiskInsightsForPremium),
|
||||
]).pipe(
|
||||
switchMap(([userId, cipher, featureEnabled]) => {
|
||||
if (
|
||||
!featureEnabled ||
|
||||
!cipher.hasLoginPassword ||
|
||||
!cipher.edit ||
|
||||
cipher.organizationId ||
|
||||
cipher.isDeleted
|
||||
) {
|
||||
combineLatest([this.activeUserId$, this.cipher$]).pipe(
|
||||
switchMap(([userId, cipher]) => {
|
||||
if (!cipher.hasLoginPassword || !cipher.edit || cipher.organizationId || cipher.isDeleted) {
|
||||
return of(false);
|
||||
}
|
||||
return this.switchPremium$(
|
||||
|
||||
Reference in New Issue
Block a user