From 3924900e9ad6d05831d37d6bab250f09b31cb803 Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Tue, 20 Sep 2022 15:55:38 +0000 Subject: [PATCH] [server] Show "Team Plans" to users who are about to uprgade to usage-based --- components/server/ee/src/billing/billing-mode.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/server/ee/src/billing/billing-mode.ts b/components/server/ee/src/billing/billing-mode.ts index 78441bbd1f746e..dbbb5ac0a66385 100644 --- a/components/server/ee/src/billing/billing-mode.ts +++ b/components/server/ee/src/billing/billing-mode.ts @@ -132,8 +132,7 @@ export class BillingModesImpl implements BillingModes { const hasCbTeamSeat = cbTeamSubscriptions.length > 0; const hasCbTeamSubscription = cbOwnedTeamSubscriptions.length > 0; - if (hasUbbPaidTeam || hasUbbPersonal) { - // UBB is greedy: once a user has at least a paid team membership, they should benefit from it! + function usageBased() { const result: BillingMode = { mode: "usage-based" }; if (hasCbTeam) { result.hasChargebeeTeamPlan = true; @@ -143,6 +142,11 @@ export class BillingModesImpl implements BillingModes { } return result; } + + if (hasUbbPaidTeam || hasUbbPersonal) { + // UBB is greedy: once a user has at least a paid team membership, they should benefit from it! + return usageBased(); + } if (hasCbTeam || hasCbTeamSeat || canUpgradeToUBB) { // TODO(gpl): Q: How to test the free-tier, then? A: Make sure you have no CB seats anymore // For that we could add a new field here, which lists all seats that are "blocking" you, and display them in the UI somewhere. @@ -150,7 +154,7 @@ export class BillingModesImpl implements BillingModes { } // UBB free tier - return { mode: "usage-based" }; + return usageBased(); } async getBillingModeForTeam(team: Team, _now: Date): Promise {