Skip to content

Commit cee1369

Browse files
committed
fix(billing): Fix on-demand capitalization
1 parent b0ab3fd commit cee1369

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

static/gsApp/views/amCheckout/billingCycleSelectCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {t, tct} from 'sentry/locale';
99

1010
import {ANNUAL} from 'getsentry/constants';
1111
import type {Plan, Subscription} from 'getsentry/types';
12-
import {isDeveloperPlan} from 'getsentry/utils/billing';
12+
import {displayBudgetName, isDeveloperPlan} from 'getsentry/utils/billing';
1313
import CheckoutOption from 'getsentry/views/amCheckout/checkoutOption';
1414
import type {CheckoutFormData} from 'getsentry/views/amCheckout/types';
1515

@@ -72,7 +72,10 @@ function BillingCycleSelectCard({
7272

7373
const additionalInfo = isAnnual
7474
? tct('[budgetTerm] usage billed monthly, discount does not apply', {
75-
budgetTerm: plan.budgetTerm === 'pay-as-you-go' ? 'PAYG' : plan.budgetTerm,
75+
budgetTerm:
76+
plan.budgetTerm === 'pay-as-you-go'
77+
? 'PAYG'
78+
: displayBudgetName(plan, {title: true}),
7679
})
7780
: t('Cancel anytime');
7881

static/gsApp/views/amCheckout/cart.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
type Subscription,
3131
} from 'getsentry/types';
3232
import {
33+
displayBudgetName,
3334
formatReservedWithUnits,
3435
getPlanIcon,
3536
getProductIcon,
@@ -238,13 +239,16 @@ function ItemsSummary({activePlan, formData}: ItemsSummaryProps) {
238239
budgetTerm:
239240
activePlan.budgetTerm === 'pay-as-you-go'
240241
? 'PAYG'
241-
: activePlan.budgetTerm,
242+
: displayBudgetName(activePlan, {title: true}),
242243
})
243244
) : (
244245
// "Unlock with on-demand" gets cut off in non-chonk theme
245246
<Text size="xs">
246247
{tct('Unlock with [budgetTerm]', {
247-
budgetTerm: activePlan.budgetTerm,
248+
budgetTerm:
249+
activePlan.budgetTerm === 'pay-as-you-go'
250+
? 'PAYG'
251+
: displayBudgetName(activePlan, {title: true}),
248252
})}
249253
</Text>
250254
)}
@@ -364,7 +368,7 @@ function SubtotalSummary({
364368
<ItemFlex>
365369
<Text>
366370
{tct('[budgetTerm] spend limit', {
367-
budgetTerm: capitalize(activePlan.budgetTerm),
371+
budgetTerm: displayBudgetName(activePlan, {title: true}),
368372
})}
369373
</Text>
370374
<Flex direction="column" gap="sm" align="end">

static/gsApp/views/amCheckout/index.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function assertCheckoutV3Steps(tier: PlanTier) {
2929
[
3030
'Build your plan',
3131
[PlanTier.AM1, PlanTier.AM2].includes(tier)
32-
? /Set your on-demand limit/
33-
: /Set your pay-as-you-go limit/,
32+
? /Set your On-Demand limit/
33+
: /Set your Pay-as-you-go limit/,
3434
'Pay monthly or yearly, your choice',
3535
'Edit billing information',
3636
].forEach(step => {

static/gsApp/views/amCheckout/steps/setSpendLimit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {Flex} from 'sentry/components/core/layout';
44
import {t} from 'sentry/locale';
55

66
import type {OnDemandBudgets} from 'getsentry/types';
7+
import {displayBudgetName} from 'getsentry/utils/billing';
78
import trackGetsentryAnalytics from 'getsentry/utils/trackGetsentryAnalytics';
89
import ReserveAdditionalVolume from 'getsentry/views/amCheckout/reserveAdditionalVolume';
910
import StepHeader from 'getsentry/views/amCheckout/steps/stepHeader';
@@ -55,7 +56,7 @@ function SetSpendCap({
5556
organization={organization}
5657
header={
5758
<StepHeader
58-
title={t('Set your %s limit', activePlan.budgetTerm)}
59+
title={t('Set your %s limit', displayBudgetName(activePlan, {title: true}))}
5960
isActive
6061
stepNumber={stepNumber}
6162
isCompleted={false}

static/gsApp/views/spendLimits/spendLimitSettings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
type Plan,
2323
} from 'getsentry/types';
2424
import {
25+
displayBudgetName,
2526
formatReservedWithUnits,
2627
getReservedBudgetCategoryForAddOn,
2728
isAm2Plan,
@@ -656,8 +657,8 @@ function SpendLimitSettings({
656657
{
657658
budgetTerm:
658659
activePlan.budgetTerm === 'pay-as-you-go'
659-
? `${capitalize(activePlan.budgetTerm)} (PAYG)`
660-
: `${capitalize(activePlan.budgetTerm)}`,
660+
? `${displayBudgetName(activePlan, {title: true})} (PAYG)`
661+
: displayBudgetName(activePlan, {title: true}),
661662
}
662663
)}
663664
</Text>

static/gsApp/views/subscriptionPage/onDemandSettings.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ export function OnDemandSettings({subscription, organization}: OnDemandSettingsP
5454
},
5555
success: data => {
5656
SubscriptionStore.set(data.slug, data);
57-
addSuccessMessage(t('%s max spend updated', subscription.planDetails.budgetTerm));
57+
addSuccessMessage(
58+
t(
59+
'%s max spend updated',
60+
displayBudgetName(subscription.planDetails, {title: true})
61+
)
62+
);
5863
},
5964
});
6065
}

0 commit comments

Comments
 (0)