Skip to content

Commit d9e4dfa

Browse files
fix(billing): Use correct icons for plans (#94288)
Closes https://linear.app/getsentry/issue/BIL-1007/business-plan-icon-is-wrong - Fixes the icon displayed on the subscription page for Business plans - corrects `isEnterprise` checks which previously only took into account legacy enterprise plans # before -- business plan incorrectly used the enterprise plan icon ![image](https://github.com/user-attachments/assets/de136842-99d3-40b8-918e-fbbb050ec06b) # after -- business plan uses the business plan icon ![Screenshot 2025-06-25 at 9 52 28 AM](https://github.com/user-attachments/assets/38753f88-c8ba-4c79-a09f-b6cc87a62fdf)
1 parent 196f59b commit d9e4dfa

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

static/gsApp/components/labelWithPowerIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function LabelWithPowerIcon({children, id, subscription}: Props) {
7474
return children as React.ReactElement;
7575
}
7676

77-
if (!subscription?.plan || isEnterprise(subscription)) {
77+
if (!subscription?.plan || isEnterprise(subscription.plan)) {
7878
return children as React.ReactElement;
7979
}
8080

static/gsApp/components/profiling/alerts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function ContinuousProfilingBetaAlertBannerInner({
304304
'[bold:Profiling Beta Ending Soon:] Your free access ends May 19, 2025. Profiling will require a pay-as-you-go budget after this date. To avoid disruptions, upgrade to a paid plan.',
305305
{bold: <b />}
306306
)
307-
: isEnterprise(subscription)
307+
: isEnterprise(subscription.plan)
308308
? tct(
309309
'[bold:Profiling Beta Ending Soon:] Your free access ends May 19, 2025. To avoid disruptions, contact your account manager before then to add it to your plan.',
310310
{bold: <b />}

static/gsApp/utils/billing.spec.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
hasPerformance,
1919
isBizPlanFamily,
2020
isDeveloperPlan,
21+
isEnterprise,
2122
isNewPayingCustomer,
2223
isTeamPlanFamily,
2324
MILLISECONDS_IN_HOUR,
@@ -883,3 +884,20 @@ describe('getOnDemandCategories', function () {
883884
expect(categories).toEqual(plan.onDemandCategories);
884885
});
885886
});
887+
888+
describe('isEnterprise', function () {
889+
it('returns true for enterprise plans', function () {
890+
expect(isEnterprise('e1')).toBe(true);
891+
expect(isEnterprise('enterprise')).toBe(true);
892+
expect(isEnterprise('am1_business_ent')).toBe(true);
893+
expect(isEnterprise('am2_team_ent_auf')).toBe(true);
894+
expect(isEnterprise('am3_business_ent_ds_auf')).toBe(true);
895+
});
896+
897+
it('returns false for non-enterprise plans', function () {
898+
expect(isEnterprise('_e1')).toBe(false);
899+
expect(isEnterprise('_enterprise')).toBe(false);
900+
expect(isEnterprise('am1_business')).toBe(false);
901+
expect(isEnterprise('am2_team')).toBe(false);
902+
});
903+
});

static/gsApp/utils/billing.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ function displayNumber(n: number, fractionDigits = 0) {
278278
/**
279279
* Utility functions for Pricing Plans
280280
*/
281-
export const isEnterprise = (subscription: Subscription) =>
282-
['e1', 'enterprise'].some(p => subscription.plan.startsWith(p));
281+
export const isEnterprise = (plan: string) =>
282+
['e1', 'enterprise'].some(p => plan.startsWith(p)) || isAmEnterprisePlan(plan);
283283

284284
export const isTrialPlan = (plan: string) => TRIAL_PLANS.includes(plan);
285285

@@ -329,14 +329,11 @@ export function isAm3DsPlan(planId?: string) {
329329
}
330330

331331
export function isAmEnterprisePlan(planId?: string) {
332-
return (
333-
typeof planId === 'string' &&
334-
planId.startsWith('am') &&
335-
(planId.endsWith('_ent') ||
336-
planId.endsWith('_ent_auf') ||
337-
planId.endsWith('_ent_ds') ||
338-
planId.endsWith('_ent_ds_auf'))
339-
);
332+
if (typeof planId !== 'string' || !isAmPlan(planId)) {
333+
return false;
334+
}
335+
336+
return planId.includes('_ent');
340337
}
341338

342339
export function hasJustStartedPlanTrial(subscription: Subscription) {

static/gsApp/views/subscriptionPage/headerCards/subscriptionCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ function PlanImage({subscription}: {subscription: Subscription}) {
2828
}
2929

3030
let tierImage: any | null = null;
31-
if (isEnterprise(subscription)) {
32-
tierImage = BusinessBundleArt;
31+
if (isEnterprise(subscription.plan)) {
32+
tierImage = CustomBundleArt;
3333
} else if (isTeamPlan(subscription.plan)) {
3434
tierImage = TeamBundleArt;
3535
} else {
36-
tierImage = CustomBundleArt;
36+
tierImage = BusinessBundleArt;
3737
}
3838

3939
return (

0 commit comments

Comments
 (0)