|
1 | | -import type {ComponentType} from 'react'; |
2 | 1 | import type {Theme} from '@emotion/react'; |
3 | 2 | import {css} from '@emotion/react'; |
4 | | -import styled from '@emotion/styled'; |
5 | 3 |
|
6 | 4 | import {addErrorMessage} from 'sentry/actionCreators/indicator'; |
7 | 5 | import {openModal} from 'sentry/actionCreators/modal'; |
8 | 6 | import {promptsUpdate} from 'sentry/actionCreators/prompts'; |
9 | 7 | import {Client} from 'sentry/api'; |
10 | | -import {openConfirmModal} from 'sentry/components/confirm'; |
11 | | -import {t, tct} from 'sentry/locale'; |
| 8 | +import {tct} from 'sentry/locale'; |
12 | 9 | import type {Organization} from 'sentry/types/organization'; |
13 | 10 |
|
14 | | -import type {PromotionModalBodyProps} from 'getsentry/components/promotionModal'; |
15 | 11 | import type {Reservations} from 'getsentry/components/upgradeNowModal/types'; |
16 | 12 | import SubscriptionStore from 'getsentry/stores/subscriptionStore'; |
17 | | -import type { |
18 | | - Invoice, |
19 | | - Plan, |
20 | | - PreviewData, |
21 | | - Promotion, |
22 | | - PromotionClaimed, |
23 | | - Subscription, |
24 | | -} from 'getsentry/types'; |
| 13 | +import type {Invoice, Plan, PreviewData, Subscription} from 'getsentry/types'; |
25 | 14 | import {displayBudgetName, hasBillingAccess, supportsPayg} from 'getsentry/utils/billing'; |
26 | 15 | import type {AM2UpdateSurfaces} from 'getsentry/utils/trackGetsentryAnalytics'; |
27 | 16 |
|
@@ -212,72 +201,6 @@ export async function openAM2ProfilingUpsellModal(options: ProfilingUpsellModalP |
212 | 201 | openModal(deps => <Modal {...deps} {...options} />, {modalCss}); |
213 | 202 | } |
214 | 203 |
|
215 | | -type PromotionModalOptions = { |
216 | | - organization: Organization; |
217 | | - price: number; |
218 | | - promotion: Promotion; |
219 | | - promptFeature: string; |
220 | | - PromotionModalBody?: ComponentType<PromotionModalBodyProps>; |
221 | | - acceptButtonText?: string; |
222 | | - api?: Client; |
223 | | - declineButtonText?: string; |
224 | | - onAccept?: () => void; |
225 | | -}; |
226 | | - |
227 | | -export async function openPromotionModal(options: PromotionModalOptions) { |
228 | | - const {default: Modal, modalCss} = await import('getsentry/components/promotionModal'); |
229 | | - openModal(deps => <Modal {...deps} {...options} />, {closeEvents: 'none', modalCss}); |
230 | | -} |
231 | | - |
232 | | -export function openPromotionReminderModal( |
233 | | - promotionClaimed: PromotionClaimed, |
234 | | - onCancel?: () => void, |
235 | | - onConfirm?: () => void |
236 | | -) { |
237 | | - const {dateCompleted} = promotionClaimed; |
238 | | - const promo = promotionClaimed.promotion; |
239 | | - const {amount, billingInterval, billingPeriods, maxCentsPerPeriod, reminderText} = |
240 | | - promo.discountInfo; |
241 | | - const date = new Date(dateCompleted); |
242 | | - const percentOff = amount / 100; |
243 | | - |
244 | | - const interval = billingInterval === 'monthly' ? t('months') : t('years'); |
245 | | - const intervalSingular = interval.slice(0, -1); |
246 | | - |
247 | | - /** |
248 | | - * Removed translation because of complicated pluralization and lots of changing |
249 | | - * parameters from the different promotions we can use this for |
250 | | - */ |
251 | | - |
252 | | - openConfirmModal({ |
253 | | - message: ( |
254 | | - <div> |
255 | | - <p>{reminderText}</p> |
256 | | - <Subheader>{t('Current Promotion:')} </Subheader> |
257 | | - <p> |
258 | | - {percentOff}% off (up to ${maxCentsPerPeriod / 100} per {intervalSingular}) for{' '} |
259 | | - {billingPeriods} {interval} starting on {date.toLocaleDateString('en-US')} |
260 | | - </p> |
261 | | - </div> |
262 | | - ), |
263 | | - header: <HeaderText>Promotion Conflict</HeaderText>, |
264 | | - priority: 'danger', |
265 | | - confirmText: 'Downgrade Anyway', |
266 | | - onCancel: () => onCancel?.(), |
267 | | - onConfirm: () => onConfirm?.(), |
268 | | - }); |
269 | | -} |
270 | | - |
271 | | -const HeaderText = styled('div')` |
272 | | - font-size: ${p => p.theme.font.size.xl}; |
273 | | - font-weight: bold; |
274 | | -`; |
275 | | - |
276 | | -const Subheader = styled('div')` |
277 | | - font-weight: bold; |
278 | | - font-size: ${p => p.theme.font.size.md}; |
279 | | -`; |
280 | | - |
281 | 204 | export async function openDataConsentModal() { |
282 | 205 | const {default: Modal} = await import('getsentry/components/dataConsentModal'); |
283 | 206 |
|
|
0 commit comments