import React, { useEffect } from "react";
import * as storeExports from "../toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore";
import { initialize as userPreferencesStoreInitialize, Actions as UserPreferencesActions, } from "./stores/UserPreferencesStore";
import { UserPreferences as UserPreferencesComponent } from "./UserPreferences";
import { FEAGlobals } from "../../../common/Globals";
var WorkspaceManagementMenuGlobalStore;
export const UserPreferences = ({ sections }) => {
    const [ready, setReady] = React.useState(false);
    if (window.glue42gd) {
        // Notifications not available under iocd. Use settings in notifications panel instead.
        sections === null || sections === void 0 ? true : delete sections["Notifications"];
    }
    useEffect(() => {
        var _a;
        const makeReady = () => {
            storeExports.initialize(() => {
                WorkspaceManagementMenuGlobalStore = storeExports.GlobalStore;
                userPreferencesStoreInitialize(WorkspaceManagementMenuGlobalStore, () => {
                    UserPreferencesActions.getWorkspaces();
                });
                setReady(true);
            });
        };
        if ((_a = FEAGlobals.FSBL) === null || _a === void 0 ? void 0 : _a.addEventListener) {
            FEAGlobals.FSBL.addEventListener("onReady", makeReady);
        }
        else {
            window.addEventListener("FEAGlobals.FSBLReady", makeReady);
        }
    }, []);
    return React.createElement(React.Fragment, null, ready && React.createElement(UserPreferencesComponent, { sections: sections }));
};
//# sourceMappingURL=UserPreferencesWrapper.js.map