import { ReactNode } from 'react'; import { ConnectWidgetView } from './ConnectViewContextTypes'; import { WalletWidgetView } from './WalletViewContextTypes'; import { PrefilledSwapForm, SwapWidgetView } from './SwapViewContextTypes'; import { BridgeWidgetView } from './BridgeViewContextTypes'; import { SaleWidgetView } from './SaleViewContextTypes'; import { ViewType } from './ViewType'; import { OnRampWidgetView } from './OnRampViewContextTypes'; import { AddTokensWidgetView } from './AddTokensViewContextTypes'; import { CheckoutWidgetView } from './CheckoutWidgetViewContextTypes'; import { PurchaseWidgetView } from './PurchaseViewContextTypes'; import { TransferWidgetView } from './TransferViewContextTypes'; export declare enum SharedViews { LOADING_VIEW = "LOADING_VIEW", ERROR_VIEW = "ERROR_VIEW", SUCCESS_VIEW = "SUCCESS_VIEW", TOP_UP_VIEW = "TOP_UP_VIEW", SERVICE_UNAVAILABLE_ERROR_VIEW = "SERVICE_UNAVAILABLE_ERROR_VIEW" } export type SharedView = LoadingView | ErrorView | ServiceUnavailableErrorView | TopUpView; interface LoadingView extends ViewType { type: SharedViews.LOADING_VIEW; } export interface ErrorView extends ViewType { type: SharedViews.ERROR_VIEW; error: Error; tryAgain?: () => Promise; } interface ServiceUnavailableErrorView extends ViewType { type: SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW; error: Error; } interface TopUpView extends ViewType { type: SharedViews.TOP_UP_VIEW; swapData?: PrefilledSwapForm; } export type View = SharedView | ConnectWidgetView | WalletWidgetView | SwapWidgetView | OnRampWidgetView | SaleWidgetView | BridgeWidgetView | AddTokensWidgetView | CheckoutWidgetView | PurchaseWidgetView | TransferWidgetView; export interface ViewState { view: View; history: View[]; } export declare const initialViewState: ViewState; export interface ViewContextState { viewState: ViewState; viewDispatch: React.Dispatch; } export interface ViewAction { payload: ViewActionPayload; } type ViewActionPayload = UpdateViewPayload | GoBackPayload | GoBackToPayload; export declare enum ViewActions { UPDATE_VIEW = "UPDATE_VIEW", GO_BACK = "GO_BACK", GO_BACK_TO = "GO_BACK_TO" } export interface UpdateViewPayload { type: ViewActions.UPDATE_VIEW; view: View; currentViewData?: any; } export interface GoBackPayload { type: ViewActions.GO_BACK; } export interface GoBackToPayload { type: ViewActions.GO_BACK_TO; view: View; } export declare const ViewContext: import("react").Context; export type Reducer = (prevState: S, action: A) => S; export declare const viewReducer: Reducer; export declare const useViewState: (initialState?: ViewState) => readonly [ViewState, import("react").Dispatch]; type ViewContextProviderProps = { children: ReactNode; }; export declare function ViewContextProvider({ children }: ViewContextProviderProps): import("@emotion/react/jsx-runtime").JSX.Element; export {};