mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-24558] Remove FF: pm-21821-provider-portal-takeover (#17521)
* Remove FF: pm-21821-provider-portal-takeover * Fix failing tests
This commit is contained in:
@@ -21,8 +21,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions";
|
||||
import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response";
|
||||
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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import {
|
||||
@@ -100,19 +98,11 @@ export class ManageClientsComponent implements OnInit, OnDestroy {
|
||||
),
|
||||
);
|
||||
|
||||
protected providerPortalTakeover$ = this.configService.getFeatureFlag$(
|
||||
FeatureFlag.PM21821_ProviderPortalTakeover,
|
||||
);
|
||||
|
||||
protected suspensionActive$ = combineLatest([
|
||||
this.isAdminOrServiceUser$,
|
||||
this.providerPortalTakeover$,
|
||||
this.provider$.pipe(map((provider) => provider?.enabled ?? false)),
|
||||
]).pipe(
|
||||
map(
|
||||
([isAdminOrServiceUser, portalTakeoverEnabled, providerEnabled]) =>
|
||||
isAdminOrServiceUser && portalTakeoverEnabled && !providerEnabled,
|
||||
),
|
||||
map(([isAdminOrServiceUser, providerEnabled]) => isAdminOrServiceUser && !providerEnabled),
|
||||
);
|
||||
|
||||
private destroy$ = new Subject<void>();
|
||||
@@ -127,7 +117,6 @@ export class ManageClientsComponent implements OnInit, OnDestroy {
|
||||
private validationService: ValidationService,
|
||||
private webProviderService: WebProviderService,
|
||||
private billingNotificationService: BillingNotificationService,
|
||||
private configService: ConfigService,
|
||||
private accountService: AccountService,
|
||||
private providerApiService: ProviderApiServiceAbstraction,
|
||||
) {}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
route="clients"
|
||||
>
|
||||
<i
|
||||
*ngIf="!provider.enabled && (providerPortalTakeover$ | async)"
|
||||
*ngIf="!provider.enabled"
|
||||
slot="end"
|
||||
class="bwi bwi-exclamation-triangle tw-text-danger"
|
||||
title="{{ 'providerIsDisabled' | i18n }}"
|
||||
|
||||
@@ -13,8 +13,6 @@ import { ProviderType } from "@bitwarden/common/admin-console/enums";
|
||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/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 { IconModule } from "@bitwarden/components";
|
||||
import { NonIndividualSubscriber } from "@bitwarden/web-vault/app/billing/types";
|
||||
import { TaxIdWarningComponent } from "@bitwarden/web-vault/app/billing/warnings/components";
|
||||
@@ -48,7 +46,6 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
|
||||
protected canAccessBilling$: Observable<boolean>;
|
||||
|
||||
protected clientsTranslationKey$: Observable<string>;
|
||||
protected providerPortalTakeover$: Observable<boolean>;
|
||||
|
||||
protected subscriber$: Observable<NonIndividualSubscriber>;
|
||||
protected getTaxIdWarning$: () => Observable<TaxIdWarningType>;
|
||||
@@ -56,7 +53,6 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private providerService: ProviderService,
|
||||
private configService: ConfigService,
|
||||
private providerWarningsService: ProviderWarningsService,
|
||||
private accountService: AccountService,
|
||||
) {}
|
||||
@@ -101,10 +97,6 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.providerPortalTakeover$ = this.configService.getFeatureFlag$(
|
||||
FeatureFlag.PM21821_ProviderPortalTakeover,
|
||||
);
|
||||
|
||||
this.subscriber$ = this.provider$.pipe(
|
||||
map((provider) => ({
|
||||
type: "provider",
|
||||
|
||||
@@ -5,7 +5,6 @@ import { of } from "rxjs";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||
import { ProviderId } from "@bitwarden/common/types/guid";
|
||||
@@ -21,7 +20,6 @@ describe("ProviderWarningsService", () => {
|
||||
let service: ProviderWarningsService;
|
||||
let activatedRoute: MockProxy<ActivatedRoute>;
|
||||
let apiService: MockProxy<ApiService>;
|
||||
let configService: MockProxy<ConfigService>;
|
||||
let dialogService: MockProxy<DialogService>;
|
||||
let i18nService: MockProxy<I18nService>;
|
||||
let router: MockProxy<Router>;
|
||||
@@ -42,7 +40,6 @@ describe("ProviderWarningsService", () => {
|
||||
beforeEach(() => {
|
||||
activatedRoute = mock<ActivatedRoute>();
|
||||
apiService = mock<ApiService>();
|
||||
configService = mock<ConfigService>();
|
||||
dialogService = mock<DialogService>();
|
||||
i18nService = mock<I18nService>();
|
||||
router = mock<Router>();
|
||||
@@ -72,7 +69,6 @@ describe("ProviderWarningsService", () => {
|
||||
ProviderWarningsService,
|
||||
{ provide: ActivatedRoute, useValue: activatedRoute },
|
||||
{ provide: ApiService, useValue: apiService },
|
||||
{ provide: ConfigService, useValue: configService },
|
||||
{ provide: DialogService, useValue: dialogService },
|
||||
{ provide: I18nService, useValue: i18nService },
|
||||
{ provide: Router, useValue: router },
|
||||
@@ -211,22 +207,7 @@ describe("ProviderWarningsService", () => {
|
||||
});
|
||||
|
||||
describe("showProviderSuspendedDialog$", () => {
|
||||
it("should not show dialog when feature flag is disabled", (done) => {
|
||||
configService.getFeatureFlag$.mockReturnValue(of(false));
|
||||
apiService.send.mockResolvedValue({
|
||||
Suspension: { Resolution: "add_payment_method" },
|
||||
});
|
||||
|
||||
service.showProviderSuspendedDialog$(provider).subscribe({
|
||||
complete: () => {
|
||||
expect(dialogService.openSimpleDialog).not.toHaveBeenCalled();
|
||||
done();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should not show dialog when no suspension warning exists", (done) => {
|
||||
configService.getFeatureFlag$.mockReturnValue(of(true));
|
||||
apiService.send.mockResolvedValue({});
|
||||
|
||||
service.showProviderSuspendedDialog$(provider).subscribe({
|
||||
@@ -239,7 +220,6 @@ describe("ProviderWarningsService", () => {
|
||||
|
||||
it("should show add payment method dialog with cancellation date", (done) => {
|
||||
const cancelsAt = new Date(2024, 11, 31);
|
||||
configService.getFeatureFlag$.mockReturnValue(of(true));
|
||||
apiService.send.mockResolvedValue({
|
||||
Suspension: {
|
||||
Resolution: "add_payment_method",
|
||||
@@ -282,7 +262,6 @@ describe("ProviderWarningsService", () => {
|
||||
});
|
||||
|
||||
it("should show add payment method dialog without cancellation date", (done) => {
|
||||
configService.getFeatureFlag$.mockReturnValue(of(true));
|
||||
apiService.send.mockResolvedValue({
|
||||
Suspension: {
|
||||
Resolution: "add_payment_method",
|
||||
@@ -319,7 +298,6 @@ describe("ProviderWarningsService", () => {
|
||||
});
|
||||
|
||||
it("should show contact administrator dialog for contact_administrator resolution", (done) => {
|
||||
configService.getFeatureFlag$.mockReturnValue(of(true));
|
||||
apiService.send.mockResolvedValue({
|
||||
Suspension: {
|
||||
Resolution: "contact_administrator",
|
||||
@@ -343,7 +321,6 @@ describe("ProviderWarningsService", () => {
|
||||
});
|
||||
|
||||
it("should show contact support dialog with action for contact_support resolution", (done) => {
|
||||
configService.getFeatureFlag$.mockReturnValue(of(true));
|
||||
apiService.send.mockResolvedValue({
|
||||
Suspension: {
|
||||
Resolution: "contact_support",
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Injectable } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import {
|
||||
BehaviorSubject,
|
||||
combineLatest,
|
||||
from,
|
||||
lastValueFrom,
|
||||
map,
|
||||
@@ -16,8 +15,6 @@ import {
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||
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 { SyncService } from "@bitwarden/common/platform/sync";
|
||||
import { ProviderId } from "@bitwarden/common/types/guid";
|
||||
@@ -39,7 +36,6 @@ export class ProviderWarningsService {
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private apiService: ApiService,
|
||||
private configService: ConfigService,
|
||||
private dialogService: DialogService,
|
||||
private i18nService: I18nService,
|
||||
private router: Router,
|
||||
@@ -61,12 +57,9 @@ export class ProviderWarningsService {
|
||||
refreshTaxIdWarning = () => this.refreshTaxIdWarningTrigger.next();
|
||||
|
||||
showProviderSuspendedDialog$ = (provider: Provider): Observable<void> =>
|
||||
combineLatest([
|
||||
this.configService.getFeatureFlag$(FeatureFlag.PM21821_ProviderPortalTakeover),
|
||||
this.getWarning$(provider, (response) => response.suspension),
|
||||
]).pipe(
|
||||
switchMap(async ([providerPortalTakeover, warning]) => {
|
||||
if (!providerPortalTakeover || !warning) {
|
||||
this.getWarning$(provider, (response) => response.suspension).pipe(
|
||||
switchMap(async (warning) => {
|
||||
if (!warning) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ export enum FeatureFlag {
|
||||
|
||||
/* Billing */
|
||||
TrialPaymentOptional = "PM-8163-trial-payment",
|
||||
PM21821_ProviderPortalTakeover = "pm-21821-provider-portal-takeover",
|
||||
PM22415_TaxIDWarnings = "pm-22415-tax-id-warnings",
|
||||
PM24032_NewNavigationPremiumUpgradeButton = "pm-24032-new-navigation-premium-upgrade-button",
|
||||
PM25379_UseNewOrganizationMetadataStructure = "pm-25379-use-new-organization-metadata-structure",
|
||||
@@ -126,7 +125,6 @@ export const DefaultFeatureFlagValue = {
|
||||
|
||||
/* Billing */
|
||||
[FeatureFlag.TrialPaymentOptional]: FALSE,
|
||||
[FeatureFlag.PM21821_ProviderPortalTakeover]: FALSE,
|
||||
[FeatureFlag.PM22415_TaxIDWarnings]: FALSE,
|
||||
[FeatureFlag.PM24032_NewNavigationPremiumUpgradeButton]: FALSE,
|
||||
[FeatureFlag.PM25379_UseNewOrganizationMetadataStructure]: FALSE,
|
||||
|
||||
Reference in New Issue
Block a user