@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
90 lines (89 loc) • 4.31 kB
TypeScript
import { type ReactNode } from 'react';
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 {
/** Title alignment - defaults to "center" */
alignTitle?: 'left' | 'center';
/** Whetehr to show CTA in uppercase - defaults to false */
callToActionsUppercase?: boolean;
confirmationScreen?: {
/** 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 - defaults to false */
preferDestinationWhenSame?: 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;
/**
* Whether and how to show transaction fee's digest.
* - "none": show nothing (default)
* - "chainDependent": show price impact and additionally show gas as well for eth-mainnet
*/
showTransactionDigest?: 'none' | 'chainDependent';
/** Whether to show the amount of tokens below the USD equivalent - defaults to true */
showTokenAmount?: boolean;
};
inputAmountScreen?: {
/** Whether to allow entering an amount of tokens, rather than only USD - defaults to true */
allowTokenAmountInput?: boolean;
};
selectAssetScreen?: {
/** Whether to show target asset selection menu if dynamicTargetAssetCandidates exist - defaults to false */
showTargetAssetSelection?: boolean;
};
transferCryptoScreen?: {
/** Whether to show the "You Send -> You Receive" block in the transfer crypto screen - defaults to false */
showYouSendYouReceive?: boolean;
};
}
export type FunkitUiCustomizationsConfigInternal = Required<FunkitUiCustomizationsConfig> & {
confirmationScreen: FunkitUiCustomizationsConfig['confirmationScreen'] & Required<Omit<FunkitUiCustomizationsConfig['confirmationScreen'] & {}, 'destinationConfig'>>;
inputAmountScreen: Required<FunkitUiCustomizationsConfig['inputAmountScreen'] & {}>;
selectAssetScreen: Required<FunkitUiCustomizationsConfig['selectAssetScreen'] & {}>;
transferCryptoScreen: Required<FunkitUiCustomizationsConfig['transferCryptoScreen'] & {}>;
};
export declare const DEFAULT_TEXT_CUSTOMIZATIONS: FunkitTextCustomizationsConfig;
export declare const DEFAULT_UI_CUSTOMIZATIONS: FunkitUiCustomizationsConfigInternal;
export type FunkitConfig = {
/** Funkit api key **/
apiKey: string;
/** App name **/
appName: string;
/** Text customizations across all widgets **/
textCustomizations?: Partial<FunkitTextCustomizationsConfig>;
/** UI customizations across all widgets **/
uiCustomizations?: FunkitUiCustomizationsConfig;
/** used to link funkit users to your own user system */
externalUserId?: string;
};
interface FinalFunkitConfigInternal extends FunkitConfig {
textCustomizations: FunkitTextCustomizationsConfig;
uiCustomizations: FunkitUiCustomizationsConfigInternal;
}
export declare const FunkitConfigContext: import("react").Context<FunkitConfig>;
export declare function useFunkitConfig(): FinalFunkitConfigInternal;
export {};