{"size": 863, "ext": "js", "max_stars_repo_path": "tgnms/fbcnms-projects/tgnms/app/common/uiConfig.js", "max_stars_repo_name": "kkkkv/tgnms", "max_stars_repo_stars_event_min_datetime": "2021-04-06T06:27:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-18T10:52:29.000Z", "max_issues_repo_path": "tgnms/fbcnms-projects/tgnms/app/common/uiConfig.js", "max_issues_repo_name": "kkkkv/tgnms", "max_issues_repo_issues_event_min_datetime": "2022-01-04T13:32:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T21:13:59.000Z", "max_forks_repo_path": "tgnms/fbcnms-projects/tgnms/app/common/uiConfig.js", "max_forks_repo_name": "kkkkv/tgnms", "max_forks_repo_forks_event_min_datetime": "2021-09-27T13:14:42.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T16:24:15.000Z"}
{"max_stars_count": 12, "max_issues_count": 6, "max_forks_count": 7, "avg_line_length": 20.0697674419, "max_line_length": 76, "alphanum_fraction": 0.6546929316}
/**
 * Copyright 2004-present Facebook. All Rights Reserved.
 *
 * @format
 * @flow strict-local
 */
import type {MapStyle, UIConfig, UIEnv} from '@fbcnms/tg-nms/shared/dto/UI';
import type {User} from '@fbcnms/tg-nms/shared/auth/User';

export function getUIConfig(): UIConfig {
  if (window.CONFIG) {
    return window.CONFIG;
  }
  return {
    env: {},
    networks: {},
    user: null,
    version: 'none',
    featureFlags: {},
    mapStyles: [],
  };
}

export function getMapStyles(): Array<MapStyle> {
  const {mapStyles} = getUIConfig();
  return mapStyles;
}

export function getUIEnv(): UIEnv {
  const {env} = getUIConfig();
  return env;
}

export function getUIEnvVal(envKey: $Keys<UIEnv>): string {
  const {env} = getUIConfig();
  return env[envKey];
}

export function getUser(): ?User {
  const config = getUIConfig();
  return config?.user;
}
