[AC-2570] Existing providers see new CB experience on Admin Console org Billing Subscription page (#9108)

* Fix the subscription page issue for existing providers

* Merge branch 'main' into ac-2570-existing-providers-see-new-cb-experience-on-admin-console-org-billing-subscription-page

* Fix pr comment on error if the user isn't a provider user

* Resolve the pr comment on error for non provider user

* Remove unused property
This commit is contained in:
cyprain-okeke 2024-05-13 22:00:38 +01:00 committed by GitHub
parent 626128d498
commit bf57a181eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,8 @@ 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 { OrganizationApiKeyType } from "@bitwarden/common/admin-console/enums"; import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
import { OrganizationApiKeyType, ProviderStatusType } 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";
import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response"; import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response";
@ -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: ProviderService,
) {} ) {}
async ngOnInit() { async ngOnInit() {
@ -109,8 +111,11 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
if (this.userOrg.canViewSubscription) { if (this.userOrg.canViewSubscription) {
const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$); const enableConsolidatedBilling = await firstValueFrom(this.enableConsolidatedBilling$);
const provider = await this.providerService.get(this.userOrg.providerId);
this.isProviderManaged = enableConsolidatedBilling && this.userOrg.hasProvider; this.isProviderManaged =
enableConsolidatedBilling &&
this.userOrg.hasProvider &&
provider.providerStatus == ProviderStatusType.Billable;
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;