Skip to content

Scheduling infrastructure for absolutely everyone.

chore: app router - /payment pages (#18152)

Benny Joo828940b4d680
diff --git a/apps/web/app/future/payment/[uid]/page.tsx b/apps/web/app/future/payment/[uid]/page.tsx
deleted file mode 100644
index 38883bcd3dc..00000000000
--- a/apps/web/app/future/payment/[uid]/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { withAppDirSsr } from "app/WithAppDirSsr";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-
-import PaymentPage from "@calcom/features/ee/payments/components/PaymentPage";
-import { getServerSideProps, type PaymentPageProps } from "@calcom/features/ee/payments/pages/payment";
-
-export const generateMetadata = async () =>
- await _generateMetadata(
- // the title does not contain the eventName as in the legacy page
- (t) => `${t("payment")}`,
- () => ""
- );
-
-const getData = withAppDirSsr<PaymentPageProps>(getServerSideProps);
-
-export default WithLayout({ getLayout: null, getData, Page: PaymentPage });
diff --git a/apps/web/app/payment/[uid]/page.tsx b/apps/web/app/payment/[uid]/page.tsx
new file mode 100644
index 00000000000..17a4f29266b
--- /dev/null
+++ b/apps/web/app/payment/[uid]/page.tsx
@@ -0,0 +1,24 @@
+import { withAppDirSsr } from "app/WithAppDirSsr";
+import type { PageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { cookies, headers } from "next/headers";
+
+import PaymentPage from "@calcom/features/ee/payments/components/PaymentPage";
+import { getServerSideProps, type PaymentPageProps } from "@calcom/features/ee/payments/pages/payment";
+import { APP_NAME } from "@calcom/lib/constants";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+
+export const generateMetadata = async ({ params, searchParams }: PageProps) => {
+ const props = await getData(buildLegacyCtx(headers(), cookies(), params, searchParams));
+ const eventName = props.booking.title;
+ return await _generateMetadata(
+ (t) => `${t("payment")} | ${eventName} | ${APP_NAME}`,
+ () => ""
+ );
+};
+
+const getData = withAppDirSsr<PaymentPageProps>(getServerSideProps);
+
+export default WithLayout({ getLayout: null, getData, Page: PaymentPage });
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index a68b06492b0..9d1f39ecfdd 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -189,6 +189,7 @@ export const config = {
"/reschedule/:path*",
"/availability/:path*",
"/booking/:path*",
+ "/payment/:path*",
"/routing-forms/:path*",
"/team/:path*",
"/org/:path*",
diff --git a/apps/web/pages/payment/[uid].tsx b/apps/web/pages/payment/[uid].tsx
deleted file mode 100644
index 3e512d5b3da..00000000000
--- a/apps/web/pages/payment/[uid].tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import PaymentPage from "@calcom/features/ee/payments/components/PaymentPage";
-import { getServerSideProps } from "@calcom/features/ee/payments/pages/payment";
-import type { inferSSRProps } from "@calcom/types/inferSSRProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-export default function Payment(props: inferSSRProps<typeof getServerSideProps>) {
- return <PaymentPage {...props} />;
-}
-Payment.PageWrapper = PageWrapper;
-export { getServerSideProps };
diff --git a/packages/features/ee/payments/components/PaymentPage.tsx b/packages/features/ee/payments/components/PaymentPage.tsx
index ade48dd055e..dfb9a143b02 100644
--- a/packages/features/ee/payments/components/PaymentPage.tsx
+++ b/packages/features/ee/payments/components/PaymentPage.tsx
@@ -2,7 +2,6 @@
import classNames from "classnames";
import dynamic from "next/dynamic";
-import Head from "next/head";
import type { FC } from "react";
import { useEffect, useState } from "react";
@@ -88,12 +87,6 @@ const PaymentPage: FC<PaymentPageProps> = (props) => {
return (
<div className="h-screen">
- <Head>
- <title>
- {t("payment")} | {eventName} | {APP_NAME}
- </title>
- <link rel="icon" href="/favicon.ico" />
- </Head>
<main className="mx-auto max-w-3xl py-24">
<div className="fixed inset-0 z-50 overflow-y-auto scroll-auto">
<div className="flex min-h-screen items-end justify-center px-4 pb-20 pt-4 text-center sm:block sm:p-0">