mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Fix upgrade/change plan for free organization (#14537)
This commit is contained in:
@@ -983,7 +983,7 @@
|
||||
</div>
|
||||
<ng-container bitDialogFooter>
|
||||
<button bitButton bitFormButton buttonType="primary" type="submit">
|
||||
{{ sub.subscription.status === "canceled" ? ("restart" | i18n) : ("upgrade" | i18n) }}
|
||||
{{ submitButtonLabel }}
|
||||
</button>
|
||||
<button bitButton buttonType="secondary" type="button" [bitDialogClose]="ResultType.Closed">
|
||||
{{ "cancel" | i18n }}
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "@angular/core";
|
||||
import { FormBuilder, Validators } from "@angular/forms";
|
||||
import { Router } from "@angular/router";
|
||||
import { Subject, firstValueFrom, map, switchMap, takeUntil } from "rxjs";
|
||||
import { firstValueFrom, map, Subject, switchMap, takeUntil } from "rxjs";
|
||||
|
||||
import { ManageTaxInformationComponent } from "@bitwarden/angular/billing/components";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
@@ -31,10 +31,10 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import {
|
||||
BillingApiServiceAbstraction,
|
||||
BillingInformation,
|
||||
OrganizationBillingServiceAbstraction as OrganizationBillingService,
|
||||
OrganizationInformation,
|
||||
PaymentInformation,
|
||||
PlanInformation,
|
||||
OrganizationBillingServiceAbstraction as OrganizationBillingService,
|
||||
} from "@bitwarden/common/billing/abstractions";
|
||||
import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/tax.service.abstraction";
|
||||
import {
|
||||
@@ -744,7 +744,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
const doSubmit = async (): Promise<string> => {
|
||||
let orgId: string = null;
|
||||
if (this.sub.subscription.status === "canceled") {
|
||||
if (this.sub?.subscription?.status === "canceled") {
|
||||
await this.restartSubscription();
|
||||
orgId = this.organizationId;
|
||||
} else {
|
||||
@@ -1089,4 +1089,15 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
this.isSubscriptionCanceled
|
||||
);
|
||||
}
|
||||
|
||||
get submitButtonLabel(): string {
|
||||
if (
|
||||
this.organization.productTierType !== ProductTierType.Free &&
|
||||
this.sub.subscription.status === "canceled"
|
||||
) {
|
||||
return this.i18nService.t("restart");
|
||||
} else {
|
||||
return this.i18nService.t("upgrade");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||
return (
|
||||
!this.showChangePlan &&
|
||||
this.sub.plan.productTier !== ProductTierType.Enterprise &&
|
||||
!this.sub.subscription.cancelled
|
||||
!this.sub.subscription?.cancelled
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user