import { Key } from 'react'; import { MessageItem, Status } from '../../../types'; /** * A set of message util functions. */ export declare const messagesActions: { ADD_MESSAGE: string; HIDE_MESSAGE: string; REMOVE_MESSAGE: string; CLEAR_MESSAGES: string; SHOW_SUCCESS_MESSAGE: string; SHOW_ERROR_MESSAGE: string; SHOW_WARNING_MESSAGE: string; MULTI_SHOW_SUCCESS_MESSAGE: string; MULTI_SHOW_CRITICAL_MESSAGE: string; MULTI_SHOW_WARNING_MESSAGE: string; }; interface AddMessageAction { type: typeof messagesActions.ADD_MESSAGE; message: MessageItem; } interface HideMessageAction { type: typeof messagesActions.HIDE_MESSAGE; key: Key; } interface RemoveMessageAction { type: typeof messagesActions.REMOVE_MESSAGE; key: Key; } interface ClearMessagesAction { type: typeof messagesActions.CLEAR_MESSAGES; } export type MessageActions = AddMessageAction | HideMessageAction | RemoveMessageAction | ClearMessagesAction; /** * Create an action to add a message * The message object to be added */ export declare const addMessage: (message: MessageItem) => AddMessageAction; /** * Create an action to hide a message by key */ export declare const hideMessage: (key: Key) => HideMessageAction; /** * Create an action to remove a message by key */ export declare const removeMessage: (key: Key) => RemoveMessageAction; /** * Create an action to add a message and then remove it if there's a timeout */ export declare const showMessage: (messageArg: MessageItem, timeout?: number) => (dispatch: (action: MessageActions) => void) => { text?: string; node?: React.ReactNode; key: Key; props?: import("../../../types").MessageItemProps; status?: Status; isHidden?: boolean; }; /** Create an action to clear all messages */ export declare const clearMessages: () => ClearMessagesAction; /** Reducer to store a list of messages */ export declare const messagesReducer: { (state: Array | undefined, action: MessageActions): Array; actions: { addMessage: (message: MessageItem) => AddMessageAction; hideMessage: (key: Key) => HideMessageAction; removeMessage: (key: Key) => RemoveMessageAction; showMessage: (messageArg: MessageItem, timeout?: number) => (dispatch: (action: MessageActions) => void) => { text?: string; node?: React.ReactNode; key: Key; props?: import("../../../types").MessageItemProps; status?: Status; isHidden?: boolean; }; clearMessages: () => ClearMessagesAction; showSuccessMessage: (text: string) => (dispatch: (action: MessageActions) => void) => { text?: string; node?: React.ReactNode; key: Key; props?: import("../../../types").MessageItemProps; status?: Status; isHidden?: boolean; }; showErrorMessage: (text: string) => (dispatch: (action: MessageActions) => void) => { text?: string; node?: React.ReactNode; key: Key; props?: import("../../../types").MessageItemProps; status?: Status; isHidden?: boolean; }; showWarningMessage: (text: string) => (dispatch: (action: MessageActions) => void) => { text?: string; node?: React.ReactNode; key: Key; props?: import("../../../types").MessageItemProps; status?: Status; isHidden?: boolean; }; }; }; export default messagesReducer;