"use client"; import type { ThirdwebClient } from "../../../../client/client.js"; import type { Wallet } from "../../../../wallets/interfaces/wallet.js"; import type { AuthOption } from "../../../../wallets/types.js"; import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js"; import { iconSize, radius, spacing, } from "../../../core/design-system/index.js"; import { socialIcons } from "../../../core/utils/walletIcon.js"; import { defaultAuthOptions } from "../../wallets/shared/ConnectWalletSocialOptions.js"; import { Img } from "../components/Img.js"; import { EmailIcon } from "./icons/EmailIcon.js"; import { FingerPrintIcon } from "./icons/FingerPrintIcon.js"; import { GuestIcon } from "./icons/GuestIcon.js"; import { PhoneIcon } from "./icons/PhoneIcon.js"; export function InAppWalletIcon(props: { client: ThirdwebClient; wallet: Wallet<"inApp">; }) { const enabledAuthMethods = ( props.wallet.getConfig()?.auth?.options || defaultAuthOptions ) .slice() // clone .sort((a, b) => { if (a in socialIcons && !(b in socialIcons)) { return -1; } if (!(a in socialIcons) && b in socialIcons) { return 1; } return 0; }); const theme = useCustomTheme(); const firstMethod = enabledAuthMethods[0]; const secondMethod = enabledAuthMethods[1]; const thirdMethod = enabledAuthMethods[2]; const fourthMethod = enabledAuthMethods[3]; const offset = "4px"; const offset2 = "6px"; const smallIconSize = "20"; const extraIconSize = "12"; if (firstMethod && secondMethod) { return (
{thirdMethod && (
)} {fourthMethod && (
)}
); } if (firstMethod) { return (
); } return null; } function AuthOptionIcon(props: { authOption: AuthOption; client: ThirdwebClient; size: string; }) { const theme = useCustomTheme(); if (props.authOption in socialIcons) { const icon = socialIcons[props.authOption as keyof typeof socialIcons]; return ( ); } if (props.authOption === "phone") { return ; } if (props.authOption === "email") { return ; } if (props.authOption === "passkey") { return ( ); } if (props.authOption === "guest") { return ; } return null; }