diff --git a/apps/browser/src/vault/popup/components/vault/vault.component.spec.ts b/apps/browser/src/vault/popup/components/vault/vault.component.spec.ts index ac25230ab04..17cb20564eb 100644 --- a/apps/browser/src/vault/popup/components/vault/vault.component.spec.ts +++ b/apps/browser/src/vault/popup/components/vault/vault.component.spec.ts @@ -5,7 +5,7 @@ import { provideNoopAnimations } from "@angular/platform-browser/animations"; import { ActivatedRoute, Router } from "@angular/router"; import { RouterTestingModule } from "@angular/router/testing"; import { mock } from "jest-mock-extended"; -import { BehaviorSubject, Observable, Subject, of } from "rxjs"; +import { BehaviorSubject, Observable, Subject, of, take } from "rxjs"; import { PremiumUpgradeDialogComponent } from "@bitwarden/angular/billing/components"; import { NudgeType, NudgesService } from "@bitwarden/angular/vault"; @@ -472,20 +472,19 @@ describe("VaultComponent", () => { expect(spy).toHaveBeenCalledWith(NudgeType.HasVaultItems, "user-xyz"); })); - it("accountAgeInDays$ computes integer days since creation", (done) => { + it("accountAgeInDays$ computes integer days since creation", fakeAsync(() => { activeAccount$.next({ id: "user-123", creationDate: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // 7 days ago } as any); - getObs(component, "accountAgeInDays$").subscribe((days) => { - if (days !== null) { - expect(days).toBeGreaterThanOrEqual(7); - done(); - } - }); void component.ngOnInit(); - }); + tick(); + + getObs(component, "accountAgeInDays$") + .pipe(take(1)) + .subscribe((days) => expect(days).toBeGreaterThanOrEqual(7)); + })); it("renders Premium spotlight when eligible and opens dialog on click", fakeAsync(() => { itemsSvc.cipherCount$.next(10); @@ -559,6 +558,10 @@ describe("VaultComponent", () => { })); it("does not render Premium spotlight when account is less than a week old", fakeAsync(() => { + activeAccount$.next({ + id: "user-1", + creationDate: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000), // 3 days ago + } as any); itemsSvc.cipherCount$.next(10); hasPremiumFromAnySource$.next(false); diff --git a/apps/browser/src/vault/popup/components/vault/vault.component.ts b/apps/browser/src/vault/popup/components/vault/vault.component.ts index e975f979251..97dbfed38ac 100644 --- a/apps/browser/src/vault/popup/components/vault/vault.component.ts +++ b/apps/browser/src/vault/popup/components/vault/vault.component.ts @@ -157,10 +157,6 @@ export class VaultComponent implements OnInit, OnDestroy { }), ); - protected premiumSpotlightFeatureFlag$ = this.configService.getFeatureFlag$( - FeatureFlag.BrowserPremiumSpotlight, - ); - protected readonly hasSearchText$ = this.vaultPopupItemsService.hasSearchText$; protected readonly numberOfAppliedFilters$ = this.vaultPopupListFiltersService.numberOfAppliedFilters$; @@ -184,7 +180,6 @@ export class VaultComponent implements OnInit, OnDestroy { ); protected showPremiumSpotlight$ = combineLatest([ - this.premiumSpotlightFeatureFlag$, this.activeUserId$.pipe( switchMap((userId) => this.nudgesService.showNudgeSpotlight$(NudgeType.PremiumUpgrade, userId), @@ -195,15 +190,8 @@ export class VaultComponent implements OnInit, OnDestroy { this.cipherCount$, this.accountAgeInDays$, ]).pipe( - map(([featureFlagEnabled, showPremiumNudge, showHasItemsNudge, hasPremium, count, age]) => { - return ( - featureFlagEnabled && - showPremiumNudge && - !showHasItemsNudge && - !hasPremium && - count >= 5 && - age >= 7 - ); + map(([showPremiumNudge, showHasItemsNudge, hasPremium, count, age]) => { + return showPremiumNudge && !showHasItemsNudge && !hasPremium && count >= 5 && age >= 7; }), shareReplay({ bufferSize: 1, refCount: true }), ); diff --git a/libs/common/src/enums/feature-flag.enum.ts b/libs/common/src/enums/feature-flag.enum.ts index 3014bd94af8..8c62edc5ede 100644 --- a/libs/common/src/enums/feature-flag.enum.ts +++ b/libs/common/src/enums/feature-flag.enum.ts @@ -67,7 +67,6 @@ export enum FeatureFlag { PM22134SdkCipherListView = "pm-22134-sdk-cipher-list-view", PM22136_SdkCipherEncryption = "pm-22136-sdk-cipher-encryption", CipherKeyEncryption = "cipher-key-encryption", - BrowserPremiumSpotlight = "pm-23384-browser-premium-spotlight", MigrateMyVaultToMyItems = "pm-20558-migrate-myvault-to-myitems", PM27632_SdkCipherCrudOperations = "pm-27632-cipher-crud-operations-to-sdk", PM30521_AutofillButtonViewLoginScreen = "pm-30521-autofill-button-view-login-screen", @@ -133,7 +132,6 @@ export const DefaultFeatureFlagValue = { [FeatureFlag.PM19941MigrateCipherDomainToSdk]: FALSE, [FeatureFlag.PM22134SdkCipherListView]: FALSE, [FeatureFlag.PM22136_SdkCipherEncryption]: FALSE, - [FeatureFlag.BrowserPremiumSpotlight]: FALSE, [FeatureFlag.PM27632_SdkCipherCrudOperations]: FALSE, [FeatureFlag.MigrateMyVaultToMyItems]: FALSE, [FeatureFlag.PM30521_AutofillButtonViewLoginScreen]: FALSE,