1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

[PM-22415] Tax ID notifications for Organizations and Providers (#15996)

* [NO LOGIC] Rename BillableEntity to BitwardenSubscriber

This helps us maintain paraody with server where we call this choice type ISubscriber. I chose BitwardenSubscriber to avoid overlap with RxJS

* [NO LOGIC] Move subscriber-billing.client to clients folder

* [NO LOGIC] Move organization warnings under organization folder

* Move getWarnings from OrganizationBillingApiService to new OrganizationBillingClient

I'd like us to move away from stashing so much in libs and utilizing the JsLibServicesModule when it's not necessary to do so. These are invocations used exclusively by the Web Vault and, until that changes, they should be treated as such

* Refactor OrganizationWarningsService

There was a case added to the Inactive Subscription warning for a free trial, but free trials do not represent inactive subscriptions so this was semantically incorrect. This creates another method that pulls the free trial warning and shows a dialog asking the user to subscribe if they're on one.

* Implement Tax ID Warnings throughout Admin Console and Provider Portal

* Fix linting error

* Jimmy's feedback
This commit is contained in:
Alex Morask
2025-08-18 09:52:28 -05:00
committed by GitHub
parent 0c166b3f94
commit df7f1a8d49
58 changed files with 2422 additions and 976 deletions

View File

@@ -18,15 +18,24 @@ import {
ProviderPortalLogo,
BusinessUnitPortalLogo,
} from "@bitwarden/components";
import { NonIndividualSubscriber } from "@bitwarden/web-vault/app/billing/types";
import { TaxIdWarningComponent } from "@bitwarden/web-vault/app/billing/warnings/components";
import { TaxIdWarningType } from "@bitwarden/web-vault/app/billing/warnings/types";
import { WebLayoutModule } from "@bitwarden/web-vault/app/layouts/web-layout.module";
import { ProviderWarningsService } from "../../billing/providers/services/provider-warnings.service";
import { ProviderWarningsService } from "../../billing/providers/warnings/services";
@Component({
selector: "providers-layout",
templateUrl: "providers-layout.component.html",
imports: [CommonModule, RouterModule, JslibModule, WebLayoutModule, IconModule],
providers: [ProviderWarningsService],
imports: [
CommonModule,
RouterModule,
JslibModule,
WebLayoutModule,
IconModule,
TaxIdWarningComponent,
],
})
export class ProvidersLayoutComponent implements OnInit, OnDestroy {
protected readonly logo = ProviderPortalLogo;
@@ -43,6 +52,9 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
protected managePaymentDetailsOutsideCheckout$: Observable<boolean>;
protected providerPortalTakeover$: Observable<boolean>;
protected subscriber$: Observable<NonIndividualSubscriber>;
protected getTaxIdWarning$: () => Observable<TaxIdWarningType>;
constructor(
private route: ActivatedRoute,
private providerService: ProviderService,
@@ -90,10 +102,10 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
FeatureFlag.PM21881_ManagePaymentDetailsOutsideCheckout,
);
providerId$
this.provider$
.pipe(
switchMap((providerId) =>
this.providerWarningsService.showProviderSuspendedDialog$(providerId),
switchMap((provider) =>
this.providerWarningsService.showProviderSuspendedDialog$(provider),
),
takeUntil(this.destroy$),
)
@@ -102,6 +114,18 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
this.providerPortalTakeover$ = this.configService.getFeatureFlag$(
FeatureFlag.PM21821_ProviderPortalTakeover,
);
this.subscriber$ = this.provider$.pipe(
map((provider) => ({
type: "provider",
data: provider,
})),
);
this.getTaxIdWarning$ = () =>
this.provider$.pipe(
switchMap((provider) => this.providerWarningsService.getTaxIdWarning$(provider)),
);
}
ngOnDestroy() {
@@ -116,4 +140,6 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy {
showSettingsTab(provider: Provider) {
return provider.isProviderAdmin;
}
refreshTaxIdWarning = () => this.providerWarningsService.refreshTaxIdWarning();
}