diff --git a/packages/fakeyou/src/v2/view/premium/PricingPage.tsx b/packages/fakeyou/src/v2/view/premium/PricingPage.tsx index bc615a8d2b..f8fac962a2 100644 --- a/packages/fakeyou/src/v2/view/premium/PricingPage.tsx +++ b/packages/fakeyou/src/v2/view/premium/PricingPage.tsx @@ -62,8 +62,6 @@ function PricingPage(props: Props) { const userHasPaidPremium = props.sessionSubscriptionsWrapper.hasPaidFeatures(); - let freeButtonText = "Use for free"; - let plusButtonText = "Buy Plus"; let plusButtonDisabled = false; @@ -74,26 +72,50 @@ function PricingPage(props: Props) { let eliteButtonText = "Buy Elite"; let eliteButtonDisabled = false; + let freeButton = ( + <> + + Use for free + + > + ); + if (userHasPaidPremium) { - freeButtonText = "Unsubscribe"; + let unsubscribeKey = FYP.plus.internal_plan_key[planKey]; // NB: Default to something (I don't think this matters to Stripe.) + if (props.sessionSubscriptionsWrapper.hasActivePlusSubscription()) { plusButtonText = "Subscribed"; plusButtonDisabled = true; } else { plusButtonText = "Switch to Plus"; } + if (props.sessionSubscriptionsWrapper.hasActiveProSubscription()) { + unsubscribeKey = FYP.pro.internal_plan_key[planKey]; proButtonText = "Subscribed"; proButtonDisabled = true; } else { proButtonText = "Switch to Pro"; } + if (props.sessionSubscriptionsWrapper.hasActiveEliteSubscription()) { + unsubscribeKey = FYP.elite.internal_plan_key[planKey]; eliteButtonText = "Subscribed"; eliteButtonDisabled = true; } else { eliteButtonText = "Switch to Elite"; } + + freeButton = ( + <> + + > + ); } // Highlight the mid-tier plan if nothing is subscribed @@ -126,9 +148,9 @@ function PricingPage(props: Props) {