UNPKG

@funkit/connect

Version:

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

59 lines (58 loc) 2.66 kB
import { type SwappedFormOfPayment } from '@funkit/api-base'; import React from 'react'; import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodBitcoinLightningInfo, type PaymentMethodCardInfo, type PaymentMethodCashAppLightningInfo, type PaymentMethodVirtualBankIncompleteInfo } from '../../../domains/paymentMethods'; import { type PaymentMethodType } from '../../../hooks/usePaymentSources'; import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition'; export type SourceChangeState = CheckoutModalCommonState & { paymentMethodInfo: ConnectablePaymentMethodInfo | null; /** Persisted payment method type filter (crypto/fiat tab) */ paymentMethodTypeFilter?: PaymentMethodType; }; export type SourceChangeNext = { connectNew: false; paymentMethodInfo: ConnectablePaymentMethodInfo; brokerageFailed: false; } | { connectNew: true; paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD | PaymentMethod.VIRTUAL_BANK | PaymentMethod.BITCOIN_LIGHTNING | PaymentMethod.CASH_APP_LIGHTNING>; brokerageFailed: false; } | { connectNew: true; paymentMethod: PaymentMethod.BITCOIN_LIGHTNING; paymentMethodInfo: PaymentMethodBitcoinLightningInfo; brokerageFailed: false; } | { connectNew: true; paymentMethod: PaymentMethod.CASH_APP_LIGHTNING; paymentMethodInfo: PaymentMethodCashAppLightningInfo; brokerageFailed: false; } | { connectNew: true; paymentMethod: PaymentMethod.VIRTUAL_BANK; paymentMethodInfo: PaymentMethodVirtualBankIncompleteInfo; brokerageFailed: false; } | { connectNew: true; paymentMethod: PaymentMethod.CARD; paymentMethodInfo: PaymentMethodCardInfo; brokerageFailed: false; } | { brokerageFailed: true; paymentMethodInfo: ConnectablePaymentMethodInfo; } | { /** Navigate to Swapped iframe with a selected payment option */ swappedIframe: true; selectedPaymentOption: SwappedFormOfPayment; /** Payment method type filter to restore when returning */ paymentMethodTypeFilter: PaymentMethodType; } | { /** * Skip the asset-select screen; land on InputAmount with the * source asset pre-set on the checkout context. Used by the * Native fast-path row. */ skipAssetSelect: true; paymentMethodInfo: ConnectablePaymentMethodInfo; }; export declare const SourceChangeInfo: ModalStepInfo<FunCheckoutStep.SOURCE_CHANGE>; export declare function SourceChange({ modalState, onClose, onNext, onStepChange, setModalState, }: ModalStepComponentProps<FunCheckoutStep.SOURCE_CHANGE>): React.JSX.Element;