Skip to content

Commit 4a742f2

Browse files

File tree

4 files changed

+23
-41
lines changed

4 files changed

+23
-41
lines changed

static/gsApp/constants.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Object.entries(DEFAULT_BILLED_DATA_CATEGORY_INFO).forEach(
5959
feature: null,
6060
hasSpikeProtection: false,
6161
reservedVolumeTooltip: null,
62+
tallyType: 'usage',
6263
};
6364
}
6465
);
@@ -73,7 +74,6 @@ export const BILLED_DATA_CATEGORY_INFO = {
7374
[DataCategoryExact.ERROR]: {
7475
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.ERROR],
7576
canAllocate: true,
76-
canProductTrial: false,
7777
maxAdminGift: 10_000_000,
7878
freeEventsMultiple: 1_000,
7979
hasSpikeProtection: true,
@@ -96,7 +96,6 @@ export const BILLED_DATA_CATEGORY_INFO = {
9696
[DataCategoryExact.ATTACHMENT]: {
9797
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.ATTACHMENT],
9898
canAllocate: true,
99-
canProductTrial: false,
10099
maxAdminGift: 10_000,
101100
freeEventsMultiple: 1,
102101
feature: 'event-attachments',
@@ -107,7 +106,6 @@ export const BILLED_DATA_CATEGORY_INFO = {
107106
},
108107
[DataCategoryExact.REPLAY]: {
109108
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.REPLAY],
110-
canAllocate: false,
111109
canProductTrial: true,
112110
maxAdminGift: 1_000_000,
113111
freeEventsMultiple: 1,
@@ -118,7 +116,6 @@ export const BILLED_DATA_CATEGORY_INFO = {
118116
},
119117
[DataCategoryExact.SPAN]: {
120118
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.SPAN],
121-
canAllocate: false,
122119
canProductTrial: true,
123120
maxAdminGift: 1_000_000_000,
124121
freeEventsMultiple: 100_000,
@@ -130,58 +127,44 @@ export const BILLED_DATA_CATEGORY_INFO = {
130127
},
131128
[DataCategoryExact.SPAN_INDEXED]: {
132129
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.SPAN_INDEXED],
133-
canAllocate: false,
134130
canProductTrial: true,
135131
maxAdminGift: 1_000_000_000,
136132
freeEventsMultiple: 100_000,
137133
feature: 'spans-usage-tracking',
138134
},
139135
[DataCategoryExact.MONITOR_SEAT]: {
140136
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.MONITOR_SEAT],
141-
canAllocate: false,
142-
canProductTrial: false,
143137
maxAdminGift: 10_000,
144138
freeEventsMultiple: 1,
145139
feature: 'monitor-seat-billing',
140+
tallyType: 'seat',
146141
},
147142
[DataCategoryExact.UPTIME]: {
148143
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.UPTIME],
149-
canAllocate: false,
150-
canProductTrial: false,
151144
maxAdminGift: 10_000,
152145
freeEventsMultiple: 1,
153146
feature: 'uptime-billing',
147+
tallyType: 'seat',
154148
},
155149
[DataCategoryExact.PROFILE_DURATION]: {
156150
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.PROFILE_DURATION],
157-
canAllocate: false,
158151
canProductTrial: true,
159152
maxAdminGift: 10_000,
160153
freeEventsMultiple: 1, // in hours
161-
feature: null,
162154
},
163155
[DataCategoryExact.PROFILE_DURATION_UI]: {
164156
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.PROFILE_DURATION_UI],
165-
canAllocate: false,
166157
canProductTrial: true,
167158
maxAdminGift: 10_000,
168159
freeEventsMultiple: 1, // in hours
169-
feature: null,
170160
},
161+
// Seer categories have product trials through ReservedBudgetCategoryType.SEER, not as individual categories
171162
[DataCategoryExact.SEER_AUTOFIX]: {
172163
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.SEER_AUTOFIX],
173-
canAllocate: false,
174-
canProductTrial: false,
175-
maxAdminGift: 0,
176-
freeEventsMultiple: 0,
177164
feature: 'seer-billing',
178165
},
179166
[DataCategoryExact.SEER_SCANNER]: {
180167
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.SEER_SCANNER],
181-
canAllocate: false,
182-
canProductTrial: false,
183-
maxAdminGift: 0,
184-
freeEventsMultiple: 0,
185168
feature: 'seer-billing',
186169
},
187170
} as const satisfies Record<DataCategoryExact, BilledDataCategoryInfo>;

