import React, { useMemo } from 'react';
import { StatusToast } from '@wix/design-system';
const TOAST_TYPE_TO_STATUS = {
    STANDARD: 'info',
    PREMIUM: 'info',
    SUCCESS: 'success',
    WARNING: 'warning',
    ERROR: 'error',
};
export const StatusToastFromConfig = ({ config, onClose, dataHook, messageDataHook, actionDataHook, }) => {
    const action = useMemo(() => {
        if (!config.action?.text) {
            return undefined;
        }
        const handleClick = () => {
            config.action?.onClick?.();
            if (config.action?.removeToastOnClick) {
                onClose();
            }
        };
        return (React.createElement(StatusToast.Action, { dataHook: actionDataHook, onClick: handleClick }, config.action.text));
    }, [config, onClose, actionDataHook]);
    return (React.createElement(StatusToast, { key: config.biName ?? config.message, dataHook: dataHook, status: TOAST_TYPE_TO_STATUS[config.type ?? 'STANDARD'], dismissible: true, onDismiss: onClose, action: action }, messageDataHook ? (React.createElement("span", { "data-hook": messageDataHook }, config.message)) : (config.message)));
};
//# sourceMappingURL=StatusToastFromConfig.js.map