Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AC-2554] Prevent calls to billing-status endpoint when feature flag is off #9032

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions apps/web/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
import { Component, Inject, NgZone, OnDestroy, OnInit } from "@angular/core";
import { NavigationEnd, Router } from "@angular/router";
import * as jq from "jquery";
import { Subject, firstValueFrom, map, switchMap, takeUntil, timer } from "rxjs";
import {

Check warning on line 5 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L5

Added line #L5 was not covered by tests
combineLatest,
filter,
firstValueFrom,
map,
Subject,
switchMap,
takeUntil,
timer,
} from "rxjs";

import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
Expand All @@ -14,6 +23,7 @@
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { KeyConnectorService } from "@bitwarden/common/auth/abstractions/key-connector.service";
import { PaymentMethodWarningsServiceAbstraction as PaymentMethodWarningService } from "@bitwarden/common/billing/abstractions/payment-method-warnings-service.abstraction";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";

Check warning on line 26 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L26

Added line #L26 was not covered by tests
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
Expand Down Expand Up @@ -242,8 +252,12 @@
new SendOptionsPolicy(),
]);

this.paymentMethodWarningsRefresh$
combineLatest([

Check warning on line 255 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L255

Added line #L255 was not covered by tests
this.configService.getFeatureFlag$(FeatureFlag.ShowPaymentMethodWarningBanners),
this.paymentMethodWarningsRefresh$,
])
.pipe(
filter(([showPaymentMethodWarningBanners]) => showPaymentMethodWarningBanners),

Check warning on line 260 in apps/web/src/app/app.component.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

AppComponent.ngOnInit already has high cyclomatic complexity, and now it increases in Lines of Code from 134 to 138. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 260 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L260

Added line #L260 was not covered by tests
switchMap(() => this.organizationService.memberOrganizations$),
switchMap(
async (organizations) =>
Expand Down