Skip to content

Commit 5abbae7

Browse files
[thirdweb] fix: Respect buyWithFiat setting in PayEmbed (#6289)
1 parent b98c228 commit 5abbae7

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

.changeset/eight-pandas-serve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Respect buy with fiat disabled in pay embed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ function BuyScreenContent(props: BuyScreenContentProps) {
558558
supportedSourcesQuery.data &&
559559
sourceSupportedTokens && (
560560
<TokenSelectorScreen
561+
fiatSupported={props.payOptions.buyWithFiat !== false}
561562
client={props.client}
562563
sourceTokens={sourceSupportedTokens}
563564
sourceSupportedTokens={sourceSupportedTokens}

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export function TokenSelectorScreen(props: {
6969
onSelectToken: (wallet: Wallet, token: TokenInfo, chain: Chain) => void;
7070
onConnect: () => void;
7171
onPayWithFiat: () => void;
72+
fiatSupported: boolean;
7273
}) {
7374
const connectedWallets = useConnectedWallets();
7475
const activeAccount = useActiveAccount();
@@ -255,29 +256,31 @@ export function TokenSelectorScreen(props: {
255256
</Text>
256257
</Container>
257258
</Button>
258-
<Button
259-
variant="secondary"
260-
fullWidth
261-
onClick={props.onPayWithFiat}
262-
bg="tertiaryBg"
263-
style={{
264-
border: `1px solid ${theme.colors.borderColor}`,
265-
padding: spacing.sm,
266-
}}
267-
>
268-
<Container
269-
flex="row"
270-
gap="sm"
271-
center="y"
272-
expand
273-
color="secondaryIconColor"
259+
{props.fiatSupported && (
260+
<Button
261+
variant="secondary"
262+
fullWidth
263+
onClick={props.onPayWithFiat}
264+
bg="tertiaryBg"
265+
style={{
266+
border: `1px solid ${theme.colors.borderColor}`,
267+
padding: spacing.sm,
268+
}}
274269
>
275-
<CardStackIcon width={iconSize.md} height={iconSize.md} />
276-
<Text size="sm" color="primaryText">
277-
Pay with credit card
278-
</Text>
279-
</Container>
280-
</Button>
270+
<Container
271+
flex="row"
272+
gap="sm"
273+
center="y"
274+
expand
275+
color="secondaryIconColor"
276+
>
277+
<CardStackIcon width={iconSize.md} height={iconSize.md} />
278+
<Text size="sm" color="primaryText">
279+
Pay with credit card
280+
</Text>
281+
</Container>
282+
</Button>
283+
)}
281284
</Container>
282285
</Container>
283286
</Container>

0 commit comments

Comments
 (0)