diff --git a/apps/web/app/future/booking/[uid]/embed/page.tsx b/apps/web/app/future/booking/[uid]/embed/page.tsx index d3fcef1feb..4fab8011c6 100644 --- a/apps/web/app/future/booking/[uid]/embed/page.tsx +++ b/apps/web/app/future/booking/[uid]/embed/page.tsx @@ -1,10 +1,9 @@ -import OldPage from "@pages/booking/[uid]"; +import OldPage, { type PageProps, getServerSideProps } from "@pages/booking/[uid]"; +import { withAppDirSsr } from "app/WithAppDirSsr"; import withEmbedSsrAppDir from "app/WithEmbedSSR"; import { WithLayout } from "app/layoutHOC"; -import { getData } from "../page"; - +const getData = withAppDirSsr(getServerSideProps); const getEmbedData = withEmbedSsrAppDir(getData); -// @ts-expect-error Type '(context: GetServerSidePropsContext) => Promise' is not assignable to type '(arg: { export default WithLayout({ getLayout: null, getData: getEmbedData, Page: OldPage }); diff --git a/apps/web/app/future/booking/[uid]/page.tsx b/apps/web/app/future/booking/[uid]/page.tsx index e0db2efa6f..b701997205 100644 --- a/apps/web/app/future/booking/[uid]/page.tsx +++ b/apps/web/app/future/booking/[uid]/page.tsx @@ -41,7 +41,7 @@ export const generateMetadata = async () => () => "" ); -export const getData = async (context: GetServerSidePropsContext) => { +const getData = async (context: GetServerSidePropsContext) => { const ssr = await ssrInit(context); const session = await getServerSession(context); let tz: string | null = null; diff --git a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx index 7577b56681..a39a2b28f9 100644 --- a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx +++ b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx @@ -1,9 +1,10 @@ -import LegacyPage from "@pages/team/[slug]/[type]/embed"; +import LegacyPage, { getServerSideProps } from "@pages/team/[slug]/[type]/embed"; +import { withAppDirSsr } from "app/WithAppDirSsr"; import withEmbedSsrAppDir from "app/WithEmbedSSR"; import { WithLayout } from "app/layoutHOC"; -import { getData } from "../page"; - +const getData = withAppDirSsr(getServerSideProps); const getEmbedData = withEmbedSsrAppDir(getData); +// @ts-expect-error Type is missing the following properties from type: entity, duration, booking, away, and 7 more. export default WithLayout({ getLayout: null, getData: getEmbedData, Page: LegacyPage })<"P">; diff --git a/apps/web/app/future/team/[slug]/[type]/page.tsx b/apps/web/app/future/team/[slug]/[type]/page.tsx index f6b971de73..424faf6fb3 100644 --- a/apps/web/app/future/team/[slug]/[type]/page.tsx +++ b/apps/web/app/future/team/[slug]/[type]/page.tsx @@ -1,5 +1,5 @@ import LegacyPage, { type PageProps, getServerSideProps } from "@pages/team/[slug]/[type]"; -import { withAppDir } from "app/AppDirSSRHOC"; +import { withAppDirSsr } from "app/WithAppDirSsr"; import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { type GetServerSidePropsContext } from "next"; @@ -7,8 +7,14 @@ import { cookies, headers } from "next/headers"; import { buildLegacyCtx } from "@lib/buildLegacyCtx"; -export const generateMetadata = async ({ params }: { params: Record }) => { - const legacyCtx = buildLegacyCtx(headers(), cookies(), params); +export const generateMetadata = async ({ + params, + searchParams, +}: { + params: Record; + searchParams: { [key: string]: string | string[] | undefined }; +}) => { + const legacyCtx = buildLegacyCtx(headers(), cookies(), params, searchParams); const props = await getData(legacyCtx as unknown as GetServerSidePropsContext); const { entity, user, slug, booking } = props; const { trpc } = await import("@calcom/trpc"); @@ -25,7 +31,7 @@ export const generateMetadata = async ({ params }: { params: Record `${booking?.uid ? t("reschedule") : ""} ${title}` ); }; -export const getData = withAppDir(getServerSideProps); +const getData = withAppDirSsr(getServerSideProps); export default WithLayout({ Page: LegacyPage, diff --git a/apps/web/app/future/team/[slug]/embed/page.tsx b/apps/web/app/future/team/[slug]/embed/page.tsx index df0d97365e..407fb30e44 100644 --- a/apps/web/app/future/team/[slug]/embed/page.tsx +++ b/apps/web/app/future/team/[slug]/embed/page.tsx @@ -1,9 +1,9 @@ -import LegacyPage from "@pages/team/[slug]/embed"; +import LegacyPage, { type PageProps, getServerSideProps } from "@pages/team/[slug]"; +import { withAppDirSsr } from "app/WithAppDirSsr"; import withEmbedSsrAppDir from "app/WithEmbedSSR"; import { WithLayout } from "app/layoutHOC"; -import { getData } from "../page"; - +const getData = withAppDirSsr(getServerSideProps); const getEmbedData = withEmbedSsrAppDir(getData); export default WithLayout({ getLayout: null, getData: getEmbedData, Page: LegacyPage })<"P">; diff --git a/apps/web/app/future/team/[slug]/page.tsx b/apps/web/app/future/team/[slug]/page.tsx index df6569a226..f1f447eebe 100644 --- a/apps/web/app/future/team/[slug]/page.tsx +++ b/apps/web/app/future/team/[slug]/page.tsx @@ -1,5 +1,5 @@ -import LegacyPage, { type PageProps, getServerSideProps } from "@pages/team/[slug]"; -import { withAppDir } from "app/AppDirSSRHOC"; +import LegacyPage, { getServerSideProps, type PageProps } from "@pages/team/[slug]"; +import { withAppDirSsr } from "app/WithAppDirSsr"; import { _generateMetadata } from "app/_utils"; import { WithLayout } from "app/layoutHOC"; import { type GetServerSidePropsContext } from "next"; @@ -7,9 +7,15 @@ import { cookies, headers } from "next/headers"; import { buildLegacyCtx } from "@lib/buildLegacyCtx"; -export const generateMetadata = async ({ params }: { params: Record }) => { +export const generateMetadata = async ({ + params, + searchParams, +}: { + params: Record; + searchParams: { [key: string]: string | string[] | undefined }; +}) => { const props = await getData( - buildLegacyCtx(headers(), cookies(), params) as unknown as GetServerSidePropsContext + buildLegacyCtx(headers(), cookies(), params, searchParams) as unknown as GetServerSidePropsContext ); const teamName = props.team.name || "Nameless Team"; @@ -19,7 +25,7 @@ export const generateMetadata = async ({ params }: { params: Record(getServerSideProps); +const getData = withAppDirSsr(getServerSideProps); export default WithLayout({ Page: LegacyPage, diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx index cdb7f67978..0e40412a62 100644 --- a/apps/web/pages/booking/[uid].tsx +++ b/apps/web/pages/booking/[uid].tsx @@ -54,6 +54,8 @@ import EventReservationSchema from "@components/schemas/EventReservationSchema"; export { getServerSideProps }; +export type PageProps = inferSSRProps; + const stringToBoolean = z .string() .optional() diff --git a/apps/web/pages/team/[slug]/[type]/embed.tsx b/apps/web/pages/team/[slug]/[type]/embed.tsx index 9b0fb7a7a8..63531e5f39 100644 --- a/apps/web/pages/team/[slug]/[type]/embed.tsx +++ b/apps/web/pages/team/[slug]/[type]/embed.tsx @@ -4,6 +4,6 @@ import withEmbedSsr from "@lib/withEmbedSsr"; import { getServerSideProps as _getServerSideProps } from "../[type]"; -export { default } from "../[type]"; +export { default, type PageProps } from "../[type]"; export const getServerSideProps = withEmbedSsr(_getServerSideProps);