Skip to content

Commit 1349f9a

Browse files
ref(billing): Clean up hardcoded on-demand terms (#102408)
Mainly just cleaning up where we display the term to users everywhere; some comments and variable names updated but we'll probably need to do the rest (if ever) when we update on the backend too.
1 parent cbeb197 commit 1349f9a

39 files changed

+512
-568
lines changed

static/app/views/insights/crons/components/processingErrors/processingErrorItem.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ export function ProcessingErrorItem({error, checkinTooltip}: Props) {
5555
{checkinTooltip}
5656
);
5757
case ProcessingErrorType.MONITOR_DISABLED_NO_QUOTA:
58+
// TODO: this should really be a gsApp hook so we have subscription context, but
59+
// for now we'll just default to "pay-as-you-go" since it's the modern term
5860
return tct(
59-
'A [checkinTooltip:check-in] upsert was sent, but due to insufficient quota a new monitor could not be enabled. Increase your Crons on-demand budget in your [link: subscription settings], and then enable this monitor.',
61+
'A [checkinTooltip:check-in] upsert was sent, but due to insufficient quota a new monitor could not be enabled. Increase your Crons pay-as-you-go budget in your [link: subscription settings], and then enable this monitor.',
6062
{checkinTooltip, link: <Link to="/settings/billing/overview/" />}
6163
);
6264
case ProcessingErrorType.MONITOR_INVALID_CONFIG:

static/gsAdmin/components/customerStatus.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ const getTooltip = ({planDetails, trialPlan}: Subscription) => (
4343
)}
4444
<dt>Base Price:</dt>
4545
<dd>{formatCurrency(planDetails?.price)}</dd>
46-
<dt>On-Demand:</dt>
47-
<dd>{formatCurrency(planDetails?.onDemandEventPrice)} / event</dd>
4846
<dt>Contract:</dt>
4947
<dd>{planDetails?.contractInterval}</dd>
5048
<dt>Billed:</dt>

