UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

48 lines (47 loc) 2.36 kB
import React, { type ReactNode } from 'react'; import type { AddToWalletToken } from '../../providers/FunkitCheckoutContext'; export type AddTokenToWalletBannerStatus = 'idle' | 'pending' | 'success' | 'error'; interface AddTokenToWalletBannerProps { status: AddTokenToWalletBannerStatus; /** Localized prompt for the left side, e.g. "Add aUSDT to your balance". */ prompt: string; /** Localized button label, e.g. "Add to Wallet" / "Added". */ actionLabel: string; /** * Localized full-intent aria-label for the button — "Add {symbol} to wallet" * / "{symbol} added to wallet". Decoupled from the visible label so screen * readers still get the per-token intent even though the button itself is * a static "Add to Wallet". */ ariaLabel: string; /** Localized error copy shown below the banner when status === 'error'. */ errorMessage: string; /** * Icon for the connected wallet (idle/error states only). Resolved by * `usePaymentMethodIcon(PaymentMethod.ACCOUNT_BALANCE, 16)` in the smart * wrapper so it mirrors the wallet glyph the rest of the SDK uses; pending * / success states substitute a spinner / check. */ walletIcon: ReactNode; /** Called when the user clicks; only fires when `status` allows it. */ onClick?: () => void; } /** * Presentational banner-with-CTA — no hooks, no wagmi, no gating. The * `AddTokenToWalletButton` smart component below wires this up to * `useAddTokenToWallet`; the story renders the banner directly. */ export declare function AddTokenToWalletBanner({ status, prompt, actionLabel, ariaLabel, errorMessage, walletIcon, onClick, }: AddTokenToWalletBannerProps): React.JSX.Element; interface AddTokenToWalletButtonProps { /** Parents pass `config.addToWalletToken`, gating on its presence. */ addToWalletToken: AddToWalletToken; } /** * Hidden for non-EVM chains and native tokens — EIP-747's `type: 'ERC20'` * doesn't model either. `addToWalletToken` is supplied by the customer flow * (e.g. an Aave aToken receipt that differs from the checkout's destination * token); rendered from `FunDirectExecutionHistoryDetail` (the wallet- * executed success screen). */ export declare function AddTokenToWalletButton({ addToWalletToken, }: AddTokenToWalletButtonProps): React.JSX.Element | null; export {};