Skip to content

Commit 56e3619

Browse files
chore(sub v3): Remove dead code (#105677)
Kills old subscription settings code. Closes BIL-1883
1 parent 9949760 commit 56e3619

File tree

77 files changed

+564
-10015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+564
-10015
lines changed

static/gsAdmin/components/customers/pendingChanges.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
isOnDemandBudgetsEqual,
2222
parseOnDemandBudgets,
2323
parseOnDemandBudgetsFromSubscription,
24-
} from 'getsentry/views/onDemandBudgets/utils';
24+
} from 'getsentry/views/spendLimits/utils';
2525

2626
function getStringForPrice(
2727
price: number | null | undefined,

static/gsApp/actionCreators/modal.tsx

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import type {ComponentType} from 'react';
2+
import type {Theme} from '@emotion/react';
3+
import {css} from '@emotion/react';
24
import styled from '@emotion/styled';
3-
import type {Location} from 'history';
45

6+
import {addErrorMessage} from 'sentry/actionCreators/indicator';
57
import {openModal} from 'sentry/actionCreators/modal';
68
import {promptsUpdate} from 'sentry/actionCreators/prompts';
79
import {Client} from 'sentry/api';
810
import {openConfirmModal} from 'sentry/components/confirm';
9-
import {t} from 'sentry/locale';
11+
import {t, tct} from 'sentry/locale';
1012
import type {Organization} from 'sentry/types/organization';
1113

1214
import type {PromotionModalBodyProps} from 'getsentry/components/promotionModal';
1315
import type {Reservations} from 'getsentry/components/upgradeNowModal/types';
1416
import SubscriptionStore from 'getsentry/stores/subscriptionStore';
1517
import type {
16-
BillingDetails,
1718
Invoice,
1819
Plan,
1920
PreviewData,
2021
Promotion,
2122
PromotionClaimed,
2223
Subscription,
2324
} from 'getsentry/types';
25+
import {displayBudgetName, hasBillingAccess, supportsPayg} from 'getsentry/utils/billing';
2426
import type {AM2UpdateSurfaces} from 'getsentry/utils/trackGetsentryAnalytics';
2527

2628
type UpsellModalOptions = {
@@ -118,30 +120,40 @@ export async function openPartnerPlanEndingModal(options: PartnerPlanModalProps)
118120
openModal(deps => <Modal {...deps} {...options} />, {modalCss, onClose});
119121
}
120122

121-
type EditCreditCardOptions = {
122-
onSuccess: (data: Subscription) => void;
123+
interface OpenOnDemandBudgetEditModalProps {
123124
organization: Organization;
124125
subscription: Subscription;
125-
location?: Location;
126-
};
127-
128-
export async function openEditCreditCard(options: EditCreditCardOptions) {
129-
const {default: Modal} = await import('getsentry/components/creditCardEdit/modal');
130-
131-
openModal(deps => <Modal {...deps} {...options} />);
126+
theme?: Theme;
132127
}
133128

134-
type EditBillingDetailsOptions = {
135-
organization: Organization;
136-
refetch: () => void;
137-
initialData?: BillingDetails;
138-
};
139-
140-
export async function openEditBillingDetails(options: EditBillingDetailsOptions) {
141-
const {default: Modal} = await import('getsentry/components/billingDetails/modal');
142-
openModal(deps => <Modal {...deps} {...options} />);
129+
export async function openOnDemandBudgetEditModal(
130+
options: OpenOnDemandBudgetEditModalProps
131+
) {
132+
const {default: Modal} = await import('getsentry/views/spendLimits/editModal');
133+
const {theme, organization, subscription} = options;
134+
const hasBillingPerms = hasBillingAccess(organization);
135+
const canUsePayg = supportsPayg(subscription);
136+
137+
if (hasBillingPerms && canUsePayg) {
138+
openModal(deps => <Modal {...deps} {...options} />, {
139+
closeEvents: 'escape-key',
140+
modalCss: theme ? onDemandBudgetEditModalCss(theme) : undefined,
141+
});
142+
} else {
143+
addErrorMessage(
144+
tct("You don't have permission to edit [budgetTerm] budgets.", {
145+
budgetTerm: displayBudgetName(subscription.planDetails),
146+
})
147+
);
148+
}
143149
}
144150

151+
const onDemandBudgetEditModalCss = (theme: Theme) => css`
152+
@media (min-width: ${theme.breakpoints.md}) {
153+
width: 1000px;
154+
}
155+
`;
156+
145157
type OpenInvoicePaymentOptions = {
146158
invoice: Invoice;
147159
organization: Organization;

static/gsApp/components/addEventsCTA.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {t, tct} from 'sentry/locale';
88
import type {Organization} from 'sentry/types/organization';
99
import withApi from 'sentry/utils/withApi';
1010

11+
import {openOnDemandBudgetEditModal} from 'getsentry/actionCreators/modal';
1112
import {sendAddEventsRequest, sendUpgradeRequest} from 'getsentry/actionCreators/upsell';
1213
import StartTrialButton from 'getsentry/components/startTrialButton';
1314
import type {Subscription} from 'getsentry/types';
@@ -17,7 +18,6 @@ import {
1718
type UsageAction,
1819
} from 'getsentry/utils/billing';
1920
import trackGetsentryAnalytics from 'getsentry/utils/trackGetsentryAnalytics';
20-
import {openOnDemandBudgetEditModal} from 'getsentry/views/onDemandBudgets/editOnDemandButton';
2121

2222
/**
2323
* Event types for quota CTAs and notifications.

static/gsApp/components/ai/AiSetupDataConsent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import useApi from 'sentry/utils/useApi';
2121
import {useNavigate} from 'sentry/utils/useNavigate';
2222
import useOrganization from 'sentry/utils/useOrganization';
2323

24+
import {openOnDemandBudgetEditModal} from 'getsentry/actionCreators/modal';
2425
import {sendAddEventsRequest} from 'getsentry/actionCreators/upsell';
2526
import type {EventType} from 'getsentry/components/addEventsCTA';
2627
import StartTrialButton from 'getsentry/components/startTrialButton';
2728
import useSubscription from 'getsentry/hooks/useSubscription';
2829
import {BillingType, OnDemandBudgetMode} from 'getsentry/types';
2930
import {getPotentialProductTrial, getSeerTrialCategory} from 'getsentry/utils/billing';
30-
import {openOnDemandBudgetEditModal} from 'getsentry/views/onDemandBudgets/editOnDemandButton';
3131

3232
type AiSetupDataConsentProps = {
3333
groupId?: string;

static/gsApp/components/billingDetails/modal.tsx

Lines changed: 0 additions & 41 deletions
This file was deleted.

static/gsApp/components/billingDetails/panel.tsx

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ import {Alert} from '@sentry/scraps/alert';
66
import {Button} from 'sentry/components/core/button';
77
import {Flex} from 'sentry/components/core/layout';
88
import {Heading, Text} from 'sentry/components/core/text';
9-
import FieldGroup from 'sentry/components/forms/fieldGroup';
109
import LoadingError from 'sentry/components/loadingError';
1110
import LoadingIndicator from 'sentry/components/loadingIndicator';
12-
import Panel from 'sentry/components/panels/panel';
13-
import PanelBody from 'sentry/components/panels/panelBody';
14-
import PanelHeader from 'sentry/components/panels/panelHeader';
1511
import QuestionTooltip from 'sentry/components/questionTooltip';
1612
import {t, tct} from 'sentry/locale';
1713
import type {Organization} from 'sentry/types/organization';
1814

19-
import {openEditBillingDetails} from 'getsentry/actionCreators/modal';
2015
import BillingDetailsForm from 'getsentry/components/billingDetails/form';
2116
import {useBillingDetails} from 'getsentry/hooks/useBillingDetails';
2217
import type {Subscription} from 'getsentry/types';
@@ -26,37 +21,21 @@ import {getCountryByCode} from 'getsentry/utils/ISO3166codes';
2621
import {countryHasSalesTax, getTaxFieldInfo} from 'getsentry/utils/salesTax';
2722
import type {GetsentryEventKey} from 'getsentry/utils/trackGetsentryAnalytics';
2823

29-
/**
30-
* Sets the min-height so a field displaying text will be the same height as a
31-
* field that has an input
32-
*/
33-
function TextForField({children}: {children: React.ReactNode}) {
34-
return (
35-
<Flex minHeight="37px" align="center">
36-
<Text as="span">{children}</Text>
37-
</Flex>
38-
);
39-
}
40-
4124
/**
4225
* Panel displaying existing billing details.
4326
*/
4427
function BillingDetailsPanel({
4528
organization,
4629
subscription,
47-
title,
48-
isNewBillingUI,
4930
analyticsEvent,
5031
shouldExpandInitially,
5132
maxPanelWidth,
5233
}: {
5334
organization: Organization;
5435
subscription: Subscription;
5536
analyticsEvent?: GetsentryEventKey;
56-
isNewBillingUI?: boolean;
5737
maxPanelWidth?: string;
5838
shouldExpandInitially?: boolean;
59-
title?: string;
6039
}) {
6140
const [isEditing, setIsEditing] = useState(false);
6241
const [expandInitially, setExpandInitially] = useState(shouldExpandInitially);
@@ -98,74 +77,6 @@ function BillingDetailsPanel({
9877
})
9978
: `${formatCurrency(subscription.accountBalance)}`;
10079

101-
if (!isNewBillingUI) {
102-
return (
103-
<Panel className="ref-billing-details">
104-
<PanelHeader>
105-
{title ?? t('Billing Details')}
106-
<Button
107-
priority="primary"
108-
size="sm"
109-
onClick={() =>
110-
openEditBillingDetails({
111-
organization,
112-
initialData: billingDetails,
113-
refetch: fetchBillingDetails,
114-
})
115-
}
116-
disabled={!organization.access.includes('org:billing')}
117-
>
118-
{t('Update details')}
119-
</Button>
120-
</PanelHeader>
121-
<PanelBody>
122-
{subscription.accountBalance ? (
123-
<FieldGroup id="account-balance" label="Account Balance">
124-
{balance}
125-
</FieldGroup>
126-
) : null}
127-
<FieldGroup label={t('Billing Email')}>
128-
<TextForField>{billingDetails?.billingEmail}</TextForField>
129-
</FieldGroup>
130-
<FieldGroup label={t('Company Name')}>
131-
<TextForField>{billingDetails?.companyName}</TextForField>
132-
</FieldGroup>
133-
<FieldGroup label={t('Address Line 1')}>
134-
<TextForField>{billingDetails?.addressLine1}</TextForField>
135-
</FieldGroup>
136-
<FieldGroup label={t('Address Line 2')}>
137-
<TextForField>{billingDetails?.addressLine2}</TextForField>
138-
</FieldGroup>
139-
<FieldGroup label={t('City')}>
140-
<TextForField>{billingDetails?.city}</TextForField>
141-
</FieldGroup>
142-
<FieldGroup label={t('State / Region')}>
143-
<TextForField>{billingDetails?.region}</TextForField>
144-
</FieldGroup>
145-
<FieldGroup label={t('Postal Code')}>
146-
<TextForField>{billingDetails?.postalCode}</TextForField>
147-
</FieldGroup>
148-
<FieldGroup label={t('Country')}>
149-
<TextForField>
150-
{getCountryByCode(billingDetails?.countryCode)?.name}
151-
</TextForField>
152-
</FieldGroup>
153-
{countryHasSalesTax(billingDetails?.countryCode) && taxFieldInfo && (
154-
<FieldGroup
155-
label={taxFieldInfo.label}
156-
help={tct(
157-
"Your company's [taxNumberName] will appear on all receipts. You may be subject to taxes depending on country specific tax policies.",
158-
{taxNumberName: <strong>{taxFieldInfo.taxNumberName}</strong>}
159-
)}
160-
>
161-
<TextForField>{billingDetails?.taxNumber}</TextForField>
162-
</FieldGroup>
163-
)}
164-
</PanelBody>
165-
</Panel>
166-
);
167-
}
168-
16980
return (
17081
<Flex
17182
justify={isEditing ? 'start' : 'between'}

static/gsApp/components/creditCardEdit/modal.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)