static/gsAdmin/components/customers/customerHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function CustomerHistory({orgId, ...props}: Props) {
3232
columns={[
3333
<th key="period">Period</th>,
3434
<th key="onDemand" style={{width: 200, textAlign: 'right'}}>
35-
On-Demand
35+
Pay-as-you-go
3636
</th>,
3737
<th key="reserved" style={{width: 200, textAlign: 'right'}}>
3838
Reserved

static/gsAdmin/components/customers/customerOverview.spec.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,18 @@ describe('CustomerOverview', () => {
190190
expect(screen.getByText('Total: $0.00 / $3,000,000.00')).toBeInTheDocument();
191191

192192
// CPE information
193-
expect(screen.getByText('Pay-as-you-go Cost-Per-Event Errors:')).toBeInTheDocument();
193+
expect(screen.getByText('On-Demand Cost-Per-Event Errors:')).toBeInTheDocument();
194194
expect(screen.getByText('$0.12345678')).toBeInTheDocument();
195195
expect(
196-
screen.getByText('Pay-as-you-go Cost-Per-Event Performance units:')
196+
screen.getByText('On-Demand Cost-Per-Event Performance units:')
197197
).toBeInTheDocument();
198198
expect(screen.getByText('$1.00000000')).toBeInTheDocument();
199-
expect(screen.getByText('Pay-as-you-go Cost-Per-Event Replays:')).toBeInTheDocument();
199+
expect(screen.getByText('On-Demand Cost-Per-Event Replays:')).toBeInTheDocument();
200200
expect(screen.getByText('$0.50000000')).toBeInTheDocument();
201-
expect(
202-
screen.getByText('Pay-as-you-go Cost-Per-Event Attachments:')
203-
).toBeInTheDocument();
201+
expect(screen.getByText('On-Demand Cost-Per-Event Attachments:')).toBeInTheDocument();
204202
expect(screen.getByText('$0.20300000')).toBeInTheDocument();
205203
expect(
206-
screen.getByText('Pay-as-you-go Cost-Per-Event Cron monitors:')
204+
screen.getByText('On-Demand Cost-Per-Event Cron monitors:')
207205
).toBeInTheDocument();
208206
expect(screen.getByText('$0.07550000')).toBeInTheDocument();
209207
});

static/gsAdmin/components/customers/customerOverview.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import type {
3232
} from 'getsentry/types';
3333
import {BillingType, OnDemandBudgetMode} from 'getsentry/types';
3434
import {
35+
displayBudgetName,
3536
formatBalance,
3637
formatReservedWithUnits,
3738
getActiveProductTrial,
@@ -130,6 +131,7 @@ function SubscriptionSummary({customer, onAction}: SubscriptionSummaryProps) {
130131
<small>{customer.contractInterval}</small>
131132
</DetailLabel>
132133
)}
134+
{/* TODO(billing): Should we start calling On-Demand periods "Pay-as-you-go" periods? */}
133135
<DetailLabel title="On-Demand">
134136
<OnDemandSummary customer={customer} />
135137
</DetailLabel>
@@ -213,7 +215,9 @@ function ReservedData({customer}: ReservedDataProps) {
213215
: 'None'}
214216
</DetailLabel>
215217
{customer.onDemandInvoicedManual && (
216-
<DetailLabel title={`Pay-as-you-go Cost-Per-Event ${categoryName}`}>
218+
<DetailLabel
219+
title={`${displayBudgetName(customer.planDetails, {title: true})} Cost-Per-Event ${categoryName}`}
220+
>
217221
{typeof categoryHistory.paygCpe === 'number'
218222
? displayPriceWithCents({
219223
cents: categoryHistory.paygCpe,

static/gsAdmin/components/customers/customerStatsFilters.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export function CustomerStatsFilters({
9292

9393
const {start, end, period, utc} = pageDateTime;
9494

95+
// TODO(billing): Should we start calling On-Demand periods "Pay-as-you-go" periods?
9596
const onDemandLabel = (
9697
<Fragment>
9798
On-Demand (

static/gsAdmin/components/customers/pendingChanges.spec.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('PendingChanges', () => {
4646
name: 'Team (Enterprise)',
4747
contractInterval: 'annual',
4848
billingInterval: 'annual',
49+
budgetTerm: 'on-demand',
4950
}),
5051
plan: 'am1_team_ent',
5152
planName: 'Team (Enterprise)',
@@ -87,7 +88,7 @@ describe('PendingChanges', () => {
8788
expect(container).toHaveTextContent(
8889
'The following changes will take effect on Feb 16, 2022'
8990
);
90-
expect(container).toHaveTextContent('On-demand maximum — $0.00 → $500.00');
91+
expect(container).toHaveTextContent('On-Demand maximum — $0.00 → $500.00');
9192
});
9293

9394
it('renders pending changes with all categories', () => {
@@ -100,6 +101,7 @@ describe('PendingChanges', () => {
100101
name: 'Team (Enterprise)',
101102
contractInterval: 'annual',
102103
billingInterval: 'annual',
104+
budgetTerm: 'on-demand',
103105
}),
104106
plan: 'am3_team_ent',
105107
planName: 'Team (Enterprise)',
@@ -140,7 +142,7 @@ describe('PendingChanges', () => {
140142
expect(container).toHaveTextContent(
141143
'The following changes will take effect on Feb 20, 2024'
142144
);
143-
expect(container).toHaveTextContent('On-demand maximum — $0.00 → $500.00');
145+
expect(container).toHaveTextContent('On-Demand maximum — $0.00 → $500.00');
144146
});
145147

146148
it('renders on-demand budgets', () => {
@@ -189,7 +191,7 @@ describe('PendingChanges', () => {
189191
'The following changes will take effect on Feb 16, 2022'
190192
);
191193
expect(container).toHaveTextContent(
192-
'On-demand budget — shared on-demand budget of $100 → per-category on-demand budget (errors at $3, transactions at $2, and attachments at $1)'
194+
'On-Demand Budget — shared on-demand budget of $100 → per-category on-demand budget (errors at $3, transactions at $2, and attachments at $1)'
193195
);
194196
});
195197

@@ -234,7 +236,7 @@ describe('PendingChanges', () => {
234236
);
235237
expect(container).toHaveTextContent('Plan changes — Developer → Team (Enterprise)');
236238
expect(container).toHaveTextContent(
237-
'On-demand budget — shared on-demand budget of $100 → per-category on-demand budget (errors at $3, transactions at $2, and attachments at $1)'
239+
'On-Demand Budget — shared on-demand budget of $100 → per-category on-demand budget (errors at $3, transactions at $2, and attachments at $1)'
238240
);
239241
expect(screen.getAllByText(/The following changes will take effect on/)).toHaveLength(
240242
1

static/gsAdmin/components/customers/pendingChanges.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {DataCategory} from 'sentry/types/core';
1010
import {RESERVED_BUDGET_QUOTA} from 'getsentry/constants';
1111
import {usePlanMigrations} from 'getsentry/hooks/usePlanMigrations';
1212
import type {Plan, PlanMigration, Subscription} from 'getsentry/types';
13-
import {formatReservedWithUnits} from 'getsentry/utils/billing';
13+
import {displayBudgetName, formatReservedWithUnits} from 'getsentry/utils/billing';
1414
import {
1515
getPlanCategoryName,
1616
getReservedBudgetDisplayName,
@@ -307,7 +307,8 @@ function getOnDemandChanges(subscription: Subscription) {
307307
);
308308
changes.push(
309309
<span>
310-
On-demand budget — {current}{change}
310+
{displayBudgetName(pendingChanges.planDetails, {title: true, withBudget: true})}{' '}
311+
{current}{change}
311312
</span>
312313
);
313314
}
@@ -316,7 +317,8 @@ function getOnDemandChanges(subscription: Subscription) {
316317
const change = getStringForPrice(pendingChanges.onDemandMaxSpend);
317318
changes.push(
318319
<span>
319-
On-demand maximum — {old}{change}
320+
{displayBudgetName(pendingChanges.planDetails, {title: true})} maximum — {old}{' '}
321+
{change}
320322
</span>
321323
);
322324
}

static/gsAdmin/components/provisionSubscriptionAction.spec.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -281,22 +281,22 @@ describe('provisionSubscriptionAction', () => {
281281
);
282282

283283
expect(
284-
within(container).getByLabelText('On-Demand Max Spend Setting')
284+
within(container).getByLabelText('Pay-as-you-go Max Spend Setting')
285285
).toBeInTheDocument();
286286
expect(
287-
within(container).queryByLabelText('On-Demand Cost-Per-Event Errors')
287+
within(container).queryByLabelText('Pay-as-you-go Cost-Per-Event Errors')
288288
).not.toBeInTheDocument();
289289
expect(
290-
within(container).queryByLabelText('On-Demand Cost-Per-Event Performance Units')
290+
within(container).queryByLabelText('Pay-as-you-go Cost-Per-Event Performance Units')
291291
).not.toBeInTheDocument();
292292
expect(
293-
within(container).queryByLabelText('On-Demand Cost-Per-Event Replays')
293+
within(container).queryByLabelText('Pay-as-you-go Cost-Per-Event Replays')
294294
).not.toBeInTheDocument();
295295
expect(
296-
within(container).queryByLabelText('On-Demand Cost-Per-Event Attachments')
296+
within(container).queryByLabelText('Pay-as-you-go Cost-Per-Event Attachments')
297297
).not.toBeInTheDocument();
298298
expect(
299-
within(container).queryByLabelText('On-Demand Cost-Per-Event Cron Monitors')
299+
within(container).queryByLabelText('Pay-as-you-go Cost-Per-Event Cron Monitors')
300300
).not.toBeInTheDocument();
301301
});
302302

@@ -325,19 +325,19 @@ describe('provisionSubscriptionAction', () => {
325325
).not.toBeInTheDocument();
326326

327327
await selectEvent.select(
328-
screen.getByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
328+
screen.getByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
329329
'Shared'
330330
);
331331
expect(
332-
(await within(container).findAllByLabelText(/On-Demand Cost-Per-Event/)).length
332+
(await within(container).findAllByLabelText(/Pay-as-you-go Cost-Per-Event/)).length
333333
).toBeGreaterThan(0);
334334

335335
await selectEvent.select(
336-
screen.getByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
336+
screen.getByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
337337
'Disable'
338338
);
339339
expect(
340-
within(container).queryByLabelText(/On-Demand Cost-Per-Event/)
340+
within(container).queryByLabelText(/Pay-as-you-go Cost-Per-Event/)
341341
).not.toBeInTheDocument();
342342
});
343343

@@ -363,7 +363,7 @@ describe('provisionSubscriptionAction', () => {
363363
'Invoiced'
364364
);
365365
await selectEvent.select(
366-
screen.getByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
366+
screen.getByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
367367
'Shared'
368368
);
369369
const disabledSoftCapFields = screen.getAllByLabelText(/Soft Cap Type/);
@@ -389,7 +389,7 @@ describe('provisionSubscriptionAction', () => {
389389
'Invoiced'
390390
);
391391
await selectEvent.select(
392-
screen.getByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
392+
screen.getByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
393393
'Disable'
394394
);
395395
const enabledSoftCapFields = screen.getAllByLabelText(/Soft Cap Type/);
@@ -845,21 +845,21 @@ describe('provisionSubscriptionAction', () => {
845845
'Invoiced'
846846
);
847847
await selectEvent.select(
848-
await screen.findByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
848+
await screen.findByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
849849
'Shared'
850850
);
851851

852852
expect(
853-
within(container).getByLabelText('Retain On-Demand Budget')
853+
within(container).getByLabelText('Retain Pay-as-you-go Budget')
854854
).toBeInTheDocument();
855855

856856
await selectEvent.select(
857-
await screen.findByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
857+
await screen.findByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
858858
'Per Category'
859859
);
860860

861861
expect(
862-
within(container).queryByLabelText('Retain On-Demand Budget')
862+
within(container).queryByLabelText('Retain Pay-as-you-go Budget')
863863
).not.toBeInTheDocument();
864864

865865
await selectEvent.select(
@@ -1251,7 +1251,7 @@ describe('provisionSubscriptionAction', () => {
12511251
);
12521252

12531253
await selectEvent.select(
1254-
await screen.findByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
1254+
await screen.findByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
12551255
'Disable'
12561256
);
12571257

@@ -1380,7 +1380,7 @@ describe('provisionSubscriptionAction', () => {
13801380
);
13811381

13821382
await selectEvent.select(
1383-
await screen.findByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
1383+
await screen.findByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
13841384
'Disable'
13851385
);
13861386

@@ -1500,7 +1500,7 @@ describe('provisionSubscriptionAction', () => {
15001500
);
15011501

15021502
await selectEvent.select(
1503-
await screen.findByRole('textbox', {name: 'On-Demand Max Spend Setting'}),
1503+
await screen.findByRole('textbox', {name: 'Pay-as-you-go Max Spend Setting'}),
15041504
'Disable'
15051505
);
15061506

0 commit comments

Comments
 (0)