mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-15840] When org reaches collection limit, organization upgrade pa… (#12648)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { Component, OnDestroy, OnInit } from "@angular/core";
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
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 { 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";
|
||||||
@@ -42,6 +42,9 @@ import { SecretsManagerSubscriptionOptions } from "./sm-adjust-subscription.comp
|
|||||||
templateUrl: "organization-subscription-cloud.component.html",
|
templateUrl: "organization-subscription-cloud.component.html",
|
||||||
})
|
})
|
||||||
export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy {
|
export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy {
|
||||||
|
static readonly QUERY_PARAM_UPGRADE: string = "upgrade";
|
||||||
|
static readonly ROUTE_PARAM_ORGANIZATION_ID: string = "organizationId";
|
||||||
|
|
||||||
sub: OrganizationSubscriptionResponse;
|
sub: OrganizationSubscriptionResponse;
|
||||||
lineItems: BillingSubscriptionItemResponse[] = [];
|
lineItems: BillingSubscriptionItemResponse[] = [];
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
@@ -82,7 +85,19 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
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();
|
await this.changePlan();
|
||||||
const productTierTypeStr = this.route.snapshot.queryParamMap.get("productTierType");
|
const productTierTypeStr = this.route.snapshot.queryParamMap.get("productTierType");
|
||||||
if (productTierTypeStr != null) {
|
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() {
|
ngOnDestroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user