Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

2.5 KB
Raw Blame
import { createRoot } from "react-dom/client";
import App from "../../src/App";
import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";
import { ADVANCED_MODE_KEY, setAdvancedMode } from "../../src/lib/interface-mode";
import { languageChoice, setLanguageChoice } from "../../src/lib/language-preference";
import { GROK_MOVE_NOTICE, MODELGO_CARD_NOTICE, TEAMS_NOTICE, WHATS_NEW_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkinChoice, readSkinChoice } from "../../src/lib/skins";
import "../../src/styles.css";

// This entry point is served only by the disposable verification launcher.
// The voice-latency harness opts in with ?ombVoiceProbe=1; the recorder in
// src/lib/voice-latency-probe stays inert without this sink.
if (new URLSearchParams(location.search).has("ombVoiceProbe")) {
  (window as typeof window & { __ombVoiceProbe?: unknown[] }).__ombVoiceProbe = [];
}
setAnalyticsEnabled(false);
// Tests use English accessibility names from the first render, including after a reload.
if (languageChoice() === null) setLanguageChoice("en");
// Every launch is a new browser, so it opens in Simple mode as a new install does, unless a test chose a mode first.
// ?onboarding=1 plays a brand-new install.
if (localStorage.getItem(ADVANCED_MODE_KEY) == null) setAdvancedMode(false);
if (!new URLSearchParams(location.search).has("onboarding")) setEmailGateDone("skipped");
// Every launch is a new browser, so the once-per-browser Simple mode popup shows only with ?simpleModePrompt=1.
if (!new URLSearchParams(location.search).has("simpleModePrompt")) markSimpleModePromptSeen();
// The same for the once-per-person Move from Grok Bot popup, with ?grokMovePopup=1.
if (!new URLSearchParams(location.search).has("grokMovePopup")) localStorage.setItem(GROK_MOVE_NOTICE, "1");
// And for the once-per-person Teams What's new, with ?teamsPopup=1.
if (!new URLSearchParams(location.search).has("teamsPopup")) localStorage.setItem(TEAMS_NOTICE, "1");
// And for the once-per-person What's new (the new Cloud, Team and the sponsor's slides), with ?whatsNew=1.
if (!new URLSearchParams(location.search).has("whatsNew")) localStorage.setItem(WHATS_NEW_NOTICE, "1");
// And for the once-per-person ModelGo sponsor card, with ?modelgoCard=1: it sits over the sidebar's foot, where tests click.
if (!new URLSearchParams(location.search).has("modelgoCard")) localStorage.setItem(MODELGO_CARD_NOTICE, "1");
applySkinChoice(readSkinChoice());
createRoot(document.getElementById("root")!).render(<App />);