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