index.jsxjavascript
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";

// Initialize the tracking SDK's global listeners immediately at app boot
import { initAnalytics } from "@tracking/messe-tracking/react";

// UI MarCom Fonts
import "@ui-marcom/shared/assets/icons/icons.css";
import "@ui-marcom/shared/assets/webfonts/webfonts.css";

// UI MarCom Styles
import "@ui-marcom/shared/assets/styles/variables.css";
import "@ui-marcom/shared/assets/styles/global-styles.css";
import "@ui-marcom/shared/assets/styles/grid.css";

// Pins UIMC's own breakpoint-driven tokens to one value - must load after
// variables.css (source order decides the tie, see the file itself) and
// before index.scss so the rest of the app's CSS can rely on stable values.
import "./styles/uimc-overrides.scss";

// App Styles
import "./styles/index.scss";

import { preventPageZoom } from "./utils/preventPageZoom";
import { redirectStartHash } from "./utils/legacyRoutes";
import { restoreKioskParams } from "./utils/kioskParams";
import { currentArea } from "./services/tracking/area";

// only the globe itself may zoom (OrbitControls), never the page
preventPageZoom();

// installed iPad PWA: stageDevice etc. survive launches without them
restoreKioskParams();

// before initAnalytics, so the SDK's first page_view already has the current route
redirectStartHash();

// Degrades to a no-op (with a console warning) while exponatId/apiKey are empty
initAnalytics({
  exponatId: import.meta.env.VITE_ANALYTICS_EXPONAT_ID,
  apiKey: import.meta.env.VITE_ANALYTICS_API_KEY,
  endpoint: import.meta.env.VITE_ANALYTICS_ENDPOINT,
  exposeOnWindow: import.meta.env.DEV,
  // evaluated per event, so automatic clicks and page_views carry the app too;
  // useTracking's own area (the app an event happened in) takes precedence
  context: () => ({ area: currentArea() }),
});

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);