"use client"; import type { Chain } from "../../../../chains/types.js"; import type { ThirdwebClient } from "../../../../client/client.js"; import type { Wallet } from "../../../../wallets/interfaces/wallet.js"; import type { EcosystemWalletId } from "../../../../wallets/wallet-types.js"; import { useSelectionData, useSetSelectionData, } from "../../providers/wallet-ui-states-provider.js"; import type { ConnectLocale } from "../../ui/ConnectWallet/locale/types.js"; import { useInAppWalletLocale } from "../in-app/useInAppWalletLocale.js"; import { WalletAuth } from "../in-app/WalletAuth.js"; import type { ConnectWalletSelectUIState } from "../shared/ConnectWalletSocialOptions.js"; import { GuestLogin } from "../shared/GuestLogin.js"; import { LoadingScreen } from "../shared/LoadingScreen.js"; import { OTPLoginUI } from "../shared/OTPLoginUI.js"; import { PassKeyLogin } from "../shared/PassKeyLogin.js"; import { SocialLogin } from "../shared/SocialLogin.js"; import { EcosystemWalletFormUIScreen } from "./EcosystemWalletFormUI.js"; /** * * @internal */ function EcosystemWalletConnectUI(props: { wallet: Wallet; done: () => void; goBack?: () => void; client: ThirdwebClient; chain: Chain | undefined; connectLocale: ConnectLocale; size: "compact" | "wide"; meta: { title?: string; titleIconUrl?: string; showThirdwebBranding?: boolean; termsOfServiceUrl?: string; privacyPolicyUrl?: string; }; walletConnect: { projectId?: string } | undefined; isLinking?: boolean; }) { const data = useSelectionData(); const setSelectionData = useSetSelectionData(); const state = data as ConnectWalletSelectUIState; const localeId = props.connectLocale.id; const locale = useInAppWalletLocale(localeId); if (!locale) { return ; } const goBackToMain = () => { if (props.size === "compact") { props.goBack?.(); } setSelectionData({}); }; const done = () => { props.done(); setSelectionData({}); }; const otpUserInfo = state?.emailLogin ? { email: state.emailLogin } : state?.phoneLogin ? { phone: state.phoneLogin } : undefined; if (otpUserInfo) { return ( ); } if (state?.passkeyLogin) { return ( ); } if (state?.socialLogin) { return ( ); } if (state?.walletLogin) { return ( setSelectionData({}))} size={props.size} wallet={props.wallet} walletConnect={props.walletConnect} /> ); } if (state?.guestLogin) { return ( ); } return ( {}} size={props.size} wallet={props.wallet} /> ); } export default EcosystemWalletConnectUI;