/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  // SaaS module loaded via iframe — keep output static-ish but App Router still works
  // with default settings. We disable SSR-by-default by using "use client" everywhere
  // (see src/app layout/page).
  output: 'standalone',
  typedRoutes: true,
  async redirects() {
    // 根路径跳召回工作台 —— 放在路由层(而非 HomePage 组件里 redirect()):
    // server 组件同步 redirect() 会让 Next dev 给未开始计时的 'HomePage' 打耗时 →
    // "Performance measure cannot have a negative time stamp" 运行时报错。路由层跳转
    // 根本不渲染该组件,从源头消除。
    return [{ source: '/', destination: '/plans', permanent: false }];
  },
  async headers() {
    // frame-ancestors is dynamically injected per-tenant in real deploys; here we
    // keep a permissive default for local dev. Production should set this from
    // platform config.
    return [
      {
        source: '/:path*',
        headers: [
          { key: 'X-Frame-Options', value: 'ALLOWALL' },
        ],
      },
    ];
  },
};

export default nextConfig;
