// apps/web-next/instrumentation-client.ts
// Next.js 15+ browser hook: runs in the client bundle on app start.

import { initSentryClient } from "@repo/core-shared/instrumentation/sentry/init-client";

function getNonce(): string {
  if (typeof document === "undefined") return "";
  return (
    document.querySelector('meta[name="csp-nonce"]')?.getAttribute("content") ??
    ""
  );
}

initSentryClient({
  dsn: process.env["NEXT_PUBLIC_WEB_NEXT_SENTRY_DSN"],
  app: "web-next",
  release: process.env["NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA"],
  nonce: getNonce(),
});
