Skip to content

Commit 144497c

Browse files
noahsmartinsehr-m
authored andcommitted
Remove trial selection tier (#117865)
The enable enterprise trial modal had this tier dropdown. It's redundant because the backend already picks the appropriate tier for an enterprise trial (if the field is not supplied from the FE) and rejects if a wrong one was specified.
1 parent ac8ffc0 commit 144497c

39 files changed

Lines changed: 83 additions & 191 deletions

static/gsAdmin/components/changePlanAction.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
SubscriptionFixture,
88
SubscriptionWithLegacySeerFixture,
99
} from 'getsentry-test/fixtures/subscription';
10+
import {PlanTier} from 'getsentry-test/planTier';
1011
import {renderGlobalModal, screen, userEvent} from 'sentry-test/reactTestingLibrary';
1112
import {selectEvent} from 'sentry-test/selectEvent';
1213

@@ -15,7 +16,6 @@ import {DataCategory} from 'sentry/types/core';
1516

1617
import {triggerChangePlanAction} from 'admin/components/changePlanAction';
1718
import {SubscriptionStore} from 'getsentry/stores/subscriptionStore';
18-
import {PlanTier} from 'getsentry/types';
1919

2020
describe('ChangePlanAction', () => {
2121
const mockOrg = OrganizationFixture({slug: 'org-slug'});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
SubscriptionFixture,
99
SubscriptionWithLegacySeerFixture,
1010
} from 'getsentry-test/fixtures/subscription';
11+
import {PlanTier} from 'getsentry-test/planTier';
1112
import {
1213
render,
1314
screen,
@@ -20,7 +21,7 @@ import {DataCategory} from 'sentry/types/core';
2021
import {toTitleCase} from 'sentry/utils/string/toTitleCase';
2122

2223
import {CustomerOverview} from 'admin/components/customers/customerOverview';
23-
import {AddOnCategory, PlanTier} from 'getsentry/types';
24+
import {AddOnCategory} from 'getsentry/types';
2425

2526
describe('CustomerOverview', () => {
2627
it('renders DetailLabels for SubscriptionSummary section', () => {

static/gsAdmin/components/provisionSubscriptionAction.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
InvoicedSubscriptionFixture,
77
SubscriptionFixture,
88
} from 'getsentry-test/fixtures/subscription';
9+
import {PlanTier} from 'getsentry-test/planTier';
910
import {
1011
fireEvent,
1112
renderGlobalModal,
@@ -20,7 +21,7 @@ import {DataCategory} from 'sentry/types/core';
2021

2122
import {triggerProvisionSubscription} from 'admin/components/provisionSubscriptionAction';
2223
import {RESERVED_BUDGET_QUOTA} from 'getsentry/constants';
23-
import {OnDemandBudgetMode, PlanTier} from 'getsentry/types';
24+
import {OnDemandBudgetMode} from 'getsentry/types';
2425

2526
describe('provisionSubscriptionAction', () => {
2627
const onSuccess = jest.fn();

static/gsAdmin/components/trialSubscriptionAction.spec.tsx

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ import moment from 'moment-timezone';
22
import {OrganizationFixture} from 'sentry-fixture/organization';
33

44
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
5-
import {
6-
renderGlobalModal,
7-
screen,
8-
userEvent,
9-
within,
10-
} from 'sentry-test/reactTestingLibrary';
5+
import {renderGlobalModal, screen, userEvent} from 'sentry-test/reactTestingLibrary';
116

127
import {openAdminConfirmModal} from 'admin/components/adminConfirmationModal';
138
import {TrialSubscriptionAction} from 'admin/components/trialSubscriptionAction';
14-
import {PlanTier} from 'getsentry/types';
159

1610
describe('TrialSubscriptionAction', () => {
1711
const organization = OrganizationFixture();
@@ -75,7 +69,6 @@ describe('TrialSubscriptionAction', () => {
7569
expect(onConfirm).toHaveBeenCalledWith({
7670
trialDays: 45,
7771
startEnterpriseTrial: true,
78-
trialTier: PlanTier.AM3,
7972
});
8073
});
8174

@@ -219,87 +212,6 @@ describe('TrialSubscriptionAction', () => {
219212
);
220213
});
221214

222-
it('displays am3 trial tier option when free plan', async () => {
223-
jest.mock('@sentry/scraps/alert');
224-
225-
openAdminConfirmModal({
226-
onConfirm,
227-
renderModalSpecificContent: deps => (
228-
<TrialSubscriptionAction
229-
subscription={SubscriptionFixture({
230-
organization,
231-
plan: 'am2_f',
232-
isFree: true,
233-
planTier: PlanTier.AM2,
234-
})}
235-
startEnterpriseTrial
236-
{...deps}
237-
/>
238-
),
239-
});
240-
241-
renderGlobalModal();
242-
243-
await userEvent.click(screen.getByTestId('trial-plan-tier-choices'));
244-
const trialTierInputs = within(screen.getByRole('dialog')).getAllByRole('textbox');
245-
await userEvent.click(trialTierInputs[1]!);
246-
expect(screen.getByText('am3')).toBeInTheDocument();
247-
});
248-
249-
it('displays am3 trial tier option when am3 plan', async () => {
250-
jest.mock('@sentry/scraps/alert');
251-
252-
openAdminConfirmModal({
253-
onConfirm,
254-
renderModalSpecificContent: deps => (
255-
<TrialSubscriptionAction
256-
subscription={SubscriptionFixture({
257-
organization,
258-
plan: 'am3_team',
259-
isFree: false,
260-
planTier: PlanTier.AM3,
261-
})}
262-
startEnterpriseTrial
263-
{...deps}
264-
/>
265-
),
266-
});
267-
268-
renderGlobalModal();
269-
270-
await userEvent.click(screen.getByTestId('trial-plan-tier-choices'));
271-
const trialTierInputs = within(screen.getByRole('dialog')).getAllByRole('textbox');
272-
await userEvent.click(trialTierInputs[1]!);
273-
expect(screen.getByText('am3')).toBeInTheDocument();
274-
});
275-
276-
it('displays am3 trial tier option when am2 plan', async () => {
277-
jest.mock('@sentry/scraps/alert');
278-
279-
openAdminConfirmModal({
280-
onConfirm,
281-
renderModalSpecificContent: deps => (
282-
<TrialSubscriptionAction
283-
subscription={SubscriptionFixture({
284-
organization,
285-
plan: 'am2_team',
286-
isFree: false,
287-
planTier: PlanTier.AM2,
288-
})}
289-
startEnterpriseTrial
290-
{...deps}
291-
/>
292-
),
293-
});
294-
295-
renderGlobalModal();
296-
297-
await userEvent.click(screen.getByTestId('trial-plan-tier-choices'));
298-
const trialTierInputs = within(screen.getByRole('dialog')).getAllByRole('textbox');
299-
await userEvent.click(trialTierInputs[1]!);
300-
expect(screen.getByText('am3')).toBeInTheDocument();
301-
});
302-
303215
it('defaults 14-day trial for self-serve', () => {
304216
jest.mock('@sentry/scraps/alert');
305217

static/gsAdmin/components/trialSubscriptionAction.tsx

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import moment from 'moment-timezone';
44
import {Alert} from '@sentry/scraps/alert';
55

66
import {NumberField} from 'sentry/components/forms/fields/numberField';
7-
import {SelectField} from 'sentry/components/forms/fields/selectField';
87

98
import type {
109
AdminConfirmParams,
1110
AdminConfirmRenderProps,
1211
} from 'admin/components/adminConfirmationModal';
1312
import type {Subscription} from 'getsentry/types';
14-
import {PlanTier} from 'getsentry/types';
1513

1614
type Props = AdminConfirmRenderProps & {
1715
subscription: Subscription;
@@ -20,7 +18,6 @@ type Props = AdminConfirmRenderProps & {
2018

2119
type State = {
2220
trialDays: number;
23-
trialTier?: PlanTier;
2421
};
2522

2623
/**
@@ -32,26 +29,24 @@ export class TrialSubscriptionAction extends Component<Props, State> {
3229
this.props.subscription.isEnterpriseTrial || this.props.startEnterpriseTrial
3330
? 28
3431
: 14,
35-
trialTier: PlanTier.AM3,
3632
};
3733

3834
componentDidMount() {
3935
this.props.setConfirmCallback(this.handleConfirm);
4036
}
4137

4238
handleConfirm = (_params: AdminConfirmParams) => {
43-
const {trialDays, trialTier} = this.state;
39+
const {trialDays} = this.state;
4440
const {startEnterpriseTrial, onConfirm} = this.props;
4541

4642
// XXX(epurkhiser): In the original implementation none of the audit params
4743
// were passed, is that an oversight?
48-
44+
//
45+
// The trial tier is resolved server-side (omitting `trialTier` falls back
46+
// to the subscription's default enterprise-trial plan).
4947
const data = {
5048
trialDays,
51-
...(startEnterpriseTrial && {
52-
startEnterpriseTrial,
53-
trialTier,
54-
}),
49+
...(startEnterpriseTrial && {startEnterpriseTrial}),
5550
};
5651

5752
onConfirm?.(data);
@@ -74,7 +69,7 @@ export class TrialSubscriptionAction extends Component<Props, State> {
7469

7570
render() {
7671
const {subscription, startEnterpriseTrial} = this.props;
77-
const {trialDays, trialTier} = this.state;
72+
const {trialDays} = this.state;
7873

7974
if (!subscription) {
8075
return null;
@@ -85,12 +80,6 @@ export class TrialSubscriptionAction extends Component<Props, State> {
8580
);
8681
const trialEndDate = currentTrialEnd.add(trialDays, 'days').format('MMMM Do YYYY');
8782

88-
const tierChoices: Array<[string | PlanTier, string | PlanTier]> = [
89-
[PlanTier.AM3, PlanTier.AM3],
90-
[PlanTier.AM2, PlanTier.AM2],
91-
[PlanTier.AM1, PlanTier.AM1],
92-
];
93-
9483
return (
9584
<Fragment>
9685
{startEnterpriseTrial && (
@@ -114,22 +103,6 @@ export class TrialSubscriptionAction extends Component<Props, State> {
114103
value={trialDays}
115104
onChange={this.onDaysChange}
116105
/>
117-
<div data-test-id="trial-plan-tier-choices">
118-
{startEnterpriseTrial && (
119-
<SelectField
120-
inline={false}
121-
stacked
122-
flexibleControlStateSize
123-
label="Trial Plan Tier"
124-
name="tier"
125-
value={trialTier}
126-
onChange={(val: any) => {
127-
this.setState({trialTier: val});
128-
}}
129-
choices={tierChoices}
130-
/>
131-
)}
132-
</div>
133106
</Fragment>
134107
);
135108
}

static/gsAdmin/views/customerDetails.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {PoliciesFixture} from 'getsentry-test/fixtures/policies';
1414
import {ProjectFixture} from 'getsentry-test/fixtures/project';
1515
import {SeerReservedBudgetFixture} from 'getsentry-test/fixtures/reservedBudget';
1616
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
17+
import {PlanTier} from 'getsentry-test/planTier';
1718
import {initializeOrg} from 'sentry-test/initializeOrg';
1819
import {
1920
render,
@@ -35,7 +36,7 @@ import type {StatsGroup} from 'admin/components/customers/customerStats';
3536
import {populateChartData, useSeries} from 'admin/components/customers/customerStats';
3637
import {CustomerDetails} from 'admin/views/customerDetails';
3738
import type {Subscription} from 'getsentry/types';
38-
import {BillingType, PlanTier} from 'getsentry/types';
39+
import {BillingType} from 'getsentry/types';
3940

4041
const theme = ThemeFixture();
4142
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;

static/gsApp/components/crons/cronsBillingBanner.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
44
import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
55
import {PlanDetailsLookupFixture} from 'getsentry-test/fixtures/planDetailsLookup';
66
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
7+
import {PlanTier} from 'getsentry-test/planTier';
78
import {render, screen} from 'sentry-test/reactTestingLibrary';
89

910
import {CronsBillingBanner} from 'getsentry/components/crons/cronsBillingBanner';
10-
import {PlanTier} from 'getsentry/types';
1111

1212
describe('CronsBillingBanner', () => {
1313
beforeEach(() => {

static/gsApp/components/features/insightsDateRangeQueryLimitFooter.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
44
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
5+
import {PlanTier} from 'getsentry-test/planTier';
56
import {render, screen} from 'sentry-test/reactTestingLibrary';
67

78
import {InsightsDateRangeQueryLimitFooter} from 'getsentry/components/features/insightsDateRangeQueryLimitFooter';
8-
import {PlanTier} from 'getsentry/types';
99

1010
describe('InsightsUpsellPage', () => {
1111
const organization = OrganizationFixture();

static/gsApp/components/features/pageUpsellOverlay.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
22

33
import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
44
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
5+
import {PlanTier} from 'getsentry-test/planTier';
56
import {render, screen} from 'sentry-test/reactTestingLibrary';
67

78
import PageUpsellOverlay from 'getsentry/components/features/pageUpsellOverlay';
89
import {SubscriptionStore} from 'getsentry/stores/subscriptionStore';
9-
import {PlanTier} from 'getsentry/types';
1010

1111
describe('PageUpsellOverlay', () => {
1212
let wrapper: any;

static/gsApp/components/features/planFeature.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
33
import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
44
import {PlanDetailsLookupFixture} from 'getsentry-test/fixtures/planDetailsLookup';
55
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
6+
import {PlanTier} from 'getsentry-test/planTier';
67
import {render, waitFor} from 'sentry-test/reactTestingLibrary';
78

89
import PlanFeature from 'getsentry/components/features/planFeature';
910
import {SubscriptionStore} from 'getsentry/stores/subscriptionStore';
10-
import {PlanTier} from 'getsentry/types';
1111

1212
describe('PlanFeature', () => {
1313
const organization = OrganizationFixture();

0 commit comments

Comments
 (0)