mirror of
https://github.com/bitwarden/clients.git
synced 2025-12-22 13:17:30 +00:00
[PM-21421] Show current plan instead of legacy plan when resubscribing (#17949)
* Show current plan instead of legacy plan when resubscribing * Claude / Kyle feedback
This commit is contained in:
@@ -387,6 +387,8 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
this.focusedIndex = this.selectableProducts.length - 1;
|
||||
if (!this.isSubscriptionCanceled) {
|
||||
await this.selectPlan(this.getPlanByType(ProductTierType.Enterprise));
|
||||
} else {
|
||||
await this.selectPlan(this.reSubscribablePlan);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,10 +549,28 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
|
||||
return this.selectedPlan.isAnnual ? "year" : "month";
|
||||
}
|
||||
|
||||
get reSubscribablePlan() {
|
||||
if (!this.currentPlan) {
|
||||
throw new Error(
|
||||
"Current plan must be set to find the re-subscribable plan for a cancelled subscription.",
|
||||
);
|
||||
}
|
||||
if (!this.currentPlan.disabled) {
|
||||
return this.currentPlan;
|
||||
}
|
||||
return (
|
||||
this.passwordManagerPlans.find(
|
||||
(plan) =>
|
||||
plan.productTier === this.currentPlan.productTier &&
|
||||
plan.isAnnual === this.currentPlan.isAnnual &&
|
||||
!plan.disabled,
|
||||
) ?? this.currentPlan
|
||||
);
|
||||
}
|
||||
|
||||
get selectableProducts() {
|
||||
if (this.isSubscriptionCanceled) {
|
||||
// Return only the current plan if the subscription is canceled
|
||||
return [this.currentPlan];
|
||||
return [this.reSubscribablePlan];
|
||||
}
|
||||
|
||||
if (this.acceptingSponsorship) {
|
||||
|
||||
Reference in New Issue
Block a user