@@ -10,6 +10,7 @@ import type { Appearance as StripeAppearance, Stripe } from '@stripe/stripe-js';
10
10
import { loadStripe } from '@stripe/stripe-js' ;
11
11
import { useEffect , useRef , useState } from 'react' ;
12
12
13
+ import { clerkUnsupportedEnvironmentWarning } from '../../../core/errors' ;
13
14
import { useEnvironment , usePaymentSourcesContext } from '../../contexts' ;
14
15
import { descriptors , Flex , localizationKeys , Spinner , useAppearance } from '../../customizables' ;
15
16
import { Alert , Form , FormButtons , FormContainer , withCardStateProvider } from '../../elements' ;
@@ -74,12 +75,16 @@ export const AddPaymentSource = (props: AddPaymentSourceProps) => {
74
75
75
76
useEffect ( ( ) => {
76
77
if ( ! stripePromiseRef . current && externalGatewayId && __experimental_commerceSettings . stripePublishableKey ) {
77
- stripePromiseRef . current = loadStripe ( __experimental_commerceSettings . stripePublishableKey , {
78
- stripeAccount : externalGatewayId ,
79
- } ) ;
80
- void stripePromiseRef . current . then ( stripeInstance => {
81
- setStripe ( stripeInstance ) ;
82
- } ) ;
78
+ if ( ! __BUILD_DISABLE_RHC__ ) {
79
+ stripePromiseRef . current = loadStripe ( __experimental_commerceSettings . stripePublishableKey , {
80
+ stripeAccount : externalGatewayId ,
81
+ } ) ;
82
+ void stripePromiseRef . current . then ( stripeInstance => {
83
+ setStripe ( stripeInstance ) ;
84
+ } ) ;
85
+ } else {
86
+ clerkUnsupportedEnvironmentWarning ( 'Stripe' ) ;
87
+ }
83
88
}
84
89
} , [ externalGatewayId , __experimental_commerceSettings ] ) ;
85
90
0 commit comments