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>
|
</div>
|
||||||
<ng-container bitDialogFooter>
|
<ng-container bitDialogFooter>
|
||||||
<button bitButton bitFormButton buttonType="primary" type="submit">
|
<button bitButton bitFormButton buttonType="primary" type="submit">
|
||||||
{{ sub.subscription.status === "canceled" ? ("restart" | i18n) : ("upgrade" | i18n) }}
|
{{ submitButtonLabel }}
|
||||||
</button>
|
</button>
|
||||||
<button bitButton buttonType="secondary" type="button" [bitDialogClose]="ResultType.Closed">
|
<button bitButton buttonType="secondary" type="button" [bitDialogClose]="ResultType.Closed">
|
||||||
{{ "cancel" | i18n }}
|
{{ "cancel" | i18n }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { FormBuilder, Validators } from "@angular/forms";
|
import { FormBuilder, Validators } from "@angular/forms";
|
||||||
import { Router } from "@angular/router";
|
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 { ManageTaxInformationComponent } from "@bitwarden/angular/billing/components";
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
@@ -31,10 +31,10 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
|||||||
import {
|
import {
|
||||||
BillingApiServiceAbstraction,
|
BillingApiServiceAbstraction,
|
||||||
BillingInformation,
|
BillingInformation,
|
||||||
|
OrganizationBillingServiceAbstraction as OrganizationBillingService,
|
||||||
OrganizationInformation,
|
OrganizationInformation,
|
||||||
PaymentInformation,
|
PaymentInformation,
|
||||||
PlanInformation,
|
PlanInformation,
|
||||||
OrganizationBillingServiceAbstraction as OrganizationBillingService,
|
|
||||||
} from "@bitwarden/common/billing/abstractions";
|
} from "@bitwarden/common/billing/abstractions";
|
||||||
import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/tax.service.abstraction";
|
import { TaxServiceAbstraction } from "@bitwarden/common/billing/abstractions/tax.service.abstraction";
|
||||||
import {
|
import {
|
||||||
@@ -744,7 +744,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
const doSubmit = async (): Promise<string> => {
|
const doSubmit = async (): Promise<string> => {
|
||||||
let orgId: string = null;
|
let orgId: string = null;
|
||||||
if (this.sub.subscription.status === "canceled") {
|
if (this.sub?.subscription?.status === "canceled") {
|
||||||
await this.restartSubscription();
|
await this.restartSubscription();
|
||||||
orgId = this.organizationId;
|
orgId = this.organizationId;
|
||||||
} else {
|
} else {
|
||||||
@@ -1089,4 +1089,15 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
|||||||
this.isSubscriptionCanceled
|
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 (
|
return (
|
||||||
!this.showChangePlan &&
|
!this.showChangePlan &&
|
||||||
this.sub.plan.productTier !== ProductTierType.Enterprise &&
|
this.sub.plan.productTier !== ProductTierType.Enterprise &&
|
||||||
!this.sub.subscription.cancelled
|
!this.sub.subscription?.cancelled
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user