Skip to content

Commit f1ae01d

Browse files
authored
fix(clerk-js,chrome-extension): Remove Stripe RHC (#5569)
1 parent 2033919 commit f1ae01d

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.changeset/free-knives-boil.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Remove Stripe from non-RHC build

packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx

+11-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Appearance as StripeAppearance, Stripe } from '@stripe/stripe-js';
1010
import { loadStripe } from '@stripe/stripe-js';
1111
import { useEffect, useRef, useState } from 'react';
1212

13+
import { clerkUnsupportedEnvironmentWarning } from '../../../core/errors';
1314
import { useEnvironment, usePaymentSourcesContext } from '../../contexts';
1415
import { descriptors, Flex, localizationKeys, Spinner, useAppearance } from '../../customizables';
1516
import { Alert, Form, FormButtons, FormContainer, withCardStateProvider } from '../../elements';
@@ -74,12 +75,16 @@ export const AddPaymentSource = (props: AddPaymentSourceProps) => {
7475

7576
useEffect(() => {
7677
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+
}
8388
}
8489
}, [externalGatewayId, __experimental_commerceSettings]);
8590

scripts/search-for-rhc.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ await Promise.allSettled([
2727
asyncSearchRHC('Turnstile', 'cloudflare.com/turnstile/v0/api.js'),
2828
asyncSearchRHC('clerk-js Hotloading', '/npm/@clerk/clerk-js'),
2929
asyncSearchRHC('Google One Tap', 'accounts.google.com/gsi/client'),
30+
asyncSearchRHC('Stripe', 'loadStripe('),
3031
]).then(results => {
3132
const errors = results.filter(result => result.status === 'rejected').map(result => result.reason.message);
3233

0 commit comments

Comments
 (0)