From 8dd904f4b7ad767a24839a18b878703514be1f87 Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Wed, 11 Dec 2024 19:08:14 -0500 Subject: [PATCH] fix ts strict errors (#12355) --- .../clients/vnext-clients.component.ts | 10 +++++----- .../clients/vnext-manage-clients.component.ts | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/vnext-clients.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/vnext-clients.component.ts index ba56ce872b..2be38477d4 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/clients/vnext-clients.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/clients/vnext-clients.component.ts @@ -53,8 +53,8 @@ const DisallowedPlanTypes = [ ], }) export class vNextClientsComponent { - providerId: string; - addableOrganizations: Organization[]; + providerId: string = ""; + addableOrganizations: Organization[] = []; loading = true; manageOrganizations = false; showAddExisting = false; @@ -79,8 +79,8 @@ export class vNextClientsComponent { this.searchControl.setValue(queryParams.search); }); - this.activatedRoute.parent.params - .pipe( + this.activatedRoute.parent?.params + ?.pipe( switchMap((params) => { this.providerId = params.providerId; return this.providerService.get$(this.providerId).pipe( @@ -125,7 +125,7 @@ export class vNextClientsComponent { await this.webProviderService.detachOrganization(this.providerId, organization.id); this.toastService.showToast({ variant: "success", - title: null, + title: "", message: this.i18nService.t("detachedOrganization", organization.organizationName), }); await this.load(); diff --git a/bitwarden_license/bit-web/src/app/billing/providers/clients/vnext-manage-clients.component.ts b/bitwarden_license/bit-web/src/app/billing/providers/clients/vnext-manage-clients.component.ts index 5ee7817f34..4c0837d6da 100644 --- a/bitwarden_license/bit-web/src/app/billing/providers/clients/vnext-manage-clients.component.ts +++ b/bitwarden_license/bit-web/src/app/billing/providers/clients/vnext-manage-clients.component.ts @@ -51,15 +51,15 @@ import { vNextNoClientsComponent } from "./vnext-no-clients.component"; ], }) export class vNextManageClientsComponent { - providerId: string; - provider: Provider; + providerId: string = ""; + provider: Provider | undefined; loading = true; isProviderAdmin = false; dataSource: TableDataSource = new TableDataSource(); protected searchControl = new FormControl("", { nonNullable: true }); - protected plans: PlanResponse[]; + protected plans: PlanResponse[] = []; constructor( private billingApiService: BillingApiServiceAbstraction, @@ -76,8 +76,8 @@ export class vNextManageClientsComponent { this.searchControl.setValue(queryParams.search); }); - this.activatedRoute.parent.params - .pipe( + this.activatedRoute.parent?.params + ?.pipe( switchMap((params) => { this.providerId = params.providerId; return this.providerService.get$(this.providerId).pipe( @@ -110,12 +110,12 @@ export class vNextManageClientsComponent { async load() { this.provider = await firstValueFrom(this.providerService.get$(this.providerId)); - this.isProviderAdmin = this.provider.type === ProviderUserType.ProviderAdmin; + this.isProviderAdmin = this.provider?.type === ProviderUserType.ProviderAdmin; const clients = (await this.billingApiService.getProviderClientOrganizations(this.providerId)) .data; - clients.forEach((client) => (client.plan = client.plan.replace(" (Monthly)", ""))); + clients.forEach((client) => (client.plan = client.plan?.replace(" (Monthly)", ""))); this.dataSource.data = clients; @@ -146,7 +146,7 @@ export class vNextManageClientsComponent { organization: { id: organization.id, name: organization.organizationName, - seats: organization.seats, + seats: organization.seats ? organization.seats : 0, }, }, }); @@ -164,7 +164,7 @@ export class vNextManageClientsComponent { const dialogRef = openManageClientSubscriptionDialog(this.dialogService, { data: { organization, - provider: this.provider, + provider: this.provider!, }, }); @@ -190,7 +190,7 @@ export class vNextManageClientsComponent { await this.webProviderService.detachOrganization(this.providerId, organization.id); this.toastService.showToast({ variant: "success", - title: null, + title: "", message: this.i18nService.t("detachedOrganization", organization.organizationName), }); await this.load();