UNPKG

@funkit/connect

Version:

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

86 lines (85 loc) 3.73 kB
import { type ReactNode } from 'react'; import { type FunkitPrioritizedLoginType, FunkitSocialLoginMethod } from '../consts/funkit'; export interface FunkitTextCustomizationsConfig { virtualFiat: string; brokerageOrExchange: string; debitOrCredit: string; accountBalance: string; selectAccount: string; sourceChangeTitle?: string; sourceMethodTitle: string; tokensListTitle: string; transferTokens: string; receiveDropdownTitle: string; receiveDropdownLabel: string; confirmationScreen: { payAmountLabel: string; receiveAmountLabel: string; }; } export interface FunkitUiDestinationConfig { /** What icon (15x15) to show in the `destination` row - defaults to user wallet icon */ icon?: ReactNode; /** What text to show in the `destination` row - defaults to formatted destination wallet address */ text?: string; /** Which url to redirect to. If not specified, defaults to the block explorer of the recipientAddr of the checkout*/ url?: string; } export interface FunkitUiCustomizationsConfig { confirmationScreen?: { /** Whether to show the amount of tokens below the USD equivalent - defaults to true */ showTokenAmount?: boolean; /** Whether to show the total payment amount in USD below the token amount equivalent. Defaults to false */ showPaymentAmountUsd?: boolean; /** Whether to show the total receive amount in USD below the token amount equivalent. Defaults to false */ showReceiveAmountUsd?: boolean; /** Custom destination icon and text used in checkout summary */ destinationConfig?: FunkitUiDestinationConfig; /** when source and destination are the same address, show destination as payment method instead of source */ preferDestinationWhenSame?: boolean; }; inputAmountScreen?: { /** Whether to allow entering an amount of tokens, rather than only USD - defaults to true */ allowTokenAmountInput?: boolean; }; paymentMethods?: { /** Whether paying by card is a payment method the users can use - defaults to true */ isCardEnabled?: boolean; }; callToActionsUppercase?: boolean; } export declare const DEFAULT_TEXT_CUSTOMIZATIONS: FunkitTextCustomizationsConfig; interface FunkitLoginOptionsConfig { web2: boolean; web3: boolean; prioritizedLogin: FunkitPrioritizedLoginType; /** Enables social logins. Each type requires configuration in your app's privy dashboard. Please ensure to do so before enabling any. **/ web2SocialLogins: { [FunkitSocialLoginMethod.GOOGLE]?: boolean; [FunkitSocialLoginMethod.TWITTER]?: boolean; [FunkitSocialLoginMethod.APPLE]?: boolean; [FunkitSocialLoginMethod.FARCASTER]?: boolean; }; } export type FunkitConfig = { /** Funkit api key **/ apiKey: string; /** App name **/ appName: string; /** Whether app's background is scrollable when a widget is active **/ allowBackgroundScroll?: boolean; /** Text customizations across all widgets **/ textCustomizations?: Partial<FunkitTextCustomizationsConfig>; /** UI customizations across all widgets **/ uiCustomizations?: FunkitUiCustomizationsConfig; /** Login modal configuration **/ loginConfig: Partial<FunkitLoginOptionsConfig>; }; interface FinalFunkitConfigInternal extends FunkitConfig { allowBackgroundScroll: boolean; textCustomizations: FunkitTextCustomizationsConfig; loginConfig: FunkitLoginOptionsConfig; } export declare const FunkitConfigContext: import("react").Context<FunkitConfig>; export declare function useFunkitConfig(): FinalFunkitConfigInternal; export {};