"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BannerContainer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const Dialog_1 = require("../../Dialog");
const Notification_1 = require("../../Notification");
const useViewportType_1 = require("../../useViewportType");
const Banner_1 = require("../Banner");
const BannerTemplate_1 = require("../BannerTemplate");
const styles_1 = require("./styles");
/**
 * Предназначен для отображения баннера, совместно с уведомлениями.
 * Используется внутри NotificationContainer и NotificationStackContainer.
 * */
const BannerContainer = ({ bannerContainerId = Notification_1.BANNER_CONTAINER_ID, }) => {
    const { isMobile } = (0, useViewportType_1.useViewportType)();
    const [isOpenDialog, setIsOpenDialog] = (0, react_1.useState)(false);
    (0, react_1.useEffect)(() => {
        Banner_1.banner._init(isMobile, setIsOpenDialog);
    }, []);
    const handleCloseDialog = () => {
        setIsOpenDialog(false);
        if (Banner_1.banner._options?.onClose) {
            Banner_1.banner._options.onClose();
        }
    };
    return isMobile ? ((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { onClose: handleCloseDialog, open: isOpenDialog, title: "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0435", children: (0, jsx_runtime_1.jsx)(BannerTemplate_1.BannerTemplate, { ...Banner_1.banner._options, setIsOpenDialog: setIsOpenDialog }) })) : ((0, jsx_runtime_1.jsx)(styles_1.Inner, { containerId: bannerContainerId || Notification_1.BANNER_CONTAINER_ID, position: Notification_1.NOTIFY_POSITIONS.BOTTOM_RIGHT, newestOnTop: false, closeOnClick: false, draggable: false, rtl: false, closeButton: false, bodyClassName: `${Notification_1.notifyClassnames.body}`, toastClassName: Notification_1.notifyClassnames.root, progressClassName: `${Notification_1.notifyClassnames.progress}` }));
};
exports.BannerContainer = BannerContainer;
