import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
import { AuthEventPayload, OtpDestination, PhoneData, UserProfile } from '@dynamic-labs/types';
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
import { SdkErrorCode } from '@dynamic-labs/utils';
import { Wallet, WalletListViewTabItem } from './wallets';
export type DynamicEventsCallbacks = {
    onSignedMessage?: (params: {
        messageToSign: string;
        signedMessage: string;
    }) => void;
    /** Called when the auth modal is closed before reaching success (due to user cancel or fail) */
    onAuthFlowCancel?: () => void;
    /** Called whenever the auth modal is closed */
    onAuthFlowClose?: () => void;
    onAuthFlowOpen?: () => void;
    onAuthSuccess?: OnAuthSuccess;
    onOtpVerificationResult?: OnOtpVerificationResult;
    onLogout?: (user: UserProfile | undefined) => void;
    onUserProfileUpdate?: (user: UserProfile) => void;
    onEmbeddedWalletCreated?: OnEmbeddedWalletCreated;
    /** Called when a user successfully reveals their embedded wallet private key or recovery phrase */
    onEmbeddedWalletRevealSuccess?: (wallet: Wallet) => void;
    /** Called when revealing an embedded wallet private key or recovery phrase fails */
    onEmbeddedWalletRevealFailure?: (error: unknown) => void;
    onWalletAdded?: OnWalletAdded;
    onWalletRemoved?: OnWalletRemoved;
    onWalletConnectionFailed?: (walletConnector: WalletConnector, error: unknown) => void;
    /**
     * Informs an auth attempt failed.
     * In general triggered when an error occurs or when user cancels out.
     * For email/sms, specifically happens when users cancels the OTP verification.
     */
    onAuthFailure?: (data: AuthEventPayload, reason: SdkErrorCode.USER_CANCELLED | {
        error: unknown;
    }) => void;
    /** Informs an auth attempt initialized, and provides insight into which auth option it is */
    onAuthInit?: (data: AuthEventPayload) => void;
    /** Informs when a wallet tab is selected */
    onWalletTabSelected?: (params: {
        index: number;
        tab: WalletListViewTabItem;
    }) => void;
    /**
     * Called when the app returns from a wallet deep link (mobile only).
     * Use this to navigate back to the route the user was on before
     * the wallet operation.
     */
    onWalletReturnFromDeepLink?: (params: {
        previousRoute: string;
    }) => void;
};
export type OnAuthSuccess = (params: {
    handleLogOut: () => Promise<void>;
    isAuthenticated: boolean;
    primaryWallet: Wallet | null;
    user: UserProfile;
}) => void;
export type OnWalletAdded = (params: {
    wallet: Wallet;
    userWallets: Wallet[];
}) => void;
export type OnWalletRemoved = (params: {
    wallet: Wallet;
    userWallets: Wallet[];
}) => void;
export type OnOtpVerificationResult = (
/** Whether it was a success or failure */
isSuccess: boolean, 
/** Data on where the OTP was sent to */
destination: {
    type: Extract<OtpDestination, 'email'>;
    value: string;
} | {
    type: Extract<OtpDestination, 'sms'>;
    value: PhoneData;
}) => void;
export type OnUserProfileUpdate = (user: UserProfile) => void;
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined, user: UserProfile | undefined) => void;
