[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:
Alex Morask
2025-12-18 09:12:23 -06:00
committed by GitHub
parent 42e7fdf48a
commit 2afa36f598

View File

@@ -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) {