"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLogic = void 0;
const react_1 = require("react");
const useLocalStorage_1 = require("../../useLocalStorage");
const constants_1 = require("../constants");
const useLogic = () => {
    const [open, setOpen] = (0, react_1.useState)(false);
    const [storageOnBoardShow, setStorageOnBoardShow] = (0, useLocalStorage_1.useLocalStorage)(constants_1.AUTOSAVE_ONBOARD_KEY, true);
    const ref = (0, react_1.useRef)(null);
    (0, react_1.useEffect)(() => {
        if (storageOnBoardShow) {
            setOpen(true);
        }
    }, []);
    const handleClose = () => {
        setOpen(false);
        setStorageOnBoardShow(false);
    };
    return {
        ref,
        handleClose,
        popoverProps: {
            open,
            onClose: handleClose,
            anchorEl: ref.current,
        },
    };
};
exports.useLogic = useLogic;