static/gsApp/types/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,4 +1030,8 @@ export interface BilledDataCategoryInfo extends DataCategoryInfo {
10301030
* The tooltip text for the checkout page
10311031
*/
10321032
reservedVolumeTooltip: string | null;
1033+
/**
1034+
* How usage is tallied for the category
1035+
*/
1036+
tallyType: 'usage' | 'seat';
10331037
}

static/gsApp/views/amCheckout/checkoutOverviewV2.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,9 @@ function CheckoutOverviewV2({activePlan, formData, onUpdate: _onUpdate}: Props)
191191
};
192192

193193
const renderObservabilityProductBreakdown = () => {
194-
const paygCategories = [
195-
DataCategory.MONITOR_SEATS,
196-
DataCategory.PROFILE_DURATION,
197-
DataCategory.PROFILE_DURATION_UI,
198-
DataCategory.UPTIME,
199-
];
194+
const paygCategories = activePlan.onDemandCategories.filter(
195+
category => activePlan.planCategories[category]?.length === 1
196+
);
200197

201198
const budgetCategories = Object.values(
202199
activePlan.availableReservedBudgetTypes

static/gsApp/views/subscriptionPage/overview.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import type {
2525
} from 'getsentry/types';
2626
import {PlanTier} from 'getsentry/types';
2727
import {hasAccessToSubscriptionOverview} from 'getsentry/utils/billing';
28-
import {isPartOfReservedBudget, sortCategories} from 'getsentry/utils/dataCategory';
28+
import {
29+
getCategoryInfoFromPlural,
30+
isPartOfReservedBudget,
31+
sortCategories,
32+
} from 'getsentry/utils/dataCategory';
2933
import withPromotions from 'getsentry/utils/withPromotions';
3034
import ContactBillingMembers from 'getsentry/views/contactBillingMembers';
3135
import {openOnDemandBudgetEditModal} from 'getsentry/views/onDemandBudgets/editOnDemandButton';
@@ -205,15 +209,12 @@ function Overview({location, subscription, promotionData}: Props) {
205209
)
206210
.map(categoryHistory => {
207211
const category = categoryHistory.category;
212+
const categoryInfo = getCategoryInfoFromPlural(category);
208213

209-
// The usageData does not include details for seat-based categories.
210-
// For now we will handle the monitor category specially
214+
// The usageData does not include details for seat-based categories
211215
let monitor_usage: number | undefined = 0;
212-
if (category === DataCategory.MONITOR_SEATS) {
213-
monitor_usage = subscription.categories.monitorSeats?.usage;
214-
}
215-
if (category === DataCategory.UPTIME) {
216-
monitor_usage = subscription.categories.uptime?.usage;
216+
if (categoryInfo?.tallyType === 'seat') {
217+
monitor_usage = subscription.categories[category]?.usage;
217218
}
218219

219220
if (
@@ -224,7 +225,7 @@ function Overview({location, subscription, promotionData}: Props) {
224225
}
225226

226227
const categoryTotals: BillingStatTotal =
227-
category !== DataCategory.MONITOR_SEATS && category !== DataCategory.UPTIME
228+
categoryInfo?.tallyType === 'usage'
228229
? usageData.totals[category]!
229230
: {
230231
accepted: monitor_usage ?? 0,
@@ -235,9 +236,8 @@ function Overview({location, subscription, promotionData}: Props) {
235236
filtered: 0,
236237
projected: 0,
237238
};
238-
239239
const eventTotals =
240-
category !== DataCategory.MONITOR_SEATS && category !== DataCategory.UPTIME
240+
categoryInfo?.tallyType === 'usage'
241241
? usageData.eventTotals?.[category]
242242
: undefined;
243243

@@ -259,9 +259,7 @@ function Overview({location, subscription, promotionData}: Props) {
259259
trueForward={categoryHistory.trueForward}
260260
softCapType={categoryHistory.softCapType}
261261
disableTable={
262-
category === DataCategory.MONITOR_SEATS ||
263-
category === DataCategory.UPTIME ||
264-
displayMode === 'cost'
262+
categoryInfo?.tallyType === 'seat' || displayMode === 'cost'
265263
}
266264
subscription={subscription}
267265
organization={organization}

0 commit comments

Comments
 (0)