import { createRoot } from "react-dom/client";
import posthog from "posthog-js";
import App from "./App";
import "./index.css";

const posthogKey = import.meta.env.VITE_POSTHOG_KEY as string | undefined;
if (posthogKey) {
  posthog.init(posthogKey, {
    api_host: "https://us.i.posthog.com",
    capture_pageview: true,
    capture_pageleave: true,
    session_recording: {
      // Mask all typed input in replays. The booking flow collects customer
      // name, email, and phone — capturing those into session recordings is a
      // PII exposure. maskAllInputs:true replaces input values in replays while
      // still letting you watch flow/navigation.
      maskAllInputs: true,
    },
  });
}

createRoot(document.getElementById("root")!).render(<App />);
