Skip to content

Commit 21a602c

Browse files
committed
fix: plan selection
1 parent 647f5d8 commit 21a602c

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/lib/components/billing/planSelection.svelte

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@
2626
2727
function shouldShowTooltip(plan: Models.BillingPlan) {
2828
if (plan.group !== BillingPlanGroup.Starter) return true;
29-
else return !anyOrgFree;
29+
if (!anyOrgFree) return true;
30+
// Hide only when upgrading from Free (current org on Free, user selected Pro)
31+
if ($organization?.billingPlanId === plan.$id && selectedPlan !== plan.$id) return true;
32+
return false;
3033
}
3134
3235
function shouldDisable(plan: Models.BillingPlan) {
3336
return plan.group === BillingPlanGroup.Starter && anyOrgFree;
3437
}
3538
39+
function shouldForceShowTooltip(plan: Models.BillingPlan) {
40+
if (!shouldDisable(plan)) return false;
41+
// Don't force-show when upgrading from Free (current org on Free, user selected Pro)
42+
if ($organization?.billingPlanId === plan.$id && selectedPlan !== plan.$id) return false;
43+
return true;
44+
}
45+
3646
$effect(() => {
3747
selectedBillingPlan = billingIdToPlan(selectedPlan);
3848
});
@@ -45,7 +55,7 @@
4555
name="plan"
4656
bind:group={selectedPlan}
4757
disabled={!selfService || shouldDisable(plan)}
48-
tooltipShow={shouldDisable(plan)}
58+
tooltipShow={shouldForceShowTooltip(plan)}
4959
value={plan.$id}
5060
title={plan.name}>
5161
<svelte:fragment slot="action">

src/routes/(console)/organization-[organization]/change-plan/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
bind:couponData={selectedCoupon}
487487
bind:billingBudget
488488
organizationId={data.organization.$id} />
489-
{:else if !data.organization.billingPlanDetails.selfService}
489+
{:else}
490490
<PlanComparisonBox downgrade={data.hasFreeOrgs ? false : isDowngrade} />
491491
{/if}
492492
</svelte:fragment>

0 commit comments

Comments
 (0)