/** * Flash alerts, especially for ajax error messages * Typical usage: * import {showFlashError} from './FlashAlert' * ... * doFetchApi({path: url, method: 'PUT', body: data}).then((response) => { * // do something with response * }).catch(showFlashError(your_error_message)) * * showFlashError() with no argument shows a generic message * * On error, will display an inst-ui Alert at the top of the page * with an error message and "Details" button. When the user clicks * the button, it shows error details extracted from the Error * * You could also import the lower level showFlashAlert function or * the FlashAlert component if you need more control * * showFlashAlert({ err, message, type }, onCloseCallback) * err: error object * message: user-facing message * type: one of ['info', 'success', 'warning', 'error'] * default is 'info' unless an error object is passed in, else is 'error' */ import React from 'react'; import PropTypes from 'prop-types'; export default class FlashAlert extends React.Component { state: { showDetails: boolean; isOpen: boolean; }; timerId: number; static propTypes: { onClose: PropTypes.Validator<(...args: any[]) => any>; message: PropTypes.Validator; error: PropTypes.Requireable; variant: PropTypes.Requireable; timeout: PropTypes.Requireable; screenReaderOnly: PropTypes.Requireable; }; static defaultProps: { error: null; variant: string; timeout: number; screenReaderOnly: boolean; }; constructor(props: any); showDetails: () => void; closeAlert: () => void; findDetailMessage(): { a: any; b: any; }; renderDetailMessage(): React.JSX.Element; render(): React.JSX.Element; } export declare function showFlashAlert({ message, err, type, srOnly }: { err: any; message: any; srOnly?: boolean | undefined; type?: string | undefined; }): void; export declare function destroyContainer(): void; export declare function showFlashError(message?: string): (err: any) => void; export declare function showFlashSuccess(message: any): () => void;