mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-07 21:10:55 +08:00
[PM-29250] remove browser premium spotlight flag. update spec files (#19364)
This commit is contained in:
parent
5ddaa031c9
commit
55d0595184
@ -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<number | null>(component, "accountAgeInDays$").subscribe((days) => {
|
||||
if (days !== null) {
|
||||
expect(days).toBeGreaterThanOrEqual(7);
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
void component.ngOnInit();
|
||||
});
|
||||
tick();
|
||||
|
||||
getObs<number | null>(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);
|
||||
|
||||
|
||||
@ -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 }),
|
||||
);
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user