1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-27 22:11:38 +01:00

[PM-15840] When org reaches collection limit, organization upgrade pa… (#12648)

This commit is contained in:
Jonas Hendrickx 2025-01-09 08:53:29 +01:00 committed by GitHub
parent 5c96634974
commit aec25b1491
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@
// @ts-strict-ignore
import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { concatMap, firstValueFrom, lastValueFrom, Observable, Subject, takeUntil } from "rxjs";
import { firstValueFrom, lastValueFrom, Observable, Subject } from "rxjs";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
@ -42,6 +42,9 @@ import { SecretsManagerSubscriptionOptions } from "./sm-adjust-subscription.comp
templateUrl: "organization-subscription-cloud.component.html",
})
export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy {
static readonly QUERY_PARAM_UPGRADE: string = "upgrade";
static readonly ROUTE_PARAM_ORGANIZATION_ID: string = "organizationId";
sub: OrganizationSubscriptionResponse;
lineItems: BillingSubscriptionItemResponse[] = [];
organizationId: string;
@ -82,7 +85,19 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
) {}
async ngOnInit() {
if (this.route.snapshot.queryParamMap.get("upgrade")) {
this.organizationId =
this.route.snapshot.params[
OrganizationSubscriptionCloudComponent.ROUTE_PARAM_ORGANIZATION_ID
];
await this.load();
this.showUpdatedSubscriptionStatusSection$ = this.configService.getFeatureFlag$(
FeatureFlag.AC1795_UpdatedSubscriptionStatusSection,
);
if (
this.route.snapshot.queryParams[OrganizationSubscriptionCloudComponent.QUERY_PARAM_UPGRADE]
) {
await this.changePlan();
const productTierTypeStr = this.route.snapshot.queryParamMap.get("productTierType");
if (productTierTypeStr != null) {
@ -92,20 +107,6 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
}
}
}
this.route.params
.pipe(
concatMap(async (params) => {
this.organizationId = params.organizationId;
await this.load();
}),
takeUntil(this.destroy$),
)
.subscribe();
this.showUpdatedSubscriptionStatusSection$ = this.configService.getFeatureFlag$(
FeatureFlag.AC1795_UpdatedSubscriptionStatusSection,
);
}
ngOnDestroy() {