[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:
parent
ff3021129e
commit
425c7914b0
|
@ -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"
|
||||||
>
|
>
|
||||||
|
|
|
@ -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);
|
||||||
const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$);
|
if (this.userOrg.hasProvider) {
|
||||||
this.IsProviderManaged =
|
const provider = await this.providerService.getProvider(this.userOrg.providerId);
|
||||||
this.userOrg.hasProvider &&
|
const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$);
|
||||||
this.userOrg.providerType == ProviderType.Msp &&
|
this.isProviderManaged = provider.type == ProviderType.Msp && enableConsolidatedBilling;
|
||||||
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;
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue