"use client"; import type { TokenWithPrices } from "../../../../bridge/types/Token.js"; import { defineChain } from "../../../../chains/utils.js"; import type { ThirdwebClient } from "../../../../client/client.js"; import type { SupportedFiatCurrency } from "../../../../pay/convert/type.js"; import type { Address } from "../../../../utils/address.js"; import { PoweredByThirdweb } from "../ConnectWallet/PoweredByTW.js"; import { FiatValue } from "../ConnectWallet/screens/Buy/swap/FiatValue.js"; import { Container, Line } from "../components/basic.js"; import { Button } from "../components/buttons.js"; import { ChainName } from "../components/ChainName.js"; import { Spacer } from "../components/Spacer.js"; import { Text } from "../components/text.js"; import { ChainIcon } from "./common/TokenAndChain.js"; import { WithHeader } from "./common/WithHeader.js"; import type { DirectPaymentInfo } from "./types.js"; type DirectPaymentProps = { paymentInfo: DirectPaymentInfo; currency: SupportedFiatCurrency; metadata: { title: string | undefined; description: string | undefined; image: string | undefined; }; buttonLabel: string | undefined; /** * ThirdwebClient for blockchain interactions */ client: ThirdwebClient; /** * Called when user continues with the payment */ onContinue: ( amount: string, token: TokenWithPrices, receiverAddress: Address, ) => void; /** * Whether to show thirdweb branding in the widget. */ showThirdwebBranding: boolean; }; export function DirectPayment({ paymentInfo, metadata, client, onContinue, showThirdwebBranding = true, buttonLabel, currency, }: DirectPaymentProps) { const chain = defineChain(paymentInfo.token.chainId); const handleContinue = () => { onContinue( paymentInfo.amount, paymentInfo.token, paymentInfo.sellerAddress, ); }; return ( {/* Price section */} One-time payment Price {`${paymentInfo.amount} ${paymentInfo.token.symbol}`} {/* Network section */} Network {/* Action button */} {showThirdwebBranding ? (
) : null}
); }