@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
46 lines (45 loc) • 2.28 kB
TypeScript
import type { ExchangeRates, GetFopsResponse, SavedFormOfPayment, SwappedFormOfPayment } from '@funkit/api-base';
import type { ListFormOfPayment, SyntheticFormOfPayment } from '@funkit/connect-core';
import React from 'react';
/** FOP list normalized to hold real (Swapped) and synthetic methods together. */
interface ListFopsData {
genericFormsOfPayments: ListFormOfPayment[];
savedFormsOfPayments: SavedFormOfPayment[];
}
interface FormOfPaymentsListProps {
fopsData?: GetFopsResponse;
isLoading: boolean;
selectedFop?: ListFormOfPayment | null;
/**
* Non-Swapped methods (e.g. Cash App Lightning) to interleave into the list.
* They flow through the same sort/section/slice machinery as real FOPs.
*/
syntheticFops?: SyntheticFormOfPayment[];
onSelect: (fop: ListFormOfPayment) => void;
exchangeRatesData?: ExchangeRates;
enableSourceGroupLabels: boolean;
isDisabled?: boolean;
/**
* Maps a FOP to its disclaimer-limit string. Defaults to the rounded deposit
* limit (getFopsLimit). Return undefined to omit the limit and show only the
* processing time (the withdrawal off-ramp hides limits).
*/
getDisclaimerLimit?: (fop: SwappedFormOfPayment, exchangeRates: ExchangeRates | undefined) => string | undefined;
/**
* Withdrawal off-ramp only: balance is below the cash sell minimum, so every
* cash method is disabled with a "Low Balance" badge. A single flag is enough
* while all providers share one minimum — switch to a `(fop) => boolean`
* predicate if per-provider minimums ever diverge.
*/
isBelowMinimumBalance?: boolean;
}
interface FormOfPaymentSection {
items: ListFormOfPayment[];
labelKey: 'sourceChange.mostPopular' | 'sourceChange.savedPaymentMethods' | 'sourceChange.moreOptions';
}
export declare function getFormOfPaymentSections(fopsData: ListFopsData, fopPriority: readonly string[]): {
primary: FormOfPaymentSection;
secondary: FormOfPaymentSection;
};
export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, syntheticFops, onSelect, exchangeRatesData, getDisclaimerLimit, enableSourceGroupLabels, isDisabled, isBelowMinimumBalance, }: FormOfPaymentsListProps): React.JSX.Element;
export {};