Skip to content

Commit ec47bde

Browse files
committed
Remove card options from top up view
1 parent bab4551 commit ec47bde

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/checkout/widgets-lib/src/views/top-up/TopUpView.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ export function TopUpView({
122122
}
123123
}, [checkout]);
124124

125+
const isOnRampAvailable = useAsyncMemo<boolean | undefined>(async () => {
126+
if (!checkout) return undefined;
127+
try {
128+
return checkout.isOnRampAvailable();
129+
} catch (error) {
130+
return false;
131+
}
132+
}, [checkout]);
133+
125134
useMount(() => {
126135
page({ userJourney, screen: 'TopUp' });
127136
});
@@ -298,8 +307,8 @@ export function TopUpView({
298307
'views.TOP_UP_VIEW.topUpOptions.debit.subcaption',
299308
)}${onRampFeesPercentage}%`,
300309
),
301-
isAvailable: true,
302-
isEnabled: showOnrampOption,
310+
isAvailable: !!isOnRampAvailable,
311+
isEnabled: showOnrampOption && !!isOnRampAvailable,
303312
},
304313
{
305314
testId: 'onramp',
@@ -311,8 +320,8 @@ export function TopUpView({
311320
'views.TOP_UP_VIEW.topUpOptions.credit.subcaption',
312321
)}${onRampFeesPercentage}%`,
313322
),
314-
isAvailable: true,
315-
isEnabled: showOnrampOption,
323+
isAvailable: !!isOnRampAvailable,
324+
isEnabled: showOnrampOption && !!isOnRampAvailable,
316325
},
317326
{
318327
testId: 'advanced',
@@ -348,7 +357,7 @@ export function TopUpView({
348357
isEnabled: showBridgeOption,
349358
},
350359
],
351-
[showBridgeOption, showOnrampOption, showSwapOption],
360+
[showBridgeOption, showOnrampOption, showSwapOption, isOnRampAvailable],
352361
);
353362

354363
return (

0 commit comments

Comments
 (0)