Skip to content

Commit 9c5c306

Browse files
fix: on demand copy for self serve partners (#86559)
Update existing copy in on demand edit modal for self serve partners. ![Screenshot 2025-03-06 at 2 25 25 PM](https://github.com/user-attachments/assets/fde3550b-5d03-445d-8ff2-3476a990266c)
1 parent a59f4f9 commit 9c5c306

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed

static/gsApp/views/onDemandBudgets/onDemandBudgetEdit.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ class OnDemandBudgetEdit extends Component<Props> {
198198
<BudgetDetails>
199199
<Description>
200200
{t(
201-
"This budget ensures continued monitoring after you've used up your reserved event volume. We’ll only charge you for actual usage, so this is your maximum charge for overage."
201+
"This budget ensures continued monitoring after you've used up your reserved event volume. We'll only charge you for actual usage, so this is your maximum charge for overage.%s",
202+
subscription.isSelfServePartner
203+
? ` This will be part of your ${subscription.partner?.partnership.displayName} bill.`
204+
: ''
202205
)}
203206
</Description>
204207
{this.renderInputFields(OnDemandBudgetMode.SHARED)}

static/gsApp/views/onDemandBudgets/onDemandBudgets.spec.tsx

+78
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ describe('OnDemandBudgets', () => {
502502
const budgetTextbox = screen.getByRole('textbox', {name: 'Pay-as-you-go max budget'});
503503
expect(budgetTextbox).toHaveValue('0');
504504

505+
expect(
506+
screen.getByText(
507+
`This budget ensures continued monitoring after you've used up your reserved event volume. We'll only charge you for actual usage, so this is your maximum charge for overage.`
508+
)
509+
).toBeInTheDocument();
510+
505511
await userEvent.type(budgetTextbox, '42');
506512
await userEvent.click(screen.getByLabelText('Save'));
507513
await waitForModalToHide();
@@ -516,4 +522,76 @@ describe('OnDemandBudgets', () => {
516522
expect(await screen.findByText('$42')).toBeInTheDocument();
517523
expect(screen.getByTestId('shared-budget-info')).toBeInTheDocument();
518524
});
525+
526+
it('renders billed through partner for self serve partner', async function () {
527+
MockApiClient.addMockResponse({
528+
url: `/customers/${organization.slug}/ondemand-budgets/`,
529+
method: 'POST',
530+
statusCode: 200,
531+
body: {
532+
enabled: true,
533+
budgetMode: OnDemandBudgetMode.SHARED,
534+
sharedMaxBudget: 4200,
535+
},
536+
});
537+
538+
const subscription = SubscriptionFixture({
539+
plan: 'am3_business',
540+
planTier: PlanTier.AM3,
541+
isFree: false,
542+
isTrial: false,
543+
supportsOnDemand: true,
544+
isSelfServePartner: true,
545+
partner: {
546+
externalId: 'x123x',
547+
name: 'FOO',
548+
partnership: {
549+
id: 'foo',
550+
displayName: 'FOO',
551+
supportNote: '',
552+
},
553+
isActive: true,
554+
},
555+
organization,
556+
onDemandBudgets: {
557+
enabled: false,
558+
budgetMode: OnDemandBudgetMode.SHARED,
559+
sharedMaxBudget: 0,
560+
onDemandSpendUsed: 0,
561+
},
562+
});
563+
SubscriptionStore.set(organization.slug, subscription);
564+
565+
MockApiClient.addMockResponse({
566+
url: `/subscriptions/${organization.slug}/`,
567+
method: 'GET',
568+
statusCode: 200,
569+
body: {
570+
...subscription,
571+
onDemandMaxSpend: 4200,
572+
onDemandSpendUsed: 100,
573+
onDemandBudgets: {
574+
enabled: true,
575+
budgetMode: OnDemandBudgetMode.SHARED,
576+
sharedMaxBudget: 4200,
577+
onDemandSpendUsed: 100,
578+
},
579+
},
580+
});
581+
582+
const props = {
583+
subscription,
584+
onDemandEnabled: true,
585+
hasPaymentSource: true,
586+
};
587+
createWrapper(props);
588+
renderGlobalModal();
589+
590+
await userEvent.click(screen.getByRole('button', {name: 'Set Up Pay-as-you-go'}));
591+
expect(
592+
screen.getByText(
593+
`This budget ensures continued monitoring after you've used up your reserved event volume. We'll only charge you for actual usage, so this is your maximum charge for overage. This will be part of your FOO bill.`
594+
)
595+
).toBeInTheDocument();
596+
});
519597
});

0 commit comments

Comments
 (0)