Skip to content

Commit

Permalink
remove app-payment-method-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan0xC committed Apr 4, 2024
1 parent 2379a32 commit d6b1c81
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 37 deletions.
22 changes: 1 addition & 21 deletions apps/web/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DomSanitizer } from "@angular/platform-browser";
import { NavigationEnd, Router } from "@angular/router";
import * as jq from "jquery";
import { IndividualConfig, ToastrService } from "ngx-toastr";
import { Subject, switchMap, takeUntil, timer } from "rxjs";
import { Subject, takeUntil } from "rxjs";

import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
Expand All @@ -14,7 +14,6 @@ import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-
import { InternalPolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
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 { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { ConfigServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config.service.abstraction";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
Expand Down Expand Up @@ -46,7 +45,6 @@ import {

const BroadcasterSubscriptionId = "AppComponent";
const IdleTimeout = 60000 * 10; // 10 minutes
const PaymentMethodWarningsRefresh = 60000; // 1 Minute

@Component({
selector: "app-root",
Expand All @@ -57,7 +55,6 @@ export class AppComponent implements OnDestroy, OnInit {
private idleTimer: number = null;
private isIdle = false;
private destroy$ = new Subject<void>();
private paymentMethodWarningsRefresh$ = timer(0, PaymentMethodWarningsRefresh);

constructor(
@Inject(DOCUMENT) private document: Document,
Expand Down Expand Up @@ -87,7 +84,6 @@ export class AppComponent implements OnDestroy, OnInit {
private dialogService: DialogService,
private biometricStateService: BiometricStateService,
private stateEventRunnerService: StateEventRunnerService,
private paymentMethodWarningService: PaymentMethodWarningService,
private organizationService: InternalOrganizationServiceAbstraction,
) {}

Expand Down Expand Up @@ -246,21 +242,6 @@ export class AppComponent implements OnDestroy, OnInit {
new DisableSendPolicy(),
new SendOptionsPolicy(),
]);

this.paymentMethodWarningsRefresh$
.pipe(
switchMap(() => this.organizationService.memberOrganizations$),
switchMap(
async (organizations) =>
await Promise.all(
organizations.map((organization) =>
this.paymentMethodWarningService.update(organization.id),
),
),
),
takeUntil(this.destroy$),
)
.subscribe();
}

ngOnDestroy() {
Expand All @@ -282,7 +263,6 @@ export class AppComponent implements OnDestroy, OnInit {
this.passwordGenerationService.clear(),
this.keyConnectorService.clear(),
this.biometricStateService.logout(userId as UserId),
this.paymentMethodWarningService.clear(),
]);

await this.stateEventRunnerService.handleEvent("logout", userId as UserId);
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/app/layouts/user-layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,5 @@
></bit-nav-item>
</bit-nav-group>
</nav>
<app-payment-method-warnings
*ngIf="showPaymentMethodWarningBanners$ | async"
></app-payment-method-warnings>
<router-outlet></router-outlet>
</bit-layout>
12 changes: 1 addition & 11 deletions apps/web/src/app/layouts/user-layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { IconModule, LayoutComponent, NavigationModule } from "@bitwarden/components";

import { PaymentMethodWarningsModule } from "../billing/shared";

import { PasswordManagerLogo } from "./password-manager-logo";

const BroadcasterSubscriptionId = "UserLayoutComponent";
Expand All @@ -24,15 +22,7 @@ const BroadcasterSubscriptionId = "UserLayoutComponent";
selector: "app-user-layout",
templateUrl: "user-layout.component.html",
standalone: true,
imports: [
CommonModule,
RouterModule,
JslibModule,
LayoutComponent,
IconModule,
NavigationModule,
PaymentMethodWarningsModule,
],
imports: [CommonModule, RouterModule, JslibModule, LayoutComponent, IconModule, NavigationModule],
})
export class UserLayoutComponent implements OnInit, OnDestroy {
protected readonly logo = PasswordManagerLogo;
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/app/shared/loose-components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import { UpdatePasswordComponent } from "../auth/update-password.component";
import { UpdateTempPasswordComponent } from "../auth/update-temp-password.component";
import { VerifyEmailTokenComponent } from "../auth/verify-email-token.component";
import { VerifyRecoverDeleteComponent } from "../auth/verify-recover-delete.component";
import { PaymentMethodWarningsModule } from "../billing/shared";
import { DynamicAvatarComponent } from "../components/dynamic-avatar.component";
import { SelectableAvatarComponent } from "../components/selectable-avatar.component";
import { FrontendLayoutComponent } from "../layouts/frontend-layout.component";
Expand Down Expand Up @@ -111,7 +110,6 @@ import { SharedModule } from "./shared.module";
HeaderModule,
OrganizationLayoutComponent,
UserLayoutComponent,
PaymentMethodWarningsModule,
],
declarations: [
AcceptFamilySponsorshipComponent,
Expand Down

0 comments on commit d6b1c81

Please sign in to comment.