[AC-2558] Provider Admin still sees manage billing options - not the provided image (#9048)

* Fix the issue of provider admin not seeing the image

* Resolve the  case and ternary operator comment
This commit is contained in:
cyprain-okeke 2024-05-06 20:21:11 +01:00 committed by GitHub
parent ff3021129e
commit 425c7914b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 9 deletions

View File

@ -256,7 +256,7 @@
</ng-container> </ng-container>
</ng-container> </ng-container>
</bit-container> </bit-container>
<bit-container *ngIf="IsProviderManaged"> <bit-container *ngIf="isProviderManaged">
<div <div
class="tw-mx-auto tw-flex tw-flex-col tw-items-center tw-justify-center tw-pt-24 tw-text-center tw-font-bold" class="tw-mx-auto tw-flex tw-flex-col tw-items-center tw-justify-center tw-pt-24 tw-text-center tw-font-bold"
> >

View File

@ -5,6 +5,7 @@ import { concatMap, firstValueFrom, lastValueFrom, Observable, Subject, takeUnti
import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { ProviderApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/provider/provider-api.service.abstraction";
import { OrganizationApiKeyType, ProviderType } from "@bitwarden/common/admin-console/enums"; import { OrganizationApiKeyType, ProviderType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { PlanType } from "@bitwarden/common/billing/enums"; import { PlanType } from "@bitwarden/common/billing/enums";
@ -49,7 +50,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
locale: string; locale: string;
showUpdatedSubscriptionStatusSection$: Observable<boolean>; showUpdatedSubscriptionStatusSection$: Observable<boolean>;
manageBillingFromProviderPortal = ManageBilling; manageBillingFromProviderPortal = ManageBilling;
IsProviderManaged = false; isProviderManaged = false;
protected readonly teamsStarter = ProductType.TeamsStarter; protected readonly teamsStarter = ProductType.TeamsStarter;
@ -69,6 +70,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
private route: ActivatedRoute, private route: ActivatedRoute,
private dialogService: DialogService, private dialogService: DialogService,
private configService: ConfigService, private configService: ConfigService,
private providerService: ProviderApiServiceAbstraction,
) {} ) {}
async ngOnInit() { async ngOnInit() {
@ -106,13 +108,12 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
this.loading = true; this.loading = true;
this.locale = await firstValueFrom(this.i18nService.locale$); this.locale = await firstValueFrom(this.i18nService.locale$);
this.userOrg = await this.organizationService.get(this.organizationId); this.userOrg = await this.organizationService.get(this.organizationId);
if (this.userOrg.hasProvider) {
const provider = await this.providerService.getProvider(this.userOrg.providerId);
const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$); const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$);
this.IsProviderManaged = this.isProviderManaged = provider.type == ProviderType.Msp && enableConsolidatedBilling;
this.userOrg.hasProvider && }
this.userOrg.providerType == ProviderType.Msp &&
enableConsolidatedBilling
? true
: false;
if (this.userOrg.canViewSubscription) { if (this.userOrg.canViewSubscription) {
this.sub = await this.organizationApiService.getSubscription(this.organizationId); this.sub = await this.organizationApiService.getSubscription(this.organizationId);
this.lineItems = this.sub?.subscription?.items; this.lineItems = this.sub?.subscription?.items;

View File

@ -1,4 +1,5 @@
import { BaseResponse } from "../../../../models/response/base.response"; import { BaseResponse } from "../../../../models/response/base.response";
import { ProviderType } from "../../../enums";
export class ProviderResponse extends BaseResponse { export class ProviderResponse extends BaseResponse {
id: string; id: string;
@ -6,6 +7,7 @@ export class ProviderResponse extends BaseResponse {
businessName: string; businessName: string;
billingEmail: string; billingEmail: string;
creationDate: Date; creationDate: Date;
type: ProviderType;
constructor(response: any) { constructor(response: any) {
super(response); super(response);
@ -14,5 +16,6 @@ export class ProviderResponse extends BaseResponse {
this.businessName = this.getResponseProperty("BusinessName"); this.businessName = this.getResponseProperty("BusinessName");
this.billingEmail = this.getResponseProperty("BillingEmail"); this.billingEmail = this.getResponseProperty("BillingEmail");
this.creationDate = this.getResponseProperty("CreationDate"); this.creationDate = this.getResponseProperty("CreationDate");
this.type = this.getResponseProperty("Type");
} }
} }