import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { getServerClient } from "./client";
import { ReflagBootstrappedProvider } from "@reflag/react-sdk";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
const publishableKey = process.env.REFLAG_PUBLISHABLE_KEY || "";
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
// Get the singleton server client
const serverClient = await getServerClient();
// In a real app, you'd get user/company from your auth system
const flags = serverClient.getFlagsForBootstrap({
user: {
id: "demo-user",
email: "demo-user@example.com",
"optin-huddles": true,
},
company: { id: "demo-company", name: "Demo Company" },
other: { source: "web" },
});
return (
<html lang="en">
<body className={inter.className}>
<ReflagBootstrappedProvider
publishableKey={publishableKey}
flags={flags}
>
{children}
</ReflagBootstrappedProvider>
</body>
</html>
);
}