mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-23513] Complete usage of OrganizationWarningsService (#16272)
* Use OrganizationWarningsService in AC VaultComponent * Use OrganizationWarningsService in OrgSwitcherComponent * Use OrganizationWarningsService in VaultFilterComponent * Use OrganizationWarningsService in VaultComponent * Use OrganizationWarningsService in SM OverviewComponent * Remove TrialFlowService from unused codepaths * Remove TrialFlowService * Refresh free trial warning on standard payment method update * Fix lint errors * Fix lint errors * Remove FF * Fix free trial banner on deprecated ac vault component
This commit is contained in:
@@ -1,23 +1,8 @@
|
||||
<ng-container *ngIf="freeTrial$ | async as freeTrial">
|
||||
<bit-banner
|
||||
id="update-browser-banner"
|
||||
bannerType="premium"
|
||||
icon="bwi-billing"
|
||||
[showClose]="false"
|
||||
*ngIf="!loading && freeTrial.shownBanner"
|
||||
>
|
||||
{{ freeTrial.message }}
|
||||
<a
|
||||
bitLink
|
||||
linkType="secondary"
|
||||
class="tw-cursor-pointer"
|
||||
(click)="navigateToPaymentMethod()"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
{{ "clickHereToAddPaymentMethod" | i18n }}
|
||||
</a>
|
||||
</bit-banner>
|
||||
</ng-container>
|
||||
<app-organization-free-trial-warning
|
||||
[organization]="organization"
|
||||
(clicked)="navigateToPaymentMethod()"
|
||||
>
|
||||
</app-organization-free-trial-warning>
|
||||
<app-header [title]="organizationName">
|
||||
<sm-new-menu></sm-new-menu>
|
||||
</app-header>
|
||||
|
||||
@@ -14,13 +14,8 @@ import {
|
||||
take,
|
||||
share,
|
||||
firstValueFrom,
|
||||
of,
|
||||
filter,
|
||||
catchError,
|
||||
from,
|
||||
} from "rxjs";
|
||||
|
||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
||||
import {
|
||||
getOrganizationById,
|
||||
OrganizationService,
|
||||
@@ -28,16 +23,12 @@ import {
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { OrganizationBillingServiceAbstraction } from "@bitwarden/common/billing/abstractions";
|
||||
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 { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { BillingNotificationService } from "@bitwarden/web-vault/app/billing/services/billing-notification.service";
|
||||
import { TrialFlowService } from "@bitwarden/web-vault/app/billing/services/trial-flow.service";
|
||||
import { FreeTrial } from "@bitwarden/web-vault/app/billing/types/free-trial";
|
||||
|
||||
import { OrganizationCounts } from "../models/view/counts.view";
|
||||
import { ProjectListView } from "../models/view/project-list.view";
|
||||
@@ -111,7 +102,6 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
tasks: OrganizationTasks;
|
||||
counts: OrganizationCounts;
|
||||
}>;
|
||||
protected freeTrial$: Observable<FreeTrial>;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -127,10 +117,6 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
private smOnboardingTasksService: SMOnboardingTasksService,
|
||||
private logService: LogService,
|
||||
private router: Router,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private trialFlowService: TrialFlowService,
|
||||
private organizationBillingService: OrganizationBillingServiceAbstraction,
|
||||
private billingNotificationService: BillingNotificationService,
|
||||
private configService: ConfigService,
|
||||
) {}
|
||||
|
||||
@@ -161,27 +147,6 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
this.organizationEnabled = org.enabled;
|
||||
});
|
||||
|
||||
this.freeTrial$ = org$.pipe(
|
||||
filter((org) => org.isOwner && org.canViewBillingHistory && org.canViewSubscription),
|
||||
switchMap((org) =>
|
||||
combineLatest([
|
||||
of(org),
|
||||
this.organizationApiService.getSubscription(org.id),
|
||||
from(this.organizationBillingService.getPaymentSource(org.id)).pipe(
|
||||
catchError((error: unknown) => {
|
||||
this.billingNotificationService.handleError(error);
|
||||
return of(null);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
),
|
||||
map(([org, sub, paymentSource]) => {
|
||||
return this.trialFlowService.checkForOrgsWithUpcomingPaymentIssues(org, sub, paymentSource);
|
||||
}),
|
||||
filter((result) => result !== null),
|
||||
takeUntil(this.destroy$),
|
||||
);
|
||||
|
||||
const projects$ = combineLatest([
|
||||
orgId$,
|
||||
this.projectService.project$.pipe(startWith(null)),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { NgModule } from "@angular/core";
|
||||
|
||||
import { BannerModule } from "@bitwarden/components";
|
||||
import { OrganizationFreeTrialWarningComponent } from "@bitwarden/web-vault/app/billing/organizations/warnings/components";
|
||||
import { OrganizationWarningsModule } from "@bitwarden/web-vault/app/billing/organizations/warnings/organization-warnings.module";
|
||||
import { OnboardingModule } from "@bitwarden/web-vault/app/shared/components/onboarding/onboarding.module";
|
||||
|
||||
import { SecretsManagerSharedModule } from "../shared/sm-shared.module";
|
||||
@@ -10,7 +12,14 @@ import { OverviewComponent } from "./overview.component";
|
||||
import { SectionComponent } from "./section.component";
|
||||
|
||||
@NgModule({
|
||||
imports: [SecretsManagerSharedModule, OverviewRoutingModule, OnboardingModule, BannerModule],
|
||||
imports: [
|
||||
SecretsManagerSharedModule,
|
||||
OverviewRoutingModule,
|
||||
OnboardingModule,
|
||||
BannerModule,
|
||||
OrganizationFreeTrialWarningComponent,
|
||||
OrganizationWarningsModule,
|
||||
],
|
||||
declarations: [OverviewComponent, SectionComponent],
|
||||
providers: [],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user