"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SnackbarUtilsConfigurator = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const notistack_1 = require("notistack");
const InnerSnackbarUtilsConfigurator = (props) => {
    props.setUseSnackbarRef(notistack_1.useSnackbar());
    return null;
};
let useSnackbarRef;
const setUseSnackbarRef = (useSnackbarRefProp) => {
    useSnackbarRef = useSnackbarRefProp;
};
exports.SnackbarUtilsConfigurator = () => {
    return react_1.default.createElement(InnerSnackbarUtilsConfigurator, { setUseSnackbarRef: setUseSnackbarRef });
};
const WxSnackBar = {
    success(msg) {
        this.toast(msg, 'success');
    },
    warning(msg) {
        this.toast(msg, 'warning');
    },
    info(msg) {
        this.toast(msg, 'info');
    },
    error(msg) {
        this.toast(msg, 'error', { anchorOrigin: { horizontal: 'center', vertical: 'top' } });
    },
    toast(msg, variant = 'default', options) {
        useSnackbarRef === null || useSnackbarRef === void 0 ? void 0 : useSnackbarRef.enqueueSnackbar(msg, Object.assign({ variant, autoHideDuration: 2000 }, options));
    },
};
exports.default = WxSnackBar;
