import type { NextConfig } from "next";

/**
 * Bakes `NEXT_PUBLIC_MAILFORGE_PRODUCT` at `next build` so the proxy (Edge)
 * knows the deployment shape.
 *
 * - Default: `standalone` — bootstrap session without CRM embed.
 * - CRM embed: build with `MAILFORGE_EMBEDDED=1` → `embed` (`?token=` handoff).
 */
const nextConfig: NextConfig = {
  env: {
    NEXT_PUBLIC_MAILFORGE_PRODUCT:
      process.env.MAILFORGE_EMBEDDED === "1" || process.env.MAILFORGE_EMBEDDED === "true"
        ? "embed"
        : "standalone",
  },
};

export default nextConfig;
