1
1
import { useEffect , useMemo , useState } from 'react' ;
2
- import { useTheme } from '@emotion/react' ;
3
2
import styled from '@emotion/styled' ;
4
- import { AddressElement , Elements } from '@stripe/react-stripe-js' ;
3
+ import { AddressElement } from '@stripe/react-stripe-js' ;
5
4
6
- import { debossedBackground } from 'sentry/components/core/chonk' ;
7
5
import { Flex } from 'sentry/components/core/layout' ;
8
6
import { Heading , Text } from 'sentry/components/core/text' ;
9
7
import type { FieldGroupProps } from 'sentry/components/forms/fieldGroup/types' ;
@@ -13,12 +11,11 @@ import FormModel from 'sentry/components/forms/model';
13
11
import QuestionTooltip from 'sentry/components/questionTooltip' ;
14
12
import { t , tct } from 'sentry/locale' ;
15
13
import ConfigStore from 'sentry/stores/configStore' ;
16
- import { useLegacyStore } from 'sentry/stores/useLegacyStore' ;
17
14
import type { Organization } from 'sentry/types/organization' ;
18
15
import { defined } from 'sentry/utils' ;
19
16
20
17
import LegacyBillingDetailsForm from 'getsentry/components/legacyBillingDetailsForm' ;
21
- import { useStripeInstance } from 'getsentry/hooks/useStripeInstance ' ;
18
+ import StripeWrapper from 'getsentry/components/stripeWrapper ' ;
22
19
import type { BillingDetails } from 'getsentry/types' ;
23
20
import { hasStripeComponentsFeature } from 'getsentry/utils/billing' ;
24
21
import { countryCodes } from 'getsentry/utils/ISO3166codes' ;
@@ -130,10 +127,6 @@ function BillingDetailsForm({
130
127
wrapper = DefaultWrapper ,
131
128
fieldProps,
132
129
} : Props ) {
133
- const theme = useTheme ( ) ;
134
- const prefersDarkMode = useLegacyStore ( ConfigStore ) . theme === 'dark' ;
135
- const stripe = useStripeInstance ( ) ;
136
-
137
130
const transformData = ( data : Record < string , any > ) => {
138
131
// Clear tax number if not applicable to country code.
139
132
// This is done on save instead of on change to retain the field value
@@ -266,43 +259,7 @@ function BillingDetailsForm({
266
259
fieldProps = { fieldProps }
267
260
/>
268
261
) }
269
- < Elements
270
- stripe = { stripe }
271
- options = { {
272
- fonts : [
273
- {
274
- family : 'Rubik' ,
275
- cssSrc :
276
- 'https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap' ,
277
- } ,
278
- ] ,
279
- appearance : {
280
- theme : prefersDarkMode ? 'night' : 'stripe' ,
281
- variables : {
282
- fontFamily : theme . text . family ,
283
- borderRadius : theme . borderRadius ,
284
- colorBackground : theme . background ,
285
- colorText : theme . textColor ,
286
- colorDanger : theme . danger ,
287
- colorSuccess : theme . success ,
288
- colorWarning : theme . warning ,
289
- iconColor : theme . textColor ,
290
- } ,
291
- rules : {
292
- '.Input' : {
293
- fontSize : theme . fontSize . md ,
294
- boxShadow : `0px 2px 0px 0px ${ theme . tokens . border . primary } inset` ,
295
- backgroundColor : debossedBackground ( theme as any ) . backgroundColor ,
296
- padding : `${ theme . space . lg } ${ theme . space . xl } ` ,
297
- } ,
298
- '.Label' : {
299
- fontSize : theme . fontSize . sm ,
300
- color : theme . subText ,
301
- } ,
302
- } ,
303
- } ,
304
- } }
305
- >
262
+ < StripeWrapper >
306
263
< AddressElement
307
264
options = { {
308
265
mode : 'billing' ,
@@ -333,7 +290,7 @@ function BillingDetailsForm({
333
290
} }
334
291
onChange = { handleStripeFormChange }
335
292
/>
336
- </ Elements >
293
+ </ StripeWrapper >
337
294
{ ! ! ( state . showTaxNumber && taxFieldInfo ) && (
338
295
// TODO: use Stripe's TaxIdElement when it's generally available
339
296
< CustomBillingDetailsFormField
0 commit comments