diff --git a/apps/api/pages/api/slots/_get.ts b/apps/api/pages/api/slots/_get.ts index 61447e1751dbd7..4c2d2094648538 100644 --- a/apps/api/pages/api/slots/_get.ts +++ b/apps/api/pages/api/slots/_get.ts @@ -22,7 +22,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const { usernameList, ...rest } = req.query; let slugs = usernameList; if (!Array.isArray(usernameList)) { - slugs = usernameList ? [usernameList] : []; + slugs = usernameList ? [usernameList] : undefined; } const input = getScheduleSchema.parse({ usernameList: slugs, ...rest }); const timeZoneSupported = input.timeZone ? isSupportedTimeZone(input.timeZone) : false; @@ -40,7 +40,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { ) : availableSlots; - return slotsInProvidedTimeZone; + return { slots: slotsInProvidedTimeZone }; // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (cause) { if (cause instanceof TRPCError) { diff --git a/apps/api/pages/api/webhooks/[id]/_patch.ts b/apps/api/pages/api/webhooks/[id]/_patch.ts index 0a9b63f0de306a..073a7f0704219e 100644 --- a/apps/api/pages/api/webhooks/[id]/_patch.ts +++ b/apps/api/pages/api/webhooks/[id]/_patch.ts @@ -92,7 +92,7 @@ export async function patchHandler(req: NextApiRequest) { args.data.userId = bodyUserId; } - if (args.data.eventTriggers) { + if (eventTriggers) { const eventTriggersSet = new Set(eventTriggers); args.data.eventTriggers = Array.from(eventTriggersSet); } diff --git a/apps/api/pages/api/webhooks/_post.ts b/apps/api/pages/api/webhooks/_post.ts index e08d59d29ddceb..05e46d3a951691 100644 --- a/apps/api/pages/api/webhooks/_post.ts +++ b/apps/api/pages/api/webhooks/_post.ts @@ -92,7 +92,7 @@ async function postHandler(req: NextApiRequest) { args.data.userId = bodyUserId; } - if (args.data.eventTriggers) { + if (eventTriggers) { const eventTriggersSet = new Set(eventTriggers); args.data.eventTriggers = Array.from(eventTriggersSet); } diff --git a/apps/web/components/eventtype/EventLimitsTab.tsx b/apps/web/components/eventtype/EventLimitsTab.tsx index da68c260a9b3c6..01d82f8717bccd 100644 --- a/apps/web/components/eventtype/EventLimitsTab.tsx +++ b/apps/web/components/eventtype/EventLimitsTab.tsx @@ -528,7 +528,10 @@ const IntervalLimitItem = ({ onIntervalSelect, }: IntervalLimitItemProps) => { return ( -
+
{ - const { req, res } = context; + const { req } = context; const ssr = await ssrInit(context); - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); let appStore; if (session?.user?.id) { diff --git a/apps/web/lib/apps/getServerSideProps.tsx b/apps/web/lib/apps/getServerSideProps.tsx index c0a3e2acc05466..e662f3cf176e6a 100644 --- a/apps/web/lib/apps/getServerSideProps.tsx +++ b/apps/web/lib/apps/getServerSideProps.tsx @@ -9,11 +9,11 @@ import type { AppCategories } from "@calcom/prisma/enums"; import { ssrInit } from "@server/lib/ssr"; export const getServerSideProps = async (context: GetServerSidePropsContext) => { - const { req, res } = context; + const { req } = context; const ssr = await ssrInit(context); - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); let appStore, userAdminTeams: UserAdminTeams; if (session?.user?.id) { diff --git a/apps/web/lib/buildLegacyCtx.tsx b/apps/web/lib/buildLegacyCtx.tsx index 3aa9372de7e06b..14430210a3f139 100644 --- a/apps/web/lib/buildLegacyCtx.tsx +++ b/apps/web/lib/buildLegacyCtx.tsx @@ -32,22 +32,18 @@ export const buildLegacyCtx = ( params: Params, searchParams: SearchParams ) => { - return new Proxy>( - { - query: { ...searchParams, ...params }, - params, - req: { headers: buildLegacyHeaders(headers), cookies: buildLegacyCookies(cookies) }, - }, - { - get(obj, prop) { - if (prop === "res") { - throw new Error( - "You are trying to access the 'res' property of the context, which is not supported in app dir" - ); - } - - return obj[prop as keyof typeof obj]; + return { + query: { ...searchParams, ...params }, + params, + req: { headers: buildLegacyHeaders(headers), cookies: buildLegacyCookies(cookies) }, + res: new Proxy(Object.create(null), { + // const { req, res } = ctx - valid + // res.anything - throw + get() { + throw new Error( + "You are trying to access the 'res' property of the context, which is not supported in app dir" + ); }, - } - ) as unknown as GetServerSidePropsContext; + }), + } as unknown as GetServerSidePropsContext; }; diff --git a/apps/web/lib/getting-started/[[...step]]/getServerSideProps.tsx b/apps/web/lib/getting-started/[[...step]]/getServerSideProps.tsx index e6fa841c672a9f..7163afa276fb46 100644 --- a/apps/web/lib/getting-started/[[...step]]/getServerSideProps.tsx +++ b/apps/web/lib/getting-started/[[...step]]/getServerSideProps.tsx @@ -8,9 +8,9 @@ import prisma from "@calcom/prisma"; import { ssrInit } from "@server/lib/ssr"; export const getServerSideProps = async (context: GetServerSidePropsContext) => { - const { req, res } = context; + const { req } = context; - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); if (!session?.user?.id) { return { redirect: { permanent: false, destination: "/auth/login" } }; diff --git a/apps/web/lib/video/[uid]/getServerSideProps.tsx b/apps/web/lib/video/[uid]/getServerSideProps.tsx index 6052f58a4ca5e6..a0d6d788964cc9 100644 --- a/apps/web/lib/video/[uid]/getServerSideProps.tsx +++ b/apps/web/lib/video/[uid]/getServerSideProps.tsx @@ -10,7 +10,7 @@ import { ssrInit } from "@server/lib/ssr"; const md = new MarkdownIt("default", { html: true, breaks: true, linkify: true }); export async function getServerSideProps(context: GetServerSidePropsContext) { - const { req, res } = context; + const { req } = context; const ssr = await ssrInit(context); @@ -79,7 +79,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { endTime: booking.endTime.toString(), }); - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); // set meetingPassword to null for guests if (session?.user.id !== bookingObj.user?.id) { diff --git a/apps/web/pages/api/avatar/[uuid].ts b/apps/web/pages/api/avatar/[uuid].ts index 2e8a1dfda38bc3..85ef09648e59ac 100644 --- a/apps/web/pages/api/avatar/[uuid].ts +++ b/apps/web/pages/api/avatar/[uuid].ts @@ -55,6 +55,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) res.writeHead(200, { "Content-Type": "image/png", "Content-Length": imageResp.length, + "Cache-Control": "max-age=86400", }); res.end(imageResp); diff --git a/apps/web/pages/auth/forgot-password/index.tsx b/apps/web/pages/auth/forgot-password/index.tsx index fe68bc4e99dfa6..6e7df248409196 100644 --- a/apps/web/pages/auth/forgot-password/index.tsx +++ b/apps/web/pages/auth/forgot-password/index.tsx @@ -148,8 +148,9 @@ ForgotPassword.PageWrapper = PageWrapper; export const getServerSideProps = async (context: GetServerSidePropsContext) => { const { req, res } = context; - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); + // @TODO res will not be available in future pages (app dir) if (session) { res.writeHead(302, { Location: "/" }); res.end(); diff --git a/apps/web/pages/auth/setup/index.tsx b/apps/web/pages/auth/setup/index.tsx index bc128f4cff3b8d..89830d3613df1b 100644 --- a/apps/web/pages/auth/setup/index.tsx +++ b/apps/web/pages/auth/setup/index.tsx @@ -153,12 +153,12 @@ Setup.PageWrapper = PageWrapper; export default Setup; export const getServerSideProps = async (context: GetServerSidePropsContext) => { - const { req, res } = context; + const { req } = context; const ssr = await ssrInit(context); const userCount = await prisma.user.count(); - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); if (session?.user.role && session?.user.role !== UserPermissionRole.ADMIN) { return { diff --git a/apps/web/pages/auth/signin.tsx b/apps/web/pages/auth/signin.tsx index 295879ddd3bdf0..8ac84add2ad48b 100644 --- a/apps/web/pages/auth/signin.tsx +++ b/apps/web/pages/auth/signin.tsx @@ -30,9 +30,9 @@ signin.PageWrapper = PageWrapper; export default signin; export async function getServerSideProps(context: GetServerSidePropsContext) { - const { req, res } = context; + const { req } = context; - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); const csrfToken = await getCsrfToken(context); const providers = await getProviders(); if (session) { diff --git a/apps/web/pages/auth/sso/[provider].tsx b/apps/web/pages/auth/sso/[provider].tsx index 7337b4b311ba36..f1a2e759baefb6 100644 --- a/apps/web/pages/auth/sso/[provider].tsx +++ b/apps/web/pages/auth/sso/[provider].tsx @@ -63,9 +63,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => throw new Error(`File is not named sso/[provider]`); } - const { req, res } = context; + const { req } = context; - const session = await getServerSession({ req, res }); + const session = await getServerSession({ req }); const ssr = await ssrInit(context); const { currentOrgDomain } = orgDomainConfig(context.req); diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx index 7613047aaabfb0..0ab4c6848761b5 100644 --- a/apps/web/pages/booking/[uid].tsx +++ b/apps/web/pages/booking/[uid].tsx @@ -757,7 +757,7 @@ export default function Success(props: PageProps) { name="email" id="email" defaultValue={email} - className="mr- focus:border-brand-default border-default text-default mt-0 block w-full rounded-none rounded-l-md shadow-sm focus:ring-black sm:text-sm" + className="mr- focus:border-brand-default border-default text-default mt-0 block w-full rounded-none rounded-l-md shadow-sm focus:ring-black sm:text-sm" placeholder="rick.astley@cal.com" /> ) : ( <> @@ -455,7 +462,9 @@ export const BookEventFormChild = ({ {rescheduleUid && bookingData ? t("reschedule") : renderConfirmNotVerifyEmailButtonCond - ? t("confirm") + ? isPaidEvent + ? t("pay_and_book") + : t("confirm") : t("verify_email_email_button")} @@ -543,8 +552,8 @@ const RedirectToInstantMeetingModal = ({ expiryTime }: { expiryTime?: Date }) => */}

{t("please_do_not_close_this_tab")}

-
-