mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Remove the feature flag (#13102)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { combineLatest, filter, from, map, Observable, of, switchMap } from "rxjs";
|
import { combineLatest, filter, map, Observable, of, switchMap } from "rxjs";
|
||||||
|
|
||||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
@@ -7,7 +7,6 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
|||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
|
|
||||||
interface EnterpriseOrgStatus {
|
interface EnterpriseOrgStatus {
|
||||||
@@ -52,11 +51,7 @@ export class FreeFamiliesPolicyService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
get showFreeFamilies$(): Observable<boolean> {
|
get showFreeFamilies$(): Observable<boolean> {
|
||||||
return this.isFreeFamilyFlagEnabled$.pipe(
|
return this.getFreeFamiliesVisibility$();
|
||||||
switchMap((isFreeFamilyFlagEnabled) =>
|
|
||||||
isFreeFamilyFlagEnabled ? this.getFreeFamiliesVisibility$() : this.canManageSponsorships$,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getFreeFamiliesVisibility$(): Observable<boolean> {
|
private getFreeFamiliesVisibility$(): Observable<boolean> {
|
||||||
@@ -143,8 +138,4 @@ export class FreeFamiliesPolicyService {
|
|||||||
const enterpriseOrganizations = organizations.filter((org) => org.canManageSponsorships);
|
const enterpriseOrganizations = organizations.filter((org) => org.canManageSponsorships);
|
||||||
return enterpriseOrganizations.length === 1 ? enterpriseOrganizations[0].id : null;
|
return enterpriseOrganizations.length === 1 ? enterpriseOrganizations[0].id : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get isFreeFamilyFlagEnabled$(): Observable<boolean> {
|
|
||||||
return from(this.configService.getFeatureFlag(FeatureFlag.DisableFreeFamiliesSponsorship));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
|||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { PlanSponsorshipType } from "@bitwarden/common/billing/enums";
|
import { PlanSponsorshipType } from "@bitwarden/common/billing/enums";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
||||||
@@ -41,7 +39,6 @@ interface RequestSponsorshipForm {
|
|||||||
})
|
})
|
||||||
export class SponsoredFamiliesComponent implements OnInit, OnDestroy {
|
export class SponsoredFamiliesComponent implements OnInit, OnDestroy {
|
||||||
loading = false;
|
loading = false;
|
||||||
isFreeFamilyFlagEnabled: boolean;
|
|
||||||
|
|
||||||
availableSponsorshipOrgs$: Observable<Organization[]>;
|
availableSponsorshipOrgs$: Observable<Organization[]>;
|
||||||
activeSponsorshipOrgs$: Observable<Organization[]>;
|
activeSponsorshipOrgs$: Observable<Organization[]>;
|
||||||
@@ -64,7 +61,6 @@ export class SponsoredFamiliesComponent implements OnInit, OnDestroy {
|
|||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private configService: ConfigService,
|
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private freeFamiliesPolicyService: FreeFamiliesPolicyService,
|
private freeFamiliesPolicyService: FreeFamiliesPolicyService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -87,37 +83,27 @@ export class SponsoredFamiliesComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.isFreeFamilyFlagEnabled = await this.configService.getFeatureFlag(
|
|
||||||
FeatureFlag.DisableFreeFamiliesSponsorship,
|
|
||||||
);
|
|
||||||
|
|
||||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||||
|
|
||||||
if (this.isFreeFamilyFlagEnabled) {
|
await this.preventAccessToFreeFamiliesPage();
|
||||||
await this.preventAccessToFreeFamiliesPage();
|
|
||||||
|
|
||||||
this.availableSponsorshipOrgs$ = combineLatest([
|
this.availableSponsorshipOrgs$ = combineLatest([
|
||||||
this.organizationService.organizations$(userId),
|
this.organizationService.organizations$(userId),
|
||||||
this.policyService.getAll$(PolicyType.FreeFamiliesSponsorshipPolicy, userId),
|
this.policyService.getAll$(PolicyType.FreeFamiliesSponsorshipPolicy, userId),
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([organizations, policies]) =>
|
map(([organizations, policies]) =>
|
||||||
organizations
|
organizations
|
||||||
.filter((org) => org.familySponsorshipAvailable)
|
.filter((org) => org.familySponsorshipAvailable)
|
||||||
.map((org) => ({
|
.map((org) => ({
|
||||||
organization: org,
|
organization: org,
|
||||||
isPolicyEnabled: policies.some(
|
isPolicyEnabled: policies.some(
|
||||||
(policy) => policy.organizationId === org.id && policy.enabled,
|
(policy) => policy.organizationId === org.id && policy.enabled,
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
.filter(({ isPolicyEnabled }) => !isPolicyEnabled)
|
.filter(({ isPolicyEnabled }) => !isPolicyEnabled)
|
||||||
.map(({ organization }) => organization),
|
.map(({ organization }) => organization),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
this.availableSponsorshipOrgs$ = this.organizationService
|
|
||||||
.organizations$(userId)
|
|
||||||
.pipe(map((orgs) => orgs.filter((o) => o.familySponsorshipAvailable)));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.availableSponsorshipOrgs$.pipe(takeUntil(this._destroy)).subscribe((orgs) => {
|
this.availableSponsorshipOrgs$.pipe(takeUntil(this._destroy)).subscribe((orgs) => {
|
||||||
if (orgs.length === 1) {
|
if (orgs.length === 1) {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
|||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -29,7 +28,6 @@ export class SponsoringOrgRowComponent implements OnInit {
|
|||||||
statusMessage = "loading";
|
statusMessage = "loading";
|
||||||
statusClass: "tw-text-success" | "tw-text-danger" = "tw-text-success";
|
statusClass: "tw-text-success" | "tw-text-danger" = "tw-text-success";
|
||||||
isFreeFamilyPolicyEnabled$: Observable<boolean>;
|
isFreeFamilyPolicyEnabled$: Observable<boolean>;
|
||||||
isFreeFamilyFlagEnabled: boolean;
|
|
||||||
private locale = "";
|
private locale = "";
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -52,25 +50,20 @@ export class SponsoringOrgRowComponent implements OnInit {
|
|||||||
this.sponsoringOrg.familySponsorshipValidUntil,
|
this.sponsoringOrg.familySponsorshipValidUntil,
|
||||||
this.sponsoringOrg.familySponsorshipLastSyncDate,
|
this.sponsoringOrg.familySponsorshipLastSyncDate,
|
||||||
);
|
);
|
||||||
this.isFreeFamilyFlagEnabled = await this.configService.getFeatureFlag(
|
|
||||||
FeatureFlag.DisableFreeFamiliesSponsorship,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this.isFreeFamilyFlagEnabled) {
|
this.isFreeFamilyPolicyEnabled$ = this.accountService.activeAccount$.pipe(
|
||||||
this.isFreeFamilyPolicyEnabled$ = this.accountService.activeAccount$.pipe(
|
getUserId,
|
||||||
getUserId,
|
switchMap((userId) =>
|
||||||
switchMap((userId) =>
|
this.policyService.getAll$(PolicyType.FreeFamiliesSponsorshipPolicy, userId),
|
||||||
this.policyService.getAll$(PolicyType.FreeFamiliesSponsorshipPolicy, userId),
|
),
|
||||||
),
|
map(
|
||||||
map(
|
(policies) =>
|
||||||
(policies) =>
|
Array.isArray(policies) &&
|
||||||
Array.isArray(policies) &&
|
policies.some(
|
||||||
policies.some(
|
(policy) => policy.organizationId === this.sponsoringOrg.id && policy.enabled,
|
||||||
(policy) => policy.organizationId === this.sponsoringOrg.id && policy.enabled,
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async revokeSponsorship() {
|
async revokeSponsorship() {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import { WebLayoutModule } from "./web-layout.module";
|
|||||||
})
|
})
|
||||||
export class UserLayoutComponent implements OnInit {
|
export class UserLayoutComponent implements OnInit {
|
||||||
protected readonly logo = PasswordManagerLogo;
|
protected readonly logo = PasswordManagerLogo;
|
||||||
isFreeFamilyFlagEnabled: boolean;
|
|
||||||
protected hasFamilySponsorshipAvailable$: Observable<boolean>;
|
protected hasFamilySponsorshipAvailable$: Observable<boolean>;
|
||||||
protected showSponsoredFamilies$: Observable<boolean>;
|
protected showSponsoredFamilies$: Observable<boolean>;
|
||||||
protected showSubscription$: Observable<boolean>;
|
protected showSubscription$: Observable<boolean>;
|
||||||
|
|||||||
@@ -20,17 +20,10 @@ export class AppComponent extends BaseAppComponent implements OnInit {
|
|||||||
this.policyListService.addPolicies([
|
this.policyListService.addPolicies([
|
||||||
new MaximumVaultTimeoutPolicy(),
|
new MaximumVaultTimeoutPolicy(),
|
||||||
new DisablePersonalVaultExportPolicy(),
|
new DisablePersonalVaultExportPolicy(),
|
||||||
|
new FreeFamiliesSponsorshipPolicy(),
|
||||||
|
new ActivateAutofillPolicy(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.configService
|
|
||||||
.getFeatureFlag(FeatureFlag.DisableFreeFamiliesSponsorship)
|
|
||||||
.then((isFreeFamilyEnabled) => {
|
|
||||||
if (isFreeFamilyEnabled) {
|
|
||||||
this.policyListService.addPolicies([new FreeFamiliesSponsorshipPolicy()]);
|
|
||||||
}
|
|
||||||
this.policyListService.addPolicies([new ActivateAutofillPolicy()]);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.configService.getFeatureFlag(FeatureFlag.IdpAutoSubmitLogin).then((enabled) => {
|
this.configService.getFeatureFlag(FeatureFlag.IdpAutoSubmitLogin).then((enabled) => {
|
||||||
if (
|
if (
|
||||||
enabled &&
|
enabled &&
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ export enum FeatureFlag {
|
|||||||
SecurityTasks = "security-tasks",
|
SecurityTasks = "security-tasks",
|
||||||
NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss",
|
NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss",
|
||||||
NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss",
|
NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss",
|
||||||
DisableFreeFamiliesSponsorship = "PM-12274-disable-free-families-sponsorship",
|
|
||||||
MacOsNativeCredentialSync = "macos-native-credential-sync",
|
MacOsNativeCredentialSync = "macos-native-credential-sync",
|
||||||
PM9111ExtensionPersistAddEditForm = "pm-9111-extension-persist-add-edit-form",
|
PM9111ExtensionPersistAddEditForm = "pm-9111-extension-persist-add-edit-form",
|
||||||
PrivateKeyRegeneration = "pm-12241-private-key-regeneration",
|
PrivateKeyRegeneration = "pm-12241-private-key-regeneration",
|
||||||
@@ -107,7 +106,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.SecurityTasks]: FALSE,
|
[FeatureFlag.SecurityTasks]: FALSE,
|
||||||
[FeatureFlag.NewDeviceVerificationTemporaryDismiss]: FALSE,
|
[FeatureFlag.NewDeviceVerificationTemporaryDismiss]: FALSE,
|
||||||
[FeatureFlag.NewDeviceVerificationPermanentDismiss]: FALSE,
|
[FeatureFlag.NewDeviceVerificationPermanentDismiss]: FALSE,
|
||||||
[FeatureFlag.DisableFreeFamiliesSponsorship]: FALSE,
|
|
||||||
[FeatureFlag.MacOsNativeCredentialSync]: FALSE,
|
[FeatureFlag.MacOsNativeCredentialSync]: FALSE,
|
||||||
[FeatureFlag.PM9111ExtensionPersistAddEditForm]: FALSE,
|
[FeatureFlag.PM9111ExtensionPersistAddEditForm]: FALSE,
|
||||||
[FeatureFlag.PrivateKeyRegeneration]: FALSE,
|
[FeatureFlag.PrivateKeyRegeneration]: FALSE,
|
||||||
|
|||||||
Reference in New Issue
Block a user